Revert "Windows: Add synthesized fonts also when there is a style name"
This is a partial revert of commitbb10f385b8827a. 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 reintroducef385b8827aand 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>
parent
4f730fc5f1
commit
d16ee17a39
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue