Adding KFontUtils to kdeui

Christoph Feck christoph at maxiom.de
Fri May 1 19:24:43 BST 2009


Am Friday 01 May 2009 16:25:42 schrieb Albert Astals Cid:
> The rational of this helper method is that QFontMetrics is a good try but
> it really fails when you need pixel perfection.

Hm, if your aim is pixel perfection, you really should return a qreal here, as 
with high DPI displays the difference between a 10 pt and an 11 pt font can 
be quite big.

The return value documentation says "biggest", the description says "optimal". 

As for the name, fontSize() sounds like an attribute getter, it should reflect 
the fact that it computes the largest possible font size, maybe call it 
adaptFontSize() to reflect the behaviour that it changes the size of the 
QPainter's font?

Other than that, this function is surely useful, maybe even in KMessageBox.

> Since the code is small and already used in lots of places, Allen agreed i
> can commit it to kdelibs on Monday if noone objects.

Not sure how the freeze dates apply here...

Christoph Feck (kdepepo)




More information about the kde-core-devel mailing list