Created
December 29, 2021 02:05
-
-
Save nwillc/611dceee18935d9cc5979d64ce4c331c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func toFontRune(fs embed.FS, fontName string, name string) (FontRune, error) { | |
txt, err := fs.ReadFile(fontName + "/" + name) | |
if err != nil { | |
return nil, err | |
} | |
lines := strings.Split(string(txt), "\n") | |
var fr [][]bool | |
for _, line := range lines { | |
if len(line) < 3 { | |
continue | |
} | |
var l []bool | |
for _, c := range line { | |
l = append(l, c == blackPixel) | |
} | |
fr = append(fr, l) | |
} | |
return fr, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment