Remove last traces of old Harfbuzz
In Qt 6, we removed the "old" Harfbuzz and Harfbuzz-NG became the only option. But the QT_HARFBUZZ=old environment variable would still be read and would disable certain parts of the code path. This has caused some confusion when porting older applications, where QT_HARFBUZZ=old was used to work around issues with the earlier versions of Harfbuzz-NG. Setting it now causes text to disappear completely. To avoid this confusion, we remove traces of the QT_HARFBUZZ environment variable as well. [ChangeLog][Text] Fixed an issue where setting the legacy environment variable QT_HARFBUZZ=old would cause text to disappear from the application. Fixes: QTBUG-102774 Change-Id: I0f07cdb2418202fc36b82e766ad9547c34477175 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
6eb9439809
commit
7fa2a1a479
@ -90,17 +90,6 @@ static inline bool qSafeFromBigEndian(const uchar *source, const uchar *end, T *
|
||||
return true;
|
||||
}
|
||||
|
||||
// Harfbuzz helper functions
|
||||
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old"))
|
||||
|
||||
bool qt_useHarfbuzzNG()
|
||||
{
|
||||
return *useHarfbuzzNG();
|
||||
}
|
||||
#endif
|
||||
|
||||
int QFontEngine::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
|
||||
{
|
||||
Q_UNUSED(glyph);
|
||||
@ -199,20 +188,20 @@ void *QFontEngine::harfbuzzFont() const
|
||||
{
|
||||
Q_ASSERT(type() != QFontEngine::Multi);
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (qt_useHarfbuzzNG())
|
||||
return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
|
||||
#endif
|
||||
return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *QFontEngine::harfbuzzFace() const
|
||||
{
|
||||
Q_ASSERT(type() != QFontEngine::Multi);
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (qt_useHarfbuzzNG())
|
||||
return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
|
||||
#endif
|
||||
return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QFontEngine::supportsScript(QChar::Script script) const
|
||||
@ -227,23 +216,21 @@ bool QFontEngine::supportsScript(QChar::Script script) const
|
||||
return true;
|
||||
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (qt_useHarfbuzzNG()) {
|
||||
// in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
|
||||
uint lenMort = 0, lenMorx = 0;
|
||||
if (getSfntTableData(MAKE_TAG('m','o','r','t'), nullptr, &lenMort) || getSfntTableData(MAKE_TAG('m','o','r','x'), nullptr, &lenMorx))
|
||||
// in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
|
||||
uint lenMort = 0, lenMorx = 0;
|
||||
if (getSfntTableData(MAKE_TAG('m','o','r','t'), nullptr, &lenMort) || getSfntTableData(MAKE_TAG('m','o','r','x'), nullptr, &lenMorx))
|
||||
return true;
|
||||
|
||||
if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
|
||||
unsigned int script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
|
||||
hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
|
||||
|
||||
hb_ot_tags_from_script_and_language(hb_qt_script_to_script(script), HB_LANGUAGE_INVALID,
|
||||
&script_count, script_tags,
|
||||
nullptr, nullptr);
|
||||
|
||||
if (hb_ot_layout_table_select_script(face, HB_OT_TAG_GSUB, script_count, script_tags, nullptr, nullptr))
|
||||
return true;
|
||||
|
||||
if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
|
||||
unsigned int script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
|
||||
hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
|
||||
|
||||
hb_ot_tags_from_script_and_language(hb_qt_script_to_script(script), HB_LANGUAGE_INVALID,
|
||||
&script_count, script_tags,
|
||||
nullptr, nullptr);
|
||||
|
||||
if (hb_ot_layout_table_select_script(face, HB_OT_TAG_GSUB, script_count, script_tags, nullptr, nullptr))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
|
@ -1354,10 +1354,6 @@ void QTextEngine::shapeLine(const QScriptLine &line)
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
|
||||
#endif
|
||||
|
||||
static void applyVisibilityRules(ushort ucs, QGlyphLayout *glyphs, uint glyphPosition, QFontEngine *fontEngine)
|
||||
{
|
||||
// hide characters that should normally be invisible
|
||||
@ -1517,7 +1513,7 @@ void QTextEngine::shapeText(int item) const
|
||||
}
|
||||
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (Q_LIKELY(shapingEnabled && qt_useHarfbuzzNG())) {
|
||||
if (Q_LIKELY(shapingEnabled)) {
|
||||
si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0);
|
||||
} else
|
||||
#endif
|
||||
@ -1578,8 +1574,7 @@ void QTextEngine::shapeText(int item) const
|
||||
QGlyphLayout glyphs = shapedGlyphs(&si);
|
||||
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (Q_LIKELY(qt_useHarfbuzzNG()))
|
||||
qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
|
||||
qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
|
||||
#endif
|
||||
|
||||
if (letterSpacing != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user