David Turner <[EMAIL PROTECTED]> writes:

>   regarding Pango:
> 
>     - Pango uses the file "pangoxft-fontmap.c" to retrieve
>       the list of installed fonts from libXft. This source
>       file contains a _persistent_ cache of XftFont objects
> 
>       this means that once Pango has matched a font description
>       into a XftFont object, the latter will remain open until
>       the application closes, and hence the equivalent FT_Face
>       objects..
> 
>     - note that the file "pangoft2-fontmap.c" has the exact
>       same "persistent cache" problem (it uses FT_Face objects
>       directly, instead of XftFont ones..).
> 
>       I thus suspect that GdkEmbedded has the same problem..
> 
> As a consequence, a typical application using the current versions
> of Pango and libXft will simple eat more and more memory as it
> displays text with more fonts..
 
Actually this reading of the code is not correct ... Pango only
keeps alive a PangoXftFont/XftFont for
 
 - Any fonts currently referenced by the application
 - The last MAX_FREED_FONTS (16) that are not otherwise referenced

Now whether this is best way to do caching is another issue, but
it doesn't just keep arbitrary numbers of XftFont/FT_FACE objects
around.

(The reason for the caching is that, for example, when laying out
the text in a GtkTextView object the code will load the fonts
for a paragraph, do the layout, free the fonts, load the fonts
for the next paragraph, and so forth, so if you don't have cache,
this can get very inefficient. If you have more than 16 fonts
per paragraph, of course, it gets very inefficient now, but you
probably deserved that...)

Regards,
                                        Owen
 
_______________________________________________
Render mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/render

Reply via email to