Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get a QGlyphRun for a single character?



  • Hi,
    I want to get a QGlyphRun for a single character and the way I do is:

        QCharRef c = text[text.length()-1];
        QTextLayout *pTextLayout = new QTextLayout(QString(c));
        pTextLayout->setFont(font);
        pTextLayout->beginLayout();
        pTextLayout->createLine();
        pTextLayout->endLayout();
        QList<QGlyphRun> glyphData = pTextLayout->glyphRuns();
    

    Is there a quicker way of doing it ?


Log in to reply