Add FontFileNamer type, set default fontNamer.

This commit is contained in:
Steven Edwards 2015-08-09 12:43:37 -04:00
parent 994e11cd6d
commit d0cd538261
1 changed files with 5 additions and 2 deletions

View File

@ -13,8 +13,9 @@ import (
) )
var ( var (
fontFolder = "../resource/font/" fontFolder = "../resource/font/"
fonts = make(map[string]*truetype.Font) fonts = make(map[string]*truetype.Font)
fontNamer FontFileNamer = FontFileName
) )
type FontStyle byte type FontStyle byte
@ -39,6 +40,8 @@ type FontData struct {
Style FontStyle Style FontStyle
} }
type FontFileNamer func(fontData FontData) string
func FontFileName(fontData FontData) string { func FontFileName(fontData FontData) string {
fontFileName := fontData.Name fontFileName := fontData.Name
switch fontData.Family { switch fontData.Family {