Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: Fix Inter font rendering on Windows with FreeType #2169

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ $(package)_config_opts_mingw32 += "QMAKE_CXXFLAGS = '$($(package)_cflags) $($(pa
$(package)_config_opts_mingw32 += "QMAKE_LFLAGS = '$($(package)_ldflags)'"
$(package)_config_opts_mingw32 += -device-option CROSS_COMPILE="$(host)-"
$(package)_config_opts_mingw32 += -pch
$(package)_config_opts_mingw32 += -qt-freetype

$(package)_config_opts_android = -xplatform android-clang
$(package)_config_opts_android += -android-sdk $(ANDROID_SDK)
Expand Down
14 changes: 14 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,20 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}

#ifdef Q_OS_WIN
// Use Qt's built-in FreeType rendering engine to display text on Windows.
// We use the Inter font's OpenType format which doesn't render clearly on
// Windows in Qt applications with the default engine. The TrueType format
// works fine in either case, but the OpenType appearance is more legible.
// Apply this before instantiating QApplication. This environment variable
// configures the option for Qt's Windows integration plugin which doesn't
// have a C++ API.
//
if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) {
qputenv("QT_QPA_PLATFORM", "windows:fontengine=freetype");
}
#endif

// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#if QT_VERSION >= 0x050600
Expand Down
2 changes: 1 addition & 1 deletion src/qt/res/stylesheets/dark_stylesheet.qss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

QWidget {
color: rgb(204, 208, 209);
font-family: "SF Pro Display", "Segoe UI", "Inter";
font-family: "SF Pro Display", "Inter";
}

QMainWindow {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/res/stylesheets/light_stylesheet.qss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

QWidget {
color: rgb(58, 70, 93);
font-family: "SF Pro Display", "Segoe UI", "Inter";
font-family: "SF Pro Display", "Inter";
}

QMainWindow {
Expand Down