mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
text: cache metrics
This commit is contained in:
parent
5a8cfb2561
commit
159c19a671
@ -38,7 +38,8 @@ type kernCacheKey struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type faceWithCache struct {
|
type faceWithCache struct {
|
||||||
f font.Face
|
f font.Face
|
||||||
|
metrics font.Metrics
|
||||||
|
|
||||||
glyphBoundsCache map[rune]glyphBoundsCacheValue
|
glyphBoundsCache map[rune]glyphBoundsCacheValue
|
||||||
glyphAdvanceCache map[rune]glyphAdvanceCacheValue
|
glyphAdvanceCache map[rune]glyphAdvanceCacheValue
|
||||||
@ -126,5 +127,9 @@ func (f *faceWithCache) Kern(r0, r1 rune) fixed.Int26_6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *faceWithCache) Metrics() font.Metrics {
|
func (f *faceWithCache) Metrics() font.Metrics {
|
||||||
return f.f.Metrics()
|
if f.metrics != (font.Metrics{}) {
|
||||||
|
return f.metrics
|
||||||
|
}
|
||||||
|
f.metrics = f.f.Metrics()
|
||||||
|
return f.metrics
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user