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

Text position wrong when rendering non opaque text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 5.3.2
    • 4.8.4, 5.2.1, 5.3.0 Beta1, 5.3.1
    • GUI: Font handling
    • None
    • Win7
      visual studio 2012

    Description

      When rendering text and he font color aplha component is not 255, each character is aligned differently. This is not the case when rendering opaque text. I expect text positions not to change when using different colors.

      Attached is the result I get when executing the code below:

      QImage Image(100, 100, QImage::Format_RGB32);
      Image.fill(QColor(255,255,255,255));
      QPainter painter(&Image);

      QPen pen;
      //change 128 to 255 and text is rendered on a different position, "correctly"
      pen.setColor(QColor(0,0,0,128));
      pen.setWidth(1);
      painter.setPen(pen);

      QFont Font("Verdana");
      Font.setPointSize(10);
      painter.setFont(Font);

      QTextOption to;
      to.setAlignment(Qt::AlignLeft | Qt::AlignTop);
      painter.drawText(QRect(50, -5, 500, 20), "abcd", to);
      Image.save("C:
      bmp.BMP");

      Attachments

        1. bmp.BMP
          29 kB
        2. QtTextBug.cpp
          1.0 kB
        3. QtTextBug.png
          QtTextBug.png
          3 kB
        For Gerrit Dashboard: QTBUG-34148
        # Subject Branch Project Status CR V

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            thl Thomas Lammers
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes