summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJosh Faust <jfaust@suitabletech.com>2013-06-10 18:42:01 (GMT)
committerAshish Kulkarni <kulkarni.ashish@gmail.com>2014-12-13 17:28:55 (GMT)
commit61379d481a1a9d646c812df010089c6d52d18f31 (patch)
treee844d4712811cd73cfcbce9c173c12c25a657dd5 /src/gui
parent19f8b8ebc144555f53f69d8a0230d24a91384454 (diff)
downloadQt-61379d481a1a9d646c812df010089c6d52d18f31.zip
Qt-61379d481a1a9d646c812df010089c6d52d18f31.tar.gz
Qt-61379d481a1a9d646c812df010089c6d52d18f31.tar.bz2
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')
-rw-r--r--src/gui/text/qfontengine_win.cpp13
-rw-r--r--src/gui/text/qfontengine_win_p.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index befe37f..9852b89 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);
}
diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h
index a56cd2c..ba6aa02 100644
--- a/src/gui/text/qfontengine_win_p.h
+++ b/src/gui/text/qfontengine_win_p.h
@@ -147,6 +147,7 @@ public:
private:
bool hasCFFTable() const;
+ bool hasCMapTable() const;
QNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
QImage::Format mask_format);