diff --git a/text/v2/glyph.go b/text/v2/glyph.go index 6c6932b88..2e77a74c4 100644 --- a/text/v2/glyph.go +++ b/text/v2/glyph.go @@ -40,15 +40,8 @@ func init() { } type faceCacheKey struct { - stdFaceID uint64 - - goTextFaceSourceID uint64 - goTextFaceDirection Direction + id uint64 goTextFaceSizeInPixels float64 - goTextFaceLanguage string - goTextFaceScript string - goTextFaceVariations string - goTextFaceFeatures string } type glyphImageCacheKey struct { diff --git a/text/v2/gotext.go b/text/v2/gotext.go index c7285169b..8d3a415c9 100644 --- a/text/v2/gotext.go +++ b/text/v2/gotext.go @@ -236,13 +236,8 @@ func (g *GoTextFace) ensureFeaturesString() string { // faceCacheKey implements Face. func (g *GoTextFace) faceCacheKey() faceCacheKey { return faceCacheKey{ - goTextFaceSourceID: g.Source.id, - goTextFaceDirection: g.Direction, + id: g.Source.id, goTextFaceSizeInPixels: g.SizeInPixels, - goTextFaceLanguage: g.Language.String(), - goTextFaceScript: g.Script.String(), - goTextFaceVariations: g.ensureVariationsString(), - goTextFaceFeatures: g.ensureFeaturesString(), } } diff --git a/text/v2/gotextfacesource.go b/text/v2/gotextfacesource.go index 1ed3efd33..1a0e78e01 100644 --- a/text/v2/gotextfacesource.go +++ b/text/v2/gotextfacesource.go @@ -124,7 +124,7 @@ func NewGoTextFaceSourcesFromCollection(source io.ReadSeeker) ([]*GoTextFaceSour func finalizeGoTextFaceSource(source *GoTextFaceSource) { runtime.SetFinalizer(source, nil) theGlyphImageCache.clear(func(key faceCacheKey) bool { - return key.goTextFaceSourceID == source.id + return key.id == source.id }) } diff --git a/text/v2/std.go b/text/v2/std.go index e7b4d1f24..b2f0bf034 100644 --- a/text/v2/std.go +++ b/text/v2/std.go @@ -54,7 +54,7 @@ func NewStdFace(face font.Face) *StdFace { func finalizeStdFace(face *StdFace) { runtime.SetFinalizer(face, nil) theGlyphImageCache.clear(func(key faceCacheKey) bool { - return key.stdFaceID == face.id + return key.id == face.id }) } @@ -85,7 +85,7 @@ func (s *StdFace) UnsafeInternal() any { // faceCacheKey implements Face. func (s *StdFace) faceCacheKey() faceCacheKey { return faceCacheKey{ - stdFaceID: s.id, + id: s.id, } }