Results 1 to 3 of 3

Thread: Turn off Smoothing/AntiAliasing for my app (Win/Lin)

  1. #1
    Join Date
    Apr 2015
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Turn off Smoothing/AntiAliasing for my app (Win/Lin)

    Hi guys in this forum,

    first i am rather beginner with Qt, but my question will require rather in-depth knowledge, therefore I didn't choose the beginners section.

    My situation: I am currently using the QPainter.drawText function on a QImage. The QImage is then simply saved into a .bmp file. So far so good.

    Challenge:
    Currently a saved QImage looks like this (please click to see in proper size):
    Screenshot_F.png

    But I want it to be displayed "unchanged" and pixel-exact, like this:
    Screenshot_T.png

    You might ask yourself now how I got the proper result I want? Well there is 2 answers to that depending on the OS.
    Windows: Simply switching off ClearType completely (with a free app called ClearType switch; saves time instead of you doing the work with the registry)
    Linux(in my case CentOS): Switching off Smoothing etc right here:
    Screenshot_S.jpg

    I need to know how to use Qt in order to tell my app to NOT use those Smoothing, AntiAlias, Subpixel or Hinting Features at all.
    The global settings as mentioned above are not usable, as I need my app to run anywhere without having to have admin-rights.
    I did try things like

    CustomFont.setStyleStrategy(QFont::NoAntialias);
    CustomFont.setStyleStrategy(QFont::PreferBitmap);
    CustomFont.setStyleStrategy(QFont::NoSubpixelAntia lias);
    CustomFont.setHintingPreference(QFont::PreferNoHin ting);
    CustomPainter.setRenderHint(QPainter::Antialiasing , false);
    CustomPainter.setRenderHint(QPainter::HighQualityA ntialiasing, false);

    they didn't help at all.

    I am quite deperate to find a solution, appreciate any help on this.

    Best regards

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Turn off Smoothing/AntiAliasing for my app (Win/Lin)

    This works fine on my Linux system:
    Qt Code:
    1. QImage my_image(/* ... */);
    2. {
    3. QPainter p(&my_image);
    4. QFont font(/* ... */);
    5. font.setStyleStrategy(QFont::NoAntialias);
    6. p.setFont(font);
    7. p.drawText(/* ... */);
    8. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Apr 2015
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Turn off Smoothing/AntiAliasing for my app (Win/Lin)

    Ok. Well for me setStyleStrategy doesn't do any difference to it, particularly I am talking about small Pointsizes, such as 7,8,9.

    Anyone else some advice?

Similar Threads

  1. Replies: 5
    Last Post: 10th January 2014, 16:20
  2. QSvgRenderer antialiasing
    By jonks in forum Qt Programming
    Replies: 4
    Last Post: 19th July 2013, 09:39
  3. Best AntiAliasing?
    By beni46 in forum Qwt
    Replies: 2
    Last Post: 2nd February 2010, 13:28
  4. QImage antialiasing
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 19:37
  5. Font not Antialiasing
    By ChasW in forum Qt Programming
    Replies: 6
    Last Post: 21st January 2007, 18:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.