PDA

View Full Version : adjust Letter Spacing



niko
15th August 2006, 17:53
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

e8johan
16th August 2006, 08:37
In my experience, you will have to draw one character at a time.

niko
16th August 2006, 08:46
:(
sounds quite a bit complicated...
especially multiline and so on....

thanks

wysota
16th August 2006, 10:05
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.