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

QFontMetrics(F) API is formulated in QChar (should be char32_t)

XMLWordPrintable

    • 8
    • Foundation Sprint 141

      QChar cannot represent all Unicode characters (it's only 16 bit), but it unfortunately has a ctor from 32-bit values. The QFontEngine APIs for single characters take QChar, so they cannot be used to query non-BMP characters. I didn't check, but it would be fatal if the QChar overload silently accepted char32_t arguments.

      We should port the single-character functions from QChar to char32_t, and deprecate the QChar overloads. I found these, there may be more:

      • inFont() (can then be merged with inFontUcs4())
      • left/rightBearing()
      • horizontalAdvance(QChar)
      • boundingRect(QChar)

      See also QTBUG-125871 for an overarching theme.

      Found while fixing Clang 21 -Wcharacter-conversion warnings.

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

            mmutz Marc Mutz
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes