PDA

View Full Version : QFontMetrics::leading() returns negative value.



JantarManter
19th May 2010, 14:45
Hi,

I though I understood what linespacing, leading and height meant, but I guess I still need to learn more. Following code returns leading() as a negative number.




QPainter p;
p.begin(&pr);

qDebug() << p.fontMetrics().lineSpacing() << p.fontMetrics().height() << p.fontMetrics().leading();

Output:
14 15 -1


Obviously then, when my program prints on Cups-PDF printer using QPainter, the output doesn't look right. I tried this with at least two different fonts (DejaVu Sans and Trebuchet MS).

Rest of my application looks normal, so I conclude my code isn't quite correct. Any ideas what could I be missing?

Thanks