From 593c5fbf4a39def175543bf678327ff145d0126d Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Tue, 28 Jan 2025 10:35:52 -0500 Subject: [PATCH] text: round y offset of trailing newline This commit tries to ensure that trailing newlines do not introduce more vertical space below the text than is occupied by a typical text run within the text. Signed-off-by: Chris Waldon --- text/shaper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/shaper.go b/text/shaper.go index 539ccb58..bd52aa1c 100644 --- a/text/shaper.go +++ b/text/shaper.go @@ -544,7 +544,7 @@ func (l *Shaper) NextGlyph() (_ Glyph, ok bool) { // of a valid cursor position they can use for "after" such a newline, // taking text alignment into account. l.pararagraphStart.X = l.txt.alignment.Align(line.direction, 0, l.txt.alignWidth) - l.pararagraphStart.Y = glyph.Y + int32(line.lineHeight.Ceil()) + l.pararagraphStart.Y = glyph.Y + int32(line.lineHeight.Round()) } } return glyph, true