Initializing variables, font size change.

This commit is contained in:
Electric Keet 2023-08-02 22:59:45 -07:00
parent ebf8ebf7c0
commit 06d3e8a4b3
3 changed files with 14 additions and 9 deletions

View file

@ -2736,7 +2736,7 @@ void FurnaceGUI::drawSettings() {
void FurnaceGUI::syncSettings() {
settings.mainFontSize=e->getConfInt("mainFontSize",18);
settings.headFontSize=e->getConfInt("headFontSize",36);
settings.headFontSize=e->getConfInt("headFontSize",27);
settings.patFontSize=e->getConfInt("patFontSize",18);
settings.iconSize=e->getConfInt("iconSize",16);
settings.audioEngine=(e->getConfString("audioEngine","SDL")=="SDL")?1:0;
@ -4064,21 +4064,21 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
headFont=mainFont;
} else {
if (settings.headFont==6) { // custom font
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(settings.headFontPath.c_str(),MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(settings.headFontPath.c_str(),MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
logW("could not load header font! reverting to default font");
settings.headFont=0;
if ((headFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(builtinFontM[settings.headFont],builtinFontMLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(builtinFontM[settings.headFont],builtinFontMLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
logE("could not load header font! falling back to IBM Plex Sans.");
headFont=ImGui::GetIO().Fonts->AddFontDefault();
}
}
} else if (settings.headFont==5) { // system font
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_1,MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_2,MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_3,MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_1,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_2,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_3,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
logW("could not load header font! reverting to default font");
settings.headFont=0;
if ((headFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(builtinFontM[settings.headFont],builtinFontMLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(builtinFontM[settings.headFont],builtinFontMLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
logE("could not load header font! falling back to IBM Plex Sans.");
headFont=ImGui::GetIO().Fonts->AddFontDefault();
}
@ -4086,7 +4086,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
}
}
} else {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(builtinFontM[settings.headFont],builtinFontMLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",36)*dpiScale),NULL,upTo800))==NULL) {
if ((headFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(builtinFontM[settings.headFont],builtinFontMLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",27)*dpiScale),NULL,upTo800))==NULL) {
logE("could not load header font!");
headFont=ImGui::GetIO().Fonts->AddFontDefault();
}