Add SetFontNamer func.
SetFontNamer changs draw2d's default font naming convention. Accepts a func of type FontFileNamer, which accepts a FontData and returns the filename as a string.
This commit is contained in:
parent
d0cd538261
commit
be5a5617ef
1 changed files with 4 additions and 0 deletions
4
font.go
4
font.go
|
@ -87,6 +87,10 @@ func SetFontFolder(folder string) {
|
||||||
fontFolder = filepath.Clean(folder)
|
fontFolder = filepath.Clean(folder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetFontNamer(fn FontFileNamer) {
|
||||||
|
fontNamer = fn
|
||||||
|
}
|
||||||
|
|
||||||
func loadFont(fontFileName string) *truetype.Font {
|
func loadFont(fontFileName string) *truetype.Font {
|
||||||
fontBytes, err := ioutil.ReadFile(path.Join(fontFolder, fontFileName))
|
fontBytes, err := ioutil.ReadFile(path.Join(fontFolder, fontFileName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue