text/v2: bug fix: Glyph's XOffset/YOffset should be considered

This commit is contained in:
Hajime Hoshi 2023-12-12 01:33:25 +09:00
parent 159c19a671
commit d8af9dff28

View File

@ -299,7 +299,10 @@ func (g *GoTextFace) appendGlyphsForLine(glyphs []Glyph, line string, indexOffse
} }
_, gs := g.Source.shape(line, g) _, gs := g.Source.shape(line, g)
for _, glyph := range gs { for _, glyph := range gs {
img, imgX, imgY := g.glyphImage(glyph, origin) img, imgX, imgY := g.glyphImage(glyph, origin.Add(fixed.Point26_6{
X: glyph.shapingGlyph.XOffset,
Y: -glyph.shapingGlyph.YOffset,
}))
// 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{