Fix OpenType fonts with cmap tables on Windows

Task-number: QTBUG-31656

Change-Id: I5405d80f3ac1de488c44c9f1ac9ed9942ceab6b8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
bb10
Josh Faust 2013-06-10 11:42:01 -07:00 committed by The Qt Project
parent 225526410b
commit 0a170be576
2 changed files with 11 additions and 3 deletions

View File

@ -161,12 +161,18 @@ bool QWindowsFontEngine::hasCFFTable() const
return GetFontData(hdc, MAKE_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR;
}
bool QWindowsFontEngine::hasCMapTable() const
{
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
return GetFontData(hdc, MAKE_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR;
}
void QWindowsFontEngine::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 = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
@ -374,6 +380,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const
{
LOGFONT f = m_logfont;
f.lfHeight = unitsPerEm;
f.lfWidth = 0;
HFONT designFont = CreateFontIndirect(&f);
return SelectObject(m_fontEngineData->hdc, designFont);
}

View File

@ -140,6 +140,7 @@ private:
QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
QImage::Format mask_format);
bool hasCFFTable() const;
bool hasCMapTable() const;
const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;