Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.8
Description
A font without any DemiBold (weight 600) style but with Normal (400) and Bold (700) styles shows the Bold one with DirectWrite, but the Normal one + DWRITE_FONT_SIMULATIONS_BOLD with GDI.
"Times New Roman" is such a font on Windows. The following example illustrates the differences when running with fontengine=gdi vs. no options (i.e. DirectWrite is used).
#include <QApplication> #include <QLabel> int main(int argc, char **argv) { QApplication app(argc, argv); QLabel lbl("BoldText"); auto font = lbl.font(); font.setFamily("Times New Roman"); font.setWeight(QFont::DemiBold); // or QFont::Bold lbl.setFont(font); lbl.show(); return QApplication::exec(); }
As you can see, DemiBold is thicker on GDI compared to DirectWrite. "Times New Roman" actually uses DirectWrite in all cases, even when the fontengine is GDI, because the font-face created from CreateFontFaceFromHdc has simulations (DWRITE_FONT_SIMULATIONS_BOLD).
What's surprising is that the returned font-face claims to have a weight of 700.
Constructing a font of weight 700 (Bold) and enabling the bold-simulation results in text that's too thick (compared to GDI):
However, when using a font of weight 400 (Normal) and enabling the bold-simulation, the result is the same as with GDI (goal):
Attachments
Issue Links
- is duplicated by
-
QTBUG-131574 Qt 6.8 displays some font families in DemiBold much thicker than with Qt6.7
- Closed