gnustep-dev
[Top][All Lists]
Advanced

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

Re: Caching all fonts


From: Fred Kiefer
Subject: Re: Caching all fonts
Date: Wed, 30 May 2001 03:07:52 +0200

Nicola Pero wrote:
> 
> 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.

> 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. Up to now we did not cache the font object itself. This is
rather small as it delegates most calls to a fontinfo object. This
fontinfo objects have already been cached for both our backends. So if
you select an font in the xgps backend once, the xfontstructure will be
created for that font and cached till the program ends.
The caching of the NSFont objects themself has not been added for speed
in the first place, it has been done to be closer to the specification
which says:

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

But this does not say that we have to keep the font forever in the
program. We could keep all allocated fonts in a cache that would not
retain them, and remove them from the cache, when deallocated. Checking
that cache everytime we need a new font.
This would only be helpfull, if we either drop the caching of fontinfo
obejects totally, or use a similar technic there.





reply via email to

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