Adding KFontUtils to kdeui

Jeremy Whiting jpwhiting at kde.org
Tue Jan 4 16:23:38 GMT 2011


On Mon, Jan 3, 2011 at 1:03 PM, Christoph Feck <christoph at maxiom.de> wrote:

> I was asked to restate my position on this thread.
>
> 1. The namespace should be named KFontUtils as was the original intention.
> This is in line with KColorUtils and avoids the confusion with
> QFontMetrics. I
> suggest to move it to kdeui/fonts/kfontutils.{cpp|h}.
>

I agree, ok will do.


>
> 2. I share Parkers concern that passing a QPainter to the function is
> wrong.
> The reason given was that Qt has a bug where creating a QFont or
> QFontMetrics object for a specific paint device does not yield the same
> metrics as when using a QPainter for that paint device (bug number?). Qt
> bugs
> should not be reflected in the design decisions of an API. I don't have the
> patch at hand right now to check which name we used, but I suggest the
> signature to be KFontUtils::maxPointSizeF(const QFont &font, const QSizeF
> &size, const QString &text).
>

As Albert stated in his last message on the previous thread:

"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."

So change the namespace and put into kdelibs/kdeui/fonts/ ?

Best Regards,
Jeremy

>
> Christoph Feck (kdepepo)
>
> On Saturday 01 January 2011 20:31:55 Albert Astals Cid wrote:
> > A Dimarts, 28 de desembre de 2010, Jeremy Whiting va escriure:
> > > Albert Astals Cid <aacid <at> kde.org> writes:
> > > > > > 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, Albert, Others,
> > >
> > > I'd like to see this happen in the 4.7 timeframe (sooner than later)
> > > especially because it will help kdeedu/libkdeedu/kdeeduui disappear,
> > > which removes a dependency of a couple of kdeedu applications prior to
> > > the migration to git.
> > >
> > > Thoughts about the last patches sent by Albert? otherwise I suggest we
> > > move this class into kdelibs/kdeui where all kde applications can
> > > benefit from it.
> >
> > I'm all for it, not sure if i fixed all of Christoph and Parker concerns
> > though.
> >
> > Albert
> >
> > > Best Regards,
> > > Jeremy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110104/dc47dc82/attachment.htm>


More information about the kde-core-devel mailing list