Track span rtl status in layout glyph
This commit is contained in:
parent
7363c923e5
commit
d6d896688f
2 changed files with 4 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ pub struct FontLayoutGlyph<'a> {
|
||||||
pub end: usize,
|
pub end: usize,
|
||||||
pub x: f32,
|
pub x: f32,
|
||||||
pub w: f32,
|
pub w: f32,
|
||||||
|
pub rtl: bool,
|
||||||
pub font: &'a Font<'a>,
|
pub font: &'a Font<'a>,
|
||||||
pub inner: (CacheKey, i32, i32),
|
pub inner: (CacheKey, i32, i32),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub struct FontShapeGlyph<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> 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 x_offset = font_size as f32 * self.x_offset;
|
||||||
let y_offset = font_size as f32 * self.y_offset;
|
let y_offset = font_size as f32 * self.y_offset;
|
||||||
let x_advance = font_size as f32 * self.x_advance;
|
let x_advance = font_size as f32 * self.x_advance;
|
||||||
|
|
@ -25,6 +25,7 @@ impl<'a> FontShapeGlyph<'a> {
|
||||||
end: self.end,
|
end: self.end,
|
||||||
x: x,
|
x: x,
|
||||||
w: x_advance,
|
w: x_advance,
|
||||||
|
rtl,
|
||||||
font: self.font,
|
font: self.font,
|
||||||
inner,
|
inner,
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +184,7 @@ impl<'a> FontShapeLine<'a> {
|
||||||
x -= x_advance
|
x -= x_advance
|
||||||
}
|
}
|
||||||
|
|
||||||
glyphs.push(glyph.layout(font_size, x, y));
|
glyphs.push(glyph.layout(font_size, x, y, span.rtl));
|
||||||
push_line = true;
|
push_line = true;
|
||||||
|
|
||||||
if !self.rtl {
|
if !self.rtl {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue