mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 22:21:09 +00:00
GUI: prevent crash when unable to load a font
This commit is contained in:
parent
f572d6e386
commit
7d9749d0ef
1 changed files with 24 additions and 1 deletions
|
@ -2901,7 +2901,17 @@ void FurnaceGUI::commitSettings() {
|
||||||
applyUISettings();
|
applyUISettings();
|
||||||
|
|
||||||
ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
||||||
ImGui::GetIO().Fonts->Build();
|
if (!ImGui::GetIO().Fonts->Build()) {
|
||||||
|
logE("error while building font atlas!\n");
|
||||||
|
showError("error while loading fonts! please check your settings.");
|
||||||
|
ImGui::GetIO().Fonts->Clear();
|
||||||
|
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
|
||||||
|
patFont=mainFont;
|
||||||
|
ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
||||||
|
if (!ImGui::GetIO().Fonts->Build()) {
|
||||||
|
logE("error again while building font atlas!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::drawDebug() {
|
void FurnaceGUI::drawDebug() {
|
||||||
|
@ -6594,6 +6604,7 @@ void FurnaceGUI::applyUISettings() {
|
||||||
logE("could not load icon font!\n");
|
logE("could not load icon font!\n");
|
||||||
}
|
}
|
||||||
if (settings.mainFontSize==settings.patFontSize && settings.patFont<5 && builtinFontM[settings.patFont]==builtinFont[settings.mainFont]) {
|
if (settings.mainFontSize==settings.patFontSize && settings.patFont<5 && builtinFontM[settings.patFont]==builtinFont[settings.mainFont]) {
|
||||||
|
logD("using main font for pat font.\n");
|
||||||
patFont=mainFont;
|
patFont=mainFont;
|
||||||
} else {
|
} else {
|
||||||
if (settings.patFont==6) { // custom font
|
if (settings.patFont==6) { // custom font
|
||||||
|
@ -6729,6 +6740,18 @@ bool FurnaceGUI::init() {
|
||||||
|
|
||||||
applyUISettings();
|
applyUISettings();
|
||||||
|
|
||||||
|
if (!ImGui::GetIO().Fonts->Build()) {
|
||||||
|
logE("error while building font atlas!\n");
|
||||||
|
showError("error while loading fonts! please check your settings.");
|
||||||
|
ImGui::GetIO().Fonts->Clear();
|
||||||
|
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
|
||||||
|
patFont=mainFont;
|
||||||
|
ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
||||||
|
if (!ImGui::GetIO().Fonts->Build()) {
|
||||||
|
logE("error again while building font atlas!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(finalLayoutPath,(e->getConfigPath()+String(LAYOUT_INI)).c_str(),4095);
|
strncpy(finalLayoutPath,(e->getConfigPath()+String(LAYOUT_INI)).c_str(),4095);
|
||||||
prepareLayout();
|
prepareLayout();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue