Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.0
-
None
-
Windows 7
-
a620b778964158e1e38d780d62cd807276001796
Description
There's much documentation on the web about DirectWrite's superior rendering of OpenType CFF fonts (ie. OpenType fonts with Type 1 PostScript outlines). Our users make extensive use of these professional fonts (eg. all Adobe's fonts) so I was a bit disappointed to perceive no improvements when switching on DirectWrite in Qt 4.8.
I investigated further and discovered that DirectWrite isn't used for non-TrueType fonts, due to logic in loadEngine in qfontdatabase_win.cpp. This checks for TMPF_TRUETYPE in the GDI TEXTMETRIC structure. However, DirectWrite can render any sfnt-format font, whether it be TrueType or CFF, so I think the code should instead check for the presence of a cmap table, like this:
DWORD cmapTag = MAKE_TAG('c', 'm', 'a', 'p');
uint cmapTableLength = GetFontData(hdc, cmapTag, 0, 0, 0);
bool sfnt = cmapTableLength != GDI_ERROR;
and then switch on sfnt to determine whether it should try using DirectWrite. I tried this locally and the results are good.
Attachments
Issue Links
- depends on
-
QTBUG-22657 PDF export looks wrong when using the DirectWrite font engine
- Closed