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

Overlapping words when drawing text with large font in QPainter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 5.15.5
    • 5.15
    • GUI: Font handling
    • None
    • Linux/X11

      When rendering a font with a very large font size, word spacing is not correctly applied and the characters will overlap.

      The following script demonstrates the issue:

        QImage im = QImage( 2000, 1500, QImage::Format_ARGB32 );
        im.fill( Qt::transparent );
      
        QPainter painter( &im );
      
        QFont font;
        font.setPointSizeF( 1600 );
        painter.setFont( font );
        painter.setPen( QPen( Qt::black ) );
        painter.drawText( 0, 1500, "a test" );
      
        painter.end();
      
        QPixmap pm = QPixmap::fromImage( im );
        QLabel label;
        label.setPixmap( pm );
        label.show();
      

      At font size 1200 point the spacing is correct between the "a" and "t" characters, but at 1600 points the spacing gets mangled and the characters start to overlap

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

            esabraha Eskil Abrahamsen Blomfeldt
            ndawson Nyall Dawson
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes