text/v2: add comments

This commit is contained in:
Hajime Hoshi 2024-10-29 00:15:41 +09:00
parent 2748f31fc4
commit d8348abcc9
2 changed files with 5 additions and 0 deletions

View File

@ -325,7 +325,10 @@ func (g *GoTextFace) appendGlyphsForLine(glyphs []Glyph, line string, indexOffse
X: glyph.shapingGlyph.XOffset, X: glyph.shapingGlyph.XOffset,
Y: -glyph.shapingGlyph.YOffset, Y: -glyph.shapingGlyph.YOffset,
}) })
// imgX and imgY are integers so that the nearest filter can be used.
img, imgX, imgY := g.glyphImage(glyph, o) img, imgX, imgY := g.glyphImage(glyph, o)
// Append a glyph even if img is nil. // Append a glyph even if img is nil.
// This is necessary to return index information for control characters. // This is necessary to return index information for control characters.
glyphs = append(glyphs, Glyph{ glyphs = append(glyphs, Glyph{

View File

@ -132,6 +132,8 @@ func (g *GoXFace) appendGlyphsForLine(glyphs []Glyph, line string, indexOffset i
if prevR >= 0 { if prevR >= 0 {
origin.X += g.f.Kern(prevR, r) 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) img, imgX, imgY, a := g.glyphImage(r, origin)
// Adjust the position to the integers. // Adjust the position to the integers.