text: Avoid creating 0-sized image

This commit is contained in:
Hajime Hoshi 2018-04-26 02:11:45 +09:00
parent dff492955d
commit 6caebc2310

View File

@ -148,6 +148,7 @@ func getGlyphImages(face font.Face, runes []rune) []*glyphImage {
neededGlyphs[i] = b
}
if len(neededGlyphs) > 0 {
// TODO: What if w2 is too big (e.g. > 4096)?
w2 := 0
h2 := 0
@ -189,6 +190,7 @@ func getGlyphImages(face font.Face, runes []rune) []*glyphImage {
x += w
}
}
return imgs
}