I am using various Pimoroni displays with the Pico W for projects which involve lists/rows of numeric stats, formatted with leading spaces or leading 0s, eg
_123.04
9999.36
__17.94
00123.04
99999.36
00017.94
The digits need to be all equally spaced and kept aligned irrespective of the values 0…9 and taking into account the leading 0s or ‘spaces’ (shapes shown in the example as ‘_’ ) as shown above.
If the digits are not true monospace the digits display will jitter left and right as they update which is most offputting.
if you display a list of values in a loop showing a list of varying values, eg
display.set_font(“bitmap8”)
myvar1 = readscaleadc(1) # keep getting values and scale
myvar2 = readscaleadc(2)
myvar1str= (“val = {:5.1f}”.format(myvar1)) # format values into 5 char strings
myvar2str= (“val = {:5.1f}”.format(myvar2))
display.text(myvar1str, 0, 20, scale=2) # dispay each value under each other
display.text(myvar2str, 0, 60, scale=2)
etc, repeat loop
The digits will jitter left/right depending on the myvar values.
Generally, all digits 0…9 in any fonts (even proportional fonts) are monospace for the purpose of correct list alignment and leading space formatting keeps the spaces the same width as the digits.
Q: is there a small font set which has true monospaced chars/digits or is there a workaround when using bitmap8 fonts.
Thanks