Custom fonts are not displayed properly on MacOS

  • Hello,

    I'm currently experiencing an issue with the load of font.

    Here is the result on windows :


    As you can see the fonts are well loaded (it's also works on ubuntu 17). The fonts are used as icons.

    This is the result on MacOs :


    The fonts are loaded like this :

    const auto id = QFontDatabase::addApplicationFont(":/resources/fonts/Font Awesome 5 Free-Solid-900.otf");
    const auto id1 = QFontDatabase::addApplicationFont(":/resources/fonts/Font Awesome 5 Free-Regular-400.otf");
    const auto id2 = QFontDatabase::addApplicationFont(":/resources/fonts/Font Awesome 5 Brands-Regular-400.otf");
    qDebug() << QFontDatabase::applicationFontFamilies(id).at(0);
    qDebug() << QFontDatabase::applicationFontFamilies(id1).at(0);
    qDebug() << QFontDatabase::applicationFontFamilies(id2).at(0);

    This is the ouput result on windows :

    "Font Awesome 5 Free Solid"
    "Font Awesome 5 Free Regular"
    "Font Awesome 5 Brands Regular"

    And, the mac output :

    "Font Awesome 5 Free"
    "Font Awesome 5 Free"
    "Font Awesome 5 Brands"

    I see the Note on :
    Note: Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported.

    I installed qt 5.10 through the Qt Installer, so i don't know if the installer version contain fontconfig, but it's works well on Ubuntu with the Qt installer.
    Do I need to reinstall Qt from sources with -fontconfig or something like that?
    Do you have any idea of what could be wrong?

  • Qt Champions 2017

    Did you try the Font Awesome 5 font in another macOs application ?
    Oddly the icon you get looks like when some unicode string is not decoded properly.

  • Thank you for your quick answer!
    I just tried to create a new application, the same bug occurs. However, if I write "Font Awesome 5 Free" instead "Font Awesome 5 Free Solid" in my qml, it works.
    So, I can fix my application with a define to check on which system I am, but it's still strange that the name is not the same on each plateform.
    Because you have to use the font name in the qml :
    This works on windows / Ubuntu

    Label {
        text: qsTr("\uf039") "Font Awesome 5 Free Solid"
        font.pointSize: 40

    This only works on MacOs

    Label {
        text: qsTr("\uf039") "Font Awesome 5 Free"
        font.pointSize: 40

    The second issue, is that i can't recognize these two fonts on MacOs:

    "Font Awesome 5 Free Solid"
    "Font Awesome 5 Free Regular"

    Because both return :

    "Font Awesome 5 Free"

    Anyway, I think I can fix my application even if the behavior seems odd, should I create a bug report to have a record of this issue?

  • I just started using Font Awesome as well, and stumbled upon this forum post. Now I wonder if I will have this issue on iOS? Have you tried? Or have you figured out something new?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.