examples/texti18n: bug fix: space characters were ignored

This commit is contained in:
Hajime Hoshi 2023-07-01 18:17:01 +09:00
parent 3ab50c91df
commit 198bd4788e

View File

@ -203,10 +203,7 @@ func (g *Game) drawGlyphs(dst *ebiten.Image, output *shaping.Output, originX, or
v, ok := g.glyphCache[key] v, ok := g.glyphCache[key]
if !ok { if !ok {
data := output.Face.GlyphData(glyph.GlyphID).(api.GlyphOutline) data := output.Face.GlyphData(glyph.GlyphID).(api.GlyphOutline)
if len(data.Segments) == 0 { if len(data.Segments) > 0 {
continue
}
segs := make([]api.Segment, len(data.Segments)) segs := make([]api.Segment, len(data.Segments))
for i, seg := range data.Segments { for i, seg := range data.Segments {
segs[i] = seg segs[i] = seg
@ -216,8 +213,8 @@ func (g *Game) drawGlyphs(dst *ebiten.Image, output *shaping.Output, originX, or
segs[i].Args[j].Y *= -1 segs[i].Args[j].Y *= -1
} }
} }
v.image, v.point = segmentsToImage(segs, orig) v.image, v.point = segmentsToImage(segs, orig)
}
if g.glyphCache == nil { if g.glyphCache == nil {
g.glyphCache = map[glyphCacheKey]glyphCacheValue{} g.glyphCache = map[glyphCacheKey]glyphCacheValue{}
} }