freetype
[Top][All Lists]
Advanced

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

[Freetype] Clearing the cache?


From: jonathan . foster
Subject: [Freetype] Clearing the cache?
Date: Thu, 12 Sep 2002 14:43:31 +0100

Hi all,

I'm trying to figure out how to cleanly close a font.  The problem
is that I'm using sbit and cmap caches to optimize the rendering.
I can use FTC_Manager_Reset() to ensure that the FT_Face object is
closed.  However, if I reuse the FTC_FaceID for a different font,
then this could confuse the cache system.  Since my FTC_FaceIDs
are generated by allocating a structure with malloc(), this is
possible (although perhaps unlikely).

I can think of two alternative ways of fixing this:

1) Would it be possible to have a new API function, something like:

      void FTC_Manager_ResetFace(FTC_Manager manager,
                                 FTC_FaceID faceid);

   This call would remove all references to the specified faceid,
   including FT_Face and FT_Size objects, and all cached data.

2) FTC_Manager_Reset() could be extended (as the comment in the code
   suggests) to completely clear all the caches.  This isn't quite
   as good a solution, because it will remove cached glyphs from
   other fonts (slowing the system down when they have to be loaded
   again).  However, it may be much easier to implement, and doesn't
   require a new API function.  (I haven't looked through the FT2
   cache code in detail, so I don't know how tricky option 1 would
   be).

Or am I missing something here?

Thanks for a superb font engine.

Kind regards,

Jon Foster





reply via email to

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