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. missing font family

missing font family

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 114 Views 1 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.
  • C Offline
    C Offline
    cuijg
    wrote last edited by
    #1

    warnning: qt.qpa.fonts: Populating font family aliases took 215 ms. Replace uses of missing font family "DIN-Medium" with one that exists to avoid this cost.

    then, i do this:
    int font_id = QFontDatabase::addApplicationFont(":/font/DIN-Medium.ttf");
    if (font_id != -1) {
    QString font_family = QFontDatabase::applicationFontFamilies(font_id).at(0);
    QFont::insertSubstitution("DIN-Medium", font_family);
    }
    However, it still reports an warnning.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      Do you mean you get the same warning ?
      When are you doing your font adding ?
      Which version of Qt are you using ?
      On which OS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • EskilE Offline
        EskilE Offline
        Eskil
        wrote last edited by
        #3

        The font family substitutes are only queried if the requested family does not exist, which is unknown as long as the population step has not happened. So that mechanism cannot be used to avoid the cost of populating aliases unfortunately, although you should end up resolving the correct font with this substitution in place.

        If you really want to get rid of the extra cost, then you could store the result of applicationFontFamilies() somewhere central and query that instead of hardcoding the "DIN-Medium" name. But note that this is a one-time 215 ms cost. The aliases are cached in the database once they have been resolved.

        1 Reply Last reply
        3

        • Login

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