diff --git a/client/renderSDL/RenderHandler.cpp b/client/renderSDL/RenderHandler.cpp index a44224cc1..1dd57cab7 100644 --- a/client/renderSDL/RenderHandler.cpp +++ b/client/renderSDL/RenderHandler.cpp @@ -23,6 +23,7 @@ #include "../render/ColorFilter.h" #include "../render/IScreenHandler.h" +#include "../../lib/CConfigHandler.h" #include "../../lib/json/JsonUtils.h" #include "../../lib/filesystem/Filesystem.h" #include "../../lib/VCMIDirs.h" @@ -352,7 +353,7 @@ std::shared_ptr RenderHandler::loadFont(EFonts font) std::shared_ptr loadedFont; - if (ttfConf[filename].isNull()) + if(ttfConf[filename].isNull() || settings["video"]["scalableFonts"].Bool() == false) loadedFont = std::make_shared(filename); else loadedFont = std::make_shared(ttfConf[filename]); diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 24e353ee0..843558a79 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -166,6 +166,7 @@ "showfps", "targetfps", "vsync", + "scalableFonts", "upscalingFilter", "fontUpscalingFilter", "downscalingFilter" @@ -232,6 +233,10 @@ "type" : "boolean", "default" : true }, + "scalableFonts" : { + "type" : "boolean", + "default" : false + }, "fontUpscalingFilter" : { "type" : "string", "enum" : [ "nearest", "bilinear", "xbrz" ], diff --git a/launcher/settingsView/csettingsview_moc.cpp b/launcher/settingsView/csettingsview_moc.cpp index bc9a7776f..571774663 100644 --- a/launcher/settingsView/csettingsview_moc.cpp +++ b/launcher/settingsView/csettingsview_moc.cpp @@ -175,17 +175,6 @@ void CSettingsView::loadSettings() ui->lineEditGameLobbyHost->setText(QString::fromStdString(settings["lobby"]["hostname"].String())); ui->spinBoxNetworkPortLobby->setValue(settings["lobby"]["port"].Integer()); - auto mainWindow = getMainWindow(); - if(mainWindow) - { - bool fontModAvailable = mainWindow->getModView()->isModInstalled("vcmi-extras.truetypefonts"); - if(!fontModAvailable) - { - ui->labelTtfFont->hide(); - ui->buttonTtfFont->hide(); - } - } - loadToggleButtonSettings(); } @@ -206,13 +195,11 @@ void CSettingsView::loadToggleButtonSettings() setCheckbuttonState(ui->buttonRelativeCursorMode, settings["general"]["userRelativePointer"].Bool()); setCheckbuttonState(ui->buttonHapticFeedback, settings["general"]["hapticFeedback"].Bool()); + setCheckbuttonState(ui->buttonTtfFont, settings["video"]["scalableFonts"].Bool()); + std::string cursorType = settings["video"]["cursor"].String(); int cursorTypeIndex = vstd::find_pos(cursorTypesList, cursorType); setCheckbuttonState(ui->buttonCursorType, cursorTypeIndex); - - auto mainWindow = getMainWindow(); - if(mainWindow) - setCheckbuttonState(ui->buttonTtfFont, mainWindow->getModView()->isModEnabled("vcmi-extras.truetypefonts")); } void CSettingsView::fillValidResolutions() @@ -772,10 +759,7 @@ void CSettingsView::on_sliderControllerSticksSensitivity_valueChanged(int value) void CSettingsView::on_buttonTtfFont_toggled(bool value) { - auto mainWindow = getMainWindow(); - if(value) - mainWindow->getModView()->enableModByName("vcmi-extras.truetypefonts"); - else - mainWindow->getModView()->disableModByName("vcmi-extras.truetypefonts"); + Settings node = settings.write["video"]["scalableFonts"]; + node->Bool() = value; updateCheckbuttonText(ui->buttonTtfFont); }