PDA

View Full Version : QTextDocument - line spacing



mazurekwrc
6th March 2009, 13:59
Hi, I use QGraphicsTextItem to show QTextDocument by using setDocument function, could you tell how to change line spacing, because i need to decrease it.

Lykurg
6th March 2009, 15:22
You could use setHtml with modified CSS line-height attribute. Or have a look if rtf has a similar option. (Or whatever you have in your QTextDocument. Sorry but my crystal ball is still in repair...)

mazurekwrc
11th March 2009, 11:01
line-height attribute isn't supported by Qt
http://doc.trolltech.com/4.5/stylesheet-reference.html#list-of-properties
so I can't do it by this way...

Lykurg
11th March 2009, 12:27
Jepp, sorry, I was misreading the information under QTextDocument::defaultStyleSheet
The style sheet needs to be compliant to CSS 2.1 syntax.
Since only the syntax is meant, you have to go the harder way using QTextLayout yourself. You might want have a look at http://doc.trolltech.com/qq/qq24-textlayouts.html.

munchhausen
24th February 2011, 20:43
Is there a posibility to adjust the line spacing in the font metrics?
I use ttf font with Qt 4.5 on a linux system.

Thanks for help

munchhausen
24th February 2011, 23:23
I use QGraphicsTextItem with Qt4.5. As act of desperation I changed font properties of true type font with help of fontforge.

hhead ascent offset
hhead descent offset
hhead line gap

It works.