Confused by U98g2 Font Descent values #2593
Unanswered
gentlesartori
asked this question in
Q&A
Replies: 2 comments 4 replies
-
Yes 255 means -1. Value 255 is the 8bit 2-complement. Mathematics: if v > 127 then v= 255-v-1 where v is the byte value |
Beta Was this translation helpful? Give feedback.
3 replies
-
hmm maybe my own formula had been wrong. Correct description should be here: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am able to parse all of the U8g2 font data without apparent problems. There seems to be a problem with my parsing of the first 23 bytes header, or my understanding of it anyway. As an example, I am using font data from u8g2_font_5x7 from u8g2_fonts.c. The header (first 23 bytes) in Octal looks like this:
\277\0\2\2\3\3\3\4\4\5\7\0**\377**\6**\377**\6**\0**\1\22\2/\6p
For calculating the Y position of glyphs, I am interested in the descent values. The highlighted values above (in order) correspond to "y offset (descent)", "descent (lower g)", and "descent ')'". In decimal, these values are 255, 255, and 0 respectively. A descent of 255 seems wrong to me, so I am wondering if these bytes should be interpreted differently somehow - perhaps with a sign?
Edit: I realized that each glyph has a bitmap Y Offset as well. Perhaps this is the value that I should be using (makes sense). But - looking at ASCII 36, the bitmap Y Offset is again large at 254. There must be some other calculation that I am missing. Perhaps y offset (from the header) - bitmap y offset?
Please help with my confusion. I am very close to full comprehension of u8g2 fonts!
Many thanks,
Gentle
Beta Was this translation helpful? Give feedback.
All reactions