mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 20:10:08 +03:00
Cosmetics
This commit is contained in:
parent
45a75c1c2b
commit
e2939aae82
4 changed files with 18 additions and 23 deletions
|
@ -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);
|
||||||
|
|
||||||
|
@ -99,14 +97,11 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
|
||||||
const uint16_t * specs = fontspecsTable[FONT_INDEX(flags)];
|
const uint16_t * specs = fontspecsTable[FONT_INDEX(flags)];
|
||||||
|
|
||||||
int result = 0;
|
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);
|
unsigned int c = uint8_t(*s);
|
||||||
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;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "libopenui.h"
|
#include "libopenui.h"
|
||||||
|
|
||||||
class OptionsText : public StaticText {
|
class OptionsText: public StaticText {
|
||||||
public:
|
public:
|
||||||
OptionsText(Window * parent, const rect_t &rect) :
|
OptionsText(Window * parent, const rect_t &rect) :
|
||||||
StaticText(parent, rect)
|
StaticText(parent, rect)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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)])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue