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. Qt font not found in certain windows versions
Forum Update on Monday, May 27th 2025

Qt font not found in certain windows versions

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 607 Views
  • 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.
  • M Offline
    M Offline
    Melkon
    wrote on 28 Jul 2020, 07:22 last edited by
    #1

    Hello!

    How exactly qrc qfonts are working?
    In a specific pc QFontDatabase::addApplicationFont returns -1, otherwise it's working.
    The font i am using is not in my windows and it's still working, so i guess qrc compile it into the executable, am i right here?
    If that's the case, what can cause addApplicationFont to randomly not work?

    In the Qrc it's added as

    <qresource prefix="[...]">
    <file alias="[...]">[...]</file>
    </qresource>

    Thank you!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 28 Jul 2020, 07:42 last edited by
      #2

      Hi
      Yes a qrc file is often compiled into the exe.
      Im not sure why it would fail.

      Is pc that fails the same Windows version ?

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Melkon
        wrote on 28 Jul 2020, 07:59 last edited by
        #3

        Hello!

        Thank you for the answer, it is a different a windows version (a Win10 enterprise), tho i don't see why would it matter if it's in the executable.

        M 1 Reply Last reply 28 Jul 2020, 08:05
        0
        • M Melkon
          28 Jul 2020, 07:59

          Hello!

          Thank you for the answer, it is a different a windows version (a Win10 enterprise), tho i don't see why would it matter if it's in the executable.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 28 Jul 2020, 08:05 last edited by
          #4

          @Melkon
          Hi
          It should not matter but just wondered if it might already have font or something like that to make addApplicationFont fail.

          Do you have access to the pc that fails for testing ?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Melkon
            wrote on 28 Jul 2020, 08:34 last edited by
            #5

            So far it seems the app is working perfectly even without calling add application font, so maybe the solution will be to just remove it.

            I can get access to that pc, tho it's a bit problematic. Thanks for the tip, i'll check if these fonts are already there or not.

            M 1 Reply Last reply 28 Jul 2020, 08:41
            0
            • M Melkon
              28 Jul 2020, 08:34

              So far it seems the app is working perfectly even without calling add application font, so maybe the solution will be to just remove it.

              I can get access to that pc, tho it's a bit problematic. Thanks for the tip, i'll check if these fonts are already there or not.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 28 Jul 2020, 08:41 last edited by
              #6

              @Melkon
              Hi
              Well, Windows will do font matching so if you ask for a given font, it will find one as close as possible if not a direct hit.
              So in many cases, it works just fine.

              Im not sure how to debug this but i would also check on the pc, that the (embedded) font file can be found

              #include <QFileInfo>
              
              bool fileExists(QString path) {
                  QFileInfo check_file(path);
                  return check_file.exists() && check_file.isFile();
              }
              

              Else im not sure what else could be the issue.

              1 Reply Last reply
              1
              • M Offline
                M Offline
                Melkon
                wrote on 28 Jul 2020, 09:37 last edited by
                #7

                Okay, thank you very much!

                1 Reply Last reply
                0

                6/7

                28 Jul 2020, 08:41

                • Login

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