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>bb10
parent
a8f37e4775
commit
2603873e75
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ void QTextEngine::shapeLine(const QScriptLine &line)
|
|||
}
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
extern bool useHarfbuzzNG; // defined in qfontengine.cpp
|
||||
extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
|
||||
#endif
|
||||
|
||||
void QTextEngine::shapeText(int item) const
|
||||
|
|
@ -1051,7 +1051,7 @@ void QTextEngine::shapeText(int item) const
|
|||
}
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
if (useHarfbuzzNG)
|
||||
if (qt_useHarfbuzzNG())
|
||||
si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled);
|
||||
else
|
||||
#endif
|
||||
|
|
@ -1067,7 +1067,7 @@ void QTextEngine::shapeText(int item) const
|
|||
QGlyphLayout glyphs = shapedGlyphs(&si);
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
if (useHarfbuzzNG)
|
||||
if (qt_useHarfbuzzNG())
|
||||
qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
|
||||
#endif
|
||||
|
||||
|
|
@ -1607,7 +1607,7 @@ void QTextEngine::itemize() const
|
|||
}
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
analysis = scriptAnalysis.data();
|
||||
if (useHarfbuzzNG) {
|
||||
if (qt_useHarfbuzzNG()) {
|
||||
// ### pretend HB-old behavior for now
|
||||
for (int i = 0; i < length; ++i) {
|
||||
switch (analysis[i].script) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue