gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Caching all fonts


From: Nicola Pero
Subject: Re: Caching all fonts
Date: Wed, 30 May 2001 11:57:30 +0100 (BST)

> > I see we are now never releasing any NSFont object, but
> > caching/uniquing them using a global never-released dictionary.
> > 
> > Shall we discuss that a little ?
> > 
> I agree that this is something to discuss. But we should first make
> clear what the old state, before my changes to which you refere, where.

Yep - thanks for pointing that out.


> > Does it make the font panel faster ?  I couldn't notice any difference
> > between fonts already accessed and new fonts, but I am on a fast
> > machine.
> 
> 
> Of course not, as most of the font has already been cached in the old
> version. 

Sorry - a misunderstanding - I mean, using the *new* version, when I move
around in the font panel, I would expect to see a difference in speed
between fonts which come from cache (because I access them for the second
time) and fonts which are created at the moment (which I suppose it's the
case because I access them for the first time).  I did not see any
difference.


> "These methods check for an existing font object with the specified
> characteristics, returning it if there is one."

Yes - this actually makes a lot of sense.

I agree with you that the backends should not be caching the font info
object at all, while the gui should be caching in some efficient way the
NSFont object (which implicitly caches the backend fontinfo object),
putting the NSFont objects into a table which does not retain them, and
removing them from the table when they are deallocated.  That would mean
the backend does not need to worry about caching the fontinfos, as the gui
does automatically cache the NSFonts, in the same way, for all backends.  
NSFonts (and this implicitly means xfontinfos) would be cached only for
their lifetime, and not forever.

Then we could add a user defaults `GSCacheFontsForever' - by setting this
to YES, the gui would RETAINs all NSFont objects when they are put into
the table.  That means they would never be deallocated, and cached and
reused forever, precisely as we do now.  If people ever found that in that
way performance is so better (or if they need this in special
applications), they can switch behaviour (perhaps using different
behaviours for different applications) by just setting the user default.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]