Skip to content

Commit

Permalink
Update override for full woff(2) support [deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmassay committed Mar 25, 2024
1 parent 8248583 commit c2c4ba6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/reset-win-caches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 14 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2c4ba6

Please sign in to comment.