1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 20:10:08 +03:00

Cosmetics

This commit is contained in:
Bertrand Songis 2019-12-09 16:37:45 +01:00
parent 45a75c1c2b
commit e2939aae82
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
4 changed files with 18 additions and 23 deletions

View file

@ -27,51 +27,49 @@ pixel_t displayBuf[DISPLAY_BUFFER_SIZE];
uint8_t getMappedChar(uint8_t c) uint8_t getMappedChar(uint8_t c)
{ {
uint8_t result; uint8_t result;
if (c == 0)
result = 0;
#if defined(TRANSLATIONS_FR) #if defined(TRANSLATIONS_FR)
else if (c >= 0x80 && c <= 0x84) { if (c >= 0x80 && c <= 0x84) {
result = 115 + c - 0x80; result = 115 + c - 0x80;
} }
#elif defined(TRANSLATIONS_DE) #elif defined(TRANSLATIONS_DE)
else if (c >= 0x80 && c <= 0x86) { if (c >= 0x80 && c <= 0x86) {
result = 120 + c - 0x80; result = 120 + c - 0x80;
} }
#elif defined(TRANSLATIONS_CZ) #elif defined(TRANSLATIONS_CZ)
else if (c >= 0x80 && c <= 0x80+29) { if (c >= 0x80 && c <= 0x80+29) {
result = 127 + c - 0x80; result = 127 + c - 0x80;
} }
#elif defined(TRANSLATIONS_ES) #elif defined(TRANSLATIONS_ES)
else if (c >= 0x80 && c <= 0x81) { if (c >= 0x80 && c <= 0x81) {
result = 157 + c - 0x80; result = 157 + c - 0x80;
} }
#elif defined(TRANSLATIONS_FI) #elif defined(TRANSLATIONS_FI)
else if (c >= 0x80 && c <= 0x85) { if (c >= 0x80 && c <= 0x85) {
result = 159 + c - 0x80; result = 159 + c - 0x80;
} }
#elif defined(TRANSLATIONS_IT) #elif defined(TRANSLATIONS_IT)
else if (c >= 0x80 && c <= 0x81) { if (c >= 0x80 && c <= 0x81) {
result = 165 + c - 0x80; result = 165 + c - 0x80;
} }
#elif defined(TRANSLATIONS_PL) #elif defined(TRANSLATIONS_PL)
else if (c >= 0x80 && c <= 0x80+17) { if (c >= 0x80 && c <= 0x80+17) {
result = 167 + c - 0x80; result = 167 + c - 0x80;
} }
#elif defined(TRANSLATIONS_PT) #elif defined(TRANSLATIONS_PT)
else if (c >= 0x80 && c <= 0x80+21) { if (c >= 0x80 && c <= 0x80+21) {
result = 185 + c - 0x80; result = 185 + c - 0x80;
} }
#elif defined(TRANSLATIONS_SE) #elif defined(TRANSLATIONS_SE)
else if (c >= 0x80 && c <= 0x85) { if (c >= 0x80 && c <= 0x85) {
result = 207 + c - 0x80; result = 207 + c - 0x80;
} }
#endif #endif
else if (c == 0x21) // !
result = 0; if (c < 0xC0)
else if (c < 0xC0) result = c - 0x20;
result = c - 0x20 - 2;
else else
result = c - 0xC0 + 96 - 2; result = c - 0xC0 + 96;
// TRACE("getMappedChar '%c' (%x) = %d", c, c, result); // TRACE("getMappedChar '%c' (%x) = %d", c, c, result);
@ -104,9 +102,6 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
if (!c) { if (!c) {
break; break;
} }
else if (c == 0x20) {
result += 4;
}
else if (c >= 0xFE) { else if (c >= 0xFE) {
s++; s++;
c = uint8_t(*s) + ((c & 0x01) << 8) - 1; c = uint8_t(*s) + ((c & 0x01) << 8) - 1;

View file

@ -102,7 +102,7 @@ class FontBitmap:
offset = self.font_size % 2 offset = self.font_size % 2
image.paste(self.extra_bitmap.copy(), (width, offset)) image.paste(self.extra_bitmap.copy(), (width, offset))
elif c == " ": elif c == " ":
pass width += 4
elif c in special_chars["cn"]: elif c in special_chars["cn"]:
width += self.draw_char(image, width, c, self.cjk_font) width += self.draw_char(image, width, c, self.cjk_font)
else: else:

View file

@ -5,7 +5,7 @@
import os import os
standard_chars = "!#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz~|≥" standard_chars = """ !"#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz~|≥"""
extra_chars = "".join([chr(0x10000+i) for i in range(21)]) extra_chars = "".join([chr(0x10000+i) for i in range(21)])