[cairo] cairo without fontconfig revisited

Behdad Esfahbod behdad at behdad.org
Thu Jul 23 23:02:45 PDT 2009


The cairo scaled_font references the font_face, so you can free your 
reference, yes.  Beware though, FreeType doesn't refcount.  So if you create 
multiple FT_Face's from the same font file/data, multiple data structures are 
created and duplicate work happens.  You have to cache yourself.

Hope that helps,
behdad

On 07/23/2009 05:01 PM, cu wrote:
> I think that's what w do - create FT_Face for each font (in fact, for
> internal reasons multiple FT_Face references may be created for the same
> font, so I sure hope FreeType refcounts :) ). Then FT_Face is turned
> into a non-scaled font cairo and non-scaled font into scaled font.
> Non-scaled font is immediately discarded. Scaled font and appropriate
> FT_Face are essentially "static data", and only destroyed during program
> shutdown.
>
> Is that reasonable?
>
>
> Chris Wilson wrote:
>> Ok, this is worrying. So long as you keep the FT_Face alive until the
>> font-face has been destroyed by cairo (i.e. by only calling
>> FT_Face_Done() from the cairo_font_face_set_user_data() destroy
>> function) then everything should work. You will be able to destroy your
>> reference to the font-face, as it will be kept alive by the scaled fonts
>> created from it. If you're unsure, post a small snippet highlight the
>> problem you have and we'll see if we can help.
>>
>> Have fun using Cairo!
>> -ickle
>>
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
>>
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list