Mising KGlobalSettings::smallFont()

Alex Merry huntedhacker at tiscali.co.uk
Sun Jun 17 21:46:58 BST 2007


On Sunday 17 Jun 2007, Boyd Stephen Smith Jr. wrote:
> On Saturday 16 June 2007, Alex Merry <huntedhacker at tiscali.co.uk>
> wrote
>
> about 'Re: Mising KGlobalSettings::smallFont()':
> > On Saturday 16 Jun 2007, Thomas Zander wrote:
> > > On Friday 15 June 2007 18:58:25 Jaroslaw Staniek wrote:
> > > > static QFont KGlobalSettings::smallFont()
> > >
> > > I think it makes sense to have a 'smallest reasonable font', but
> > > the suggested method name doesn't show that it does that.
> > > Better think of a more matching name.
>
> QFont KGlobalSettings::minimizeFont(const QFont &)
>
> I like this because some fonts are smaller than other at a given
> "point size", but this method could take actual pixel size of the
> chosen font and current dpi into account.  It might also perform
> intelligent font face substitution if the original face was
> unavailable or inappropriate at small sizes.

I like the general idea, but surely you would be using this to make sure 
a font wasn't too small, not to make it as small as possible.

For example, with the original one, I assume the usual use case would be 
to compare the sizes of the font you were intending to use with the 
size of the QFont returned by smallFont().

So something like
QFont KGlobalSettings::ensureFontReadable(const QFont &)
would be better.  Although the name feels a little clumsy.  This would 
take a font, and if it was big enough, just return it straight away.  
If it was deemed to small to be legible, it would be increased to the 
minimum allowed size before being returned.

QFont myFancyFont = parseConfigFileFontSection();
myFancyFont = KGlobalSettings::ensureFontReadable(myFancyFont);
widget.setFont(myFancyFont);


Alex



-- 
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070617/c44215f6/attachment.sig>


More information about the kde-core-devel mailing list