QTextEngine: Apply CoreText specific post-processing for QFE::Mac only

These tricks has no meaning to other font engines (i.e. to FreeType).

Change-Id: I0410693d4d159367d760433062506691dc7c4610
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
bb10
Konstantin Ritt 2015-11-07 09:54:46 +04:00
parent 50af66293d
commit c1da13f6db
1 changed files with 13 additions and 12 deletions

View File

@ -1267,19 +1267,20 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
g.glyphs[i] |= (engineIdx << 24);
}
#ifdef Q_OS_MAC
// CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
// scaling the advances for this particular version
if (actualFontEngine->fontDef.stretch != 100
&& QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) {
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] *= stretch;
}
#ifdef Q_OS_DARWIN
if (actualFontEngine->type() == QFontEngine::Mac) {
// CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
// scaling the advances for this particular version
if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) {
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] *= stretch;
}
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round();
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round();
}
}
#endif