summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-11-07 09:54:21 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-11-13 20:43:10 +0000
commit50af66293de8bd5dd9fd9141a45d9415b5c688aa (patch)
treea9af26ea01e39b40da34e882ab8a2c4033cf7c4d /src/gui
parent2316db05a89c7de6a10ac64e0860262b25ed2a31 (diff)
QTextEngine: Do not disable graphite2 HB shaper backend
This fixes-up bf013c9e745c63cb112be4d3a37027ff997927dd by specifying graphite2 shaper in a "safe" shaper list, one used for non-CoreText font engines (currently, FreeType font engine only). Make the the comment and the code a bit cleaner about the fallback shaper list. Change-Id: Ib0cedc0b593023c9ee771e8e98c314d9c8f13037 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextengine.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 6b98c14205..530871f65b 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1120,15 +1120,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
QT_END_INCLUDE_NAMESPACE
-#if defined(Q_OS_OSX) && !defined(QT_NO_FREETYPE)
-static const char *s_shapersForOsxFreeType[] =
-{
- "ot",
- "fallback",
- Q_NULLPTR
-};
-#endif
-
int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const
{
uint glyphs_shaped = 0;
@@ -1182,13 +1173,21 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
const int num_features = 1;
const char *const *shaper_list = Q_NULLPTR;
-#if defined(Q_OS_OSX) && !defined(QT_NO_FREETYPE)
- // What's behind QFontEngine::FaceData::user_data isn't compatible between CoreText and
- // FreeType font engines - specifically functions in hb-coretext.cc would run into undefined
- // behavior with data from the FreeType engine. The OpenType shaper works with that engine.
- if (actualFontEngine->type() == QFontEngine::Freetype)
- shaper_list = s_shapersForOsxFreeType;
+#if defined(Q_OS_DARWIN)
+ // What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines
+ // - specifically functions in hb-coretext.cc would run into undefined behavior with data
+ // from non-CoreText engine. The other shapers works with that engine just fine.
+ if (actualFontEngine->type() != QFontEngine::Mac) {
+ static const char *s_shaper_list_without_coretext[] = {
+ "graphite2",
+ "ot",
+ "fallback",
+ Q_NULLPTR
+ };
+ shaper_list = s_shaper_list_without_coretext;
+ }
#endif
+
bool shapedOk = hb_shape_full(hb_font, buffer, features, num_features, shaper_list);
if (Q_UNLIKELY(!shapedOk)) {
hb_buffer_destroy(buffer);