From d8348abcc945a37320ecb225e2eb800f8d49842a Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 29 Oct 2024 00:15:41 +0900 Subject: [PATCH] text/v2: add comments --- text/v2/gotext.go | 3 +++ text/v2/gox.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/text/v2/gotext.go b/text/v2/gotext.go index 60ec4fcee..a88387c7c 100644 --- a/text/v2/gotext.go +++ b/text/v2/gotext.go @@ -325,7 +325,10 @@ func (g *GoTextFace) appendGlyphsForLine(glyphs []Glyph, line string, indexOffse X: glyph.shapingGlyph.XOffset, Y: -glyph.shapingGlyph.YOffset, }) + + // imgX and imgY are integers so that the nearest filter can be used. img, imgX, imgY := g.glyphImage(glyph, o) + // Append a glyph even if img is nil. // This is necessary to return index information for control characters. glyphs = append(glyphs, Glyph{ diff --git a/text/v2/gox.go b/text/v2/gox.go index 78d1917ce..a71ef96e0 100644 --- a/text/v2/gox.go +++ b/text/v2/gox.go @@ -132,6 +132,8 @@ func (g *GoXFace) appendGlyphsForLine(glyphs []Glyph, line string, indexOffset i if prevR >= 0 { origin.X += g.f.Kern(prevR, r) } + + // imgX and imgY are integers so that the nearest filter can be used. img, imgX, imgY, a := g.glyphImage(r, origin) // Adjust the position to the integers.