I am currently working on a project where I am custom designing some code to read a font file (Such as Arial14 that appears in many libraries). However, I'm having some issues regarding character width data.
Here is Arial14.h as an example of what I'm about to explain (Had to drop web link as the file was too large and pushed the message over 11,000 characters):
The font data makes perfect sense, and I can understand the firstchar variable and all that. However, I was having trouble comprehending the "char widths" section. I initially thought that it tells the code how many bytes make up each letter (As anyone would presume). However, it seemed at the time to be completely jumbled up and incomprehensible.
Symbol 32 (Hex code 0x20) is a space bar and hence has no width (Seems odd, but ok). However the problem presents itself as soon as you look at the second hexcode in the "char widths" section. Why does it say 0x01 when there are 2 bytes to letter 33? And the next code along 0x03 referring to character 34 with 6 bytes? I am now thinking that whatever the value is for that character you double it to get the number of bytes (Unless something weird pops up later on). Why would this be?!? Why do you have to double the value to get the number of hex codes that define that character? Why not just have the correct value in the first place? It just seems like such a stupid way of defining the font. If there are 6 hex codes that define the character, shouldn't the char width hexcode just be 0x06?
I feel this may have something to do with conversion between hex codes and some other base by some obscure libraries, but I don't see why that would alter font files to be done this way.
Also, I am 100% aware that reading from the font file DIRECTLY is considered highly unusual. This has proven to be a very unusual project.
This is not an urgent matter, as I can work with this. I would just like to know the reasoning behind the logic.
On a related note, does anyone know what "size" refer to (The very first defined byte in the array)? I'm presuming it isn't actually too important when reading from the font.
Thanking you all in advance,