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

QFontMetrics::width() gives incorrect width of text more than 2 characters like "1000" or "Hello" on Mac OS X in RTOL locale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.6.0
    • 4.5.1
    • GUI: Font handling
    • None
    • Mac OS X Tiger
      Mac OS X Leopard( 10.5.8 )
      Mac OS X Snow Leopard( 10.6 )
    • macOS
    • c0136ace31e5473493b2e366847968e30f7490a2

    Description

      Requirement : Mac OS X leopard
      Locale : Arabic/Hebrew

      FontMetrics::width() gives the incorrect the width of the text having more than 2 characters or digits on Mac OS X in RTOL locale.

      In my customized widget i am drawing the text at a particular location of the widget and trying to draw the bounding rectangle around it. For this i am asking to the QFontMetrics to give the width of the drawn text and based on thw width returned by QFontMetrics i am drawing the bounding rectangle around the drawn text.
      But text gets clipped as the width returned by the QFontMetrics is incorrect.

      Following are my observations on the values of the QFontMetrics::width() on Mac OS X
      1.in LTOR locale
      QFontMetrics::width("1000") returns 41 value
      QFontMetrics::width("900") returns 33 value
      QFontMetrics::width("90") returns 22 value

      2.in RTOL locale
      QFontMetrics::width("1000") returns 30 value
      QFontMetrics::width("900") returns 22 value
      QFontMetrics::width("90") returns 22 value

      To prove my point i have attached one sample application which contains customized widget to draw the the text containing more than 2 characters.

      In order to reproduce this issue please copy the qt_ar.qm file into sample.app/Contents/MacOS directory. Set the locale to Arabic and then launch the application.

      Attachments

        1. samplewithcustomizedwidget.zip
          14 kB
          Sanjay Mhasu Shelke

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              sanjayshelke Sanjay Mhasu Shelke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes