From adaace864d5008f4d6bfb838d1968882b564c3ad Mon Sep 17 00:00:00 2001 From: zjzhang Date: Sat, 25 Jan 2025 22:04:47 +0800 Subject: [PATCH] text: respect line height when layout the last empty line. Text Shaper set the last empty line height to ascent+decent of the paragraph break glyph which causes the last visual empty line to have a smaller line height. This commit tries to fix it by setting the line height using the line height from the last line. References: https://todo.sr.ht/~eliasnaur/gio/629 Signed-off-by: zjzhang --- text/shaper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/shaper.go b/text/shaper.go index db679268..539ccb58 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((glyph.Ascent + glyph.Descent).Ceil()) + l.pararagraphStart.Y = glyph.Y + int32(line.lineHeight.Ceil()) } } return glyph, true