summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-06-30 16:36:28 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-06-30 19:38:59 +0200
commitd16ee17a39252e06bf3bef08d80b0d116c473ba1 (patch)
tree00d833529f87a15c5c515da77b64d84714618c40 /src/gui
parent4f730fc5f13b906d7bb2461f803ecedb4937c16d (diff)
Revert "Windows: Add synthesized fonts also when there is a style name"
This is a partial revert of commit f385b8827a75688b8a2cbd51e8da8a602d7f9567. This causes issues because we may overwrite genuine styles with synthetic ones. Lets say for instance that we register "Roboto Bold" and then later we register "Roboto Thin". When we register "Roboto Thin" we also register an alternative font which is called "Roboto" (because this is the typographical family name of the font) with bold weight, because we know Windows can synthesize this. This would work fine, except that on Windows we also store the original face name of the font as a user-pointer in the database. This contains the legacy name of the font: "Roboto Thin". This will override the font that is already stored. When we look up "Roboto" + bold weight in the database later, we will find this synthetic font, replace the requested family name with the legacy one "Roboto Thin" and use this instead. The right fix for now is to revert the cause of the regression. If we want to re-fix the original bug, we might be able to reintroduce f385b8827a75688b8a2cbd51e8da8a602d7f9567 and then make sure we always prefer the "real" font when there are conflicts (this would mean marking synthetic fonts in the database). [ChangeLog][Windows] Fixed a regression where different font styles and/or weights would not be available. Fixes: QTBUG-94781 Task-number: QTBUG-91398 Pick-to: 5.15 6.1 6.2 Change-Id: I092022b14ebf1d56685eaa3b8efe55f015659adc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase.cpp6
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase_ft.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/text/windows/qwindowsfontdatabase.cpp b/src/gui/text/windows/qwindowsfontdatabase.cpp
index 94a152abed..58ff99e3a8 100644
--- a/src/gui/text/windows/qwindowsfontdatabase.cpp
+++ b/src/gui/text/windows/qwindowsfontdatabase.cpp
@@ -604,13 +604,13 @@ static bool addFontToDatabase(QString familyName,
style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName));
// add fonts windows can generate for us:
- if (weight <= QFont::DemiBold)
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName));
- if (style != QFont::StyleItalic)
+ if (style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName));
- if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName));
diff --git a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp
index c8dbba015c..e2c8d3455d 100644
--- a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp
@@ -279,15 +279,15 @@ static bool addFontToDatabase(QString familyName,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
// add fonts windows can generate for us:
- if (weight <= QFont::DemiBold)
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
- if (style != QFont::StyleItalic)
+ if (style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
- if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));