Adding KFontUtils to kdeui

Albert Astals Cid aacid at kde.org
Mon May 4 20:55:06 BST 2009


A Dilluns, 4 de maig de 2009, Christoph Feck va escriure:
> Am Monday 04 May 2009 20:29:07 schrieb Albert Astals Cid:
> > A Dilluns, 4 de maig de 2009, Christoph Feck va escriure:
> > > KFontMetrics sounds like it is a subclass of QFontMetrics, not sure if
> > > it is wise to use this name...
> >
> > You mean like KColorDialog, KShortcut, KButtonGroup, KMessageBox,
> > KPixmapCache, etc?
>
> No, I mean namespace vs. (sub)class.
>
> > > Am Saturday 02 May 2009 15:50:02 schrieb Albert Astals Cid:
> > > > The QPainter is needed because from what my experience show rendering
> > > > on a QPrinter yields different results than rendering on a QImage.
> > > >
> > > > Also it's not on QFontMetrics because AFAIR QFontMetrics works on
> > > > QFonts only so it can't have that knowledge.
> > >
> > > You can create a font metrics object suited for any device using the
> > > correct constructor.
> >
> > No, the QFontMetrics constructor that accepts a QPaintDevice does not
> > render on the device so the results are still just a guess, not the real
> > thing.
>
> Erm, that either sounds like a Qt bug, or I haven't understood the
> description. Of course it does not render, but the metrics is supposed to
> be the same as if you render on that device.

It's not a Qt bug, as far as i understand QFontMetrics calculates how much the 
font is going to use based on font information, given the same font you should 
get the same value in windows, mac, linux. On the other hand, when you render 
on a QImage you get freetype (or harfbuzz not sure) on linux and probably a 
different render for Mac and for Windows, and even the used geometry is *very* 
close, it's usually off by 1 or 2 pixels with what QFontMetrics returns 
because on how hinting and other weird font things work.

Please if someone with more Qt/font rendering knowledge thinks i'm wrong, just 
tell, but this is the behaviour i've been seeing since Qt3 times and afair it 
was always justified this way.

>
> > Anyway it's obvious i'm too late on this, let's just wait for KDE 4.4
>
> Maybe. I do not think I am in the position to stop you :) I have to agree
> with Parker that the current suggested patch does not feel "Qt way",
> though.

Well, i've done all you both have suggested, so don't know what more you want.

Anyway, let's stop this, makes no sense keep discussing for something that 
maybe we'll never ship.

Albert

>
> > Albert
> >
> > > Christoph Feck (kdepepo)






More information about the kde-core-devel mailing list