From 840a26a9b9e2fa9513fad759903c388e10900830 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 15 Feb 2015 02:45:46 +0400 Subject: 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 --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/plugins') 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__); -- cgit v1.2.3