Clip based on ascent and descent, not baseline (#396)

Due to https://github.com/pop-os/cosmic-text/pull/141 the LayoutRunIter incorrect checks to see if the baseline is past the visible bounds of the buffer, instead of using the maximum ascent and maximum descent from the baseline.
This commit is contained in:
Erik McClure 2025-06-28 12:03:47 -07:00 committed by GitHub
parent bcfb05a390
commit 3b1aa511d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -131,12 +131,12 @@ impl<'b> Iterator for LayoutRunIter<'b> {
let centering_offset = (line_height - glyph_height) / 2.0;
let line_y = line_top + centering_offset + layout_line.max_ascent;
if let Some(height) = self.buffer.height_opt {
if line_y > height {
if line_y - layout_line.max_ascent > height {
return None;
}
}
self.line_top += line_height;
if line_y < 0.0 {
if line_y + layout_line.max_descent < 0.0 {
continue;
}