From c1da13f6db756a9b23c46193304156c5e10f3bc1 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sat, 7 Nov 2015 09:54:46 +0400 Subject: [PATCH] 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 --- src/gui/text/qtextengine.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 530871f65b..50a242d81e 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -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