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

iOS: Font weight ignored when loading styles from multiple files

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.5.0, 5.5.1, 5.6.0
    • QPA
    • iOS/tvOS/watchOS

    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.

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            frank.osterfeld Frank Osterfeld
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes