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

Rendering QStaticText with a scaled painter using a type 1 font on Windows draws the text in the wrong place

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.0
    • GUI: Text handling
    • None
    • Windows

    Description

      Try this on Windows, assuming font is a QFont and device a QPaintDevice:

      QPainter painter(device);
      QTransform matrix(0.5, 0, 0, 0.5, 0, 0);
      painter.setWorldTransform(matrix);
      QStaticText staticText("test");
      painter.drawStaticText(QPoint(300, 300), staticText);

      If font is a TrueType font, it works correctly. Change font to a type 1 font and it draws the text in the wrong place.

      This seems to be caused by commit 243535036078fec14bc460ccf41708ff14878797 which was made to fix QTBUG-19086. Previously QRasterPaintEngine::drawStaticTextItem would only use the font's pixel size to determine whether transformations should be allowed. Now it calls supportsTransformation(QFontEngine*), which also includes the Windows-specific logic that used to be specific to drawTextItem. But when a similar test is done higher up in QPainter::drawStaticText, it calls the weaker version of supportsTransformation that only uses the pixel size and the matrix, and so doesn't include this Windows-only special case. This asymmetry means that in the case of type 1 fonts (and probably other cases) the positioning ends up incorrect.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            jlarcombe James Larcombe
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes