Add line width field to LayoutLine
This commit is contained in:
parent
652543f9aa
commit
67950724c3
3 changed files with 9 additions and 0 deletions
|
|
@ -55,6 +55,8 @@ pub struct LayoutRun<'a> {
|
|||
pub glyphs: &'a [LayoutGlyph],
|
||||
/// Y offset of line
|
||||
pub line_y: i32,
|
||||
/// width of line
|
||||
pub line_w: f32,
|
||||
}
|
||||
|
||||
/// An iterator of visible text lines, see [`LayoutRun`]
|
||||
|
|
@ -105,6 +107,7 @@ impl<'a, 'b> Iterator for LayoutRunIter<'a, 'b> {
|
|||
rtl: shape.rtl,
|
||||
glyphs: &layout_line.glyphs,
|
||||
line_y: self.line_y,
|
||||
line_w: layout_line.w,
|
||||
});
|
||||
}
|
||||
self.line_i += 1;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ pub struct LayoutGlyph {
|
|||
|
||||
/// A line of laid out glyphs
|
||||
pub struct LayoutLine {
|
||||
/// Width of the line
|
||||
pub w: f32,
|
||||
/// Glyphs in line
|
||||
pub glyphs: Vec<LayoutGlyph>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,6 +594,7 @@ impl ShapeLine {
|
|||
mem::swap(&mut glyphs, &mut glyphs_swap);
|
||||
layout_lines.push(
|
||||
LayoutLine {
|
||||
w: x,
|
||||
glyphs: glyphs_swap,
|
||||
},
|
||||
);
|
||||
|
|
@ -623,6 +624,7 @@ impl ShapeLine {
|
|||
mem::swap(&mut glyphs, &mut glyphs_swap);
|
||||
layout_lines.push(
|
||||
LayoutLine {
|
||||
w: x,
|
||||
glyphs: glyphs_swap,
|
||||
},
|
||||
);
|
||||
|
|
@ -650,6 +652,7 @@ impl ShapeLine {
|
|||
mem::swap(&mut glyphs, &mut glyphs_swap);
|
||||
layout_lines.push(
|
||||
LayoutLine {
|
||||
w: x,
|
||||
glyphs: glyphs_swap,
|
||||
},
|
||||
);
|
||||
|
|
@ -663,6 +666,7 @@ impl ShapeLine {
|
|||
if push_line {
|
||||
layout_lines.push(
|
||||
LayoutLine {
|
||||
w: x,
|
||||
glyphs,
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue