From be5a5617ef0e4ae4e2b25cce383d7be2ce584cf7 Mon Sep 17 00:00:00 2001 From: Steven Edwards Date: Sun, 9 Aug 2015 12:44:50 -0400 Subject: [PATCH] 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. --- font.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/font.go b/font.go index 0c3305f..ef7274c 100644 --- a/font.go +++ b/font.go @@ -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 {