text: Bug fix: one image should be used for multiple glyphs (#535)

This commit is contained in:
Hajime Hoshi 2018-04-26 02:40:43 +09:00
parent 6caebc2310
commit be3d529767

View File

@ -174,9 +174,8 @@ func getGlyphImages(face font.Face, runes []rune) []*glyphImage {
d.Dot = fixed.Point26_6{fixed.I(x) - b.Min.X, -b.Min.Y}
d.DrawString(string(r))
img, _ := ebiten.NewImageFromImage(rgba, ebiten.FilterDefault)
g := &glyphImage{
image: img,
image: nil,
x: x,
y: 0,
width: w,
@ -190,6 +189,11 @@ func getGlyphImages(face font.Face, runes []rune) []*glyphImage {
x += w
}
img, _ := ebiten.NewImageFromImage(rgba, ebiten.FilterDefault)
for i := range neededGlyphs {
imgs[i].image = img
}
}
return imgs
}