1
0
forked from me/IronOS

Impl. CJK support with zh-TW and yue-HK translations

Also add support for generating font table using the WenQuanYi Bitmap
Song font.
This commit is contained in:
Alvin Wong
2021-01-22 18:18:32 +08:00
parent 1a8826c0a8
commit 47692024c5
15 changed files with 548820 additions and 17 deletions

View File

@@ -125,7 +125,7 @@ void OLED::drawChar(char c) {
} else if (c == 0) {
return;
}
uint16_t index = c - 2; // First index is \x02
uint16_t index = static_cast<unsigned char>(c) - 2; // First index is \x02
uint8_t *charPointer;
charPointer = ((uint8_t *)currentFont) + ((fontWidth * (fontHeight / 8)) * index);
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);

View File

@@ -211,15 +211,22 @@ const menuitem advancedMenu[] = {
};
static void printShortDescriptionDoubleLine(uint32_t shortDescIndex) {
OLED::setFont(1);
OLED::setCharCursor(0, 0);
OLED::print(SettingsShortNames[shortDescIndex][0]);
OLED::setCharCursor(0, 1);
OLED::print(SettingsShortNames[shortDescIndex][1]);
if (SettingsShortNames[shortDescIndex][0][0] == '\x00') {
// Empty first line means that this uses large font (for CJK).
OLED::setFont(0);
OLED::setCharCursor(0, 0);
OLED::print(SettingsShortNames[shortDescIndex][1]);
} else {
OLED::setFont(1);
OLED::setCharCursor(0, 0);
OLED::print(SettingsShortNames[shortDescIndex][0]);
OLED::setCharCursor(0, 1);
OLED::print(SettingsShortNames[shortDescIndex][1]);
}
}
/**
* Prints two small lines of short description
* Prints two small lines (or one line for CJK) of short description
* and prepares cursor in big font after it.
* @param shortDescIndex Index to of short description.
* @param cursorCharPosition Custom cursor char position to set after printing
@@ -632,6 +639,7 @@ static bool settings_setResetSettings(void) {
resetSettings();
OLED::setFont(0);
OLED::clearScreen();
OLED::setCursor(0, 0);
OLED::print(ResetOKMessage);
OLED::refresh();
@@ -871,10 +879,17 @@ static bool settings_setHallEffect(void) {
#endif
static void displayMenu(size_t index) {
// Call into the menu
OLED::setFont(1);
const char *textPtr = SettingsMenuEntries[index];
if (textPtr[0] == '\x01') { // `\x01` is used as newline.
// Empty first line means that this uses large font (for CJK).
OLED::setFont(0);
textPtr++;
} else {
OLED::setFont(1);
}
OLED::setCursor(0, 0);
// Draw title
OLED::print(SettingsMenuEntries[index]);
OLED::print(textPtr);
// Draw symbol
// 16 pixel wide image
// 2 pixel wide scrolling indicator

View File

@@ -720,7 +720,12 @@ void showDebugMenu(void) {
void showWarnings() {
// Display alert if settings were reset
if (settingsWereReset) {
warnUser(SettingsResetMessage, 1, 10 * TICKS_SECOND);
if (SettingsResetMessage[0] == '\x01') { // `\x01` is used as newline.
// Empty first line means that this uses large font (for CJK).
warnUser(SettingsResetMessage + 1, 0, 10 * TICKS_SECOND);
} else {
warnUser(SettingsResetMessage, 1, 10 * TICKS_SECOND);
}
}
#ifndef NO_WARN_MISSING
// We also want to alert if accel or pd is not detected / not responding

View File

@@ -10,7 +10,7 @@ ifneq ($(model),$(filter $(model),$(ALL_MODELS)))
$(error Invalid model '$(model)', valid options are: $(ALL_MODELS))
endif
ALL_LANGUAGES=BG CS DA DE EN ES FI FR HR HU IT LT NL NL_BE NO PL PT RU SK SL SR_CYRL SR_LATN SV TR UK
ALL_LANGUAGES=BG CS DA DE EN ES FI FR HR HU IT LT NL NL_BE NO PL PT RU SK SL SR_CYRL SR_LATN SV TR UK YUE_HK ZH_TW
# Enumerate all of the include directories