From 178c3ec51fc0499f2650753b6353358c70207344 Mon Sep 17 00:00:00 2001 From: Benoit KUGLER Date: Sat, 4 May 2024 10:11:49 +0200 Subject: [PATCH] properly collapse trailing white spaces --- shaping/wrapping.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shaping/wrapping.go b/shaping/wrapping.go index 330ea39..35aaa97 100644 --- a/shaping/wrapping.go +++ b/shaping/wrapping.go @@ -838,12 +838,13 @@ func (l *LineWrapper) postProcessLine(finalLine Line, done bool) (WrappedLine, b // zero trailing whitespace advance, // to be coherent with Output.advanceSpaceAware if L := len(finalRun.Glyphs); L != 0 { + g := &finalRun.Glyphs[L-1] if finalRun.Direction.IsVertical() { - if g := &finalRun.Glyphs[L-1]; g.Height == 0 { + if g.Height == 0 { g.YAdvance = 0 } } else { // horizontal - if g := finalRun.Glyphs[L-1]; g.Width == 0 { + if g.Width == 0 { g.XAdvance = 0 } }