Results 1 to 3 of 3

Thread: Fixing ugly rotated text

  1. #1
    Join Date
    Sep 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Fixing ugly rotated text

    I've seen a few threads on displaying rotated text in the past. I'm working on some proof of concept code and would like to draw text, rotated, with a halo effect on a QPainter. The end goal is to display this over GL rendered scene.

    The function calls and translations all work right, but the end result is... well, ugly. I'm seeing serious kerning issues, and 'floating' letters as I apply the rotation. I've done a lot of googling trying to find a better solution here, and was curious if anyone had seen and/or found a way to make this look decent. A few fonts look slightly better, but the general case is as seen in the attached images.

    I've tried setting random text hints, as well as converting the text to a path then rendering that. So far, the best option I've found is to create a QImage, render the text to the QImage, then blit the rotated QImage. But, this really seems like I'm doing something wrong...

    Is there a recommended way to draw text like this?

    Edit: This is Win7 with Qt 5.3.2, font in picture is Calibri (I believe).
    Attached Images Attached Images
    Last edited by fate; 4th September 2015 at 01:08.

  2. #2
    Join Date
    Aug 2013
    Posts
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Fixing ugly rotated text

    I would draw the text to an image, make a texture out of this, and then rotate the texture.

  3. The following user says thank you to kangaba for this useful post:

    fate (8th September 2015)

  4. #3
    Join Date
    Sep 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Fixing ugly rotated text

    I ended up keeping the texture approach.

    I create a single QImage texture large enough to fit max string lenght, then draw/clear for all text I'm displaying. With smoothing turned on, it's not overly slow, and gives a fairly decent visual.

Similar Threads

  1. Fixing a Qt application into a TAB
    By hitesh_sharma@satyam in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2012, 23:25
  2. Replies: 3
    Last Post: 28th April 2011, 15:35
  3. QGraphicsView, OpenGL & rotated text
    By anthon in forum Qt Programming
    Replies: 8
    Last Post: 5th December 2009, 18:05
  4. How draw a rotated text in a QPainterPath?
    By iw2nhl in forum Qt Programming
    Replies: 6
    Last Post: 17th August 2007, 19:55
  5. fixing my widget's palette
    By alanh in forum Qt Programming
    Replies: 2
    Last Post: 28th February 2006, 17:10

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.