diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-02-15 02:45:46 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-20 13:43:26 +0000 |
commit | 840a26a9b9e2fa9513fad759903c388e10900830 (patch) | |
tree | 7d698e498d0082404baabd4c8a0125f821eb5958 /src | |
parent | 202a3deec74a6e730824b1a95b7f9fa2e1909a0a (diff) |
Do not re-create font if it is not of TMPF_TRUETYPE
For !ttf and stretch==100 case, it was:
hfont = CreateFontIndirect(&lf);
TEXTMETRIC tm = ..;
if (!ttf) {
DeleteObject(hfont);
lf.lfWidth = tm.tmAveCharWidth;
hfont = CreateFontIndirect(&lf);
}
Unless there is some special behavior for non-TrueType fonts I don't
know about, it looks to me like a 100% waste.
Change-Id: I864340e50591ba1d8006d1a80f36f6f06f2734b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 9e037723fe..2565e3de09 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1700,7 +1700,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, hfont = QWindowsFontDatabase::systemFont(); } - bool ttf = false; int avWidth = 0; BOOL res; HGDIOBJ oldObj = SelectObject(data->hdc, hfont); @@ -1708,11 +1707,10 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, TEXTMETRIC tm; res = GetTextMetrics(data->hdc, &tm); avWidth = tm.tmAveCharWidth; - ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE; SelectObject(data->hdc, oldObj); if (!useDirectWrite) { - if (!ttf || request.stretch != 100) { + if (request.stretch != 100) { DeleteObject(hfont); if (!res) qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__); |