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

Baseline alignment offset when text has fallback fonts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.8.0 FF
    • 6.8.0 FF
    • GUI: Text handling
    • None
    • All
    • bf7ed10ce (dev)

      Run the following code on Windows:

      import QtQuick
      import QtQuick.Window
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle {
              id: alignItem
              x: 50
              y: 100
              width: 400
              height: 1
              color: "blue"
          }
      
          Text {
              id: textItem
              textFormat: Text.RichText
              font.family: "Arial Unicode MS"
              font.pixelSize: 50
      
              text: "a&#29340;&#2339;<span style=\"font-size: 25px\">a&#29340;&#2339;</span><span style=\"font-size: 10px\">a&#29340;&#2339;</span>"
      
              anchors.baseline: alignItem.top
              anchors.left: alignItem.left
          }
      }
      

      The blue line cuts through the letters instead of aligning to the actual baseline of the text. Using StyledText (with <font size=..> instead) this works as expected. Also, if you replace the text with only e.g. the letter 'a' (so that only a single font is used), it also aligns perfectly.

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

            esabraha Eskil Abrahamsen Blomfeldt
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes