Merge pull request #106 from kortschak/fix-font-cache
Fix unnecessary filesystem access
This commit is contained in:
commit
13548be874
1 changed files with 4 additions and 0 deletions
4
font.go
4
font.go
|
@ -120,6 +120,10 @@ type defaultFontCache struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cache *defaultFontCache) Load(fontData FontData) (font *truetype.Font, err error) {
|
func (cache *defaultFontCache) Load(fontData FontData) (font *truetype.Font, err error) {
|
||||||
|
if font = cache.fonts[cache.namer(fontData)]; font != nil {
|
||||||
|
return font, nil
|
||||||
|
}
|
||||||
|
|
||||||
var data []byte
|
var data []byte
|
||||||
var file = cache.namer(fontData)
|
var file = cache.namer(fontData)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue