Consider the centering_offset for visibility in LayoutRunIter
This commit is contained in:
parent
c2bef6a345
commit
431163dc35
1 changed files with 4 additions and 5 deletions
|
|
@ -247,14 +247,13 @@ impl<'b> Iterator for LayoutRunIter<'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let line_y = self.line_i as f32 * self.buffer.metrics.line_height;
|
let line_y = self.line_i as f32 * self.buffer.metrics.line_height;
|
||||||
|
|
||||||
if line_y > self.buffer.height {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let glyph_height = layout_line.max_ascent + layout_line.max_descent;
|
let glyph_height = layout_line.max_ascent + layout_line.max_descent;
|
||||||
let centering_offset = (self.buffer.metrics.line_height - glyph_height) / 2.0;
|
let centering_offset = (self.buffer.metrics.line_height - glyph_height) / 2.0;
|
||||||
|
|
||||||
|
if line_y + centering_offset > self.buffer.height {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
return self.remaining_len.checked_sub(1).map(|num| {
|
return self.remaining_len.checked_sub(1).map(|num| {
|
||||||
self.remaining_len = num;
|
self.remaining_len = num;
|
||||||
LayoutRun {
|
LayoutRun {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue