Results 1 to 14 of 14

Thread: Drawing antialiased text on Windows very slow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Drawing antialiased text on Windows very slow

    Try this (You may have to adjust the font name). Is it very unacceptable?
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2007
    Posts
    9

    Default Re: Drawing antialiased text on Windows very slow

    Your example works fine, but it draws only one word. Just change the source a little bit to draw a little bit more and you'll see the difference.
    I've made the font a little bit smaller and replaced
    Qt Code:
    1. path.addText(0, 96, fnt, txt);
    To copy to clipboard, switch view to plain text mode 
    with
    Qt Code:
    1. QStringList lines = txt.split("\n");
    2. QFontMetrics fontMetrics(fnt);
    3. int lineHeight = fontMetrics.height();
    4. int y = 0;
    5. foreach(QString line, lines)
    6. {
    7. path.addText(0, y, fnt, line);
    8. y += lineHeight;
    9. }
    To copy to clipboard, switch view to plain text mode 
    Use a static color for the brush (otherwise the difference is not so big...). Then let the program draw 6 or more lines of text on Linux and on Windows. On Windows it needs a few seconds. Because my application often has to draw outlined text, I need some faster solution although it is drawn once on a QPixmap. Thanks for trying to help even though I still have no solution.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Drawing antialiased text on Windows very slow

    I still think you shouldn't use a painter path at all. It's just unreliable for objects where you can't estimate their complexity upfront. And if you do insist on using it - do it once and try to keep the number of nodes in it as small as possible.

  4. #4
    Join Date
    Jan 2007
    Posts
    9

    Default Re: Drawing antialiased text on Windows very slow

    I don't care whether I use a painter path or not. I just need to draw outlined text in an acceptable time.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Replies: 2
    Last Post: 23rd July 2012, 08:42
  3. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  4. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  5. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30

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
  •  
Qt is a trademark of The Qt Company.