From 43f552f48f951adb04dd8ed26bee5f2d3e7945ef Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 13 Aug 2022 15:22:53 +0400 Subject: [PATCH] Allow users to decide if they need to import bitmap fonts --- apps/launcher/settingspage.cpp | 3 +++ apps/mwiniimporter/main.cpp | 8 ++++++++ apps/wizard/importpage.cpp | 1 + apps/wizard/mainwizard.cpp | 4 ++++ docs/source/reference/modding/font.rst | 3 ++- files/ui/settingspage.ui | 15 +++++++++++++++ files/ui/wizard/importpage.ui | 15 +++++++++++++++ 7 files changed, 48 insertions(+), 1 deletion(-) diff --git a/apps/launcher/settingspage.cpp b/apps/launcher/settingspage.cpp index 1739c5cc05..3157583eb8 100644 --- a/apps/launcher/settingspage.cpp +++ b/apps/launcher/settingspage.cpp @@ -129,6 +129,9 @@ void Launcher::SettingsPage::on_importerButton_clicked() if (addonsCheckBox->isChecked()) arguments.append(QString("--game-files")); + if (fontsCheckBox->isChecked()) + arguments.append(QString("--fonts")); + arguments.append(QString("--encoding")); arguments.append(mGameSettings.value(QString("encoding"), QString("win1252"))); arguments.append(QString("--ini")); diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index 8a2aeb603b..8d562059ed 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -66,6 +66,7 @@ int wmain(int argc, wchar_t *wargv[]) { ("cfg,c", bpo::value(), "openmw.cfg file") ("output,o", bpo::value()->default_value(""), "openmw.cfg file") ("game-files,g", "import esm and esp files") + ("fonts,f", "import bitmap fonts") ("no-archives,A", "disable bsa archives import") ("encoding,e", bpo::value()-> default_value("win1252"), "Character encoding used in OpenMW game messages:\n" @@ -117,6 +118,13 @@ int wmain(int argc, wchar_t *wargv[]) { MwIniImporter::multistrmap ini = importer.loadIniFile(iniFile); MwIniImporter::multistrmap cfg = importer.loadCfgFile(cfgFile); + if (!vm.count("fonts")) + { + ini.erase("Fonts:Font 0"); + ini.erase("Fonts:Font 1"); + ini.erase("Fonts:Font 2"); + } + importer.merge(cfg, ini); importer.mergeFallback(cfg, ini); diff --git a/apps/wizard/importpage.cpp b/apps/wizard/importpage.cpp index 71c5544e6b..c59ba48e33 100644 --- a/apps/wizard/importpage.cpp +++ b/apps/wizard/importpage.cpp @@ -11,6 +11,7 @@ Wizard::ImportPage::ImportPage(QWidget *parent) : registerField(QLatin1String("installation.import-settings"), importCheckBox); registerField(QLatin1String("installation.import-addons"), addonsCheckBox); + registerField(QLatin1String("installation.import-fonts"), fontsCheckBox); } int Wizard::ImportPage::nextId() const diff --git a/apps/wizard/mainwizard.cpp b/apps/wizard/mainwizard.cpp index 840027323a..46481753a7 100644 --- a/apps/wizard/mainwizard.cpp +++ b/apps/wizard/mainwizard.cpp @@ -270,6 +270,10 @@ void Wizard::MainWizard::runSettingsImporter() arguments.append(QLatin1String("win1252")); } + // Import fonts + if (field(QLatin1String("installation.import-fonts")).toBool() == true) + arguments.append(QLatin1String("--fonts")); + // Now the paths arguments.append(QLatin1String("--ini")); diff --git a/docs/source/reference/modding/font.rst b/docs/source/reference/modding/font.rst index d43f37340c..6f17fa2fa7 100644 --- a/docs/source/reference/modding/font.rst +++ b/docs/source/reference/modding/font.rst @@ -6,7 +6,8 @@ Default UI font and font used in magic scrolls are defined in ``openmw.cfg``: fallback=Fonts_Font_0,pelagiad fallback=Fonts_Font_2,ayembedt -By default, built-in TrueType fonts are used. Font used by console and another debug windows is not configurable (so ``Fonts_Font_1`` is unused). +When there are no ``Fonts_Font_*`` lines in user's ``openmw.cfg``, built-in TrueType fonts are used. +Font used by console and another debug windows is not configurable (so ``Fonts_Font_1`` is unused). Morrowind .fnt fonts -------------------- diff --git a/files/ui/settingspage.ui b/files/ui/settingspage.ui index f4f41f8397..c59f596f5b 100644 --- a/files/ui/settingspage.ui +++ b/files/ui/settingspage.ui @@ -112,6 +112,21 @@ + + + + Import bitmap fonts setup + + + Fonts shipped with the original engine are blurry with UI scaling and support only a small amount of characters, +so OpenMW provides another set of fonts to avoid these issues. These fonts use TrueType technology and are quite similar +to default Morrowind fonts. Check this box if you still prefer original fonts over OpenMW ones or if you use custom bitmap fonts. + + + true + + + diff --git a/files/ui/wizard/importpage.ui b/files/ui/wizard/importpage.ui index 9fd4ea5000..acc0d268ec 100644 --- a/files/ui/wizard/importpage.ui +++ b/files/ui/wizard/importpage.ui @@ -50,6 +50,21 @@ + + + + Import bitmap fonts setup from Morrowind.ini + + + Fonts shipped with the original engine are blurry with UI scaling and support only a small amount of characters, +so OpenMW provides another set of fonts to avoid these issues. These fonts use TrueType technology and are quite similar +to default Morrowind fonts. Check this box if you still prefer original fonts over OpenMW ones or if you use custom bitmap fonts. + + + true + + +