PDA

View Full Version : QFont setFixedPitch



steno
27th August 2010, 21:47
Setting setFixedPitch to true doesn’t seem to work with Dejavu sans. Is this allowed? The following code doesn’t yeild the same rectangles for the given text. To me if you set fixed pitch to true, those rectangles should be the same. Am I wrong here?



QFont dejavu("DejaVu Sans");
dejavu.setKerning(false);
dejavu.setFixedPitch(true);
QFontMetrics fm(dejaVu);
QRect r1 = fm.boundingRect("Test ");
QRect r2 = fm.boundingRect("Test0");

Urthas
28th August 2010, 01:24
Is this copy-paste? It runs?

steno
30th August 2010, 16:55
Yes that code runs. Of course you have to add some stuff for it to be complete.