mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
text/v2: add variations to glyph cache keys
This commit is contained in:
parent
c7843a4e2b
commit
68d5fa46e2
@ -50,6 +50,8 @@ type glyphImageCacheKey struct {
|
|||||||
|
|
||||||
xoffset fixed.Int26_6
|
xoffset fixed.Int26_6
|
||||||
yoffset fixed.Int26_6
|
yoffset fixed.Int26_6
|
||||||
|
|
||||||
|
variations string
|
||||||
}
|
}
|
||||||
|
|
||||||
type glyphImageCacheEntry struct {
|
type glyphImageCacheEntry struct {
|
||||||
|
@ -338,9 +338,10 @@ func (g *GoTextFace) glyphImage(glyph glyph, origin fixed.Point26_6) (*ebiten.Im
|
|||||||
Y: (origin.Y + b.Min.Y) & ((1 << 6) - 1),
|
Y: (origin.Y + b.Min.Y) & ((1 << 6) - 1),
|
||||||
}
|
}
|
||||||
key := glyphImageCacheKey{
|
key := glyphImageCacheKey{
|
||||||
id: uint32(glyph.shapingGlyph.GlyphID),
|
id: uint32(glyph.shapingGlyph.GlyphID),
|
||||||
xoffset: subpixelOffset.X,
|
xoffset: subpixelOffset.X,
|
||||||
yoffset: subpixelOffset.Y,
|
yoffset: subpixelOffset.Y,
|
||||||
|
variations: g.ensureVariationsString(),
|
||||||
}
|
}
|
||||||
img := theGlyphImageCache.getOrCreate(g, key, func() *ebiten.Image {
|
img := theGlyphImageCache.getOrCreate(g, key, func() *ebiten.Image {
|
||||||
return segmentsToImage(glyph.scaledSegments, subpixelOffset, b)
|
return segmentsToImage(glyph.scaledSegments, subpixelOffset, b)
|
||||||
|
Loading…
Reference in New Issue
Block a user