Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.0.0
-
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.