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

Font glyphs rendering incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P1: Critical
    • None
    • 4.8.0
    • GUI: Font handling
    • None
    • Windows 7 x64
      Windows 7 x86
      Microsoft Visual C++ express 2010
      MinGW32 4.4.0 toolchain

    Description

      Qt configured with these options: "-no-qt3support -opensource -graphicssystem opengl -no-dsp -no-vcproj -mp"
      Just open LineEdits example program, you will see the incorrectly rendered glyphs, there're always some pixels under each line of text.

      But if not use -graphicssystem opengl option, everything works well.

      Well this bug can also be reproducible by drawing text on a QGLWidger. For example, compile a version without -graphicssystem opengl option, then launch OpenGL-2D Painting program from qtDemo, you will see the same problem.

      Here's the code for testing

      #include <QtGui>
      #include <QGLWidget>
      
      class GLWidget:public QGLWidget
      {
      protected:
          void paintEvent(QPaintEvent *event)
          {
              QPainter painter(this);
              QString text1 = "ABCDE abcde\n";
              QString text2 = "\nABCDE abcde";
              QRect rect=this->rect();
              QFont font1("Arial",30);
              QFont font2("Tahoma");
      
              painter.begin(this);
              painter.setFont(font1);
              painter.drawText(rect, Qt::AlignCenter, text1);
              painter.setFont(font2);
              painter.drawText(rect, Qt::AlignCenter, text2);
              painter.end();
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          GLWidget w;
          w.show();
          app.exec();
      
          return 0;
      }
      

      Then I try to change the point size of font. Then I found that, you will see the different result when the point size larger than 47. See picture "new".

      Here's the code.

      #include <QtGui>
      #include <QGLWidget>
      
      class GLWidget:public QGLWidget
      {
      protected:
          void paintEvent(QPaintEvent *event)
          {
              QPainter painter(this);
              QString text1 = "ABCDE abcde\n";
              QString text2 = "\nABCDE abcde";
              QRect rect=this->rect();
              QFont font1("Tahoma",47);
              QFont font2("Tahoma",48);
      
              painter.begin(this);
              painter.setFont(font1);
              painter.drawText(rect, Qt::AlignCenter, text1);
              painter.setFont(font2);
              painter.drawText(rect, Qt::AlignCenter, text2);
              painter.end();
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          GLWidget w;
          w.show();
          app.exec();
      
          return 0;
      }
      
      

      Now I have a "raster" version of qt, and try glwidget program, then I got the same result. See picture "rasterResult". Set graphicssystem option to raster could not fix this problem for me.

      I tried this program on another machine, it's a win7 x86 system. The dots gone, but there're still some problem. I uploaded a picture, so you can see the different between size 47 and 48. With 48 point size, smooth seems disabled.

      Attachments

        1. IncorrectlyGlyphsRendering.png
          IncorrectlyGlyphsRendering.png
          15 kB
        2. IncorrectlyGlyphsRendering.png
          IncorrectlyGlyphsRendering.png
          15 kB
        3. IncorrectlyGlyphsRendering1.png
          IncorrectlyGlyphsRendering1.png
          60 kB
        4. IncorrectlyGlyphsRendering2.png
          IncorrectlyGlyphsRendering2.png
          44 kB
        5. GLWidgte.png
          GLWidgte.png
          51 kB
        6. StillThere.png
          StillThere.png
          22 kB
        7. new.png
          new.png
          37 kB
        8. test1.png
          test1.png
          38 kB
        9. rasterResult.png
          rasterResult.png
          48 kB
        10. AnotherMachine.png
          AnotherMachine.png
          43 kB
        11. {B4394CCC-C12F-451A-A0E6-537BD1FFD0B0}.png
          {B4394CCC-C12F-451A-A0E6-537BD1FFD0B0}.png
          3 kB
        12. {DF219A14-12C1-459A-B235-70BBE8119FB0}.png
          {DF219A14-12C1-459A-B235-70BBE8119FB0}.png
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            hanrai Lei Fan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes