[librsvg: 14/22] Test for writing_mode.is_horizontal everywhere rather than is_vertical
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 14/22] Test for writing_mode.is_horizontal everywhere rather than is_vertical
- Date: Thu, 23 Sep 2021 18:42:13 +0000 (UTC)
commit 1ddb1433615b59a1701690616cdab11757e5d5fe
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Sep 23 11:08:30 2021 -0500
Test for writing_mode.is_horizontal everywhere rather than is_vertical
I get confused with the vertical case being first.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/593>
src/text.rs | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/text.rs b/src/text.rs
index be6f0db0..c786f17a 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -146,10 +146,10 @@ impl PositionedChunk {
let dx = mspan.dx;
let dy = mspan.dy;
- let rendered_position = if values.writing_mode().is_vertical() {
- (x + offset + dx, y + dy)
- } else {
+ let rendered_position = if values.writing_mode().is_horizontal() {
(x + dx, y - offset + dy)
+ } else {
+ (x + offset + dx, y + dy)
};
let positioned_span = PositionedSpan {
@@ -177,17 +177,17 @@ fn text_anchor_advance(
writing_mode: WritingMode,
advance: (f64, f64),
) -> (f64, f64) {
- if writing_mode.is_vertical() {
+ if writing_mode.is_horizontal() {
match anchor {
TextAnchor::Start => (0.0, 0.0),
- TextAnchor::Middle => (0.0, -advance.1 / 2.0),
- TextAnchor::End => (0.0, -advance.1),
+ TextAnchor::Middle => (-advance.0 / 2.0, 0.0),
+ TextAnchor::End => (-advance.0, 0.0),
}
} else {
match anchor {
TextAnchor::Start => (0.0, 0.0),
- TextAnchor::Middle => (-advance.0 / 2.0, 0.0),
- TextAnchor::End => (-advance.0, 0.0),
+ TextAnchor::Middle => (0.0, -advance.1 / 2.0),
+ TextAnchor::End => (0.0, -advance.1),
}
}
}
@@ -222,10 +222,10 @@ impl MeasuredSpan {
assert!(w >= 0.0);
assert!(h >= 0.0);
- let advance = if values.writing_mode().is_vertical() {
- (0.0, w)
- } else {
+ let advance = if values.writing_mode().is_horizontal() {
(w, 0.0)
+ } else {
+ (0.0, w)
};
MeasuredSpan {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]