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. How to check whether a font is the requested font

How to check whether a font is the requested font

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.2k 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.
  • J Offline
    J Offline
    Jessica SnapGene
    wrote on last edited by
    #1

    I'm working on a project where we check whether a specific font is installed when running on Linux. We recently upgraded our Qt version from 5.9.6 to 5.15.1. With 5.9.6 we did:

    bool isFontInstalled() 
    {
      return QFont("Verdana").exactMatch();
    }
    

    Now, with 5.15.1, this returns false even when Verdana is installed. I've tried:

    bool isFontInstalled() 
    {
      QFontDatabase db;
      auto fontFromDB = db.font( "Verdana", "", 12 );
      return fontFromDB.exactMatch();
    }
    

    But this also returns false. I've checked a few other font families, QFont::exactMatch() always returns false. Is this a bug? Or is there some way to construct a font that will be considered an "exact match" for Verdana?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Jessica-SnapGene said in How to check whether a font is the requested font:

      Is this a bug?

      Maybe, search the bugtracker and create one if you think it's a bug. Don't forget a simple reproducable example in the bugreport.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jessica SnapGene
        wrote on last edited by
        #3

        I logged this: https://bugreports.qt.io/browse/QTBUG-87267

        Looks like it was a bug. I haven't confirmed whether or not it has been fixed, but there's a commit to 5.15 branch. I'll mark this topic solved.

        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