|
|
|
@ -247,8 +247,8 @@ void oledDrawChar(int x, int y, char c, int font) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int zoom = (font & FONT_DOUBLE) ? 2 : 1;
|
|
|
|
|
int char_width = fontCharWidth(font & 0x7f, c);
|
|
|
|
|
const uint8_t *char_data = fontCharData(font & 0x7f, c);
|
|
|
|
|
int char_width = fontCharWidth(font & 0x7f, (uint8_t)c);
|
|
|
|
|
const uint8_t *char_data = fontCharData(font & 0x7f, (uint8_t)c);
|
|
|
|
|
|
|
|
|
|
if (x <= -char_width) {
|
|
|
|
|
return;
|
|
|
|
@ -268,9 +268,11 @@ void oledDrawChar(int x, int y, char c, int font) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char oledConvertChar(const char c) {
|
|
|
|
|
static uint8_t convert_char(const char a) {
|
|
|
|
|
static char last_was_utf8 = 0;
|
|
|
|
|
|
|
|
|
|
uint8_t c = a;
|
|
|
|
|
|
|
|
|
|
// non-printable ASCII character
|
|
|
|
|
if (c < ' ') {
|
|
|
|
|
last_was_utf8 = 0;
|
|
|
|
@ -307,7 +309,7 @@ int oledStringWidth(const char *text, int font) {
|
|
|
|
|
int space = (font & FONT_DOUBLE) ? 2 : 1;
|
|
|
|
|
int l = 0;
|
|
|
|
|
for (; *text; text++) {
|
|
|
|
|
char c = oledConvertChar(*text);
|
|
|
|
|
uint8_t c = convert_char(*text);
|
|
|
|
|
if (c) {
|
|
|
|
|
l += fontCharWidth(font & 0x7f, c) + space;
|
|
|
|
|
}
|
|
|
|
@ -320,7 +322,7 @@ void oledDrawString(int x, int y, const char *text, int font) {
|
|
|
|
|
int l = 0;
|
|
|
|
|
int space = (font & FONT_DOUBLE) ? 2 : 1;
|
|
|
|
|
for (; *text; text++) {
|
|
|
|
|
char c = oledConvertChar(*text);
|
|
|
|
|
uint8_t c = convert_char(*text);
|
|
|
|
|
if (c) {
|
|
|
|
|
oledDrawChar(x + l, y, c, font);
|
|
|
|
|
l += fontCharWidth(font & 0x7f, c) + space;
|
|
|
|
|