I’ve just noticed, whilst working on the text/char and text scrolling functions of my extension for the 17x7 LED matrix, that the internal Microbit font is rather oddly constructed.
Obviously characters which are five pixels wide are five pixels wide. However, some characters which are four pixels wide are left-aligned whilst others are right aligned. Here are two examples, first “t”:
.#...
.#...
.##..
.#...
..###
but “e” is left-aligned:
.##..
#..#.
###..
#....
.###.
Furthermore, characters which are three pixels wide “l” and j" etc are centred in the 5-wide matrix but the letter “i” is not - it is in the second leftmost column.
When scrolling text across a wider LED display attached to a Microbit it would be nice to have only one blank pixel-column between adjacent letters so as to maximise density. This requires a bit of jiggery pokery.
What do people think about this? Obviously when displaying a single letter on the 5x45 Microbit matrix it makes sense to have it centred but for any external display devices it’s a shame the characters are not consistently definted to give ease of manipulation
The original Pimoroni code included a function in a .cpp file which does a logical OR of all five rows to determine the width. I will therefore add an additional check for lack of left-alignment and return a negative value which I can use to indicate both the width (using abs(width)) and to determine that the first pixel-column can be eliminated.
.