Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontengine.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine.cpp
@@ -102,7 +102,7 @@ bool qt_useHarfbuzzNG()
 }
 #endif
 
-Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
+Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph__t));
 Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
 
 static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft)
@@ -111,21 +111,37 @@ static HB_Bool hb_stringToGlyphs(HB_Font
 
     const QChar *str = reinterpret_cast<const QChar *>(string);
 
+    QVarLengthArray<QGlyph> tmpGlyphsArray(*numGlyphs);
+
     QGlyphLayout qglyphs;
     qglyphs.numGlyphs = *numGlyphs;
-    qglyphs.glyphs = glyphs;
+    qglyphs.glyphs = tmpGlyphsArray.data();
     int nGlyphs = *numGlyphs;
     bool result = fe->stringToCMap(str, length, &qglyphs, &nGlyphs, QFontEngine::GlyphIndicesOnly);
     *numGlyphs = nGlyphs;
 
     if (rightToLeft && result && !fe->symbol) {
         QStringIterator it(str, str + length);
+        const QGlyph *itGlyph = tmpGlyphsArray.data();
         while (it.hasNext()) {
             const uint ucs4 = it.next();
             const uint mirrored = QChar::mirroredChar(ucs4);
             if (Q_UNLIKELY(mirrored != ucs4))
-                *glyphs = fe->glyphIndex(mirrored);
+                *glyphs = fe->glyphIndex(mirrored).glyph;
+            else
+                *glyphs = itGlyph->glyph;
             ++glyphs;
+            ++itGlyph;
+        }
+    }
+    else
+    {
+        const QGlyph *itGlyph = tmpGlyphsArray.data();
+        while (nGlyphs) {
+            *glyphs = itGlyph->glyph;
+            ++glyphs;
+            ++itGlyph;
+            --nGlyphs;
         }
     }
 
@@ -135,10 +151,16 @@ static HB_Bool hb_stringToGlyphs(HB_Font
 static void hb_getAdvances(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags)
 {
     QFontEngine *fe = (QFontEngine *)font->userData;
+    QVarLengthArray<QGlyph> tmpGlyphsArray(numGlyphs);
 
     QGlyphLayout qglyphs;
     qglyphs.numGlyphs = numGlyphs;
-    qglyphs.glyphs = const_cast<glyph_t *>(glyphs);
+    qglyphs.glyphs = tmpGlyphsArray.data();
+
+    QGlyph *it = qglyphs.glyphs;
+    for (int i = 0; i < numGlyphs; ++i, ++glyphs, ++it) {
+        *it = QGlyph{0, *glyphs};
+    }
     qglyphs.advances = reinterpret_cast<QFixed *>(advances);
 
     fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
@@ -153,7 +175,9 @@ static HB_Bool hb_canRender(HB_Font font
 static void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
 {
     QFontEngine *fe = (QFontEngine *)font->userData;
-    glyph_metrics_t m = fe->boundingBox(glyph);
+    QGlyph g;
+    g.glyph = glyph;
+    glyph_metrics_t m = fe->boundingBox(g);
     metrics->x = m.x.value();
     metrics->y = m.y.value();
     metrics->width = m.width.value();
@@ -171,7 +195,7 @@ static HB_Fixed hb_getFontMetric(HB_Font
     return 0;
 }
 
-int QFontEngine::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
+int QFontEngine::getPointInOutline(glyph__t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
 {
     Q_UNUSED(glyph)
     Q_UNUSED(flags)
@@ -400,14 +424,14 @@ bool QFontEngine::canRender(const QChar
 {
     QStringIterator it(str, str + len);
     while (it.hasNext()) {
-        if (glyphIndex(it.next()) == 0)
+        if (glyphIndex(it.next()).glyph == 0)
             return false;
     }
 
     return true;
 }
 
-glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix)
+glyph_metrics_t QFontEngine::boundingBox(const QGlyph &glyph, const QTransform &matrix)
 {
     glyph_metrics_t metrics = boundingBox(glyph);
 
@@ -419,21 +443,21 @@ glyph_metrics_t QFontEngine::boundingBox
 
 QFixed QFontEngine::calculatedCapHeight() const
 {
-    const glyph_t glyph = glyphIndex('H');
+    const QGlyph glyph = glyphIndex('H');
     glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
     return bb.height;
 }
 
 QFixed QFontEngine::xHeight() const
 {
-    const glyph_t glyph = glyphIndex('x');
+    const QGlyph glyph = glyphIndex('x');
     glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
     return bb.height;
 }
 
 QFixed QFontEngine::averageCharWidth() const
 {
-    const glyph_t glyph = glyphIndex('x');
+    const QGlyph glyph = glyphIndex('x');
     glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
     return bb.xoff;
 }
@@ -449,7 +473,7 @@ bool QFontEngine::expectsGammaCorrectedB
 }
 
 void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags,
-                                    QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions)
+                                    QVarLengthArray<QGlyph> &glyphs_out, QVarLengthArray<QFixedPoint> &positions)
 {
     QFixed xpos;
     QFixed ypos;
@@ -494,12 +518,12 @@ void QFontEngine::getGlyphPositions(cons
             }
             positions[current].x = gpos_x;
             positions[current].y = gpos_y;
-            glyphs_out[current] = glyphs.glyphs[i];
+            glyphs_out[current] = glyphs.at(i);
             ++current;
             if (glyphs.justifications[i].nKashidas) {
                 QChar ch(0x640); // Kashida character
 
-                glyph_t kashidaGlyph = glyphIndex(ch.unicode());
+                QGlyph kashidaGlyph = glyphIndex(ch.unicode());
                 QFixed kashidaWidth;
 
                 QGlyphLayout g;
@@ -538,7 +562,7 @@ void QFontEngine::getGlyphPositions(cons
                 if (!glyphs.attributes[i].dontPrint) {
                     positions[current].x = xpos + glyphs.offsets[i].x;
                     positions[current].y = ypos + glyphs.offsets[i].y;
-                    glyphs_out[current] = glyphs.glyphs[i];
+                    glyphs_out[current] = glyphs.at(i);
                     xpos += glyphs.advances[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
                     ++current;
                 }
@@ -553,7 +577,7 @@ void QFontEngine::getGlyphPositions(cons
                     gpos = gpos * matrix;
                     positions[current].x = QFixed::fromReal(gpos.x());
                     positions[current].y = QFixed::fromReal(gpos.y());
-                    glyphs_out[current] = glyphs.glyphs[i];
+                    glyphs_out[current] = glyphs.at(i);
                     xpos += glyphs.advances[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
                     ++current;
                 }
@@ -566,7 +590,7 @@ void QFontEngine::getGlyphPositions(cons
     Q_ASSERT(positions.size() == glyphs_out.size());
 }
 
-void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
+void QFontEngine::getGlyphBearings(const QGlyph &glyph, qreal *leftBearing, qreal *rightBearing)
 {
     glyph_metrics_t gi = boundingBox(glyph);
     if (leftBearing != 0)
@@ -634,8 +658,8 @@ qreal QFontEngine::minRightBearing() con
             m_minLeftBearing = m_minRightBearing = std::numeric_limits<qreal>::max();
 
             for (uint i = 0; i < (sizeof(characterSubset) / sizeof(ushort)); ++i) {
-                const glyph_t glyph = glyphIndex(characterSubset[i]);
-                if (!glyph)
+                const QGlyph glyph = glyphIndex(characterSubset[i]);
+                if (!glyph.glyph)
                     continue;
 
                 glyph_metrics_t glyphMetrics = const_cast<QFontEngine *>(this)->boundingBox(glyph);
@@ -663,7 +687,7 @@ glyph_metrics_t QFontEngine::tightBoundi
     QFixed ymax = 0;
     QFixed xmax = 0;
     for (int i = 0; i < glyphs.numGlyphs; i++) {
-        glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]);
+        glyph_metrics_t bb = boundingBox(glyphs.at(i));
         QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x;
         QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y;
         overall.x = qMin(overall.x, x);
@@ -687,7 +711,7 @@ void QFontEngine::addOutlineToPath(qreal
         return;
 
     QVarLengthArray<QFixedPoint> positions;
-    QVarLengthArray<glyph_t> positioned_glyphs;
+    QVarLengthArray<QGlyph> positioned_glyphs;
     QTransform matrix = QTransform::fromTranslate(x, y);
     getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
     addGlyphsToPath(positioned_glyphs.data(), positions.data(), positioned_glyphs.size(), path, flags);
@@ -795,12 +819,12 @@ void QFontEngine::addBitmapFontToPath(qr
     QFixed advanceX = QFixed::fromReal(x);
     QFixed advanceY = QFixed::fromReal(y);
     for (int i=0; i < glyphs.numGlyphs; ++i) {
-        glyph_metrics_t metrics = boundingBox(glyphs.glyphs[i]);
+        glyph_metrics_t metrics = boundingBox(glyphs.at(i));
         if (metrics.width.value() == 0 || metrics.height.value() == 0) {
             advanceX += glyphs.advances[i];
             continue;
         }
-        const QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]);
+        const QImage alphaMask = alphaMapForGlyph(glyphs.at(i));
 
         const int w = alphaMask.width();
         const int h = alphaMask.height();
@@ -836,7 +860,7 @@ void QFontEngine::addBitmapFontToPath(qr
     }
 }
 
-void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs,
+void QFontEngine::addGlyphsToPath(const QGlyph *glyphs, QFixedPoint *positions, int nGlyphs,
                                   QPainterPath *path, QTextItem::RenderFlags flags)
 {
     qreal x = positions[0].x.toReal();
@@ -853,13 +877,13 @@ void QFontEngine::addGlyphsToPath(glyph_
     addBitmapFontToPath(x, y, g, path, flags);
 }
 
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/)
+QImage QFontEngine::alphaMapForGlyph(const QGlyph &glyph, QFixed /*subPixelPosition*/)
 {
     // For font engines don't support subpixel positioning
     return alphaMapForGlyph(glyph);
 }
 
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
+QImage QFontEngine::alphaMapForGlyph(const QGlyph &glyph, const QTransform &t)
 {
     QImage i = alphaMapForGlyph(glyph);
     if (t.type() > QTransform::TxTranslate)
@@ -869,7 +893,7 @@ QImage QFontEngine::alphaMapForGlyph(gly
     return i;
 }
 
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngine::alphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition, const QTransform &t)
 {
     if (! supportsSubPixelPositions())
         return alphaMapForGlyph(glyph, t);
@@ -882,7 +906,7 @@ QImage QFontEngine::alphaMapForGlyph(gly
     return i;
 }
 
-QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &t)
+QImage QFontEngine::alphaRGBMapForGlyph(const QGlyph &glyph, QFixed /*subPixelPosition*/, const QTransform &t)
 {
     const QImage alphaMask = alphaMapForGlyph(glyph, t);
     QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
@@ -899,7 +923,7 @@ QImage QFontEngine::alphaRGBMapForGlyph(
     return rgbMask;
 }
 
-QImage QFontEngine::bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform&, const QColor &)
+QImage QFontEngine::bitmapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform&, const QColor &)
 {
     Q_UNUSED(subPixelPosition);
 
@@ -923,7 +947,7 @@ QFixed QFontEngine::subPixelPositionForX
     return subPixelPosition;
 }
 
-QImage *QFontEngine::lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
+QImage *QFontEngine::lockedAlphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition,
                                             QFontEngine::GlyphFormat neededFormat,
                                             const QTransform &t, QPoint *offset)
 {
@@ -948,7 +972,7 @@ void QFontEngine::unlockAlphaMapForGlyph
     currentlyLockedAlphaMap = QImage();
 }
 
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
+QImage QFontEngine::alphaMapForGlyph(const QGlyph &glyph)
 {
     glyph_metrics_t gm = boundingBox(glyph);
     int glyph_x = qFloor(gm.x.toReal());
@@ -985,7 +1009,7 @@ QImage QFontEngine::alphaMapForGlyph(gly
     return alphaMap;
 }
 
-void QFontEngine::removeGlyphFromCache(glyph_t)
+void QFontEngine::removeGlyphFromCache(const QGlyph &)
 {
 }
 
@@ -1009,7 +1033,7 @@ QFontEngine::Properties QFontEngine::pro
     return p;
 }
 
-void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
+void QFontEngine::getUnscaledGlyph(const QGlyph &glyph, QPainterPath *path, glyph_metrics_t *metrics)
 {
     *metrics = boundingBox(glyph);
     QFixedPoint p;
@@ -1125,10 +1149,10 @@ void QFontEngine::doKerning(QGlyphLayout
 
     if (flags & DesignMetrics) {
         for(int i = 0; i < glyphs->numGlyphs - 1; ++i)
-            glyphs->advances[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs);
+            glyphs->advances[i] += kerning(glyphs->glyphs[i].glyph, glyphs->glyphs[i+1].glyph , pairs, numPairs);
     } else {
         for(int i = 0; i < glyphs->numGlyphs - 1; ++i)
-            glyphs->advances[i] += qRound(kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs));
+            glyphs->advances[i] += qRound(kerning(glyphs->glyphs[i].glyph, glyphs->glyphs[i+1].glyph , pairs, numPairs));
     }
 }
 
@@ -1563,7 +1587,7 @@ bool QFontEngine::hasUnreliableGlyphOutl
 QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
 {
     if (glyphs.numGlyphs >= 1) {
-        glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
+        const QGlyph glyph = glyphs.at(glyphs.numGlyphs - 1);
         glyph_metrics_t gi = boundingBox(glyph);
         if (gi.isValid())
             return round ? qRound(gi.rightBearing()) : gi.rightBearing();
@@ -1613,10 +1637,10 @@ QFontEngineBox::~QFontEngineBox()
 {
 }
 
-glyph_t QFontEngineBox::glyphIndex(uint ucs4) const
+QGlyph QFontEngineBox::glyphIndex(uint ucs4) const
 {
     Q_UNUSED(ucs4)
-    return 0;
+    return {};
 }
 
 bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
@@ -1631,7 +1655,7 @@ bool QFontEngineBox::stringToCMap(const
     QStringIterator it(str, str + len);
     while (it.hasNext()) {
         it.advance();
-        glyphs->glyphs[ucs4Length++] = 0;
+        glyphs->glyphs[ucs4Length++] = QGlyph{0, 0};
     }
 
     *nglyphs = ucs4Length;
@@ -1655,7 +1679,7 @@ void QFontEngineBox::addOutlineToPath(qr
         return;
 
     QVarLengthArray<QFixedPoint> positions;
-    QVarLengthArray<glyph_t> positioned_glyphs;
+    QVarLengthArray<QGlyph> positioned_glyphs;
     QTransform matrix = QTransform::fromTranslate(x, y - _size);
     getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
 
@@ -1682,7 +1706,7 @@ void QFontEngineBox::draw(QPaintEngine *
     QSize s(_size - 3, _size - 3);
 
     QVarLengthArray<QFixedPoint> positions;
-    QVarLengthArray<glyph_t> glyphs;
+    QVarLengthArray<QGlyph> glyphs;
     QTransform matrix = QTransform::fromTranslate(x, y - _size);
     ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
     if (glyphs.size() == 0)
@@ -1700,7 +1724,7 @@ void QFontEngineBox::draw(QPaintEngine *
     painter->restore();
 }
 
-glyph_metrics_t QFontEngineBox::boundingBox(glyph_t)
+glyph_metrics_t QFontEngineBox::boundingBox(const QGlyph &)
 {
     return glyph_metrics_t(0, -_size, _size, _size, _size, 0);
 }
@@ -1742,7 +1766,7 @@ bool QFontEngineBox::canRender(const QCh
     return true;
 }
 
-QImage QFontEngineBox::alphaMapForGlyph(glyph_t)
+QImage QFontEngineBox::alphaMapForGlyph(const QGlyph &)
 {
     QImage image(_size, _size, QImage::Format_Alpha8);
     image.fill(0);
@@ -1761,13 +1785,6 @@ QImage QFontEngineBox::alphaMapForGlyph(
 // Multi engine
 // ------------------------------------------------------------------
 
-uchar QFontEngineMulti::highByte(glyph_t glyph)
-{ return glyph >> 24; }
-
-// strip high byte from glyph
-static inline glyph_t stripped(glyph_t glyph)
-{ return glyph & 0x00ffffff; }
-
 QFontEngineMulti::QFontEngineMulti(QFontEngine *engine, int script, const QStringList &fallbackFamilies)
     : QFontEngine(Multi),
       m_fallbackFamilies(fallbackFamilies),
@@ -1825,6 +1842,18 @@ void QFontEngineMulti::setFallbackFamili
     } else {
         m_engines.resize(m_fallbackFamilies.size() + 1);
     }
+    qDebug() << "----- fallbackFamilies:";
+    for (int i = 0; i < m_fallbackFamilies.size(); ++i) {
+        qDebug() << i << ") " << m_fallbackFamilies.at(i);
+    }
+    qDebug() << "----- engines:";
+
+    for (int i = 0; i < m_engines.size(); ++i) {
+        QFontEngine *engine = m_engines.at(i);
+        if (engine)
+            qDebug() << i << ") " << engine->fontDef.family << " : " << engine->fontDef.families << " ; " << engine->fontDef.fallBackFamilies;
+    }
+    qDebug() << "------------------";
 
     m_fallbackFamiliesQueried = true;
 }
@@ -1834,7 +1863,9 @@ void QFontEngineMulti::ensureEngineAt(in
     if (!m_fallbackFamiliesQueried)
         ensureFallbackFamiliesQueried();
     Q_ASSERT(at < m_engines.size());
+    qDebug() << "ensureEngineAt" << at;
     if (!m_engines.at(at)) {
+        qDebug() << "   -- loadingEngineAt" << at;
         QFontEngine *engine = loadEngine(at);
         if (!engine)
             engine = new QFontEngineBox(fontDef.pixelSize);
@@ -1866,17 +1897,17 @@ QFontEngine *QFontEngineMulti::loadEngin
     return 0;
 }
 
-glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
+QGlyph QFontEngineMulti::glyphIndex(uint ucs4) const
 {
-    glyph_t glyph = engine(0)->glyphIndex(ucs4);
-    if (glyph == 0
+    QGlyph glyph = engine(0)->glyphIndex(ucs4);
+    if (glyph.glyph == 0
             && ucs4 != QChar::LineSeparator
             && ucs4 != QChar::LineFeed
             && ucs4 != QChar::CarriageReturn
             && ucs4 != QChar::ParagraphSeparator) {
         if (!m_fallbackFamiliesQueried)
             const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
-        for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
+        for (int x = 1, n = m_engines.size(); x < n; ++x) {
             QFontEngine *engine = m_engines.at(x);
             if (!engine) {
                 if (!shouldLoadFontEngineForCharacter(x, ucs4))
@@ -1889,9 +1920,8 @@ glyph_t QFontEngineMulti::glyphIndex(uin
                 continue;
 
             glyph = engine->glyphIndex(ucs4);
-            if (glyph != 0) {
-                // set the high byte to indicate which engine the glyph came from
-                glyph |= (x << 24);
+            if (glyph.glyph != 0) {
+                glyph.engine = x;
                 break;
             }
         }
@@ -1909,6 +1939,7 @@ bool QFontEngineMulti::stringToCMap(cons
 
     int glyph_pos = 0;
     QStringIterator it(str, str + len);
+    qDebug() << "stringToCMap";
 
     int lastFallback = -1;
     while (it.hasNext()) {
@@ -1919,35 +1950,34 @@ bool QFontEngineMulti::stringToCMap(cons
         // to get the correct shaping rules applied.
         if (lastFallback >= 0 && (ucs4 == QChar(0x200d) || ucs4 == QChar(0x200c))) {
             QFontEngine *engine = m_engines.at(lastFallback);
-            glyph_t glyph = engine->glyphIndex(ucs4);
-            if (glyph != 0) {
-                glyphs->glyphs[glyph_pos] = glyph;
+            QGlyph glyph = engine->glyphIndex(ucs4);
+            if (glyph.glyph != 0) {
+                glyphs->glyphs[glyph_pos] = QGlyph{lastFallback, glyph.glyph};
                 if (!(flags & GlyphIndicesOnly)) {
                     QGlyphLayout g = glyphs->mid(glyph_pos, 1);
                     engine->recalcAdvances(&g, flags);
-                }
 
-                // set the high byte to indicate which engine the glyph came from
-                glyphs->glyphs[glyph_pos] |= (lastFallback << 24);
+                }
             } else {
                 lastFallback = -1;
             }
         } else {
             lastFallback = -1;
         }
-
-        if (glyphs->glyphs[glyph_pos] == 0
+        if (glyphs->glyphs[glyph_pos].glyph == 0
                 && ucs4 != QChar::LineSeparator
                 && ucs4 != QChar::LineFeed
                 && ucs4 != QChar::CarriageReturn
                 && ucs4 != QChar::ParagraphSeparator) {
             if (!m_fallbackFamiliesQueried)
                 const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
-            for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
+            for (int x = 1, n = m_engines.size(); x < n; ++x) {
                 QFontEngine *engine = m_engines.at(x);
                 if (!engine) {
+                    qDebug() << "not engine at " << x;
                     if (!shouldLoadFontEngineForCharacter(x, ucs4))
                         continue;
+                    qDebug() << "should load engine at " << x << " for character " << ucs4;
                     const_cast<QFontEngineMulti *>(this)->ensureEngineAt(x);
                     engine = m_engines.at(x);
                     if (!engine)
@@ -1957,18 +1987,16 @@ bool QFontEngineMulti::stringToCMap(cons
                 if (engine->type() == Box)
                     continue;
 
-                glyph_t glyph = engine->glyphIndex(ucs4);
-                if (glyph != 0) {
-                    glyphs->glyphs[glyph_pos] = glyph;
+                QGlyph glyph = engine->glyphIndex(ucs4);
+                if (glyph.glyph != 0) {
+                    glyphs->glyphs[glyph_pos] = QGlyph{x, glyph.glyph};
                     if (!(flags & GlyphIndicesOnly)) {
                         QGlyphLayout g = glyphs->mid(glyph_pos, 1);
                         engine->recalcAdvances(&g, flags);
+
                     }
 
                     lastFallback = x;
-
-                    // set the high byte to indicate which engine the glyph came from
-                    glyphs->glyphs[glyph_pos] |= (x << 24);
                     break;
                 }
             }
@@ -1998,18 +2026,14 @@ glyph_metrics_t QFontEngineMulti::boundi
 
     glyph_metrics_t overall;
 
-    int which = highByte(glyphs.glyphs[0]);
+    int which = glyphs.glyphs[0].engine;
     int start = 0;
     int end, i;
     for (end = 0; end < glyphs.numGlyphs; ++end) {
-        const int e = highByte(glyphs.glyphs[end]);
+        const int e = glyphs.glyphs[end].engine;
         if (e == which)
             continue;
 
-        // set the high byte to zero
-        for (i = start; i < end; ++i)
-            glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
-
         // merge the bounding box for this run
         const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start));
 
@@ -2021,20 +2045,11 @@ glyph_metrics_t QFontEngineMulti::boundi
         overall.xoff += gm.xoff;
         overall.yoff += gm.yoff;
 
-        // reset the high byte for all glyphs
-        const int hi = which << 24;
-        for (i = start; i < end; ++i)
-            glyphs.glyphs[i] = hi | glyphs.glyphs[i];
-
         // change engine
         start = end;
         which = e;
     }
 
-    // set the high byte to zero
-    for (i = start; i < end; ++i)
-        glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
-
     // merge the bounding box for this run
     const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start));
 
@@ -2046,19 +2061,13 @@ glyph_metrics_t QFontEngineMulti::boundi
     overall.xoff += gm.xoff;
     overall.yoff += gm.yoff;
 
-    // reset the high byte for all glyphs
-    const int hi = which << 24;
-    for (i = start; i < end; ++i)
-        glyphs.glyphs[i] = hi | glyphs.glyphs[i];
-
     return overall;
 }
 
-void QFontEngineMulti::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
+void QFontEngineMulti::getGlyphBearings(const QGlyph &glyph, qreal *leftBearing, qreal *rightBearing)
 {
-    int which = highByte(glyph);
-    ensureEngineAt(which);
-    engine(which)->getGlyphBearings(stripped(glyph), leftBearing, rightBearing);
+    ensureEngineAt(glyph.engine);
+    engine(glyph.engine)->getGlyphBearings(glyph, leftBearing, rightBearing);
 }
 
 void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
@@ -2067,7 +2076,7 @@ void QFontEngineMulti::addOutlineToPath(
     if (glyphs.numGlyphs <= 0)
         return;
 
-    int which = highByte(glyphs.glyphs[0]);
+    int which = glyphs.glyphs[0].engine;
     int start = 0;
     int end, i;
     if (flags & QTextItem::RightToLeft) {
@@ -2075,7 +2084,7 @@ void QFontEngineMulti::addOutlineToPath(
             x += glyphs.advances[gl].toReal();
     }
     for (end = 0; end < glyphs.numGlyphs; ++end) {
-        const int e = highByte(glyphs.glyphs[end]);
+        const int e = glyphs.glyphs[end].engine;
         if (e == which)
             continue;
 
@@ -2084,14 +2093,7 @@ void QFontEngineMulti::addOutlineToPath(
                 x -= glyphs.advances[i].toReal();
         }
 
-        // set the high byte to zero
-        for (i = start; i < end; ++i)
-            glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
         engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags);
-        // reset the high byte for all glyphs and update x and y
-        const int hi = which << 24;
-        for (i = start; i < end; ++i)
-            glyphs.glyphs[i] = hi | glyphs.glyphs[i];
 
         if (!(flags & QTextItem::RightToLeft)) {
             for (i = start; i < end; ++i)
@@ -2108,16 +2110,7 @@ void QFontEngineMulti::addOutlineToPath(
             x -= glyphs.advances[i].toReal();
     }
 
-    // set the high byte to zero
-    for (i = start; i < end; ++i)
-        glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
-
     engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags);
-
-    // reset the high byte for all glyphs
-    const int hi = which << 24;
-    for (i = start; i < end; ++i)
-        glyphs.glyphs[i] = hi | glyphs.glyphs[i];
 }
 
 void QFontEngineMulti::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
@@ -2125,42 +2118,24 @@ void QFontEngineMulti::recalcAdvances(QG
     if (glyphs->numGlyphs <= 0)
         return;
 
-    int which = highByte(glyphs->glyphs[0]);
+    int which = glyphs->glyphs[0].engine;
     int start = 0;
     int end, i;
     for (end = 0; end < glyphs->numGlyphs; ++end) {
-        const int e = highByte(glyphs->glyphs[end]);
+        const int e = glyphs->glyphs[end].engine;
         if (e == which)
             continue;
 
-        // set the high byte to zero
-        for (i = start; i < end; ++i)
-            glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
-
         QGlyphLayout offs = glyphs->mid(start, end - start);
         engine(which)->recalcAdvances(&offs, flags);
 
-        // reset the high byte for all glyphs and update x and y
-        const int hi = which << 24;
-        for (i = start; i < end; ++i)
-            glyphs->glyphs[i] = hi | glyphs->glyphs[i];
-
         // change engine
         start = end;
         which = e;
     }
 
-    // set the high byte to zero
-    for (i = start; i < end; ++i)
-        glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
-
     QGlyphLayout offs = glyphs->mid(start, end - start);
     engine(which)->recalcAdvances(&offs, flags);
-
-    // reset the high byte for all glyphs
-    const int hi = which << 24;
-    for (i = start; i < end; ++i)
-        glyphs->glyphs[i] = hi | glyphs->glyphs[i];
 }
 
 void QFontEngineMulti::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
@@ -2168,48 +2143,29 @@ void QFontEngineMulti::doKerning(QGlyphL
     if (glyphs->numGlyphs <= 0)
         return;
 
-    int which = highByte(glyphs->glyphs[0]);
+    int which = glyphs->glyphs[0].engine;
     int start = 0;
     int end, i;
     for (end = 0; end < glyphs->numGlyphs; ++end) {
-        const int e = highByte(glyphs->glyphs[end]);
+        const int e = glyphs->glyphs[end].engine;
         if (e == which)
             continue;
 
-        // set the high byte to zero
-        for (i = start; i < end; ++i)
-            glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
-
         QGlyphLayout offs = glyphs->mid(start, end - start);
         engine(which)->doKerning(&offs, flags);
 
-        // reset the high byte for all glyphs and update x and y
-        const int hi = which << 24;
-        for (i = start; i < end; ++i)
-            glyphs->glyphs[i] = hi | glyphs->glyphs[i];
-
         // change engine
         start = end;
         which = e;
     }
 
-    // set the high byte to zero
-    for (i = start; i < end; ++i)
-        glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
-
     QGlyphLayout offs = glyphs->mid(start, end - start);
     engine(which)->doKerning(&offs, flags);
-
-    // reset the high byte for all glyphs
-    const int hi = which << 24;
-    for (i = start; i < end; ++i)
-        glyphs->glyphs[i] = hi | glyphs->glyphs[i];
 }
 
-glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph)
+glyph_metrics_t QFontEngineMulti::boundingBox(const QGlyph &glyph)
 {
-    const int which = highByte(glyph);
-    return engine(which)->boundingBox(stripped(glyph));
+    return engine(glyph.engine)->boundingBox(glyph);
 }
 
 QFixed QFontEngineMulti::ascent() const
@@ -2268,7 +2224,7 @@ bool QFontEngineMulti::canRender(const Q
 
     int nglyphs = len;
 
-    QVarLengthArray<glyph_t> glyphs(nglyphs);
+    QVarLengthArray<QGlyph> glyphs(nglyphs);
 
     QGlyphLayout g;
     g.numGlyphs = nglyphs;
@@ -2277,7 +2233,7 @@ bool QFontEngineMulti::canRender(const Q
         Q_UNREACHABLE();
 
     for (int i = 0; i < nglyphs; i++) {
-        if (glyphs[i] == 0)
+        if (glyphs[i].glyph == 0)
             return false;
     }
 
@@ -2287,34 +2243,29 @@ bool QFontEngineMulti::canRender(const Q
 /* Implement alphaMapForGlyph() which is called by Lighthouse/Windows code.
  * Ideally, that code should be fixed to correctly handle QFontEngineMulti. */
 
-QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph)
+QImage QFontEngineMulti::alphaMapForGlyph(const QGlyph &glyph)
 {
-    const int which = highByte(glyph);
-    return engine(which)->alphaMapForGlyph(stripped(glyph));
+    return engine(glyph.engine)->alphaMapForGlyph(glyph);
 }
 
-QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
+QImage QFontEngineMulti::alphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition)
 {
-    const int which = highByte(glyph);
-    return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition);
+    return engine(glyph.engine)->alphaMapForGlyph(glyph, subPixelPosition);
 }
 
-QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
+QImage QFontEngineMulti::alphaMapForGlyph(const QGlyph &glyph, const QTransform &t)
 {
-    const int which = highByte(glyph);
-    return engine(which)->alphaMapForGlyph(stripped(glyph), t);
+    return engine(glyph.engine)->alphaMapForGlyph(glyph, t);
 }
 
-QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngineMulti::alphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition, const QTransform &t)
 {
-    const int which = highByte(glyph);
-    return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t);
+    return engine(glyph.engine)->alphaMapForGlyph(glyph, subPixelPosition, t);
 }
 
-QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngineMulti::alphaRGBMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition, const QTransform &t)
 {
-    const int which = highByte(glyph);
-    return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t);
+    return engine(glyph.engine)->alphaRGBMapForGlyph(glyph, subPixelPosition, t);
 }
 
 /*
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontdatabase.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontdatabase.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontdatabase.cpp
@@ -837,6 +837,7 @@ QStringList QPlatformFontDatabase::fallb
             }
         }
     }
+    qDebug()<< "fallbacksForFamily(" << family << "): " << preferredFallbacks << " ... " << otherFallbacks;
 
     return preferredFallbacks + otherFallbacks;
 }
@@ -871,6 +872,7 @@ static QStringList fallbacksForFamily(co
             --i;
         }
     }
+    qDebug()<< "fallbacksForFamily(" << family << "): " << retList;
 
     db->fallbacksCache.insert(cacheKey, new QStringList(retList));
 
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qtextengine.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qtextengine.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qtextengine.cpp
@@ -1455,7 +1455,7 @@ void QTextEngine::shapeText(int item) co
     if (fontEngine->type() == QFontEngine::Multi) {
         uint lastEngine = ~0u;
         for (int i = 0, glyph_pos = 0; i < itemLength; ++i, ++glyph_pos) {
-            const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
+            const uint engineIdx = initialGlyphs.glyphs[glyph_pos].engine;
             if (lastEngine != engineIdx) {
                 itemBoundaries.append(i);
                 itemBoundaries.append(glyph_pos);
@@ -1686,7 +1686,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG
         uint last_cluster = ~0u;
         uint last_glyph_pos = glyphs_shaped;
         for (uint i = 0; i < num_glyphs; ++i, ++infos, ++positions) {
-            g.glyphs[i] = infos->codepoint;
+            g.glyphs[i] = {0, infos->codepoint};
 
             g.advances[i] = QFixed::fromFixed(positions->x_advance);
             g.offsets[i].x = QFixed::fromFixed(positions->x_offset);
@@ -1717,8 +1717,9 @@ int QTextEngine::shapeTextWithHarfbuzzNG
                         // U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
                         // so we replace its glyph and metrics with ones for
                         // U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
-                        g.glyphs[i] = actualFontEngine->glyphIndex('-');
-                        if (Q_LIKELY(g.glyphs[i] != 0)) {
+                        QGlyph glyph = actualFontEngine->glyphIndex('-');
+                        g.glyphs[i] = glyph;
+                        if (Q_LIKELY(g.glyphs[i].glyph != 0)) {
                             QGlyphLayout tmp = g.mid(i, 1);
                             actualFontEngine->recalcAdvances(&tmp, 0);
                         }
@@ -1749,7 +1750,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG
 
         if (Q_UNLIKELY(engineIdx != 0)) {
             for (quint32 i = 0; i < num_glyphs; ++i)
-                g.glyphs[i] |= (engineIdx << 24);
+                g.glyphs[i].engine = engineIdx;
         }
 
 #ifdef Q_OS_DARWIN
@@ -1784,14 +1785,14 @@ QT_BEGIN_INCLUDE_NAMESPACE
 
 QT_END_INCLUDE_NAMESPACE
 
-Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
+Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph__t));
 Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
 Q_STATIC_ASSERT(sizeof(HB_FixedPoint) == sizeof(QFixedPoint));
 
 static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num)
 {
     if (num > 0 && destination.glyphs != source.glyphs)
-        memmove(destination.glyphs, source.glyphs, num * sizeof(glyph_t));
+        memmove(destination.glyphs, source.glyphs, num * sizeof(QGlyph));
 }
 
 int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const
@@ -1870,7 +1871,7 @@ int QTextEngine::shapeTextWithHarfbuzz(c
 
             if (engineIdx != 0 && shaper_item.glyphIndicesPresent) {
                 for (quint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
-                    shaper_item.glyphs[i] &= 0x00ffffff;
+                    shaper_item.glyphs[i] &= 0x003fffff;
             }
 
             shaper_item.log_clusters = logClusters(&si) + shaper_item.item.pos - entire_shaper_item.item.pos;
@@ -1900,7 +1901,7 @@ int QTextEngine::shapeTextWithHarfbuzz(c
 
         if (engineIdx != 0) {
             for (quint32 i = 0; i < shaper_item.num_glyphs; ++i)
-                g.glyphs[i] |= (engineIdx << 24);
+                g.glyphs[i].engine = engineIdx;
         }
 
         glyph_pos += shaper_item.num_glyphs;
@@ -2589,8 +2590,8 @@ static void set(QJustificationPoint *poi
     if (type >= Justification_Arabic_Normal) {
         QChar ch(0x640); // Kashida character
 
-        glyph_t kashidaGlyph = fe->glyphIndex(ch.unicode());
-        if (kashidaGlyph != 0) {
+        QGlyph kashidaGlyph = fe->glyphIndex(ch.unicode());
+        if (kashidaGlyph.glyph != 0) {
             QGlyphLayout g;
             g.numGlyphs = 1;
             g.glyphs = &kashidaGlyph;
@@ -2929,7 +2930,7 @@ void QGlyphLayout::grow(char *address, i
         memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(QGlyphAttributes));
         memmove(newLayout.justifications, oldLayout.justifications, numGlyphs * sizeof(QGlyphJustification));
         memmove(newLayout.advances, oldLayout.advances, numGlyphs * sizeof(QFixed));
-        memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(glyph_t));
+        memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(QGlyph));
     }
 
     // clear the new data
@@ -3220,20 +3221,20 @@ QString QTextEngine::elidedText(Qt::Text
             engine = multiEngine->engine(0);
         }
 
-        glyph_t glyph = engine->glyphIndex(ellipsisChar.unicode());
+        QGlyph glyph = engine->glyphIndex(ellipsisChar.unicode());
 
         QGlyphLayout glyphs;
         glyphs.numGlyphs = 1;
         glyphs.glyphs = &glyph;
         glyphs.advances = &ellipsisWidth;
 
-        if (glyph != 0) {
+        if (glyph.glyph != 0) {
             engine->recalcAdvances(&glyphs, 0);
 
             ellipsisText = ellipsisChar;
         } else {
             glyph = engine->glyphIndex('.');
-            if (glyph != 0) {
+            if (glyph.glyph != 0) {
                 engine->recalcAdvances(&glyphs, 0);
 
                 ellipsisWidth *= 3;
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfont.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfont.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfont.cpp
@@ -67,7 +67,7 @@
 #include <QtCore/QMutexLocker>
 #include <QtCore/QMutex>
 
-// #define QFONTCACHE_DEBUG
+#define QFONTCACHE_DEBUG
 #ifdef QFONTCACHE_DEBUG
 #  define FC_DEBUG qDebug
 #else
Index: qtbase-everywhere-src-5.13.1/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ qtbase-everywhere-src-5.13.1/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -784,7 +784,7 @@ QStringList QFontconfigDatabase::fallbac
         }
         FcFontSetDestroy(fontSet);
     }
-//    qDebug() << "fallbackFamilies for:" << family << style << styleHint << script << fallbackFamilies;
+    qDebug() << "fallbackFamilies for:" << family << style << styleHint << script << fallbackFamilies;
 
     return fallbackFamilies;
 }
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpainter.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpainter.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpainter.cpp
@@ -96,7 +96,7 @@ static void drawTextItemDecoration(QPain
                                    QTextItem::RenderFlags flags, qreal width,
                                    const QTextCharFormat &charFormat);
 // Helper function to calculate left most position, width and flags for decoration drawing
-Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
+Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const QGlyph *glyphArray,
                                                 const QFixedPoint *positions, int glyphCount,
                                                 QFontEngine *fontEngine, const QFont &font,
                                                 const QTextCharFormat &charFormat);
@@ -5584,11 +5584,11 @@ void QPainter::drawGlyphRun(const QPoint
 
     QGlyphRunPrivate *glyphRun_d = QGlyphRunPrivate::get(glyphRun);
 
-    const quint32 *glyphIndexes = glyphRun_d->glyphIndexData;
-    const QPointF *glyphPositions = glyphRun_d->glyphPositionData;
-
     int count = qMin(glyphRun_d->glyphIndexDataSize, glyphRun_d->glyphPositionDataSize);
+
+    QVector <QGlyph> tmpGlyphIndexes(count);
     QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count);
+    const QPointF *glyphPositions = glyphRun_d->glyphPositionData;
 
     QRawFontPrivate *fontD = QRawFontPrivate::get(font);
     bool engineRequiresPretransformedGlyphPositions = d->extended
@@ -5596,17 +5596,18 @@ void QPainter::drawGlyphRun(const QPoint
         : d->engine->type() != QPaintEngine::CoreGraphics && !d->state->matrix.isAffine();
 
     for (int i=0; i<count; ++i) {
+        tmpGlyphIndexes[i].glyph = glyphRun_d->glyphIndexData[i];
         QPointF processedPosition = position + glyphPositions[i];
         if (engineRequiresPretransformedGlyphPositions)
             processedPosition = d->state->transform().map(processedPosition);
         fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition);
     }
 
-    d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, fontD->fontEngine,
+    d->drawGlyphs(tmpGlyphIndexes.constData(), fixedPointPositions.data(), count, fontD->fontEngine,
                   glyphRun.overline(), glyphRun.underline(), glyphRun.strikeOut());
 }
 
-void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions,
+void QPainterPrivate::drawGlyphs(const QGlyph *glyphArray, QFixedPoint *positions,
                                  int glyphCount,
                                  QFontEngine *fontEngine, bool overline, bool underline,
                                  bool strikeOut)
@@ -5642,7 +5643,7 @@ void QPainterPrivate::drawGlyphs(const q
         staticTextItem.font = state->font;
         staticTextItem.setFontEngine(fontEngine);
         staticTextItem.numGlyphs = glyphCount;
-        staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray));
+        staticTextItem.glyphs = reinterpret_cast<QGlyph *>(const_cast<QGlyph *>(glyphArray));
         staticTextItem.glyphPositions = positions;
         // The font property is meaningless, the fontengine must be used directly:
         staticTextItem.usesRawFont = true;
@@ -5660,7 +5661,7 @@ void QPainterPrivate::drawGlyphs(const q
         memset(static_cast<void *>(glyphJustifications.data()), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
 
         textItem.glyphs.numGlyphs = glyphCount;
-        textItem.glyphs.glyphs = const_cast<glyph_t *>(glyphArray);
+        textItem.glyphs.glyphs = const_cast<QGlyph *>(glyphArray);
         textItem.glyphs.offsets = positions;
         textItem.glyphs.advances = advances.data();
         textItem.glyphs.justifications = glyphJustifications.data();
@@ -6370,7 +6371,7 @@ static void drawTextItemDecoration(QPain
         painter->setRenderHint(QPainter::Qt4CompatiblePainting);
 }
 
-Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
+Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const QGlyph *glyphArray,
                                                 const QFixedPoint *positions, int glyphCount,
                                                 QFontEngine *fontEngine, const QFont &font,
                                                 const QTextCharFormat &charFormat)
@@ -6488,7 +6489,7 @@ void QPainterPrivate::drawTextItem(const
         QFontEngineMulti *multi = static_cast<QFontEngineMulti *>(ti.fontEngine);
 
         const QGlyphLayout &glyphs = ti.glyphs;
-        int which = glyphs.glyphs[0] >> 24;
+        int which = glyphs.glyphs[0].engine;
 
         qreal x = p.x();
         qreal y = p.y();
@@ -6500,7 +6501,7 @@ void QPainterPrivate::drawTextItem(const
         int start = 0;
         int end, i;
         for (end = 0; end < ti.glyphs.numGlyphs; ++end) {
-            const int e = glyphs.glyphs[end] >> 24;
+            const int e = glyphs.glyphs[end].engine;
             if (e == which)
                 continue;
 
@@ -6508,11 +6509,9 @@ void QPainterPrivate::drawTextItem(const
             multi->ensureEngineAt(which);
             QTextItemInt ti2 = ti.midItem(multi->engine(which), start, end - start);
             ti2.width = 0;
-            // set the high byte to zero and calc the width
-            for (i = start; i < end; ++i) {
-                glyphs.glyphs[i] = glyphs.glyphs[i] & 0xffffff;
+            // Calculate the width
+            for (i = start; i < end; ++i)
                 ti2.width += ti.glyphs.effectiveAdvance(i);
-            }
 
             if (rtl)
                 x -= ti2.width.toReal();
@@ -6527,12 +6526,6 @@ void QPainterPrivate::drawTextItem(const
             if (!rtl)
                 x += ti2.width.toReal();
 
-            // reset the high byte for all glyphs and advance to the next sub-string
-            const int hi = which << 24;
-            for (i = start; i < end; ++i) {
-                glyphs.glyphs[i] = hi | glyphs.glyphs[i];
-            }
-
             // change engine
             start = end;
             which = e;
@@ -6541,11 +6534,9 @@ void QPainterPrivate::drawTextItem(const
         multi->ensureEngineAt(which);
         QTextItemInt ti2 = ti.midItem(multi->engine(which), start, end - start);
         ti2.width = 0;
-        // set the high byte to zero and calc the width
-        for (i = start; i < end; ++i) {
-            glyphs.glyphs[i] = glyphs.glyphs[i] & 0xffffff;
+        // Calculate the width
+        for (i = start; i < end; ++i)
             ti2.width += ti.glyphs.effectiveAdvance(i);
-        }
 
         if (rtl)
             x -= ti2.width.toReal();
@@ -6557,11 +6548,6 @@ void QPainterPrivate::drawTextItem(const
         drawTextItemDecoration(q, QPointF(x, y), ti2.fontEngine, textEngine, ti2.underlineStyle,
                                ti2.flags, ti2.width.toReal(), ti2.charFormat);
 
-        // reset the high byte for all glyphs
-        const int hi = which << 24;
-        for (i = start; i < end; ++i)
-            glyphs.glyphs[i] = hi | glyphs.glyphs[i];
-
     } else {
         if (extended)
             extended->drawTextItem(p, ti);
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qtextengine_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qtextengine_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qtextengine_p.h
@@ -86,7 +86,14 @@ class QPainter;
 
 class QAbstractTextDocumentLayout;
 
-typedef quint32 glyph_t;
+typedef quint32 engine_t;
+typedef quint32 glyph__t;
+
+struct QGlyph
+{
+    engine_t engine;
+    glyph__t glyph;
+};
 
 // this uses the same coordinate system as Qt, but a different one to freetype.
 // * y is usually negative, and is equal to the ascent.
@@ -195,13 +202,13 @@ Q_DECLARE_TYPEINFO(QGlyphAttributes, Q_P
 struct QGlyphLayout
 {
     enum {
-        SpaceNeeded = sizeof(glyph_t) + sizeof(QFixed) + sizeof(QFixedPoint)
+        SpaceNeeded = sizeof(QGlyph) + sizeof(QFixed) + sizeof(QFixedPoint)
                     + sizeof(QGlyphAttributes) + sizeof(QGlyphJustification)
     };
 
     // init to 0 not needed, done when shaping
     QFixedPoint *offsets; // 8 bytes per element
-    glyph_t *glyphs; // 4 bytes per element
+    QGlyph *glyphs; // 8 bytes per element
     QFixed *advances; // 4 bytes per element
     QGlyphJustification *justifications; // 4 bytes per element
     QGlyphAttributes *attributes; // 1 byte per element
@@ -214,8 +221,8 @@ struct QGlyphLayout
     {
         offsets = reinterpret_cast<QFixedPoint *>(address);
         int offset = totalGlyphs * sizeof(QFixedPoint);
-        glyphs = reinterpret_cast<glyph_t *>(address + offset);
-        offset += totalGlyphs * sizeof(glyph_t);
+        glyphs = reinterpret_cast<QGlyph *>(address + offset);
+        offset += totalGlyphs * sizeof(QGlyph);
         advances = reinterpret_cast<QFixed *>(address + offset);
         offset += totalGlyphs * sizeof(QFixed);
         justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
@@ -250,7 +257,7 @@ struct QGlyphLayout
         } else {
             const int num = last - first;
             memset(static_cast<void *>(offsets + first), 0, num * sizeof(QFixedPoint));
-            memset(glyphs + first, 0, num * sizeof(glyph_t));
+            memset(glyphs + first, 0, num * sizeof(QGlyph));
             memset(static_cast<void *>(advances + first), 0, num * sizeof(QFixed));
             memset(static_cast<void *>(justifications + first), 0, num * sizeof(QGlyphJustification));
             memset(attributes + first, 0, num * sizeof(QGlyphAttributes));
@@ -261,6 +268,10 @@ struct QGlyphLayout
         return reinterpret_cast<char *>(offsets);
     }
 
+    inline QGlyph at(int position) const {
+        return glyphs[position];
+    }
+
     void grow(char *address, int totalGlyphs);
 };
 
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qblittable_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qblittable_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qblittable_p.h
@@ -105,7 +105,7 @@ public:
         Q_UNUSED(opacity);
         qWarning("Please implement drawPixmapOpacity function in your platform or remove OpacityPixmapCapability from it");
     }
-    virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) {
+    virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const QGlyph *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) {
         Q_UNUSED(state);
         Q_UNUSED(glyphFormat);
         Q_UNUSED(numGlyphs);
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpaintengine.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine.cpp
@@ -756,7 +756,7 @@ void QPaintEngine::drawTextItem(const QP
 
     if (ti.fontEngine->glyphFormat == QFontEngine::Format_ARGB) {
         QVarLengthArray<QFixedPoint> positions;
-        QVarLengthArray<glyph_t> glyphs;
+        QVarLengthArray<QGlyph> glyphs;
         QTransform matrix = QTransform::fromTranslate(p.x(), p.y() - ti.fontEngine->ascent().toReal());
         ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
         painter()->save();
@@ -1007,7 +1007,7 @@ void QPaintEnginePrivate::drawBoxTextIte
     // any fixes here should probably also be done in QFontEngineBox::draw
     const int size = qRound(ti.fontEngine->ascent());
     QVarLengthArray<QFixedPoint> positions;
-    QVarLengthArray<glyph_t> glyphs;
+    QVarLengthArray<QGlyph> glyphs;
     QTransform matrix = QTransform::fromTranslate(p.x(), p.y() - size);
     ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
     if (glyphs.size() == 0)
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_blitter.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpaintengine_blitter.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_blitter.cpp
@@ -804,7 +804,7 @@ void QBlitterPaintEngine::drawStaticText
 #endif
 }
 
-bool QBlitterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
+bool QBlitterPaintEngine::drawCachedGlyphs(int numGlyphs, const QGlyph *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
 {
     Q_D(QBlitterPaintEngine);
     QFontEngine::GlyphFormat glyphFormat = d->glyphCacheFormat;
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_blitter_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpaintengine_blitter_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_blitter_p.h
@@ -107,7 +107,7 @@ public:
     void drawPoints(const QPoint *points, int pointCount) override;
     void stroke(const QVectorPath &path, const QPen &pen) override;
     void drawStaticTextItem(QStaticTextItem *) override;
-    bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions,
+    bool drawCachedGlyphs(int numGlyphs, const QGlyph *glyphs, const QFixedPoint *positions,
                           QFontEngine *fontEngine) override;
 };
 
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_raster.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpaintengine_raster.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_raster.cpp
@@ -2890,7 +2890,7 @@ void QRasterPaintEngine::alphaPenBlt(con
 /*!
     \internal
 */
-bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
+bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const QGlyph *glyphs,
                                           const QFixedPoint *positions, QFontEngine *fontEngine)
 {
     Q_D(QRasterPaintEngine);
@@ -3090,7 +3090,7 @@ QRasterPaintEnginePrivate::getPenFunc(co
 }
 
 static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine,
-                                         glyph_t *glyphs, QFixedPoint *positions, int numGlyphs)
+                                         QGlyph *glyphs, QFixedPoint *positions, int numGlyphs)
 {
     QFixed clipLeft = QFixed::fromReal(clip.left());
     QFixed clipRight = QFixed::fromReal(clip.right());
@@ -3182,7 +3182,7 @@ void QRasterPaintEngine::drawTextItem(co
 
     if (shouldDrawCachedGlyphs(ti.fontEngine, matrix)) {
         QVarLengthArray<QFixedPoint> positions;
-        QVarLengthArray<glyph_t> glyphs;
+        QVarLengthArray<QGlyph> glyphs;
 
         matrix.translate(p.x(), p.y());
         ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
@@ -3196,7 +3196,7 @@ void QRasterPaintEngine::drawTextItem(co
             return;
 
         QVarLengthArray<QFixedPoint> positions;
-        QVarLengthArray<glyph_t> glyphs;
+        QVarLengthArray<QGlyph> glyphs;
 
         ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()),
                                          ti.flags, glyphs, positions);
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_raster_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpaintengine_raster_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpaintengine_raster_p.h
@@ -198,7 +198,7 @@ public:
     inline const QClipData *clipData() const;
 
     void drawStaticTextItem(QStaticTextItem *textItem) override;
-    virtual bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions,
+    virtual bool drawCachedGlyphs(int numGlyphs, const QGlyph *glyphs, const QFixedPoint *positions,
                                   QFontEngine *fontEngine);
 
     enum ClipType {
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qtextureglyphcache_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qtextureglyphcache_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qtextureglyphcache_p.h
@@ -64,7 +64,7 @@
 #endif
 
 struct glyph_metrics_t;
-typedef unsigned int glyph_t;
+typedef unsigned int glyph__t;
 
 
 QT_BEGIN_NAMESPACE
@@ -83,14 +83,14 @@ public:
 
     struct GlyphAndSubPixelPosition
     {
-        GlyphAndSubPixelPosition(glyph_t g, QFixed spp) : glyph(g), subPixelPosition(spp) {}
+        GlyphAndSubPixelPosition(const QGlyph &g, QFixed spp) : glyph(g), subPixelPosition(spp) {}
 
         bool operator==(const GlyphAndSubPixelPosition &other) const
         {
-            return glyph == other.glyph && subPixelPosition == other.subPixelPosition;
+            return glyph.glyph == other.glyph.glyph && subPixelPosition == other.subPixelPosition;
         }
 
-        glyph_t glyph;
+        QGlyph glyph;
         QFixed subPixelPosition;
     };
 
@@ -109,7 +109,7 @@ public:
         }
     };
 
-    bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
+    bool populate(QFontEngine *fontEngine, int numGlyphs, const QGlyph *glyphs,
                   const QFixedPoint *positions);
     bool hasPendingGlyphs() const { return !m_pendingGlyphs.isEmpty(); };
     void fillInPendingGlyphs();
@@ -119,7 +119,7 @@ public:
     virtual int glyphPadding() const { return 0; }
 
     virtual void beginFillTexture() { }
-    virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0;
+    virtual void fillTexture(const Coord &coord, const QGlyph &glyph, QFixed subPixelPosition) = 0;
     virtual void endFillTexture() { }
 
     inline void createCache(int width, int height) {
@@ -141,10 +141,10 @@ public:
     virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; }
     virtual int maxTextureHeight() const { return -1; }
 
-    QImage textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const;
+    QImage textureMapForGlyph(const QGlyph &g, QFixed subPixelPosition) const;
 
 protected:
-    int calculateSubPixelPositionCount(glyph_t) const;
+    int calculateSubPixelPositionCount(const QGlyph &) const;
 
     QFontEngine *m_current_fontengine;
     QHash<GlyphAndSubPixelPosition, Coord> m_pendingGlyphs;
@@ -158,7 +158,7 @@ protected:
 
 inline uint qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
 {
-    return (g.glyph << 8)  | (g.subPixelPosition * 10).round().toInt();
+    return (g.glyph.glyph << 8)  | (g.subPixelPosition * 10).round().toInt();
 }
 
 
@@ -171,7 +171,7 @@ public:
 
     virtual void createTextureData(int width, int height) override;
     virtual void resizeTextureData(int width, int height) override;
-    virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
+    virtual void fillTexture(const Coord &c, const QGlyph &glyph, QFixed subPixelPosition) override;
 
     inline const QImage &image() const { return m_image; }
 
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qdistancefield.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qdistancefield.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qdistancefield.cpp
@@ -778,8 +778,8 @@ bool qt_fontHasNarrowOutlines(QFontEngin
 
     QImage im;
 
-    const glyph_t glyph = fe->glyphIndex('O');
-    if (glyph != 0)
+    const QGlyph glyph = fe->glyphIndex('O');
+    if (glyph.glyph != 0)
         im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
 
     Q_ASSERT(fe->ref.load() == 0);
@@ -899,17 +899,17 @@ QDistanceField::QDistanceField(int width
 {
 }
 
-QDistanceField::QDistanceField(const QRawFont &font, glyph_t glyph, bool doubleResolution)
+QDistanceField::QDistanceField(const QRawFont &font, glyph__t glyph, bool doubleResolution)
 {
     setGlyph(font, glyph, doubleResolution);
 }
 
-QDistanceField::QDistanceField(QFontEngine *fontEngine, glyph_t glyph, bool doubleResolution)
+QDistanceField::QDistanceField(QFontEngine *fontEngine, const QGlyph &glyph, bool doubleResolution)
 {
     setGlyph(fontEngine, glyph, doubleResolution);
 }
 
-QDistanceField::QDistanceField(const QPainterPath &path, glyph_t glyph, bool doubleResolution)
+QDistanceField::QDistanceField(const QPainterPath &path, const QGlyph &glyph, bool doubleResolution)
 {
     QPainterPath dfPath = path;
     dfPath.translate(-dfPath.boundingRect().topLeft());
@@ -930,12 +930,12 @@ bool QDistanceField::isNull() const
     return !d->data;
 }
 
-glyph_t QDistanceField::glyph() const
+QGlyph QDistanceField::glyph() const
 {
     return d->glyph;
 }
 
-void QDistanceField::setGlyph(const QRawFont &font, glyph_t glyph, bool doubleResolution)
+void QDistanceField::setGlyph(const QRawFont &font, glyph__t glyph, bool doubleResolution)
 {
     QRawFont renderFont = font;
     renderFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(doubleResolution) * QT_DISTANCEFIELD_SCALE(doubleResolution));
@@ -945,10 +945,10 @@ void QDistanceField::setGlyph(const QRaw
     path.setFillRule(Qt::WindingFill);
 
     d = QDistanceFieldData::create(path, doubleResolution);
-    d->glyph = glyph;
+    d->glyph = {0, glyph};
 }
 
-void QDistanceField::setGlyph(QFontEngine *fontEngine, glyph_t glyph, bool doubleResolution)
+void QDistanceField::setGlyph(QFontEngine *fontEngine, const QGlyph &glyph, bool doubleResolution)
 {
     QFixedPoint position;
     QPainterPath path;
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qdistancefield_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qdistancefield_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qdistancefield_p.h
@@ -72,14 +72,14 @@ int Q_GUI_EXPORT QT_DISTANCEFIELD_HIGHGL
 class Q_GUI_EXPORT QDistanceFieldData : public QSharedData
 {
 public:
-    QDistanceFieldData() : glyph(0), width(0), height(0), nbytes(0), data(0) {}
+    QDistanceFieldData() : glyph{0,0}, width(0), height(0), nbytes(0), data(0) {}
     QDistanceFieldData(const QDistanceFieldData &other);
     ~QDistanceFieldData();
 
     static QDistanceFieldData *create(const QSize &size);
     static QDistanceFieldData *create(const QPainterPath &path, bool doubleResolution);
 
-    glyph_t glyph;
+    QGlyph glyph;
     int width;
     int height;
     int nbytes;
@@ -91,15 +91,15 @@ class Q_GUI_EXPORT QDistanceField
 public:
     QDistanceField();
     QDistanceField(int width, int height);
-    QDistanceField(const QRawFont &font, glyph_t glyph, bool doubleResolution = false);
-    QDistanceField(QFontEngine *fontEngine, glyph_t glyph, bool doubleResolution = false);
-    QDistanceField(const QPainterPath &path, glyph_t glyph, bool doubleResolution = false);
+    QDistanceField(const QRawFont &font, glyph__t glyph, bool doubleResolution = false);
+    QDistanceField(QFontEngine *fontEngine, const QGlyph &glyph, bool doubleResolution = false);
+    QDistanceField(const QPainterPath &path, const QGlyph &glyph, bool doubleResolution = false);
 
     bool isNull() const;
 
-    glyph_t glyph() const;
-    void setGlyph(const QRawFont &font, glyph_t glyph, bool doubleResolution = false);
-    void setGlyph(QFontEngine *fontEngine, glyph_t glyph, bool doubleResolution = false);
+    QGlyph glyph() const;
+    void setGlyph(const QRawFont &font, glyph__t glyph, bool doubleResolution = false);
+    void setGlyph(QFontEngine *fontEngine, const QGlyph &glyph, bool doubleResolution = false);
 
     int width() const;
     int height() const;
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontengine_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine_p.h
@@ -143,7 +143,7 @@ public:
         QFixed lineWidth;
     };
     virtual Properties properties() const;
-    virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
+    virtual void getUnscaledGlyph(const QGlyph &glyph, QPainterPath *path, glyph_metrics_t *metrics);
     QByteArray getSfntTable(uint tag) const;
     virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
 
@@ -167,16 +167,16 @@ public:
     virtual QFixed emSquareSize() const { return ascent(); }
 
     /* returns 0 as glyph index for non existent glyphs */
-    virtual glyph_t glyphIndex(uint ucs4) const = 0;
+    virtual QGlyph glyphIndex(uint ucs4) const = 0;
     virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const = 0;
     virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const {}
     virtual void doKerning(QGlyphLayout *, ShaperFlags) const;
 
-    virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+    virtual void addGlyphsToPath(const QGlyph *glyphs, QFixedPoint *positions, int nglyphs,
                                  QPainterPath *path, QTextItem::RenderFlags flags);
 
     void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags,
-                           QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions);
+                           QVarLengthArray<QGlyph> &glyphs_out, QVarLengthArray<QFixedPoint> &positions);
 
     virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags);
     void addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags);
@@ -185,29 +185,29 @@ public:
      * Returns an image indexed_8 with index values ranging from 0=fully transparent to 255=opaque
      */
     // ### Refactor this into a smaller and more flexible API.
-    virtual QImage alphaMapForGlyph(glyph_t);
-    virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition);
-    virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
-    virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
-    virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
-    virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor());
-    virtual QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
+    virtual QImage alphaMapForGlyph(const QGlyph &);
+    virtual QImage alphaMapForGlyph(const QGlyph & glyph, QFixed subPixelPosition);
+    virtual QImage alphaMapForGlyph(const QGlyph &, const QTransform &t);
+    virtual QImage alphaMapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t);
+    virtual QImage alphaRGBMapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t);
+    virtual QImage bitmapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor());
+    virtual QImage *lockedAlphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition,
                                            GlyphFormat neededFormat,
                                            const QTransform &t = QTransform(),
                                            QPoint *offset = 0);
     virtual void unlockAlphaMapForGlyph();
     virtual bool hasInternalCaching() const { return false; }
 
-    virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/)
+    virtual glyph_metrics_t alphaMapBoundingBox(const QGlyph &glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/)
     {
         return boundingBox(glyph, matrix);
     }
 
-    virtual void removeGlyphFromCache(glyph_t);
+    virtual void removeGlyphFromCache(const QGlyph &);
 
     virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) = 0;
-    virtual glyph_metrics_t boundingBox(glyph_t glyph) = 0;
-    virtual glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix);
+    virtual glyph_metrics_t boundingBox(const QGlyph &glyph) = 0;
+    virtual glyph_metrics_t boundingBox(const QGlyph &glyph, const QTransform &matrix);
     glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
 
     virtual QFixed ascent() const = 0;
@@ -224,9 +224,9 @@ public:
     virtual qreal minLeftBearing() const;
     virtual qreal minRightBearing() const;
 
-    virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0);
+    virtual void getGlyphBearings(const QGlyph &glyph, qreal *leftBearing = 0, qreal *rightBearing = 0);
 
-    inline bool canRender(uint ucs4) const { return glyphIndex(ucs4) != 0; }
+    inline bool canRender(uint ucs4) const { return glyphIndex(ucs4).glyph != 0; }
     virtual bool canRender(const QChar *str, int len) const;
 
     virtual bool supportsTransformation(const QTransform &transform) const;
@@ -248,7 +248,7 @@ public:
                 || script == QChar::Script_Khmer || script == QChar::Script_Nko);
     }
 
-    virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
+    virtual int getPointInOutline(glyph__t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
 
     void clearGlyphCache(const void *key);
     void setGlyphCache(const void *key, QFontEngineGlyphCache *data);
@@ -411,7 +411,7 @@ public:
     QFontEngineBox(int size);
     ~QFontEngineBox();
 
-    virtual glyph_t glyphIndex(uint ucs4) const override;
+    virtual QGlyph glyphIndex(uint ucs4) const override;
     virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
     virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
 
@@ -419,7 +419,7 @@ public:
     virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
 
     virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
-    virtual glyph_metrics_t boundingBox(glyph_t glyph) override;
+    virtual glyph_metrics_t boundingBox(const QGlyph &glyph) override;
     virtual QFontEngine *cloneWithSize(qreal pixelSize) const override;
 
     virtual QFixed ascent() const override;
@@ -429,7 +429,7 @@ public:
     virtual qreal maxCharWidth() const override;
     virtual qreal minLeftBearing() const override { return 0; }
     virtual qreal minRightBearing() const override { return 0; }
-    virtual QImage alphaMapForGlyph(glyph_t) override;
+    virtual QImage alphaMapForGlyph(const QGlyph &) override;
 
     virtual bool canRender(const QChar *string, int len) const override;
 
@@ -449,16 +449,16 @@ public:
     explicit QFontEngineMulti(QFontEngine *engine, int script, const QStringList &fallbackFamilies = QStringList());
     ~QFontEngineMulti();
 
-    virtual glyph_t glyphIndex(uint ucs4) const override;
+    virtual QGlyph glyphIndex(uint ucs4) const override;
     virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
 
     virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
-    virtual glyph_metrics_t boundingBox(glyph_t glyph) override;
+    virtual glyph_metrics_t boundingBox(const QGlyph &glyph) override;
 
     virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
     virtual void doKerning(QGlyphLayout *, ShaperFlags) const override;
     virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags) override;
-    virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) override;
+    virtual void getGlyphBearings(const QGlyph &glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) override;
 
     virtual QFixed ascent() const override;
     virtual QFixed capHeight() const override;
@@ -466,11 +466,11 @@ public:
     virtual QFixed leading() const override;
     virtual QFixed xHeight() const override;
     virtual QFixed averageCharWidth() const override;
-    virtual QImage alphaMapForGlyph(glyph_t) override;
-    virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override;
-    virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t) override;
-    virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
-    virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+    virtual QImage alphaMapForGlyph(const QGlyph &) override;
+    virtual QImage alphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition) override;
+    virtual QImage alphaMapForGlyph(const QGlyph &, const QTransform &t) override;
+    virtual QImage alphaMapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t) override;
+    virtual QImage alphaRGBMapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t) override;
 
     virtual QFixed lineThickness() const override;
     virtual QFixed underlinePosition() const override;
@@ -485,8 +485,6 @@ public:
 
     void setFallbackFamiliesList(const QStringList &fallbackFamilies);
 
-    static uchar highByte(glyph_t glyph); // Used for determining engine
-
     inline QFontEngine *engine(int at) const
     { Q_ASSERT(at < m_engines.size()); return m_engines.at(at); }
 
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine_qpf2.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontengine_qpf2.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine_qpf2.cpp
@@ -148,7 +148,7 @@ static inline const uchar *verifyTag(con
     return tagPtr + length;
 }
 
-const QFontEngineQPF2::Glyph *QFontEngineQPF2::findGlyph(glyph_t g) const
+const QFontEngineQPF2::Glyph *QFontEngineQPF2::findGlyph(glyph__t g) const
 {
     if (!g || g >= glyphMapEntries)
         return 0;
@@ -326,15 +326,15 @@ bool QFontEngineQPF2::getSfntTableData(u
     return true;
 }
 
-glyph_t QFontEngineQPF2::glyphIndex(uint ucs4) const
+QGlyph QFontEngineQPF2::glyphIndex(uint ucs4) const
 {
-    glyph_t glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
+    glyph__t glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
     if (glyph == 0 && symbol && ucs4 < 0x100)
         glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000);
     if (!findGlyph(glyph))
         glyph = 0;
 
-    return glyph;
+    return {0, glyph};
 }
 
 bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
@@ -354,16 +354,16 @@ bool QFontEngineQPF2::stringToCMap(const
         QStringIterator it(str, str + len);
         while (it.hasNext()) {
             const uint uc = it.next();
-            glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
-            if(!glyphs->glyphs[glyph_pos] && uc < 0x100)
-                glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc + 0xf000);
+            glyphs->glyphs[glyph_pos] = QGlyph{0, getTrueTypeGlyphIndex(cmap, cmapSize, uc)};
+            if(!glyphs->glyphs[glyph_pos].glyph && uc < 0x100)
+                glyphs->glyphs[glyph_pos] = QGlyph{0, getTrueTypeGlyphIndex(cmap, cmapSize, uc + 0xf000)};
             ++glyph_pos;
         }
     } else {
         QStringIterator it(str, str + len);
         while (it.hasNext()) {
             const uint uc = it.next();
-            glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
+            glyphs->glyphs[glyph_pos] = QGlyph{0, getTrueTypeGlyphIndex(cmap, cmapSize, uc)};
 #if 0 && defined(DEBUG_FONTENGINE)
             QChar c(uc);
             if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c))
@@ -387,16 +387,16 @@ bool QFontEngineQPF2::stringToCMap(const
 void QFontEngineQPF2::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
 {
     for (int i = 0; i < glyphs->numGlyphs; ++i) {
-        const Glyph *g = findGlyph(glyphs->glyphs[i]);
+        const Glyph *g = findGlyph(glyphs->glyphs[i].glyph);
         if (!g)
             continue;
         glyphs->advances[i] = g->advance;
     }
 }
 
-QImage QFontEngineQPF2::alphaMapForGlyph(glyph_t g)
+QImage QFontEngineQPF2::alphaMapForGlyph(const QGlyph &g)
 {
-    const Glyph *glyph = findGlyph(g);
+    const Glyph *glyph = findGlyph(g.glyph);
     if (!glyph)
         return QImage();
 
@@ -422,7 +422,7 @@ glyph_metrics_t QFontEngineQPF2::boundin
     QFixed ymax = 0;
     QFixed xmax = 0;
     for (int i = 0; i < glyphs.numGlyphs; i++) {
-        const Glyph *g = findGlyph(glyphs.glyphs[i]);
+        const Glyph *g = findGlyph(glyphs.glyphs[i].glyph);
         if (!g)
             continue;
 
@@ -440,10 +440,10 @@ glyph_metrics_t QFontEngineQPF2::boundin
     return overall;
 }
 
-glyph_metrics_t QFontEngineQPF2::boundingBox(glyph_t glyph)
+glyph_metrics_t QFontEngineQPF2::boundingBox(const QGlyph &glyph)
 {
     glyph_metrics_t overall;
-    const Glyph *g = findGlyph(glyph);
+    const Glyph *g = findGlyph(glyph.glyph);
     if (!g)
         return overall;
     overall.x = g->x;
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine_qpf2_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontengine_qpf2_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontengine_qpf2_p.h
@@ -161,15 +161,15 @@ public:
     FaceId faceId() const override { return face_id; }
     bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
 
-    virtual glyph_t glyphIndex(uint ucs4) const override;
+    virtual QGlyph glyphIndex(uint ucs4) const override;
     bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
     void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
 
     void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
-    QImage alphaMapForGlyph(glyph_t t) override;
+    QImage alphaMapForGlyph(const QGlyph &t) override;
 
     glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
-    glyph_metrics_t boundingBox(glyph_t glyph) override;
+    glyph_metrics_t boundingBox(const QGlyph &glyph) override;
 
     QFixed ascent() const override;
     QFixed capHeight() const override;
@@ -185,7 +185,7 @@ public:
 
     bool isValid() const;
 
-    const Glyph *findGlyph(glyph_t g) const;
+    const Glyph *findGlyph(glyph__t g) const;
 
     static bool verifyHeader(const uchar *data, int size);
     static QVariant extractHeaderField(const uchar *data, HeaderTag tag);
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontmetrics.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontmetrics.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontmetrics.cpp
@@ -484,7 +484,7 @@ int QFontMetrics::leftBearing(QChar ch)
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
 
     qreal lb;
     engine->getGlyphBearings(glyph, &lb);
@@ -517,7 +517,7 @@ int QFontMetrics::rightBearing(QChar ch)
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
 
     qreal rb;
     engine->getGlyphBearings(glyph, 0, &rb);
@@ -679,7 +679,7 @@ int QFontMetrics::horizontalAdvance(QCha
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
     QFixed advance;
 
     QGlyphLayout glyphs;
@@ -731,7 +731,7 @@ int QFontMetrics::charWidth(const QStrin
 
         d->alterCharForCapitalization(ch);
 
-        glyph_t glyph = engine->glyphIndex(ch.unicode());
+        QGlyph glyph = engine->glyphIndex(ch.unicode());
         QFixed advance;
 
         QGlyphLayout glyphs;
@@ -806,7 +806,7 @@ QRect QFontMetrics::boundingRect(QChar c
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
 
     glyph_metrics_t gm = engine->boundingBox(glyph);
     return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
@@ -1449,7 +1449,7 @@ qreal QFontMetricsF::leftBearing(QChar c
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
 
     qreal lb;
     engine->getGlyphBearings(glyph, &lb);
@@ -1482,7 +1482,7 @@ qreal QFontMetricsF::rightBearing(QChar
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
 
     qreal rb;
     engine->getGlyphBearings(glyph, 0, &rb);
@@ -1609,7 +1609,7 @@ qreal QFontMetricsF::horizontalAdvance(Q
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
     QFixed advance;
 
     QGlyphLayout glyphs;
@@ -1680,7 +1680,7 @@ QRectF QFontMetricsF::boundingRect(QChar
 
     d->alterCharForCapitalization(ch);
 
-    glyph_t glyph = engine->glyphIndex(ch.unicode());
+    QGlyph glyph = engine->glyphIndex(ch.unicode());
 
     glyph_metrics_t gm = engine->boundingBox(glyph);
     return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qfontsubset.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qfontsubset.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qfontsubset.cpp
@@ -200,8 +200,10 @@ static void checkRanges(QPdf::ByteStream
 QVector<int> QFontSubset::getReverseMap() const
 {
     QVector<int> reverseMap(0x10000, 0);
+    QGlyph g;
     for (uint uc = 0; uc < 0x10000; ++uc) {
-        int idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc));
+        g = fontEngine->glyphIndex(uc);
+        int idx = glyph_indices.indexOf(g.glyph);
         if (idx >= 0 && !reverseMap.at(idx))
             reverseMap[idx] = uc;
     }
@@ -1210,10 +1212,10 @@ QByteArray QFontSubset::toTruetype() con
 
     uint sumAdvances = 0;
     for (int i = 0; i < numGlyphs; ++i) {
-        glyph_t g = glyph_indices.at(i);
+        glyph__t g = glyph_indices.at(i);
         QPainterPath path;
         glyph_metrics_t metric;
-        fontEngine->getUnscaledGlyph(g, &path, &metric);
+        fontEngine->getUnscaledGlyph({0, g}, &path, &metric);
         if (noEmbed) {
             path = QPainterPath();
             if (g == 0)
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qharfbuzzng.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qharfbuzzng.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qharfbuzzng.cpp
@@ -460,7 +460,8 @@ _hb_qt_font_get_nominal_glyph(hb_font_t
     QFontEngine *fe = static_cast<QFontEngine *>(font_data);
     Q_ASSERT(fe);
 
-    *glyph = fe->glyphIndex(unicode);
+    QGlyph g = fe->glyphIndex(unicode);
+    *glyph = g.glyph;
 
     return *glyph != 0;
 }
@@ -475,7 +476,8 @@ _hb_qt_font_get_variation_glyph(hb_font_
     Q_ASSERT(fe);
 
     // ### TODO add support for variation selectors
-    *glyph = fe->glyphIndex(unicode);
+    QGlyph g = fe->glyphIndex(unicode);
+    *glyph = g.glyph;
 
     return *glyph != 0;
 }
@@ -489,10 +491,11 @@ _hb_qt_font_get_glyph_h_advance(hb_font_
     Q_ASSERT(fe);
 
     QFixed advance;
+    QGlyph tmpGlyph = {0, glyph};
 
     QGlyphLayout g;
     g.numGlyphs = 1;
-    g.glyphs = &glyph;
+    g.glyphs = &tmpGlyph;
     g.advances = &advance;
 
     fe->recalcAdvances(&g, QFontEngine::ShaperFlags(hb_qt_font_get_use_design_metrics(font)));
@@ -508,7 +511,7 @@ _hb_qt_font_get_glyph_h_kerning(hb_font_
     QFontEngine *fe = static_cast<QFontEngine *>(font_data);
     Q_ASSERT(fe);
 
-    glyph_t glyphs[2] = { first_glyph, second_glyph };
+    QGlyph glyphs[2] = { {0, first_glyph}, {0, second_glyph} };
     QFixed advance;
 
     QGlyphLayout g;
@@ -530,7 +533,8 @@ _hb_qt_font_get_glyph_extents(hb_font_t
     QFontEngine *fe = static_cast<QFontEngine *>(font_data);
     Q_ASSERT(fe);
 
-    glyph_metrics_t gm = fe->boundingBox(glyph);
+    QGlyph g = {0, glyph};
+    glyph_metrics_t gm = fe->boundingBox(g);
 
     extents->x_bearing = gm.x.value();
     extents->y_bearing = gm.y.value();
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qrawfont.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qrawfont.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qrawfont.cpp
@@ -280,12 +280,12 @@ QImage QRawFont::alphaMapForGlyph(quint3
         return QImage();
 
     if (d->fontEngine->glyphFormat == QFontEngine::Format_ARGB)
-        return d->fontEngine->bitmapForGlyph(glyphIndex, QFixed(), transform);
+        return d->fontEngine->bitmapForGlyph({0, glyphIndex}, QFixed(), transform);
 
     if (antialiasingType == SubPixelAntialiasing)
-        return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);
+        return d->fontEngine->alphaRGBMapForGlyph({0, glyphIndex}, QFixed(), transform);
 
-    return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform);
+    return d->fontEngine->alphaMapForGlyph({0, glyphIndex}, QFixed(), transform);
 }
 
 /*!
@@ -303,7 +303,8 @@ QPainterPath QRawFont::pathForGlyph(quin
 
     QFixedPoint position;
     QPainterPath path;
-    d->fontEngine->addGlyphsToPath(&glyphIndex, &position, 1, &path, 0);
+    QGlyph glyph = {0, glyphIndex};
+    d->fontEngine->addGlyphsToPath(&glyph, &position, 1, &path, 0);
     return path;
 }
 
@@ -523,12 +524,12 @@ int QRawFont::weight() const
 */
 QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const
 {
-    QVector<quint32> glyphIndexes;
+    QVector<quint32> glyphsResult;
     if (!d->isValid() || text.isEmpty())
-        return glyphIndexes;
+        return glyphsResult;
 
     int numGlyphs = text.size();
-    glyphIndexes.resize(numGlyphs);
+    QVector<QGlyph> glyphIndexes(numGlyphs);
 
     QGlyphLayout glyphs;
     glyphs.numGlyphs = numGlyphs;
@@ -536,8 +537,11 @@ QVector<quint32> QRawFont::glyphIndexesF
     if (!d->fontEngine->stringToCMap(text.data(), text.size(), &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly))
         Q_UNREACHABLE();
 
-    glyphIndexes.resize(numGlyphs);
-    return glyphIndexes;
+    glyphsResult.resize(numGlyphs);
+    for (int i = 0; i < numGlyphs; ++i)
+        glyphsResult[i] = glyphs.glyphs[i].glyph;
+
+    return glyphsResult;
 }
 
 /*!
@@ -563,10 +567,18 @@ bool QRawFont::glyphIndexesForChars(cons
         return false;
     }
 
+    QVarLengthArray<QGlyph> tmpGlyphs(*numGlyphs);
+
     QGlyphLayout glyphs;
     glyphs.numGlyphs = *numGlyphs;
-    glyphs.glyphs = glyphIndexes;
-    return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);
+    glyphs.glyphs = tmpGlyphs.data();
+    bool r = d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);
+
+    QGlyph *it = glyphs.glyphs;
+    for (int i = 0; i < *numGlyphs; ++i, ++glyphIndexes, ++it)
+        *glyphIndexes = it->glyph;
+
+    return r;
 }
 
 /*!
@@ -611,11 +623,15 @@ bool QRawFont::advancesForGlyphIndexes(c
     if (!d->isValid() || numGlyphs <= 0)
         return false;
 
+    QVarLengthArray<QGlyph> tmpGlyphs(numGlyphs);
     QVarLengthArray<QFixed> tmpAdvances(numGlyphs);
 
     QGlyphLayout glyphs;
-    glyphs.glyphs = const_cast<glyph_t *>(glyphIndexes);
     glyphs.numGlyphs = numGlyphs;
+    glyphs.glyphs = tmpGlyphs.data();
+    for (int i = 0; i < numGlyphs; ++i)
+        glyphs.glyphs[i] = QGlyph{0, glyphIndexes[i]};
+
     glyphs.advances = tmpAdvances.data();
 
     bool design = layoutFlags & UseDesignMetrics;
@@ -811,7 +827,8 @@ QRectF QRawFont::boundingRect(quint32 gl
     if (!d->isValid())
         return QRectF();
 
-    glyph_metrics_t gm = d->fontEngine->boundingBox(glyphIndex);
+    QGlyph glyph = {0, glyphIndex};
+    glyph_metrics_t gm = d->fontEngine->boundingBox(glyph);
     return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());
 }
 
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qstatictext.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qstatictext.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qstatictext.cpp
@@ -465,7 +465,7 @@ namespace {
             QTransform matrix = m_untransformedCoordinates ? QTransform() : state->transform();
             matrix.translate(position.x(), position.y());
 
-            QVarLengthArray<glyph_t> glyphs;
+            QVarLengthArray<QGlyph> glyphs;
             QVarLengthArray<QFixedPoint> positions;
             ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
 
@@ -476,8 +476,8 @@ namespace {
             m_glyphs.resize(m_glyphs.size() + size);
             m_positions.resize(m_glyphs.size());
 
-            glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset;
-            memcpy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
+            QGlyph *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset;
+            memcpy(glyphsDestination, glyphs.constData(), sizeof(QGlyph) * currentItem.numGlyphs);
 
             QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset;
             memcpy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
@@ -508,7 +508,7 @@ namespace {
             return m_positions;
         }
 
-        QVector<glyph_t> glyphs() const
+        QVector<QGlyph> glyphs() const
         {
             return m_glyphs;
         }
@@ -516,7 +516,7 @@ namespace {
     private:
         QVector<QStaticTextItem> m_items;
         QVector<QFixedPoint> m_positions;
-        QVector<glyph_t> m_glyphs;
+        QVector<QGlyph> m_glyphs;
 
         bool m_dirtyPen;
         bool m_useBackendOptimizations;
@@ -580,7 +580,7 @@ namespace {
             return m_paintEngine;
         }
 
-        QVector<glyph_t> glyphs() const
+        QVector<QGlyph> glyphs() const
         {
             return m_paintEngine->glyphs();
         }
@@ -686,13 +686,13 @@ void QStaticTextPrivate::init()
 
     QVector<QStaticTextItem> deviceItems = device.items();
     QVector<QFixedPoint> positions = device.positions();
-    QVector<glyph_t> glyphs = device.glyphs();
+    QVector<QGlyph> glyphs = device.glyphs();
 
     itemCount = deviceItems.size();
     items = new QStaticTextItem[itemCount];
 
-    glyphPool = new glyph_t[glyphs.size()];
-    memcpy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t));
+    glyphPool = new QGlyph[glyphs.size()];
+    memcpy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(QGlyph));
 
     positionPool = new QFixedPoint[positions.size()];
     memcpy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qstatictext_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qstatictext_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qstatictext_p.h
@@ -100,11 +100,11 @@ public:
         int positionOffset;
     };
     union {
-        glyph_t *glyphs;                         // 4 bytes per glyph
+        QGlyph *glyphs;                          // 8 bytes per glyph
         int glyphOffset;
     };
                                                  // =================
-                                                 // 12 bytes per glyph
+                                                 // 16 bytes per glyph
 
                                                  // 8 bytes for pointers
     int numGlyphs;                               // 4 bytes per item
@@ -150,7 +150,7 @@ public:
     QStaticTextItem *items;              // 4 bytes per text
     int itemCount;                       // 4 bytes per text
 
-    glyph_t *glyphPool;                  // 4 bytes per text
+    QGlyph *glyphPool;                   // 8 bytes per text
     QFixedPoint *positionPool;           // 4 bytes per text
 
     QTextOption textOption;              // 28 bytes per text
@@ -160,7 +160,7 @@ public:
     unsigned char textFormat               : 2;
     unsigned char untransformedCoordinates : 1;
                                          // ================
-                                         // 191 bytes per text
+                                         // 195 bytes per text
 
     static QStaticTextPrivate *get(const QStaticText *q);
 };
Index: qtbase-everywhere-src-5.13.1/src/gui/text/qtextlayout.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/text/qtextlayout.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/text/qtextlayout.cpp
@@ -1663,7 +1663,7 @@ namespace {
         int glyphCount;
         int maxGlyphs;
         int currentPosition;
-        glyph_t previousGlyph;
+        QGlyph previousGlyph;
         QFontEngine *previousGlyphFontEngine;
 
         QFixed minw;
@@ -1684,17 +1684,17 @@ namespace {
                     + softHyphenWidth + negativeRightBearing();
         }
 
-        inline glyph_t currentGlyph() const
+        inline QGlyph currentGlyph() const
         {
             Q_ASSERT(currentPosition > 0);
             Q_ASSERT(logClusters[currentPosition - 1] < glyphs.numGlyphs);
 
-            return glyphs.glyphs[logClusters[currentPosition - 1]];
+            return glyphs.at(logClusters[currentPosition - 1]);
         }
 
         inline void saveCurrentGlyph()
         {
-            previousGlyph = 0;
+            previousGlyph = {0, 0};
             if (currentPosition > 0 &&
                 logClusters[currentPosition - 1] < glyphs.numGlyphs) {
                 previousGlyph = currentGlyph(); // needed to calculate right bearing later
@@ -1702,7 +1702,7 @@ namespace {
             }
         }
 
-        inline void calculateRightBearing(QFontEngine *engine, glyph_t glyph)
+        inline void calculateRightBearing(QFontEngine *engine, const QGlyph &glyph)
         {
             qreal rb;
             engine->getGlyphBearings(glyph, 0, &rb);
@@ -1723,7 +1723,7 @@ namespace {
 
         inline void calculateRightBearingForPreviousGlyph()
         {
-            if (previousGlyph > 0)
+            if (previousGlyph.glyph > 0)
                 calculateRightBearing(previousGlyphFontEngine, previousGlyph);
         }
 
@@ -1830,7 +1830,7 @@ void QTextLine::layout_helper(int maxGly
     lbh.currentPosition = line.from;
     int end = 0;
     lbh.logClusters = eng->layoutData->logClustersPtr;
-    lbh.previousGlyph = 0;
+    lbh.previousGlyph = {};
 
     bool hasInlineObject = false;
     QFixed maxInlineObjectHeight = 0;
@@ -2238,7 +2238,7 @@ static QGlyphRun glyphRunWithInfo(QFontE
     QRawFontPrivate *fontD = QRawFontPrivate::get(font);
     fontD->setFontEngine(fontEngine);
 
-    QVarLengthArray<glyph_t> glyphsArray;
+    QVarLengthArray<QGlyph> glyphsArray;
     QVarLengthArray<QFixedPoint> positionsArray;
 
     QTextItem::RenderFlags renderFlags;
@@ -2263,7 +2263,7 @@ static QGlyphRun glyphRunWithInfo(QFontE
     QVector<QPointF> positions;
     positions.reserve(glyphsArray.size());
     for (int i=0; i<glyphsArray.size(); ++i) {
-        glyphs.append(glyphsArray.at(i) & 0xffffff);
+        glyphs.append(glyphsArray.at(i).glyph);
 
         QPointF position = positionsArray.at(i).toPointF() + pos;
         positions.append(position);
@@ -2405,10 +2405,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(in
                 QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
                 int start = rtl ? glyphLayout.numGlyphs : 0;
                 int end = start - 1;
-                int which = glyphLayout.glyphs[rtl ? start - 1 : end + 1] >> 22;
+                int which = glyphLayout.glyphs[rtl ? start - 1 : end + 1].engine;
                 for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs - 1);
                      rtl ? --start : ++end) {
-                    const int e = glyphLayout.glyphs[rtl ? start - 1 : end + 1] >> 22;
+                    const int e = glyphLayout.glyphs[rtl ? start - 1 : end + 1].engine;
                     if (e == which)
                         continue;
 
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpainter_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpainter_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpainter_p.h
@@ -63,6 +63,7 @@
 #include "QtGui/qpaintengine.h"
 
 #include <private/qpen_p.h>
+#include <private/qtextengine_p.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -234,7 +235,7 @@ public:
     void drawTextItem(const QPointF &p, const QTextItem &_ti, QTextEngine *textEngine);
 
 #if !defined(QT_NO_RAWFONT)
-    void drawGlyphs(const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount,
+    void drawGlyphs(const QGlyph *glyphArray, QFixedPoint *positionArray, int glyphCount,
                     QFontEngine *fontEngine, bool overline = false, bool underline = false,
                     bool strikeOut = false);
 #endif
Index: qtbase-everywhere-src-5.13.1/src/gui/opengl/qopenglpaintengine.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/opengl/qopenglpaintengine.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/opengl/qopenglpaintengine.cpp
@@ -1670,7 +1670,7 @@ void QOpenGL2PaintEngineEx::drawTextItem
 
     if (shouldDrawCachedGlyphs(ti.fontEngine, s->matrix)) {
         QVarLengthArray<QFixedPoint> positions;
-        QVarLengthArray<glyph_t> glyphs;
+        QVarLengthArray<QGlyph> glyphs;
         QTransform matrix = QTransform::fromTranslate(p.x(), p.y());
         ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
 
Index: qtbase-everywhere-src-5.13.1/src/gui/opengl/qopengltextureglyphcache.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/opengl/qopengltextureglyphcache.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -421,7 +421,7 @@ void QOpenGLTextureGlyphCache::resizeTex
     }
 }
 
-void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
+void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, const QGlyph &glyph, QFixed subPixelPosition)
 {
     QOpenGLContext *ctx = QOpenGLContext::currentContext();
     if (ctx == 0) {
Index: qtbase-everywhere-src-5.13.1/src/gui/opengl/qopengltextureglyphcache_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/opengl/qopengltextureglyphcache_p.h
+++ qtbase-everywhere-src-5.13.1/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -115,7 +115,7 @@ public:
 
     virtual void createTextureData(int width, int height) override;
     virtual void resizeTextureData(int width, int height) override;
-    virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
+    virtual void fillTexture(const Coord &c, const QGlyph &glyph, QFixed subPixelPosition) override;
     virtual int glyphPadding() const override;
     virtual int maxTextureWidth() const override;
     virtual int maxTextureHeight() const override;
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qpdf.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qpdf.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qpdf.cpp
@@ -2951,7 +2951,7 @@ void QPdfEnginePrivate::drawTextItem(con
 
     qreal size = ti.fontEngine->fontDef.pixelSize;
 
-    QVarLengthArray<glyph_t> glyphs;
+    QVarLengthArray<QGlyph> glyphs;
     QVarLengthArray<QFixedPoint> positions;
     QTransform m = QTransform::fromTranslate(p.x(), p.y());
     ti.fontEngine->getGlyphPositions(ti.glyphs, m, ti.flags,
@@ -3001,7 +3001,7 @@ void QPdfEnginePrivate::drawTextItem(con
             x += .3*y;
         x /= stretch;
         char buf[5];
-        int g = font->addGlyph(glyphs[i]);
+        int g = font->addGlyph(glyphs[i].glyph);
         *currentPage << x - last_x << last_y - y << "Td <"
                      << QPdf::toHex((ushort)g, buf) << "> Tj\n";
         last_x = x;
@@ -3021,7 +3021,7 @@ void QPdfEnginePrivate::drawTextItem(con
                 x += .3*y;
             x /= stretch;
             char buf[5];
-            int g = font->addGlyph(glyphs[i]);
+            int g = font->addGlyph(glyphs[i].glyph);
             *currentPage << x - last_x << last_y - y << "Td <"
                         << QPdf::toHex((ushort)g, buf) << "> Tj\n";
             last_x = x;
Index: qtbase-everywhere-src-5.13.1/src/gui/painting/qtextureglyphcache.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/gui/painting/qtextureglyphcache.cpp
+++ qtbase-everywhere-src-5.13.1/src/gui/painting/qtextureglyphcache.cpp
@@ -52,7 +52,7 @@ QTextureGlyphCache::~QTextureGlyphCache(
 {
 }
 
-int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const
+int QTextureGlyphCache::calculateSubPixelPositionCount(const QGlyph &glyph) const
 {
     // Test 12 different subpixel positions since it factors into 3*4 so it gives
     // the coverage we need.
@@ -90,7 +90,7 @@ int QTextureGlyphCache::calculateSubPixe
     return numImages;
 }
 
-bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
+bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QGlyph *glyphs,
                                                 const QFixedPoint *positions)
 {
 #ifdef CACHE_DEBUG
@@ -123,7 +123,7 @@ bool QTextureGlyphCache::populate(QFontE
 
     // check each glyph for its metrics and get the required rowHeight.
     for (int i=0; i < numGlyphs; ++i) {
-        const glyph_t glyph = glyphs[i];
+        const QGlyph glyph = glyphs[i];
 
         QFixed subPixelPosition;
         if (supportsSubPixelPositions) {
@@ -261,7 +261,7 @@ void QTextureGlyphCache::fillInPendingGl
     m_pendingGlyphs.clear();
 }
 
-QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const
+QImage QTextureGlyphCache::textureMapForGlyph(const QGlyph &g, QFixed subPixelPosition) const
 {
     switch (m_format) {
     case QFontEngine::Format_A32:
@@ -307,7 +307,7 @@ void QImageTextureGlyphCache::createText
     }
 }
 
-void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subPixelPosition)
+void QImageTextureGlyphCache::fillTexture(const Coord &c, const QGlyph &g, QFixed subPixelPosition)
 {
     QImage mask = textureMapForGlyph(g, subPixelPosition);
 
Index: qtbase-everywhere-src-5.13.1/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ qtbase-everywhere-src-5.13.1/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -115,7 +115,7 @@ public:
 
     virtual void createTextureData(int width, int height) override;
     virtual void resizeTextureData(int width, int height) override;
-    virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
+    virtual void fillTexture(const Coord &c, const QGlyph &glyph, QFixed subPixelPosition) override;
     virtual int glyphPadding() const override;
     virtual int maxTextureWidth() const override;
     virtual int maxTextureHeight() const override;
Index: qtbase-everywhere-src-5.13.1/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
+++ qtbase-everywhere-src-5.13.1/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
@@ -178,7 +178,7 @@ int QFreetypeFace::fsType() const
     return fsType;
 }
 
-int QFreetypeFace::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
+int QFreetypeFace::getPointInOutline(glyph__t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
 {
     if (int error = FT_Load_Glyph(face, glyph, flags))
         return error;
@@ -1563,11 +1563,11 @@ QFontEngineFT::QGlyphSet *QFontEngineFT:
     return gs;
 }
 
-void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
+void QFontEngineFT::getUnscaledGlyph(const QGlyph &glyph, QPainterPath *path, glyph_metrics_t *metrics)
 {
     FT_Face face = lockFace(Unscaled);
     FT_Set_Transform(face, 0, 0);
-    FT_Load_Glyph(face, glyph, FT_LOAD_NO_BITMAP);
+    FT_Load_Glyph(face, glyph.glyph, FT_LOAD_NO_BITMAP);
 
     int left  = face->glyph->metrics.horiBearingX;
     int right = face->glyph->metrics.horiBearingX + face->glyph->metrics.width;
@@ -1607,14 +1607,14 @@ void QFontEngineFT::addOutlineToPath(qre
         QFontEngine::addOutlineToPath(x, y, glyphs, path, flags);
     } else {
         QVarLengthArray<QFixedPoint> positions;
-        QVarLengthArray<glyph_t> positioned_glyphs;
+        QVarLengthArray<QGlyph> positioned_glyphs;
         QTransform matrix;
         matrix.translate(x, y);
         getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
 
         FT_Face face = lockFace(Unscaled);
         for (int gl = 0; gl < glyphs.numGlyphs; gl++) {
-            FT_UInt glyph = positioned_glyphs[gl];
+            FT_UInt glyph = positioned_glyphs[gl].glyph;
             FT_Load_Glyph(face, glyph, FT_LOAD_TARGET_MONO);
             QFreetypeFace::addBitmapToPath(face->glyph, positions[gl], path);
         }
@@ -1622,13 +1622,13 @@ void QFontEngineFT::addOutlineToPath(qre
     }
 }
 
-void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs,
+void QFontEngineFT::addGlyphsToPath(const QGlyph *glyphs, QFixedPoint *positions, int numGlyphs,
                                     QPainterPath *path, QTextItem::RenderFlags)
 {
     FT_Face face = lockFace(Unscaled);
 
     for (int gl = 0; gl < numGlyphs; gl++) {
-        FT_UInt glyph = glyphs[gl];
+        FT_UInt glyph = glyphs[gl].glyph;
 
         FT_Load_Glyph(face, glyph, FT_LOAD_NO_BITMAP);
 
@@ -1644,9 +1644,9 @@ void QFontEngineFT::addGlyphsToPath(glyp
     unlockFace();
 }
 
-glyph_t QFontEngineFT::glyphIndex(uint ucs4) const
+QGlyph QFontEngineFT::glyphIndex(uint ucs4) const
 {
-    glyph_t glyph = ucs4 < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[ucs4] : 0;
+    glyph__t glyph = ucs4 < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[ucs4] : 0;
     if (glyph == 0) {
         FT_Face face = freetype->face;
         glyph = FT_Get_Char_Index(face, ucs4);
@@ -1671,7 +1671,7 @@ glyph_t QFontEngineFT::glyphIndex(uint u
             freetype->cmapCache[ucs4] = glyph;
     }
 
-    return glyph;
+    return {0, glyph};
 }
 
 bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
@@ -1689,15 +1689,15 @@ bool QFontEngineFT::stringToCMap(const Q
         QStringIterator it(str, str + len);
         while (it.hasNext()) {
             uint uc = it.next();
-            glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
-            if ( !glyphs->glyphs[glyph_pos] ) {
+            glyphs->glyphs[glyph_pos] = { 0, uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0};
+            if ( !glyphs->glyphs[glyph_pos].glyph ) {
                 // Symbol fonts can have more than one CMAPs, FreeType should take the
                 // correct one for us by default, so we always try FT_Get_Char_Index
                 // first. If it didn't work (returns 0), we will explicitly set the
                 // CMAP to symbol font one and try again. symbol_map is not always the
                 // correct one because in certain fonts like Wingdings symbol_map only
                 // contains PUA codepoints instead of the common ones.
-                glyph_t glyph = FT_Get_Char_Index(face, uc);
+                glyph__t glyph = FT_Get_Char_Index(face, uc);
                 // Certain symbol fonts don't have no-break space (0xa0) and tab (0x9),
                 // while we usually want to render them as space
                 if (!glyph && (uc == 0xa0 || uc == 0x9)) {
@@ -1709,7 +1709,7 @@ bool QFontEngineFT::stringToCMap(const Q
                     glyph = FT_Get_Char_Index(face, uc);
                     FT_Set_Charmap(face, freetype->unicode_map);
                 }
-                glyphs->glyphs[glyph_pos] = glyph;
+                glyphs->glyphs[glyph_pos] = {0, glyph};
                 if (uc < QFreetypeFace::cmapCacheSize)
                     freetype->cmapCache[uc] = glyph;
             }
@@ -1720,16 +1720,16 @@ bool QFontEngineFT::stringToCMap(const Q
         QStringIterator it(str, str + len);
         while (it.hasNext()) {
             uint uc = it.next();
-            glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
-            if (!glyphs->glyphs[glyph_pos]) {
+            glyphs->glyphs[glyph_pos] = {0, uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0};
+            if (!glyphs->glyphs[glyph_pos].glyph) {
                 {
                 redo:
-                    glyph_t glyph = FT_Get_Char_Index(face, uc);
+                    glyph__t glyph = FT_Get_Char_Index(face, uc);
                     if (!glyph && (uc == 0xa0 || uc == 0x9)) {
                         uc = 0x20;
                         goto redo;
                     }
-                    glyphs->glyphs[glyph_pos] = glyph;
+                    glyphs->glyphs[glyph_pos] = {0, glyph};
                     if (uc < QFreetypeFace::cmapCacheSize)
                         freetype->cmapCache[uc] = glyph;
                 }
@@ -1790,7 +1790,7 @@ void QFontEngineFT::recalcAdvances(QGlyp
     FT_Face face = 0;
     bool design = shouldUseDesignMetrics(flags);
     for (int i = 0; i < glyphs->numGlyphs; i++) {
-        Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : 0;
+        Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i].glyph) : 0;
         // Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph
         GlyphFormat acceptableFormat = (defaultFormat != Format_None) ? defaultFormat : Format_Mono;
         if (g && g->format == acceptableFormat) {
@@ -1798,7 +1798,7 @@ void QFontEngineFT::recalcAdvances(QGlyp
         } else {
             if (!face)
                 face = lockFace();
-            g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs->glyphs[i], 0, Format_None, true);
+            g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs->glyphs[i].glyph, 0, Format_None, true);
             if (g)
                 glyphs->advances[i] = design ? QFixed::fromFixed(g->linearAdvance) : QFixed(g->advance);
             else
@@ -1837,11 +1837,11 @@ glyph_metrics_t QFontEngineFT::boundingB
     QFixed ymax = 0;
     QFixed xmax = 0;
     for (int i = 0; i < glyphs.numGlyphs; i++) {
-        Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : 0;
+        Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i].glyph) : 0;
         if (!g) {
             if (!face)
                 face = lockFace();
-            g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs.glyphs[i], 0, Format_None, true);
+            g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs.glyphs[i].glyph, 0, Format_None, true);
         }
         if (g) {
             QFixed x = overall.xoff + glyphs.offsets[i].x + g->x;
@@ -1879,14 +1879,14 @@ glyph_metrics_t QFontEngineFT::boundingB
     return overall;
 }
 
-glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph)
+glyph_metrics_t QFontEngineFT::boundingBox(const QGlyph &glyph)
 {
     FT_Face face = 0;
     glyph_metrics_t overall;
-    Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyph) : 0;
+    Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyph.glyph) : 0;
     if (!g) {
         face = lockFace();
-        g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, 0, Format_None, true);
+        g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph.glyph, 0, Format_None, true);
     }
     if (g) {
         overall.x = g->x;
@@ -1918,14 +1918,14 @@ glyph_metrics_t QFontEngineFT::boundingB
     return overall;
 }
 
-glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matrix)
+glyph_metrics_t QFontEngineFT::boundingBox(const QGlyph &glyph, const QTransform &matrix)
 {
     return alphaMapBoundingBox(glyph, 0, matrix, QFontEngine::Format_None);
 }
 
-glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format)
+glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(const QGlyph &glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format)
 {
-    Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true);
+    Glyph *g = loadGlyphFor(glyph.glyph, subPixelPosition, format, matrix, true);
 
     glyph_metrics_t overall;
     if (g) {
@@ -1986,7 +1986,7 @@ static inline QImage alphaMapFromGlyphDa
     return img;
 }
 
-QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixelPosition,
+QImage *QFontEngineFT::lockedAlphaMapForGlyph(const QGlyph &glyphIndex, QFixed subPixelPosition,
                                               QFontEngine::GlyphFormat neededFormat,
                                               const QTransform &t, QPoint *offset)
 {
@@ -1999,7 +1999,7 @@ QImage *QFontEngineFT::lockedAlphaMapFor
     else if (neededFormat == Format_None)
         neededFormat = Format_A8;
 
-    Glyph *glyph = loadGlyphFor(glyphIndex, subPixelPosition, neededFormat, t);
+    Glyph *glyph = loadGlyphFor(glyphIndex.glyph, subPixelPosition, neededFormat, t);
 
     if (offset != 0 && glyph != 0)
         *offset = QPoint(glyph->x, -glyph->y);
@@ -2035,7 +2035,7 @@ static inline bool is2dRotation(const QT
         && qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), qreal(1.0));
 }
 
-QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
+QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph__t g,
                                                   QFixed subPixelPosition,
                                                   GlyphFormat format,
                                                   const QTransform &t,
@@ -2064,16 +2064,16 @@ QFontEngineFT::Glyph *QFontEngineFT::loa
     return glyph;
 }
 
-QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition)
+QImage QFontEngineFT::alphaMapForGlyph(const QGlyph &g, QFixed subPixelPosition)
 {
     return alphaMapForGlyph(g, subPixelPosition, QTransform());
 }
 
-QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngineFT::alphaMapForGlyph(const QGlyph &g, QFixed subPixelPosition, const QTransform &t)
 {
     const GlyphFormat neededFormat = antialias ? Format_A8 : Format_Mono;
 
-    Glyph *glyph = loadGlyphFor(g, subPixelPosition, neededFormat, t, false, true);
+    Glyph *glyph = loadGlyphFor(g.glyph, subPixelPosition, neededFormat, t, false, true);
 
     QImage img = alphaMapFromGlyphData(glyph, neededFormat);
     img = img.copy();
@@ -2084,14 +2084,14 @@ QImage QFontEngineFT::alphaMapForGlyph(g
     return img;
 }
 
-QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngineFT::alphaRGBMapForGlyph(const QGlyph &g, QFixed subPixelPosition, const QTransform &t)
 {
     if (t.type() > QTransform::TxRotate)
         return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
 
     const GlyphFormat neededFormat = Format_A32;
 
-    Glyph *glyph = loadGlyphFor(g, subPixelPosition, neededFormat, t, false, true);
+    Glyph *glyph = loadGlyphFor(g.glyph, subPixelPosition, neededFormat, t, false, true);
 
     QImage img = alphaMapFromGlyphData(glyph, neededFormat);
     img = img.copy();
@@ -2105,11 +2105,11 @@ QImage QFontEngineFT::alphaRGBMapForGlyp
     return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
 }
 
-QImage QFontEngineFT::bitmapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t, const QColor &color)
+QImage QFontEngineFT::bitmapForGlyph(const QGlyph &g, QFixed subPixelPosition, const QTransform &t, const QColor &color)
 {
     Q_UNUSED(color);
 
-    Glyph *glyph = loadGlyphFor(g, subPixelPosition, defaultFormat, t);
+    Glyph *glyph = loadGlyphFor(g.glyph, subPixelPosition, defaultFormat, t);
     if (glyph == nullptr)
         return QImage();
 
@@ -2132,9 +2132,9 @@ QImage QFontEngineFT::bitmapForGlyph(gly
     return img;
 }
 
-void QFontEngineFT::removeGlyphFromCache(glyph_t glyph)
+void QFontEngineFT::removeGlyphFromCache(const QGlyph &glyph)
 {
-    defaultGlyphSet.removeGlyphFromCache(glyph, 0);
+    defaultGlyphSet.removeGlyphFromCache(glyph.glyph, 0);
 }
 
 int QFontEngineFT::glyphCount() const
@@ -2215,7 +2215,7 @@ void QFontEngineFT::QGlyphSet::clear()
     glyph_data.clear();
 }
 
-void QFontEngineFT::QGlyphSet::removeGlyphFromCache(glyph_t index, QFixed subPixelPosition)
+void QFontEngineFT::QGlyphSet::removeGlyphFromCache(glyph__t index, QFixed subPixelPosition)
 {
     if (useFastGlyphData(index, subPixelPosition)) {
         if (fast_glyph_data[index]) {
@@ -2229,7 +2229,7 @@ void QFontEngineFT::QGlyphSet::removeGly
     }
 }
 
-void QFontEngineFT::QGlyphSet::setGlyph(glyph_t index, QFixed subPixelPosition, Glyph *glyph)
+void QFontEngineFT::QGlyphSet::setGlyph(glyph__t index, QFixed subPixelPosition, Glyph *glyph)
 {
     if (useFastGlyphData(index, subPixelPosition)) {
         if (!fast_glyph_data[index])
@@ -2240,7 +2240,7 @@ void QFontEngineFT::QGlyphSet::setGlyph(
     }
 }
 
-int QFontEngineFT::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
+int QFontEngineFT::getPointInOutline(glyph__t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
 {
     lockFace();
     bool hsubpixel = true;
Index: qtbase-everywhere-src-5.13.1/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
+++ qtbase-everywhere-src-5.13.1/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
@@ -101,11 +101,11 @@ public:
     FT_CharMap symbol_map;
 
     enum { cmapCacheSize = 0x200 };
-    glyph_t cmapCache[cmapCacheSize];
+    glyph__t cmapCache[cmapCacheSize];
 
     int fsType() const;
 
-    int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
+    int getPointInOutline(glyph__t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
 
     bool isScalableBitmap() const;
 
@@ -155,14 +155,14 @@ public:
 
     struct GlyphAndSubPixelPosition
     {
-        GlyphAndSubPixelPosition(glyph_t g, QFixed spp) : glyph(g), subPixelPosition(spp) {}
+        GlyphAndSubPixelPosition(glyph__t g, QFixed spp) : glyph(g), subPixelPosition(spp) {}
 
         bool operator==(const GlyphAndSubPixelPosition &other) const
         {
             return glyph == other.glyph && subPixelPosition == other.subPixelPosition;
         }
 
-        glyph_t glyph;
+        glyph__t glyph;
         QFixed subPixelPosition;
     };
 
@@ -173,19 +173,19 @@ public:
         FT_Matrix transformationMatrix;
         bool outline_drawing;
 
-        void removeGlyphFromCache(glyph_t index, QFixed subPixelPosition);
+        void removeGlyphFromCache(glyph__t index, QFixed subPixelPosition);
         void clear();
-        inline bool useFastGlyphData(glyph_t index, QFixed subPixelPosition) const {
+        inline bool useFastGlyphData(glyph__t index, QFixed subPixelPosition) const {
             return (index < 256 && subPixelPosition == 0);
         }
-        inline Glyph *getGlyph(glyph_t index, QFixed subPixelPosition = 0) const;
-        void setGlyph(glyph_t index, QFixed spp, Glyph *glyph);
+        inline Glyph *getGlyph(glyph__t index, QFixed subPixelPosition = 0) const;
+        void setGlyph(glyph__t index, QFixed spp, Glyph *glyph);
 
-        inline bool isGlyphMissing(glyph_t index) const { return missing_glyphs.contains(index); }
-        inline void setGlyphMissing(glyph_t index) const { missing_glyphs.insert(index); }
+        inline bool isGlyphMissing(glyph__t index) const { return missing_glyphs.contains(index); }
+        inline void setGlyphMissing(glyph__t index) const { missing_glyphs.insert(index); }
 private:
         mutable QHash<GlyphAndSubPixelPosition, Glyph *> glyph_data; // maps from glyph index to glyph data
-        mutable QSet<glyph_t> missing_glyphs;
+        mutable QSet<glyph__t> missing_glyphs;
         mutable Glyph *fast_glyph_data[256]; // for fast lookup of glyphs < 256
         mutable int fast_glyph_count;
     };
@@ -213,14 +213,14 @@ private:
     QFixed lineThickness() const override;
     QFixed underlinePosition() const override;
 
-    glyph_t glyphIndex(uint ucs4) const override;
+    QGlyph glyphIndex(uint ucs4) const override;
     void doKerning(QGlyphLayout *, ShaperFlags) const override;
 
-    void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+    void getUnscaledGlyph(const QGlyph &glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
 
     bool supportsTransformation(const QTransform &transform) const override;
 
-    void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+    void addGlyphsToPath(const QGlyph *glyphs, QFixedPoint *positions, int nglyphs,
                  QPainterPath *path, QTextItem::RenderFlags flags) override;
     void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
                   QPainterPath *path, QTextItem::RenderFlags flags) override;
@@ -228,27 +228,27 @@ private:
     bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
 
     glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
-    glyph_metrics_t boundingBox(glyph_t glyph) override;
-    glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) override;
+    glyph_metrics_t boundingBox(const QGlyph &glyph) override;
+    glyph_metrics_t boundingBox(const QGlyph &glyph, const QTransform &matrix) override;
 
     void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const override;
-    QImage alphaMapForGlyph(glyph_t g) override { return alphaMapForGlyph(g, 0); }
-    QImage alphaMapForGlyph(glyph_t, QFixed) override;
-    QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
-    QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
-    QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color) override;
-    glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
+    QImage alphaMapForGlyph(const QGlyph &g) override { return alphaMapForGlyph(g, 0); }
+    QImage alphaMapForGlyph(const QGlyph &, QFixed) override;
+    QImage alphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition, const QTransform &t) override;
+    QImage alphaRGBMapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t) override;
+    QImage bitmapForGlyph(const QGlyph &, QFixed subPixelPosition, const QTransform &t, const QColor &color) override;
+    glyph_metrics_t alphaMapBoundingBox(const QGlyph & glyph,
                                         QFixed subPixelPosition,
                                         const QTransform &matrix,
                                         QFontEngine::GlyphFormat format) override;
-    QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
+    QImage *lockedAlphaMapForGlyph(const QGlyph &glyph, QFixed subPixelPosition,
                                    GlyphFormat neededFormat, const QTransform &t,
                                    QPoint *offset) override;
     bool hasInternalCaching() const override { return cacheEnabled; }
     void unlockAlphaMapForGlyph() override;
     bool expectsGammaCorrectedBlending() const override;
 
-    void removeGlyphFromCache(glyph_t glyph) override;
+    void removeGlyphFromCache(const QGlyph & glyph) override;
     int glyphMargin(QFontEngine::GlyphFormat /* format */) override { return 0; }
 
     int glyphCount() const override;
@@ -270,7 +270,7 @@ private:
     inline Glyph *loadGlyph(uint glyph, QFixed subPixelPosition, GlyphFormat format = Format_None, bool fetchMetricsOnly = false, bool disableOutlineDrawing = false) const
     { return loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, subPixelPosition, format, fetchMetricsOnly, disableOutlineDrawing); }
     Glyph *loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat = Format_None, bool fetchMetricsOnly = false, bool disableOutlineDrawing = false) const;
-    Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox = false, bool disableOutlineDrawing = false);
+    Glyph *loadGlyphFor(glyph__t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox = false, bool disableOutlineDrawing = false);
 
     QGlyphSet *loadGlyphSet(const QTransform &matrix);
 
@@ -282,7 +282,7 @@ private:
     bool init(FaceId faceId, bool antialias, GlyphFormat format,
               QFreetypeFace *freetypeFace);
 
-    int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) override;
+    int getPointInOutline(glyph__t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) override;
 
     void setQtDefaultHintStyle(QFont::HintingPreference hintingPreference);
     void setDefaultHintStyle(HintStyle style) override;
@@ -347,7 +347,7 @@ inline uint qHash(const QFontEngineFT::G
     return (g.glyph << 8)  | (g.subPixelPosition * 10).round().toInt();
 }
 
-inline QFontEngineFT::Glyph *QFontEngineFT::QGlyphSet::getGlyph(glyph_t index, QFixed subPixelPosition) const
+inline QFontEngineFT::Glyph *QFontEngineFT::QGlyphSet::getGlyph(glyph__t index, QFixed subPixelPosition) const
 {
     if (useFastGlyphData(index, subPixelPosition))
         return fast_glyph_data[index];
Index: qtbase-everywhere-src-5.13.1/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ qtbase-everywhere-src-5.13.1/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1582,7 +1582,7 @@ void QGL2PaintEngineEx::drawTextItem(con
 
     if (shouldDrawCachedGlyphs(ti.fontEngine, s->matrix)) {
         QVarLengthArray<QFixedPoint> positions;
-        QVarLengthArray<glyph_t> glyphs;
+        QVarLengthArray<QGlyph> glyphs;
         QTransform matrix = QTransform::fromTranslate(p.x(), p.y());
         ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
 
Index: qtbase-everywhere-src-5.13.1/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ qtbase-everywhere-src-5.13.1/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -280,7 +280,7 @@ void QGLTextureGlyphCache::resizeTexture
     }
 }
 
-void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
+void QGLTextureGlyphCache::fillTexture(const Coord &c, const QGlyph &glyph, QFixed subPixelPosition)
 {
     QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
     if (ctx == 0) {
Index: qtbase-everywhere-src-5.13.1/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
===================================================================
--- qtbase-everywhere-src-5.13.1.orig/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
+++ qtbase-everywhere-src-5.13.1/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
@@ -228,7 +228,7 @@ public:
     ~QXRenderGlyphCache();
 
     bool addGlyphs(const QTextItemInt &ti,
-                   const QVarLengthArray<glyph_t> &glyphs,
+                   const QVarLengthArray<QGlyph> &glyphs,
                    const QVarLengthArray<QFixedPoint> &positions);
     bool draw(Drawable src, Drawable dst, const QTransform &matrix, const QTextItemInt &ti);
 
@@ -239,7 +239,7 @@ public:
     inline const XRenderPictFormat *renderPictFormat() const;
 
     static inline QFontEngine::GlyphFormat glyphFormatForDepth(QFontEngine *fontEngine, int depth);
-    static inline Glyph glyphId(glyph_t glyph, QFixed subPixelPosition);
+    static inline Glyph glyphId(glyph__t glyph, QFixed subPixelPosition);
 
     static inline bool isValidCoordinate(const QFixedPoint &fp);
 
@@ -2464,7 +2464,7 @@ void QX11PaintEngine::drawTextItem(const
 
 #if QT_CONFIG(fontconfig)
 static bool path_for_glyphs(QPainterPath *path,
-                            const QVarLengthArray<glyph_t> &glyphs,
+                            const QVarLengthArray<QGlyph> &glyphs,
                             const QVarLengthArray<QFixedPoint> &positions,
                             const QFontEngineFT *ft)
 {
@@ -2474,7 +2474,7 @@ static bool path_for_glyphs(QPainterPath
     ft->lockFace();
     int i = 0;
     while (i < glyphs.size()) {
-        QFontEngineFT::Glyph *glyph = ft->loadGlyph(glyphs[i], 0, QFontEngineFT::Format_Mono);
+        QFontEngineFT::Glyph *glyph = ft->loadGlyph(glyphs[i].glyph, 0, QFontEngineFT::Format_Mono);
         // #### fix case where we don't get a glyph
         if (!glyph || glyph->format != QFontEngineFT::Format_Mono) {
             result = false;
@@ -2541,7 +2541,7 @@ void QX11PaintEngine::drawFreetype(const
     transform.translate(p.x(), p.y());
 
     QVarLengthArray<QFixedPoint> positions;
-    QVarLengthArray<glyph_t> glyphs;
+    QVarLengthArray<QGlyph> glyphs;
     ti.fontEngine->getGlyphPositions(ti.glyphs, transform, ti.flags, glyphs, positions);
 
     if (glyphs.count() == 0)
@@ -2615,7 +2615,7 @@ QXRenderGlyphCache::~QXRenderGlyphCache(
 }
 
 bool QXRenderGlyphCache::addGlyphs(const QTextItemInt &ti,
-                                   const QVarLengthArray<glyph_t> &glyphs,
+                                   const QVarLengthArray<QGlyph> &glyphs,
                                    const QVarLengthArray<QFixedPoint> &positions)
 {
     Q_ASSERT(ti.fontEngine->type() == QFontEngine::Freetype);
@@ -2627,20 +2627,20 @@ bool QXRenderGlyphCache::addGlyphs(const
 
     for (int i = 0; i < glyphs.size(); ++i) {
         const QFixed spp = ft->subPixelPositionForX(positions[i].x);
-        QFontEngineFT::Glyph *glyph = set->getGlyph(glyphs[i], spp);
-        Glyph xglyphid = qHash(QFontEngineFT::GlyphAndSubPixelPosition(glyphs[i], spp));
+        QFontEngineFT::Glyph *glyph = set->getGlyph(glyphs[i].glyph, spp);
+        Glyph xglyphid = qHash(QFontEngineFT::GlyphAndSubPixelPosition(glyphs[i].glyph, spp));
 
         if (glyph && glyph->format == glyphFormat()) {
             if (cachedGlyphs.contains(xglyphid)) {
                 continue;
             } else {
-                set->setGlyph(glyphs[i], spp, nullptr);
+                set->setGlyph(glyphs[i].glyph, spp, nullptr);
                 delete glyph;
                 glyph = 0;
             }
         }
 
-        glyph = ft->loadGlyphFor(glyphs[i], spp, glyphFormat(), transform());
+        glyph = ft->loadGlyphFor(glyphs[i].glyph, spp, glyphFormat(), transform());
 
         if (glyph == 0 || glyph->format != glyphFormat())
             return false;
@@ -2652,7 +2652,7 @@ bool QXRenderGlyphCache::addGlyphs(const
             memcpy(glyph->data, img.constBits(), static_cast<size_t>(img.sizeInBytes()));
         }
 
-        set->setGlyph(glyphs[i], spp, glyph);
+        set->setGlyph(glyphs[i].glyph, spp, glyph);
         Q_ASSERT(glyph->data || glyph->width == 0 || glyph->height == 0);
 
         xglyphinfo.width = glyph->width;
@@ -2679,7 +2679,7 @@ bool QXRenderGlyphCache::draw(Drawable s
     QFontEngineFT *ft = static_cast<QFontEngineFT *>(ti.fontEngine);
     QFontEngineFT::QGlyphSet *set = ft->loadGlyphSet(matrix);
 
-    QVarLengthArray<glyph_t> glyphs;
+    QVarLengthArray<QGlyph> glyphs;
     QVarLengthArray<QFixedPoint> positions;
     ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
 
@@ -2692,7 +2692,7 @@ bool QXRenderGlyphCache::draw(Drawable s
     QVarLengthArray<unsigned int> chars(glyphs.size());
 
     for (int i = 0; i < glyphs.size(); ++i)
-        chars[i] = glyphId(glyphs[i], ft->subPixelPositionForX(positions[i].x));
+        chars[i] = glyphId(glyphs[i].glyph, ft->subPixelPositionForX(positions[i].x));
 
     int i = 0;
     while (i < glyphs.size() && !isValidCoordinate(positions[i]))
@@ -2719,7 +2719,7 @@ bool QXRenderGlyphCache::draw(Drawable s
             break;
 
         const QFixed spp = ft->subPixelPositionForX(positions[i].x);
-        QFontEngineFT::Glyph *g = set->getGlyph(glyphs[i], spp);
+        QFontEngineFT::Glyph *g = set->getGlyph(glyphs[i].glyph, spp);
 
         if (g
             && positions[i].x == xp + g->advance
@@ -2843,7 +2843,7 @@ QFontEngine::GlyphFormat QXRenderGlyphCa
     return glyphFormat;
 }
 
-Glyph QXRenderGlyphCache::glyphId(glyph_t glyph, QFixed subPixelPosition)
+Glyph QXRenderGlyphCache::glyphId(glyph__t glyph, QFixed subPixelPosition)
 {
     return qHash(QFontEngineFT::GlyphAndSubPixelPosition(glyph, subPixelPosition));
 }
