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

Text does not display correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.8.0
    • GUI: OpenGL
    • None
    • Windows 7, ATI

    Description

      Font not created properly on QGLWidget when using drawText because it creates a cache that comes from a QImage upload and the QImage is padded to the DWORD but the GL Texture doesn't take the padding into account.

      See:
      void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
      if (ctx->d_ptr->workaround_brokenAlphaTexSubImage)

      { for (int i = 0; i < maskHeight; ++i) glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); }

      else

      { glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits()); }

      In my case, a character '0' was padded to 12 bytes per line, for a total of 8 lines, but only took up the first 10 bytes per line. When calling glTexSubImage2D, the maskWidth was therefore inconsistent with the data sent. Since Windows puts 0xCD on uninitialized memory, I was seeing some gray pixels and each line was offset by 2 pixels.

      Forcing the ctx->d_ptr->workaround_brokenAlphaTexSubImage flag to TRUE to enable the workaround fixes the issue.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            mgo Mgo Imamedjian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes