summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2015-01-19 12:05:10 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-01-19 13:50:32 +0100
commit2603873e75e4b3eedef2939ada3069da36231c09 (patch)
tree25457f276a3516bafbdeaea8a1816d1a4fd0787a /src/gui/text/qfontengine.cpp
parenta8f37e47751d7d29ab63bef55f5849056f826e8b (diff)
Make harfbuzz-old fallback available at run-time
The old harfbuzz code path is included as a fail safe for any possible use case where the Harfbuzz-NG regresses, but because the variable was checked statically, it was not actually possible to build a releasable executable which employed the work-around. Instead we use the regular global static pattern where the variable is queried the first time it's needed. Task-number: QTBUG-43850 Change-Id: I9ade76bf0825bbfefebdbdc4e6ee5571f1a3deec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r--src/gui/text/qfontengine.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index b2a7a8e91f..b360ed5c85 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -77,7 +77,12 @@ static inline bool qtransform_equals_no_translate(const QTransform &a, const QTr
// Harfbuzz helper functions
#ifdef QT_ENABLE_HARFBUZZ_NG
-bool useHarfbuzzNG = qgetenv("QT_HARFBUZZ") != "old";
+Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old"))
+
+bool qt_useHarfbuzzNG()
+{
+ return *useHarfbuzzNG();
+}
#endif
Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
@@ -282,7 +287,7 @@ void *QFontEngine::harfbuzzFont() const
{
Q_ASSERT(type() != QFontEngine::Multi);
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (useHarfbuzzNG)
+ if (qt_useHarfbuzzNG())
return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
#endif
if (!font_) {
@@ -318,7 +323,7 @@ void *QFontEngine::harfbuzzFace() const
{
Q_ASSERT(type() != QFontEngine::Multi);
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (useHarfbuzzNG)
+ if (qt_useHarfbuzzNG())
return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
#endif
if (!face_) {
@@ -360,7 +365,7 @@ bool QFontEngine::supportsScript(QChar::Script script) const
#endif
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (useHarfbuzzNG) {
+ if (qt_useHarfbuzzNG()) {
bool ret = false;
if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
hb_tag_t script_tag_1, script_tag_2;