1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 12:55:12 +03:00

fix chars

This commit is contained in:
3djc 2020-12-17 18:05:19 +01:00
parent 204e355d38
commit cd589bc28d
20 changed files with 32 additions and 37 deletions

View file

@ -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}")

View file

@ -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()

View file

@ -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

View file

@ -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);

View file

@ -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);
}

View file

@ -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);

View file

@ -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"
};

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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 = {