Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116223

Feature Request - Move Existing Code to Aid Font Determination

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.15.10
    • GUI: Font handling
    • None
    • Linux/X11, macOS, Windows

    Description

      Supporting a Qt-based project, I ran into a problem with font calls where code with explicit font names was being utilized on different platforms. Not all platforms have the same fonts installed and errors/warnings were returned.

      Also, QFontDatabase::systemFont(QFontDatabase::FixedFont) on a platform with bad Qt configuration may result in an erroneous font being returned. (Note, I found a handful of QTBUG reports describing similar situation).

      Unfortunately, the web is littered with works-for-me code. Finding a robust code solution to identify any fixed pitch font was quite difficult. Each offered solution involved using a string literal to identify the family, include the font as an app resource, or be dependent on Qt configuration.

      My web searches lead me to the Character Map Example. Playing with that code, I was struck by the elegance of the QFontCombo control. It seemed that an easy solution for programmatically finding a fixed font already existed within the sources for this control.

      Unfortunately, the filtering mechanism employed by QFontCombo relies on static functions declared only in qfontcombo.cpp and not exposed by qfontcombo.h (see qfontcombo.cpp:19 - writingSystemFromScript and qfontcombo.cpp:89 - writingSystemFromLocale).

      Feature request is to move some of the font information/support mechanisms in the QFontCombo into QFontDatabase. For example, determining the current QFontDatabase::writingsystem from a user's locale should be an extension of font handling rather than a GUI control function.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            digifuzzy Scott Furry
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes