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:
Steven Edwards 2015-08-09 12:44:50 -04:00
parent d0cd538261
commit be5a5617ef

View file

@ -87,6 +87,10 @@ func SetFontFolder(folder string) {
fontFolder = filepath.Clean(folder)
}
func SetFontNamer(fn FontFileNamer) {
fontNamer = fn
}
func loadFont(fontFileName string) *truetype.Font {
fontBytes, err := ioutil.ReadFile(path.Join(fontFolder, fontFileName))
if err != nil {