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. Custom fonts are not displayed properly on MacOS
Forum Updated to NodeBB v4.3 + New Features

Custom fonts are not displayed properly on MacOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 2.1k 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.
  • B Offline
    B Offline
    Babiole
    wrote on last edited by
    #1

    Hello,

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

    Here is the result on windows :

    0_1517421772199_windows_screen1.png

    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 :

    0_1517421800635_mac_screen1.png

    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 https://doc.qt.io/qt-5/qfontdatabase.html#addApplicationFont :
    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?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      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.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Babiole
        wrote on last edited by Babiole
        #3

        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.family: "Font Awesome 5 Free Solid"
            font.pointSize: 40
        }
        
        

        This only works on MacOs

        Label {
            text: qsTr("\uf039")
            font.family: "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?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Benjamin Binder
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            https://github.com/benlau/fontawesome.pri

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            1

            • Login

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