From ba96cceacc59381175e20b4de5348d0d3d43b437 Mon Sep 17 00:00:00 2001 From: Dov Reshef Date: Sat, 23 Sep 2023 17:13:03 +0300 Subject: [PATCH] Fix rendering of RTL words --- src/shape.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shape.rs b/src/shape.rs index 9144b18..53cba57 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -1221,11 +1221,12 @@ impl ShapeLine { } else { 0.0 }; - let y_advance = font_size * glyph.y_advance; - glyphs.push(glyph.layout(font_size, x, y, x_advance, span.level)); if self.rtl { x -= x_advance; - } else { + } + let y_advance = font_size * glyph.y_advance; + glyphs.push(glyph.layout(font_size, x, y, x_advance, span.level)); + if !self.rtl { x += x_advance; } y += y_advance;