Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, February 2007
setting font spacing


Message 1 in thread

Is it possible to change the spacing of the letters drawn with
QPainter::drawText?

-- 
 [ signature omitted ] 

Message 2 in thread

 	it's a bit hairy.

 	QFontMetrics is going to contain most of what you need.  looks 
like maybe making your own QFont/QFontMetrics subclasses would let you 
override QFontMetrics::leading() (inter-line-spacing), e.g., if that's 
what you want.

 	inter-letter-spacing ("kerning") is rather more work.  fonts 
already have a notion of how close to an "i" another given letter is 
allowed to be, e.g.  to override that, it seems you'd basically have to 
handle it on a character-by-character basis -- look at 
QFontMetrics::width() for how kerning is basically a composite of base 
character width and its left- and right-bearings.

 	now, whether or not you can subclass those things and actually 
paint glyphs at a reasonable speed, i'm not sure.  but QFontMetrics is the 
place to start, at least.


 	good luck,

 	d
 	.

On Thu, 15 Feb 2007, Patrick Stinson wrote:

> Is it possible to change the spacing of the letters drawn with
> QPainter::drawText?
>
> -- 
> Patrick Kidd Stinson
> http://www.patrickkidd.com/
> http://pkaudio.sourceforge.net/
> http://pksampler.sourceforge.net/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ]