mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-01 10:32:40 +00:00
add a string to force glyph ranges
This commit is contained in:
parent
13ca42ea39
commit
291e7f5d8b
3 changed files with 46 additions and 4 deletions
|
@ -7049,6 +7049,35 @@ bool FurnaceGUI::init() {
|
|||
|
||||
ImGui::LocalizeRegisterEntries(guiLocalization,8);
|
||||
|
||||
const char* localeSettings=_("LocaleSettings: ccjk");
|
||||
if (strlen(localeSettings)<20) {
|
||||
logE("the LocaleSettings string is incomplete!");
|
||||
} else {
|
||||
localeRequiresChinese=(localeSettings[16]=='C');
|
||||
localeRequiresChineseTrad=(localeSettings[17]=='C');
|
||||
localeRequiresJapanese=(localeSettings[18]=='J');
|
||||
localeRequiresKorean=(localeSettings[19]=='K');
|
||||
if (strlen(localeSettings)>21) {
|
||||
if (localeSettings[20]==' ') {
|
||||
ImWchar next=0;
|
||||
for (const char* i=&localeSettings[21]; *i; i++) {
|
||||
if (((*i)>='0' && (*i)<='9') || ((*i)>='A' && (*i)<='F')) {
|
||||
next<<=4;
|
||||
if ((*i)>='0' && (*i)<='9') {
|
||||
next|=(*i)-'0';
|
||||
} else {
|
||||
next|=(*i)-'A'+10;
|
||||
}
|
||||
} else {
|
||||
localeExtraRanges.push_back(next);
|
||||
next=0;
|
||||
}
|
||||
}
|
||||
localeExtraRanges.push_back(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadUserPresets(true);
|
||||
|
||||
applyUISettings();
|
||||
|
@ -7669,6 +7698,10 @@ FurnaceGUI::FurnaceGUI():
|
|||
bigFont(NULL),
|
||||
headFont(NULL),
|
||||
fontRange(NULL),
|
||||
localeRequiresJapanese(false),
|
||||
localeRequiresChinese(false),
|
||||
localeRequiresChineseTrad(false),
|
||||
localeRequiresKorean(false),
|
||||
prevInsData(NULL),
|
||||
pendingLayoutImport(NULL),
|
||||
pendingLayoutImportLen(0),
|
||||
|
|
|
@ -2228,6 +2228,12 @@ class FurnaceGUI {
|
|||
|
||||
char finalLayoutPath[4096];
|
||||
|
||||
bool localeRequiresJapanese;
|
||||
bool localeRequiresChinese;
|
||||
bool localeRequiresChineseTrad;
|
||||
bool localeRequiresKorean;
|
||||
std::vector<ImWchar> localeExtraRanges;
|
||||
|
||||
DivInstrument* prevInsData;
|
||||
|
||||
unsigned char* pendingLayoutImport;
|
||||
|
|
|
@ -6411,18 +6411,21 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
//fontConfP.RasterizerMultiply=1.5;
|
||||
|
||||
range.AddRanges(upTo800);
|
||||
if (settings.loadJapanese) {
|
||||
if (settings.loadJapanese || localeRequiresJapanese) {
|
||||
range.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesJapanese());
|
||||
}
|
||||
if (settings.loadChinese) {
|
||||
if (settings.loadChinese || localeRequiresChinese) {
|
||||
range.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesChineseSimplifiedCommon());
|
||||
}
|
||||
if (settings.loadChineseTraditional) {
|
||||
if (settings.loadChineseTraditional || localeRequiresChineseTrad) {
|
||||
range.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesChineseFull());
|
||||
}
|
||||
if (settings.loadKorean) {
|
||||
if (settings.loadKorean || localeRequiresKorean) {
|
||||
range.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesKorean());
|
||||
}
|
||||
if (!localeExtraRanges.empty()) {
|
||||
range.AddRanges(localeExtraRanges.data());
|
||||
}
|
||||
// I'm terribly sorry
|
||||
range.UsedChars[0x80>>5]=0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue