diff --git a/src/gui/image/qfonticonengine.cpp b/src/gui/image/qfonticonengine.cpp index e98fa1bffdd..c02fba7f0c5 100644 --- a/src/gui/image/qfonticonengine.cpp +++ b/src/gui/image/qfonticonengine.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -167,6 +168,20 @@ glyph_t QFontIconEngine::glyph() const QFontEngine *engine = QFontPrivate::get(m_iconFont)->engineForScript(QChar::Script_Common); if (engine) m_glyph = engine->findGlyph(QLatin1StringView(m_iconName.toLatin1())); + if (!m_glyph) { + // May not be a named glyph, but there might be a ligature for the + // icon name. + QTextLayout layout(m_iconName, m_iconFont); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + const auto glyphRuns = layout.glyphRuns(); + if (glyphRuns.size() == 1) { + const auto glyphIndexes = glyphRuns.first().glyphIndexes(); + if (glyphIndexes.size() == 1) + m_glyph = glyphIndexes.first(); + } + } } return m_glyph; }