summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-02-15 03:09:08 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-03-20 13:43:43 +0000
commitaf1a99ebb9a8f2415106ab6bfe85fcd77412e740 (patch)
tree703d8817c05ae9dfe7996dd82377c604e7735df0 /src/plugins
parentcd75f297948e5c8c1bc7f2d016a43c883c6b212a (diff)
An attempt to fix font stretching with DirectFrite font engine
Do the `lf.lfWidth = tm.tmAveCharWidth * request.stretch / 100` trick for the DirectWrite path, too. Task-number: QTBUG-22652 Change-Id: I5238bce1033555a4386cb48fed8c898a9632e0cd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 603e88b3b2..97a319b63a 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1693,28 +1693,26 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
LOGFONT lf = fontDefToLOGFONT(request);
const bool preferClearTypeAA = lf.lfQuality == CLEARTYPE_QUALITY;
- if (!useDirectWrite) {
- if (request.stretch != 100) {
- HFONT hfont = CreateFontIndirect(&lf);
- if (!hfont) {
- qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__);
- hfont = QWindowsFontDatabase::systemFont();
- }
+ if (request.stretch != 100) {
+ HFONT hfont = CreateFontIndirect(&lf);
+ if (!hfont) {
+ qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__);
+ hfont = QWindowsFontDatabase::systemFont();
+ }
- HGDIOBJ oldObj = SelectObject(data->hdc, hfont);
- TEXTMETRIC tm;
- if (!GetTextMetrics(data->hdc, &tm))
- qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__);
- else
- lf.lfWidth = tm.tmAveCharWidth * request.stretch / 100;
- SelectObject(data->hdc, oldObj);
+ HGDIOBJ oldObj = SelectObject(data->hdc, hfont);
+ TEXTMETRIC tm;
+ if (!GetTextMetrics(data->hdc, &tm))
+ qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__);
+ else
+ lf.lfWidth = tm.tmAveCharWidth * request.stretch / 100;
+ SelectObject(data->hdc, oldObj);
- DeleteObject(hfont);
- }
+ DeleteObject(hfont);
}
#if !defined(QT_NO_DIRECTWRITE)
- else {
+ if (useDirectWrite) {
// Default to false for DirectWrite (and re-enable once/if everything turns out okay)
useDirectWrite = false;
if (initDirectWrite(data.data())) {