ab-glyph
ab-glyph copied to clipboard
Embedding fonts at compile time
I think there should be a proc macro or a const fn or something we can use to embed a Font
directly in the binary such that error handling doesn't have to be performed at runtime (no possibility of a panic). Would be nice for embedded applications
You can embed a font with include_bytes!
. But, indeed, it will need to be parsed at runtime. ttf-parser doesn't provide const fn
to parse fonts, though perhaps that's possible. ttf-parser already avoids allocation by parsing stuff on the fly during the various method calls anyway, so I'm not sure there would be too much benefit in avoiding the initial bit.