Saviq: thanks for finding the Qt part.  Things that may be useful in
reaching a decision:  Truetype defines a weight scale; which is
{100,200,300,400,500,600,700,800,900}; (plus other flags); these can be
seen with:

  (cd /usr/share/fonts/truetype/ubuntu-font-family/; for i in *.ttf ; do
echo -ne "$i\t:"; showttf $i | grep -i Weight | xargs echo ; done)

This TTF scale is the source for virtually all weights in use (as
virtually all fonts are sourced from TTF/OTF containers these days).
These are suffering from a double-remapping + double discard.  Other
people's handling of the mapping are; for Google Web Fonts (documented
per Dave Crossland) on:

  https://bugs.launchpad.net/ubuntu-font-family/+bug/730912/comments/2

Probably the most useful recommendation on the handling of mapping is
from the CSS specification;

  http://www.w3.org/TR/CSS21/fonts.html#propdef-font-weight
  "…association of other weights within a family to the numerical weight values 
is intended only to preserve the ordering of darkness within that family."

and which provides the recommended remapping algorithm in text form.
This initially maps a Medium back to 500 (if available) and a Bold to
700 (if available).  and uses other logic to fill outwards from those
reference points.  Given QML<->CSS and the significance of familiarity
with HTML/CSS (and exposure/testing) that it has likely had, it might be
reasonable to transpose/implement this algorithm too.

TTF weights {300,400,500,700}.  FC weights {50,80,100,200}.  Ideal Qt
output {25,50,63,75}

(Rule of thumb would seem to be ~0.125 of TTF value, or ~0.63 of FC
value for the two important weights Regular and Medium).

The idea way might be to have would be perhaps to have Qt's
getFCWeight() reverse the bucket logic of FcFreeTypeQueryFace() (which
returns discreet enums, not an integer, nor the raw 'os2->usWeightClass'
directly), and then apply the CSS algorithm to the untransformed result.
This should be fairly robust.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/744812

Title:
  FontConfig/Qt stack choke on Ubuntu Medium font meta-data (No medium
  in Inkscape and too bold in Qt apps)

To manage notifications about this bug go to:
https://bugs.launchpad.net/linuxlibertine/+bug/744812/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to