lancaster-university / codal-microbit-v2

CODAL target for the micro:bit v2.x series of devices
MIT License
41 stars 50 forks source link

For characters not in the font, display scrolls a null pointer #423

Closed microbit-carlos closed 2 months ago

microbit-carlos commented 3 months ago

When a string is scrolled on the display, it gets each character from the font as a pointer, but it doesn't check if the pointer is valid: codal-core/source/drivers/AnimatedDisplay.cpp#L147

When the requested character is out-of-range it returns a null pointer: codal-core/source/types/BitmapFont.cpp#L111

So, for example with uBit.display.print("Hi O갎o"), after the O it shows 3 "characters" that are essentially two pixels in a diagonal ( is 3 UTF-8 bytes 0xEA 0xB0 0x8E, which I can confirm is what I see in the compiled):

https://github.com/lancaster-university/codal-microbit-v2/assets/29712657/822e2988-1d9e-43a3-aea7-77078cb76718

microbit-carlos commented 3 months ago

PR:

microbit-carlos commented 2 months ago

PR https://github.com/lancaster-university/codal-core/pull/168 has been merged, so this issue can be closed. 🎉