Skip to content

Commit

Permalink
QTextEngine: Apply CoreText specific post-processing for QFE::Mac only
Browse files Browse the repository at this point in the history
These tricks has no meaning to other font engines (i.e. to FreeType).

Change-Id: I0410693d4d159367d760433062506691dc7c4610
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
KonstantinRitt committed Nov 13, 2015
1 parent 50af662 commit c1da13f
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/gui/text/qtextengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round();
#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();
}
}
#endif

Expand Down

0 comments on commit c1da13f

Please sign in to comment.