diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index a42ee6058..19bdc7933 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -2,7 +2,7 @@ include(CMakeForceCompiler) include(Bitmaps) set(PCB_TYPES X9LITE X9LITES X7 XLITE XLITES X9D X9D+ X9E X10 X12S SKY9X 9XRPRO AR9X NV14) -set(RADIO_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL CN) +set(RADIO_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL CN TW) set(TTS_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL RU) set(PCB "X9D+" CACHE STRING "Radio type, one of: ${PCB_TYPES}") diff --git a/radio/src/fonts/CMakeLists.txt b/radio/src/fonts/CMakeLists.txt index b9566e3c0..e0aa64384 100644 --- a/radio/src/fonts/CMakeLists.txt +++ b/radio/src/fonts/CMakeLists.txt @@ -11,6 +11,8 @@ set(CJK_FONT_BOLD "Noto/NotoSansCJKsc-Bold") if(TRANSLATIONS STREQUAL CN) set(subset all) +elseif(TRANSLATIONS STREQUAL TW) + set(subset all) else() string(TOLOWER ${TRANSLATIONS} subset) endif() diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index db3c29c33..0c2f623b1 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -202,7 +202,7 @@ void getCharPattern(PatternData * pattern, unsigned char c, LcdFlags flags) else { pattern->width = 5; pattern->height = 7; - pattern->data = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5]; + pattern->data = &font_5x7[(c - 0x20) * 5]; } #else pattern->width = 5; @@ -218,7 +218,7 @@ uint8_t getCharWidth(char c, LcdFlags flags) return getPatternWidth(&pattern); } -void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags) +void lcdDrawChar(coord_t x, coord_t y, uint8_t c, LcdFlags flags) { const unsigned char * q; @@ -277,16 +277,12 @@ void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags) else #endif { -#if !defined(BOOT) - q = (c < 0x80) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0x80)*5]; -#else - q = &font_5x7[(c-0x20)*5]; -#endif + q = &font_5x7[(c - 0x20) * 5]; lcdPutPattern(x, y, q, 5, 7, flags); } } -void lcdDrawChar(coord_t x, coord_t y, char c) +void lcdDrawChar(coord_t x, coord_t y, uint8_t c) { lcdDrawChar(x, y, c, 0); } @@ -713,7 +709,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att) #endif { drawStringWithIndex(x, y, "LUA", qr.quot+1, att); - lcdDrawChar(lcdLastRightPos, y, 'a'+qr.rem, att); + lcdDrawChar(lcdLastRightPos, y, 'a' + qr.rem, att); } } #endif diff --git a/radio/src/gui/128x64/lcd.h b/radio/src/gui/128x64/lcd.h index 25a225806..d367f0b14 100644 --- a/radio/src/gui/128x64/lcd.h +++ b/radio/src/gui/128x64/lcd.h @@ -98,8 +98,8 @@ extern coord_t lcdNextPos; extern volatile uint32_t lcdInputs ; #endif -void lcdDrawChar(coord_t x, coord_t y, char c); -void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags); +void lcdDrawChar(coord_t x, coord_t y, uint8_t c); +void lcdDrawChar(coord_t x, coord_t y, uint8_t c, LcdFlags flags); void lcdDrawCenteredText(coord_t y, const char * s, LcdFlags flags = 0); void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags flags); void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags); diff --git a/radio/src/gui/212x64/lcd.cpp b/radio/src/gui/212x64/lcd.cpp index cd21caeee..cabc266af 100644 --- a/radio/src/gui/212x64/lcd.cpp +++ b/radio/src/gui/212x64/lcd.cpp @@ -214,12 +214,12 @@ void getCharPattern(PatternData * pattern, unsigned char c, LcdFlags flags) else { pattern->width = 5; pattern->height = 7; - pattern->data = (c < 0x80) ? &font_5x7[(c - 0x20) * 5] : &font_5x7_extra[(c - 0x80) * 5]; + pattern->data = &font_5x7[(c - 0x20) * 5]; } #else pattern->width = 5; pattern->height = 7; - pattern->data = &font_5x7[(c-0x20) * 5]; + pattern->data = &font_5x7[(c - 0x20) * 5]; #endif } @@ -230,7 +230,7 @@ uint8_t getCharWidth(char c, LcdFlags flags) return getPatternWidth(&pattern); } -void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags) +void lcdDrawChar(coord_t x, coord_t y, uint8_t c, LcdFlags flags) { lcdNextPos = x - 1; #if defined(BOOT) @@ -243,7 +243,7 @@ void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags) #endif } -void lcdDrawChar(coord_t x, coord_t y, char c) +void lcdDrawChar(coord_t x, coord_t y, uint8_t c) { lcdDrawChar(x, y, c, 0); } diff --git a/radio/src/gui/212x64/lcd.h b/radio/src/gui/212x64/lcd.h index a8880ec90..f8b87552e 100644 --- a/radio/src/gui/212x64/lcd.h +++ b/radio/src/gui/212x64/lcd.h @@ -100,8 +100,8 @@ extern coord_t lcdNextPos; #define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE) #define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END) -void lcdDrawChar(coord_t x, coord_t y, char c); -void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags mode); +void lcdDrawChar(coord_t x, coord_t y, uint8_t c); +void lcdDrawChar(coord_t x, coord_t y, uint8_t c, LcdFlags mode); void lcdDrawCenteredText(coord_t y, const char * s, LcdFlags flags = 0); void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags mode); void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags mode); diff --git a/radio/src/gui/common/stdlcd/fonts.cpp b/radio/src/gui/common/stdlcd/fonts.cpp index 18f376bf2..e0641570c 100644 --- a/radio/src/gui/common/stdlcd/fonts.cpp +++ b/radio/src/gui/common/stdlcd/fonts.cpp @@ -22,6 +22,7 @@ const unsigned char font_5x7[] = { #include "font_05x07.lbm" +#include "font_05x07_extra.lbm" #if defined(TRANSLATIONS_DE) #include "font_de_05x07.lbm" #elif defined(TRANSLATIONS_CZ) @@ -129,10 +130,6 @@ const unsigned char font_4x6_extra[] = { #include "font_04x06_extra.lbm" }; -const unsigned char font_5x7_extra[] = { -#include "font_05x07_extra.lbm" -}; - const unsigned char font_10x14_extra[] = { #include "font_10x14_extra.lbm" }; diff --git a/radio/src/gui/common/stdlcd/fonts.h b/radio/src/gui/common/stdlcd/fonts.h index ee880bb05..a6e59c399 100644 --- a/radio/src/gui/common/stdlcd/fonts.h +++ b/radio/src/gui/common/stdlcd/fonts.h @@ -30,7 +30,6 @@ extern const unsigned char font_10x14[]; extern const unsigned char font_4x6[]; extern const unsigned char font_8x10[]; extern const unsigned char font_22x38_num[]; - extern const unsigned char font_5x7_extra[]; extern const unsigned char font_10x14_extra[]; extern const unsigned char font_4x6_extra[]; #endif diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index aa21d36e7..c24f9b2a8 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -1220,7 +1220,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Vstupy" #define TR_MENU_LUA STR_CHAR_LUA "Lua skripty" #define TR_MENU_STICKS STR_CHAR_STICK "Páky" -#define TR_MENU_POTS STR_CHAR_POTS "Potenciometry" +#define TR_MENU_POTS STR_CHAR_POT "Potenciometry" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cyklika" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trimy" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 951b3ad5e..bafa29fab 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -1233,7 +1233,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Inputs" #define TR_MENU_LUA STR_CHAR_LUA "Lua Skripte" #define TR_MENU_STICKS STR_CHAR_STICK "Knüppel" -#define TR_MENU_POTS STR_CHAR_POTS "Potis" +#define TR_MENU_POTS STR_CHAR_POT "Potis" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Heli-TS CYC1-3" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trimmung" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 08737df42..c80fe7ad8 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -1233,7 +1233,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Entradas" #define TR_MENU_LUA STR_CHAR_LUA "Lua scripts" #define TR_MENU_STICKS STR_CHAR_STICK "Sticks" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cíclico" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trims" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index d290cdb08..9d3e722c1 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -1240,7 +1240,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Inputs" #define TR_MENU_LUA STR_CHAR_LUA "Lua scripts" #define TR_MENU_STICKS STR_CHAR_STICK "Sticks" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cyclic" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trims" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 3a659dffc..2ceb3accf 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -1257,7 +1257,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Entrées" #define TR_MENU_LUA STR_CHAR_LUA "Scripts Lua" #define TR_MENU_STICKS STR_CHAR_STICK "Manches" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cyclique" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trims" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index f46aae313..39f923957 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -1254,7 +1254,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Ingressi" #define TR_MENU_LUA STR_CHAR_LUA "Lua scripts" #define TR_MENU_STICKS STR_CHAR_STICK "Sticks" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Ciclico" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trims" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index cc4706979..36ff84be4 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -1241,7 +1241,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Inputs" #define TR_MENU_LUA STR_CHAR_LUA "Lua Scripts" #define TR_MENU_STICKS STR_CHAR_STICK "Sticks" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "HeliCyclic" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trims" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 96ddc1448..c45ae4230 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -1250,7 +1250,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Wejści" #define TR_MENU_LUA STR_CHAR_LUA "SkryptyLUA" #define TR_MENU_STICKS STR_CHAR_STICK "Drążki" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cyclic" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trymy" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index 47d9f1011..993c49318 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -1250,7 +1250,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Inputs" #define TR_MENU_LUA STR_CHAR_LUA "Lua scripts" #define TR_MENU_STICKS STR_CHAR_STICK "Sticks" -#define TR_MENU_POTS STR_CHAR_POTS "Pots" +#define TR_MENU_POTS STR_CHAR_POT "Pots" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cyclic" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trims" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index f58d4bc63..a49adb648 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -1253,7 +1253,7 @@ #define TR_MENU_INPUTS STR_CHAR_INPUT "Inputs" #define TR_MENU_LUA STR_CHAR_LUA "Lua scripts" #define TR_MENU_STICKS STR_CHAR_STICK "Spakars" -#define TR_MENU_POTS STR_CHAR_POTS "Rattar" +#define TR_MENU_POTS STR_CHAR_POT "Rattar" #define TR_MENU_MAX STR_CHAR_FUNCTION "MAX" #define TR_MENU_HELI STR_CHAR_CYC "Cyclic" #define TR_MENU_TRIMS STR_CHAR_TRIM "Trimm" diff --git a/radio/src/translations/untranslated.h b/radio/src/translations/untranslated.h index 7a853edaa..3a228e675 100644 --- a/radio/src/translations/untranslated.h +++ b/radio/src/translations/untranslated.h @@ -45,7 +45,7 @@ #define TR_POTS_VSRCRAW STR_CHAR_POT"S1\0" STR_CHAR_POT"S2\0" #define TR_SW_VSRCRAW STR_CHAR_SWITCH"SA\0" STR_CHAR_SWITCH"SB\0" STR_CHAR_SWITCH"SC\0" STR_CHAR_SWITCH"SD\0" STR_CHAR_SWITCH"SG\0" STR_CHAR_SWITCH"SH\0" STR_CHAR_SWITCH"SI\0" STR_CHAR_SWITCH"SJ\0" #elif defined(RADIO_TX12) - #define TR_POTS_VSRCRAW STR_CHAR_POTS "S1\0" STR_CHAR_POTS "S2\0" + #define TR_POTS_VSRCRAW STR_CHAR_POT "S1\0" STR_CHAR_POT "S2\0" #define TR_SW_VSRCRAW STR_CHAR_SWITCH "SA\0" STR_CHAR_SWITCH "SB\0" STR_CHAR_SWITCH "SC\0" STR_CHAR_SWITCH "SD\0" STR_CHAR_SWITCH "SE\0" STR_CHAR_SWITCH "SF\0" STR_CHAR_SWITCH "SI\0" STR_CHAR_SWITCH "SJ\0" #elif defined(PCBX7) #define TR_POTS_VSRCRAW STR_CHAR_POT"S1\0" STR_CHAR_POT"S2\0" diff --git a/tools/charset.py b/tools/charset.py index 9fc3222bd..8169da9b3 100644 --- a/tools/charset.py +++ b/tools/charset.py @@ -10,10 +10,10 @@ standard_chars = """ !"#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ extra_chars = "".join([chr(0x10000+i) for i in range(21)]) -def chinese_chars(): +def cjk_chars(lang): charset = set() tools_path = os.path.dirname(os.path.realpath(__file__)) - with open(os.path.join(tools_path, "../radio/src/translations/cn.h.txt"), encoding='utf-8') as f: + with open(os.path.join(tools_path, "../radio/src/translations/%s.h.txt" % lang), encoding='utf-8') as f: data = f.read() for c in data: if 0x4E00 <= ord(c) <= 0x9FFF: @@ -36,7 +36,8 @@ special_chars = { "pl": "ąćęłńóśżźĄĆĘŁŃÓŚŻŹ", "pt": "ÁáÂâÃãÀàÇçÉéÊêÍíÓóÔôÕõÚú", "se": "åäöÅÄÖ", - "cn": "".join(chinese_chars()) + "cn": "".join(cjk_chars("cn")), + "tw": "".join(cjk_chars("tw")), } subset_lowercase = {