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

Fontconfig database allows multiple fonts for the same weight

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.0.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      Fontconfig has 11 font weights defined:
      http://cgit.freedesktop.org/fontconfig/tree/fontconfig/fontconfig.h#n126

      While Qt only has 5:
      http://qt.gitorious.org/qt/qt/blobs/5.0/src/gui/text/qfont.h#line103

      And so getFCWeight maps FC weights to Qt weights:
      http://qt.gitorious.org/qt/qt/blobs/5.0/src/gui/text/qfontdatabase_x11.cpp#line729

      Problem is that granularity is lost with that mapping, so if two fonts, that only differ with weight, are added, there's no way of telling which of them will be selected.

      The Ubuntu Font Family ships both a Normal and a Medium of its font, both of which end up to be QFont::Normal. Unfortunately for some reason the Medium one has preference over the Normal one, so all Qt apps end up using Medium as their default.

      While solving https://bugreports.qt-project.org/browse/QTBUG-25814 would help our particular issue, it wouldn't solve the underlying problem.

      IMO the database should drop duplicates, keeping only the closest possible mapping. I.e. if there's a Normal and a Medium, only the Normal would be available.

        Attachments

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

          Activity

            People

            Assignee:
            esabraha Eskil Abrahamsen Blomfeldt
            Reporter:
            saviq MichaƂ Sawicz
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes