Skip to content

How are U8G2 Fonts encoded in C Files? #2580

Answered by olikraus
gentlesartori asked this question in Q&A
Discussion options

You must be logged in to vote

I updated your post and added proper code tags.

if that were the case, the first value couldn't be "\0" because that would mean there are no glyphs in the font.

Because of the wrong code tags the initial "`" had not been visible.

But what I do not understand is how the fonts are encoded into the C source files

Each byte is represented by the corresponding ASCII glyph. If that glyph is risky, the corresponding octal escape sequence is used. Reason for using strings instead of byte arrays is parsing speed. The font file currently is almost 38MB in size. The string format above is parsed within seconds. Byte arrays would require multiple minutes (at least at the time when I decided for t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gentlesartori
Comment options

Answer selected by gentlesartori
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants