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

[REG 4.8.7->5.6.1] QFontMetricsF reports incorrect width for strings containing zero-width unicode characters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.2, 5.15.0 Beta1
    • 5.6.1, 5.14.1
    • GUI: Text handling
    • None
    • Ubuntu Linux 16.10.
    • 25677ec4b2957f7fd56618781dec28cb139f9df7 (qt/qtbase/5.14)

    Description

      Strings that contain sequences of ZWNJ (0x200c) or ZWSP (0x200b) cause QFontMetricsF to report boundingRects that do not match QPainter. In Qt 4 (4.8.7), the attached program outputs

      |.| QRectF(-24,-1237 444x1571)
      |..| QRectF(-24,-1237 444x1571)
      |...| QRectF(-24,-1237 444x1571)

      |*| QRectF(0,-1237 444x1571)
      |**| QRectF(0,-1237 444x1571)
      |***| QRectF(0,-1237 444x1571)

      which correctly reflects the fact that repeated ZWNJ and ZWSP do not add actual width to text. In Qt5 (5.6.1), however, the output is:

      |.| QRectF(0,-1237 814x1571)
      |..| QRectF(0,-1237 1184x1571)
      |...| QRectF(0,-1237 1554x1571)

      |*| QRectF(0,-1237 868x1571)
      |**| QRectF(0,-1237 1292x1571)
      |***| QRectF(0,-1237 1716x1571)

      This is not correct, and does not match how Qt renders text containing ZWNJ and ZWSP.

      Attachments

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

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            daw@caltech.edu Daniel Wagenaar
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes