text/v2: bug fix: the offset should be added at the end of each iteration

Updates #2454
Updates #2528
This commit is contained in:
Hajime Hoshi 2023-11-12 17:37:18 +09:00
parent b05c272499
commit 77f3b57d1f

View File

@ -225,12 +225,13 @@ func CacheGlyphs(text string, face Face) {
var buf []Glyph
// Create all the possible variations (#2528).
for i := 0; i < 4; i++ {
buf = AppendGlyphs(buf, text, face, x, y)
buf = buf[:0]
if face.direction().isHorizontal() {
x += 1.0 / glyphVariationCount
} else {
y += 1.0 / glyphVariationCount
}
buf = AppendGlyphs(buf, text, face, x, y)
buf = buf[:0]
}
}