[cairo] font lifetime

Keith Packard keithp at keithp.com
Thu Jan 27 11:05:56 PST 2005


Around 18 o'clock on Jan 27, Jost Boekemeier wrote:

> Which component could call this function?  I think in
> some languages it is possible to register a procedure
> with the GC, but I am not sure if that is possible in
> all languages. 

Finalizer support is pretty much required for any foreign function 
interface; I don't know off hand of any GC system that doesn't have 
provisions for it.  Sometimes it adds overhead to the collect process, but 
that should be limited to O(n) on the number of objects registered for 
finalization.

> I think an implementation of high-level bindings must "know" the
> cairo-internal connections anyway, at least for the cairo types the
> implementation intends to proxy.

An external library cannot know, without being told, when the various 
internal references have been dropped.  Guessing based on available 
evidence leads to fragile interfaces.

I have this feeling this morning that there is a fundemental difference
between issues related to font files and issues related to PDF files.  

In the font file case, the application really doesn't need to care when
cairo is done with a particular font object; there isn't any additional
application state transition to perform when the object is freed.

In the PDF file case, the application must be able to assert that cairo is 
done with a particular object -- it needs to be able to flush the PDF file 
and then close it so that it can then call the print spooler or whatever 
else needs to be done with the file.

So, I can see justification for handling these two cases in different ways 
inside the cairo library.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050127/f76ab7ea/attachment.pgp


More information about the cairo mailing list