Results 1 to 4 of 4

Thread: adjust Letter Spacing

  1. #1
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question adjust Letter Spacing

    I'm painting text through QPainter::drawText.
    How can I adjust the Letter-Spacing?
    (add additional space between the characters)

    QFont::setStretch doesn't work - as it stretches the whole character.

    I think it would be possible to draw one character after the other and calculate the position using QFontMetrics::leftBearing, QFontMetrics::rightBearing and QFontMetrics::width.

    But there must be a simpler solution!

    thanks, niko

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: adjust Letter Spacing

    In my experience, you will have to draw one character at a time.

  3. #3
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: adjust Letter Spacing


    sounds quite a bit complicated...
    especially multiline and so on....

    thanks

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

    Default Re: adjust Letter Spacing

    I think you should implement your own text layout implementation for Scribble. Alternatively you can use tabstops (positions for which you can set through QTextOption) to adjust spacing, but it might not look too good.

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.