olikraus / ucglib

Arduino True Color Library for TFTs and OLEDs
https://github.com/olikraus/ucglib/wiki
Other
261 stars 76 forks source link

cannot print degree ° symbol #118

Open rotarucosminleonard opened 4 years ago

rotarucosminleonard commented 4 years ago

I cannot print the degree symbol on my st7739 display. It just does not show up.

iltis42 commented 4 years ago

Did you check if your font does support this ? ucg.print("\0xb0") should do that, no problem i see as long the font supports. What font exactly did you try ?

Sub-7 commented 4 years ago

the same problem! tested with ("°" also with "\0xb0") Display: 1.77 TFT 160x128 Fonds: ucg.setFont(ucg_font_7x13_mr); ucg.setFont(ucg_font_courR12_mr); ucg.setFont(ucg_font_courR10_mr); ucg.setFont(ucg_font_profont10_mr);

Which font works?

EDIT: in my case the solution was change "ucg.setFont(ucg_font_7x13_mr);" to "ucg.setFont(ucg_font_7x13_tf);"

print ucg.print("\xb0"); // Print °

kevinstadler commented 4 years ago

I think this might be an issue with Arduino string encoding rather than with ucglib. The following works for me (note: no quotes around it, this is the raw byte notation of the ASCII character!)

ucg.drawGlyph(x, y, 0, 0xb0); // degree sign