Add FontFileNamer type, set default fontNamer.
This commit is contained in:
parent
994e11cd6d
commit
d0cd538261
1 changed files with 5 additions and 2 deletions
7
font.go
7
font.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue