[cairo] font lifetime

Jost Boekemeier jost2345 at yahoo.de
Fri Jan 28 03:59:49 PST 2005


On Thu, 2005-01-27 at 20:05, Keith Packard wrote:
> 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 

Agreed.  I think such a function is appropriate for types, imho cairo
types already have it.  

However, in the case of transient resources that I give to cairo in
order to perform a specific task, I think that cairo should handle the
resource, not the high-level library; I don't want to create a FontProxy
just to destroy the low-level font I have given to cairo.

The ps/pdf "file" could also be designed this way: Just give the file
resource to cairo and let cairo call the "close" function.  Of course
this doesn't work anymore if a FileProxy exists which tries to "close"
the font itself.  In that case it might be better to design the font as
a complete type instead and only destroy it when its ref-count reaches
zero.


Jost





More information about the cairo mailing list