1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-14 20:10:04 +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 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;

View file

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

View file

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

View file

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