summaryrefslogtreecommitdiffstats
path: root/src/gui/text
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
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')
-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 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);
}
diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h
index a56cd2c78c..ba6aa020db 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);