Home › Evil Mad Scientist Forums › Clock Kits › Alpha Clock Five – Making lowercase and custom letters › Re: Alpha Clock Five – Making lowercase and custom letters
September 23, 2014 at 6:10 pm #21963
Take a look at how a5editFontChar works.
Inside, it has:
byte offset = (3 * (asciiChar – a5_asciiOffset));
A byte is the same as a uint8_t, an unsigned 8-bit variable. It can only range between 0 and 255. Noting that a5_asciiOffset is 32, it is the case that if asciiChar is equal to 117, you get
offset = 3*(117 – 32) = 3*85 = 255.
For any asciiChar greater than 117 (ascii ‘u’), you’ll run into a problem there.
The following lines of code are:
a5_FontTable[offset++] = A;
a5_FontTable[offset++] = B;
a5_FontTable[offset] = C;
So, it should be clear that even that edge case of ‘u’ will not actually work, because it still increases the value of offset, even if it began at “only” 255.