Add FontFileNamer type, set default fontNamer.
This commit is contained in:
parent
994e11cd6d
commit
d0cd538261
1 changed files with 5 additions and 2 deletions
3
font.go
3
font.go
|
@ -15,6 +15,7 @@ import (
|
|||
var (
|
||||
fontFolder = "../resource/font/"
|
||||
fonts = make(map[string]*truetype.Font)
|
||||
fontNamer FontFileNamer = FontFileName
|
||||
)
|
||||
|
||||
type FontStyle byte
|
||||
|
@ -39,6 +40,8 @@ type FontData struct {
|
|||
Style FontStyle
|
||||
}
|
||||
|
||||
type FontFileNamer func(fontData FontData) string
|
||||
|
||||
func FontFileName(fontData FontData) string {
|
||||
fontFileName := fontData.Name
|
||||
switch fontData.Family {
|
||||
|
|
Loading…
Reference in a new issue