diff --git a/radio/src/gui/colorlcd/lcd.cpp b/radio/src/gui/colorlcd/lcd.cpp index 26e0d3ed9..8ee12ea86 100644 --- a/radio/src/gui/colorlcd/lcd.cpp +++ b/radio/src/gui/colorlcd/lcd.cpp @@ -27,51 +27,49 @@ pixel_t displayBuf[DISPLAY_BUFFER_SIZE]; uint8_t getMappedChar(uint8_t c) { uint8_t result; - if (c == 0) - result = 0; + #if defined(TRANSLATIONS_FR) - else if (c >= 0x80 && c <= 0x84) { + if (c >= 0x80 && c <= 0x84) { result = 115 + c - 0x80; } #elif defined(TRANSLATIONS_DE) - else if (c >= 0x80 && c <= 0x86) { + if (c >= 0x80 && c <= 0x86) { result = 120 + c - 0x80; } #elif defined(TRANSLATIONS_CZ) - else if (c >= 0x80 && c <= 0x80+29) { + if (c >= 0x80 && c <= 0x80+29) { result = 127 + c - 0x80; } #elif defined(TRANSLATIONS_ES) - else if (c >= 0x80 && c <= 0x81) { + if (c >= 0x80 && c <= 0x81) { result = 157 + c - 0x80; } #elif defined(TRANSLATIONS_FI) - else if (c >= 0x80 && c <= 0x85) { + if (c >= 0x80 && c <= 0x85) { result = 159 + c - 0x80; } #elif defined(TRANSLATIONS_IT) - else if (c >= 0x80 && c <= 0x81) { + if (c >= 0x80 && c <= 0x81) { result = 165 + c - 0x80; } #elif defined(TRANSLATIONS_PL) - else if (c >= 0x80 && c <= 0x80+17) { + if (c >= 0x80 && c <= 0x80+17) { result = 167 + c - 0x80; } #elif defined(TRANSLATIONS_PT) - else if (c >= 0x80 && c <= 0x80+21) { + if (c >= 0x80 && c <= 0x80+21) { result = 185 + c - 0x80; } #elif defined(TRANSLATIONS_SE) - else if (c >= 0x80 && c <= 0x85) { + if (c >= 0x80 && c <= 0x85) { result = 207 + c - 0x80; } #endif - else if (c == 0x21) // ! - result = 0; - else if (c < 0xC0) - result = c - 0x20 - 2; + + if (c < 0xC0) + result = c - 0x20; else - result = c - 0xC0 + 96 - 2; + result = c - 0xC0 + 96; // TRACE("getMappedChar '%c' (%x) = %d", c, c, result); @@ -99,14 +97,11 @@ int getTextWidth(const char * s, int len, LcdFlags flags) const uint16_t * specs = fontspecsTable[FONT_INDEX(flags)]; int result = 0; - for (int i=0; len == 0 || i < len; ++i) { + for (int i = 0; len == 0 || i < len; ++i) { unsigned int c = uint8_t(*s); if (!c) { break; } - else if (c == 0x20) { - result += 4; - } else if (c >= 0xFE) { s++; c = uint8_t(*s) + ((c & 0x01) << 8) - 1; diff --git a/radio/src/gui/colorlcd/radio_version.cpp b/radio/src/gui/colorlcd/radio_version.cpp index fdf93705d..8fa80aafd 100644 --- a/radio/src/gui/colorlcd/radio_version.cpp +++ b/radio/src/gui/colorlcd/radio_version.cpp @@ -23,7 +23,7 @@ #include "options.h" #include "libopenui.h" -class OptionsText : public StaticText { +class OptionsText: public StaticText { public: OptionsText(Window * parent, const rect_t &rect) : StaticText(parent, rect) diff --git a/tools/build-font-bitmap.py b/tools/build-font-bitmap.py index 050e15e44..66827c223 100755 --- a/tools/build-font-bitmap.py +++ b/tools/build-font-bitmap.py @@ -102,7 +102,7 @@ class FontBitmap: offset = self.font_size % 2 image.paste(self.extra_bitmap.copy(), (width, offset)) elif c == " ": - pass + width += 4 elif c in special_chars["cn"]: width += self.draw_char(image, width, c, self.cjk_font) else: diff --git a/tools/charset.py b/tools/charset.py index eda770294..7834a60cc 100644 --- a/tools/charset.py +++ b/tools/charset.py @@ -5,7 +5,7 @@ import os -standard_chars = "!#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz~|≥" +standard_chars = """ !"#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz~|≥""" extra_chars = "".join([chr(0x10000+i) for i in range(21)])