func (cache *FolderFontCache) Load(fontData FontData) (font *truetype.Font, err error) {
	if font = cache.fonts[cache.namer(fontData)]; font != nil {
		return font, nil
	}

	var data []byte
	var file = cache.namer(fontData)

	if data, err = ioutil.ReadFile(filepath.Join(cache.folder, file)); err != nil {
		return
	}

	if font, err = truetype.Parse(data); err != nil {
		return
	}

	cache.fonts[file] = font
	return
}
func (cache *FolderFontCache) Load(fontData FontData) (font *truetype.Font, err error) {
	if font = cache.fonts[cache.namer(fontData)]; font != nil {
		return font, nil
	}

	var data []byte
	var file = cache.namer(fontData)

	if data, err = ioutil.ReadFile(filepath.Join(cache.folder, file)); err != nil {
		return
	}

	if font, err = truetype.Parse(data); err != nil {
		return
	}

	cache.fonts[file] = font
	return
}
func ( cache * FolderFontCache ) Load ( fontData FontData ) ( font * truetype . Font , err error ) { if font = cache . fonts [ cache . namer ( fontData ) ] ; font != nil { return font , nil } var data [ ] byte var file = cache . namer ( fontData ) if data , err = ioutil . ReadFile ( filepath . Join ( cache . folder , file ) ) ; err != nil { return } if font , err = truetype . Parse ( data ) ; err != nil { return } cache . fonts [ file ] = font return }
// Load a font from cache if exists otherwise it will load the font from file
Load a font from cache if exists otherwise it will load the font from file