canonical / ubuntu-frame

The foundation for many embedded graphical display implementations
GNU General Public License v3.0
156 stars 21 forks source link

Miscalculated diagnostic width when using multibyte characters #149

Closed Saviq closed 12 months ago

Saviq commented 12 months ago
echo "lasczz" > diagnostic.txt

vs.

echo "łąśćźż" > diagnostic.txt
AlanGriffiths commented 12 months ago

Seems likely. render_text(() is calling TextRenderer::get_max_font_height_by_width() with the the raw utf8 string, and the later is is assuming that each code unit is a character (as in latin1). (The actual rendering first converts to utf32 so that code unit == character is a reasonable assumption.)

I think we simply need to do the conversion to utf32 earlier.