From c2c4ba673209e4dd8541cbf315f42b04a664b6d4 Mon Sep 17 00:00:00 2001 From: Doug Massay Date: Mon, 25 Mar 2024 19:03:06 -0400 Subject: [PATCH] Update override for full woff(2) support [deploy] --- .github/workflows/reset-win-caches.txt | 1 + .github/workflows/win-build.yml | 2 +- src/main.cpp | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/reset-win-caches.txt b/.github/workflows/reset-win-caches.txt index 9da140f968..8b50408be0 100644 --- a/.github/workflows/reset-win-caches.txt +++ b/.github/workflows/reset-win-caches.txt @@ -8,3 +8,4 @@ Reset cache on 7-October-2023 Reset cache on 18-November-2023 Reset cache for Qt6.6.2 on 19-Febbruary-2024 Reset Cache on 7-March-2024 +Reset Cache on 25-March-2024 diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index e8d8552383..2a323fbccf 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -29,7 +29,7 @@ on: env: BUILD_TYPE: Release - DOWNLOADQT: https://github.com/dougmassay/win-qtwebkit-5.212/releases/download/v5.212-1/Qt6.6.2b_x64_VS2022.7z + DOWNLOADQT: https://github.com/dougmassay/win-qtwebkit-5.212/releases/download/v5.212-1/Qt6.6.2e_x64_VS2022.7z QT: Qt6.6.2 INNO: C:\Program Files (x86)\Inno Setup 6 CMAKE64BIT: -DWIN_INSTALLER_USE_64BIT_CRT=1 diff --git a/src/main.cpp b/src/main.cpp index d0614ef384..2066cd9159 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -425,19 +425,23 @@ int main(int argc, char *argv[]) } } - // Trying to embedd woff fonts, or opening epubs with embedded woff fonts, can cause Sigil to - // silently crash when system display scaling is greater than 100%. So we'll force the fallback - // gdi font backend until such time as the directwrite font backend is more robust. + // Woff/woff2 fonts can be more fully supported by setting SIGIL_USE_FREETYPE_FONTENGINE to anything. // See https://www.mobileread.com/forums/showthread.php?t=356351 for discussion. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 8, 0) - // Leave a back door env var override in case of unforseen complications. - QString font_backend_override = Utility::GetEnvironmentVar("SIGIL_USE_DIRECTWRITE_FONTS"); - if (!current_platform_args.contains("nodirectwrite", Qt::CaseInsensitive)) { - if (font_backend_override.isEmpty()) { - current_platform_args.append("nodirectwrite"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QString font_backend_override = Utility::GetEnvironmentVar("SIGIL_USE_FREETYPE_FONTENGINE"); + // Don't change any global fontengine parameters a user may have set in QT_QPA_PLATFORM + bool fontengine_arg_exists = false; + foreach(QString arg, current_platform_args) { + if (arg.startsWith("fontengine=", Qt::CaseInsensitive)) { + fontengine_arg_exists = true; + } + } + if (!fontengine_arg_exists) { + if (!font_backend_override.isEmpty()) { + current_platform_args.append("fontengine=freetype"); } } -#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 8, 0) +#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // if altgr is not already in the list of windows platform options, add it