Important: Please read the Qt Code of Conduct -

QFontDatabase::addApplicationFont Linux not working

  • Hi, I'm trying to use a custom font in a Qt Quick application.

    1 - First of all I add the "Roboto-Regular.ttf" to my resource file.

        <qresource prefix="/">

    2 - I load the font and set up as default for the application. I can see the "Roboto" file display in the database while enumerating the font family

        QFontDatabase database;
        foreach (const QString &family, database.families()) {
            qDebug() << family;
        QFont font("Roboto");

    3 - On the QML side, I have :

    Text { 
          Text : "\u2794"

    4 - On Windows 7 and Linux Ubuntu this is well working, I'm seeing the symbol char
    5 - I try it on a Linux (custum image build with Yocto) but I got an empty text. No symbol displayed :( What could be the problem ? I try setting manually the font to the text item

    Text { 
 : "Roboto"                // Not work
 : "Roboto-Regular"        // Not work
          Text : "\u2794"

    I'm really out of idea.

Log in to reply