Open oxplot opened 1 year ago
const2bit is for representing 2-bit color fonts. Glyph cannot handle 2-bit colors. In addition, we would like to support colored emoji in the future, but tinyfont.Glyph cannot handle them either.
However, trying to return a Glypher results in heap allocs for each call to GetGlyph().
Any suggestions? @deadprogram @aykevl @conejoninja
const2bit works with the following versions of tinyfont.
$ go get tinygo.org/x/tinyfont@34f5899f6c1e34aa6daa4e12e2b96a2ea370dff9
I've tried to convert a TTF font to a tiny go format:
$ go run ./cmd/tinyfontgen-ttf --package fonts --size 32 --fontname Regular58pt ./CharacterCats.ttf --output cats
58.go
But I can`t use it
tinyfont.DrawChar(&display, &fonts.Regular58pt, 5, 140, 'B', green)
# command-line-arguments
main.go:87:30: cannot use fonts.Regular58pt (variable of type const2bit.Font) as tinyfont.Fonter value in argument to tinyfont.DrawChar: const2bit.Font does not implement tinyfont.Fonter (method GetGlyph has pointer receiver)
This issue should be fixed in PR #46.
Since #46 has been merged, this issue should be resolved.
Added label to close on next release.
Due to the change from
Glypher
toGlyph
.Attempting to use a font created by tinyfontgen-ttf and using it, yields:
Relevant code: