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

Disable Anti Aliasing for QML Text Element

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.3.0
    • 5.0.0 Beta 1
    • None
    • Windows 8
      Qt 5 beta

    • 3a9b01127054901293b177e538eb8cfa3937e9fe

    Description

      I'm developing a game based on pixel art.
      It seems that the text element does not have an option to disable the anti aliasing, but QFont does.
      Do I went and modified the QQuickText class and included this line:
      d->font.setStyleStrategy(QFont::NoAntialias);

      right after this block:
      d->sourceFont = font;
      QFont oldFont = d->font;
      d->font = font;

      With this custom text element plus this line in QML:
      renderType: Text.NativeRendering

      I was able to display the text the way I wanted:
      http://purpleorangegames.com/images/gameScreenshot.png

      You can zoom in and see that it is not anti-aliased, I'm using Windows 8.

      Attachments

        1. gameScreenshot.png
          gameScreenshot.png
          88 kB
        2. setFont.txt
          0.8 kB
        For Gerrit Dashboard: QTBUG-27968
        # Subject Branch Project Status CR V

        Activity

          People

            mbrasser Michael Brasser
            tiagocc0 Tiago de Castro Carvalho
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes