freetype
[Top][All Lists]
Advanced

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

Re: [ft] Open files


From: David Turner
Subject: Re: [ft] Open files
Date: Thu, 28 Sep 2006 01:13:57 +0200

Hello Steve,

On Wed, 27 Sep 2006 15:50:44 -0700, "Steve Hales" <address@hidden> said:
> Hi freetypers,
> 
> I'm using FT_New_Face() with pathnames, to manage faces. It seems though,
> that until I call FT_Done_Face() the file is left open.
>
Yes, this is on purpose.
 
> Looking through the code for FT_New_Face(), this seems to be true. My
> platform has a limited number of file descriptors, and I've got about 20
> fonts that I want to have access to, so this means I'm holding onto 20
> open files.
> 
A better option would be to limit the number of concurrent opened FT_Face
you have, for example by using the cache sub-system with FTC_Manager_LookupFace
and/or FTC_Manager_LookupSize to get FT_Face objects on demand

Remember that each FT_Face object can eat up to 10-30 KB of heap memory,
depending on font format and content. So limiting their numbers is always
a good idea.

> Is there anyway to tell freetype to close these files and reopen at will
> when pulling out the glyphs? I'm willing to take the hit for that.
> 
There is no way to tell FreeType to explicitely close the file, however,
you can provide your own i/o routines by writing a custom FT_Stream record
that you'll pass to FT_Open_Face when creating the FT_Face

the corresponding routine should do all the on-the-fly shufling required
by your environment, and this will be totally transparent to the font engine.

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)





reply via email to

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