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

Creating a QFont uses faux bold and italic, instead of intended font

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.12.0
    • GUI: Font handling
    • None
    • Kubuntu 18.04, Qt 5.9.5
      PyQt from pip, 5.12 (maybe 5.11 too)
    • Linux/X11

    Description

      If I create a QFont and initialize it via fromString() or setFamily+setBold+setItalic, then widget.setFont(font), then the widgets renders the "regular" font file, with faux bold/italic applied if those attributes are true.

      The most obvious errors:

      • "light" fonts (eg. Source Sans Pro Light) are not thin.
      • "italic" (eg. Lato Italic) is faux-oblique instead.
      • "bold" fonts are blurry (less obvious).

      If I pass the QFont object through QFontDialog::getFont() and click OK without any modifications, any widgets using the font use the "real" font file.

      The errors are fixed:

      • "light" fonts are thin.
      • "italic" is actually italic.
      • "bold" fonts are not blurry.

      I observed this bug systemwide in Kubuntu:

      • KDE lock screen uses faux oblique when displaying caps-lock or wrong-password
      • Dolphin uses faux oblique for symlinks

      I also observed in PyQt. I do not have a C++ test program at the moment.

      In PyQt from Pip:

      • QTableView "selected headers" use faux bold (Fusion style).
      • Calling QFontDialog once on a font populated by fromString() or setFamily() returns a inequal font.
        • Calling QFontDialog on a QFontDialog-obtained font returns an equal font. QFontDialog is idempotent.
      • If I pass a QFont (not fromString()) to a QFontDialog, it will mistakenly highlight the Oblique option instead of Book.
        • If I open a font dialog in KDE or PyQt, and switch from DejaVu Math TeX Gyre (regular only) to DejaVu Sans, I also get Oblique.
        • If I pass a QFont from a QFontDialog into a second QFontDialog, it highlights the correct Book option.

       This bug seems similar to https://bugreports.qt.io/browse/QTBUG-43400 from years ago. That bug didn't mention that QFontDialog returns a non-broken QFont.

      Attachments

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              anontt Anonymous (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes