From d6d896688f1c12d4d4f1002082ec3c5d89d2b1ad Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 24 Oct 2022 17:13:32 -0600 Subject: [PATCH] Track span rtl status in layout glyph --- src/font/layout.rs | 1 + src/font/shape.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/font/layout.rs b/src/font/layout.rs index be49c5a..d2ae21c 100644 --- a/src/font/layout.rs +++ b/src/font/layout.rs @@ -7,6 +7,7 @@ pub struct FontLayoutGlyph<'a> { pub end: usize, pub x: f32, pub w: f32, + pub rtl: bool, pub font: &'a Font<'a>, pub inner: (CacheKey, i32, i32), } diff --git a/src/font/shape.rs b/src/font/shape.rs index 298bf08..2251bb1 100644 --- a/src/font/shape.rs +++ b/src/font/shape.rs @@ -14,7 +14,7 @@ pub struct FontShapeGlyph<'a> { } impl<'a> FontShapeGlyph<'a> { - fn layout(&self, font_size: i32, x: f32, y: f32) -> FontLayoutGlyph<'a> { + fn layout(&self, font_size: i32, x: f32, y: f32, rtl: bool) -> FontLayoutGlyph<'a> { let x_offset = font_size as f32 * self.x_offset; let y_offset = font_size as f32 * self.y_offset; let x_advance = font_size as f32 * self.x_advance; @@ -25,6 +25,7 @@ impl<'a> FontShapeGlyph<'a> { end: self.end, x: x, w: x_advance, + rtl, font: self.font, inner, } @@ -183,7 +184,7 @@ impl<'a> FontShapeLine<'a> { x -= x_advance } - glyphs.push(glyph.layout(font_size, x, y)); + glyphs.push(glyph.layout(font_size, x, y, span.rtl)); push_line = true; if !self.rtl {