Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.5.0, 5.5.1, 5.6.0
Description
I am trying to load two styles (Regular and Light) of the same font (Open Sans) into a QML application.
The two styles come via TrueType files, from OpenSans-Regular.ttf and OpenSans-Light.ttf, which I load one after another (in the example I use FontLoader, but using QFontDatabase::addApplicationFont in C++ has the same effect).
After loading the font, I'm trying to specify the style to use from QML.
For Light:
font.family: "Open Sans"
font.weight: Font.Light
For Regular:
font.family: "Open Sans"
font.weight: Font.Normal
However, the font.weight statements are ignored by the font rendering. Instead of style used depends on the order the .ttf files are loaded:
If I load OpenSans-Regular.ttf first, all text items use regular/normal, when I load OpenSans-Light.ttf first, all items use light font.
This only affects iOS, on OS X the fonts are rendered differently, as specified in QML.
Example with font files attached.