Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFontDatabase::addApplicationFont Linux not working
Forum Updated to NodeBB v4.3 + New Features

QFontDatabase::addApplicationFont Linux not working

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Erakis
    wrote on 17 Jun 2015, 17:22 last edited by
    #1

    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.

    <RCC>
        <qresource prefix="/">
            <file>main.qml</file>
             .....
            <file>Fonts/Roboto-Regular.ttf</file>
        </qresource>
    </RCC>
    

    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::addApplicationFont(":/Fonts/Roboto-Regular.ttf");
        QFontDatabase database;
        foreach (const QString &family, database.families()) {
            qDebug() << family;
        }
        QFont font("Roboto");
        app.setFont(font);
    

    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 { 
          font.family : "Roboto"                // Not work
          font.family : "Roboto-Regular"        // Not work
          Text : "\u2794"
    }
    

    I'm really out of idea.

    1 Reply Last reply
    0

    1/1

    17 Jun 2015, 17:22

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved