summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_win.cpp
diff options
context:
space:
mode:
authorJosh Faust <jfaust@suitabletech.com>2013-06-11 00:12:01 +0530
committerAshish Kulkarni <kulkarni.ashish@gmail.com>2014-12-13 18:28:55 +0100
commit61379d481a1a9d646c812df010089c6d52d18f31 (patch)
treee844d4712811cd73cfcbce9c173c12c25a657dd5 /src/gui/text/qfontengine_win.cpp
parent19f8b8ebc144555f53f69d8a0230d24a91384454 (diff)
Fix OpenType fonts with cmap tables on Windows
Task-number: QTBUG-31656 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Change-Id: If941bddb6173b6bd93117ba5bd35fa4050f29e3d (cherry picked from qtbase/0a170be576153b84ee6249f1a2b7cbce1ef10d84)
Diffstat (limited to 'src/gui/text/qfontengine_win.cpp')
-rw-r--r--src/gui/text/qfontengine_win.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index befe37f143..9852b89072 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -197,12 +197,18 @@ bool QFontEngineWin::hasCFFTable() const
return GetFontData(hdc, MAKE_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR;
}
+bool QFontEngineWin::hasCMapTable() const
+{
+ HDC hdc = shared_dc();
+ SelectObject(hdc, hfont);
+ return GetFontData(hdc, MAKE_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR;
+}
+
void QFontEngineWin::getCMap()
{
- ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE);
+ ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE) || hasCMapTable();
- // TMPF_TRUETYPE is not set for fonts with CFF tables
- cffTable = !ttf && hasCFFTable();
+ cffTable = hasCFFTable();
HDC hdc = shared_dc();
SelectObject(hdc, hfont);
@@ -384,6 +390,7 @@ HGDIOBJ QFontEngineWin::selectDesignFont() const
{
LOGFONT f = logfont;
f.lfHeight = unitsPerEm;
+ f.lfWidth = 0;
HFONT designFont = CreateFontIndirect(&f);
return SelectObject(shared_dc(), designFont);
}