Consider the centering_offset for visibility in LayoutRunIter

This commit is contained in:
Héctor Ramón Jiménez 2023-06-16 02:25:45 +02:00
parent c2bef6a345
commit 431163dc35
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -247,14 +247,13 @@ impl<'b> Iterator for LayoutRunIter<'b> {
}
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 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| {
self.remaining_len = num;
LayoutRun {