Is font face reference counting broken?
Uli Schlachter
psychon at znc.in
Wed May 15 14:34:56 UTC 2024
Hi,
Am 15.05.24 um 16:22 schrieb Andreas Falkenhahn:
> Thanks, then the behaviour makes sense.
>
> Is there any way to flush Cairo's font cache?
There is only cairo_debug_reset_static_data(), but that can only be
called if no objects are alive anymore.
So no, there is no way to flush the font cache.
> I'm using a font saved to a temp file and I can't delete that temp file as long as it's still in use (Windows behaviour). So I'd really need to find a way to make Cairo release the hold onto the file so that I can delete the temp file.
[...]
Why not the user way around?
You can use cairo_font_face_set_user_data() to register a callback for
when the font face is destroyed. Then, in that callback you can delete
the temporary file.
Also, I am not an expert in font stuff, but why do you need a temporary
file? Where is the font file coming from and is there perhaps a way to
load it directly from memory?
In your example program, you seem to be using fontconfig only for "load
this file". I am still no font expert, but I would guess it is somehow
possible to make freetype load a font from memory...?
Cheers,
Uli
--
Homophobia - The fear that another man will treat you the way you treat
women.
More information about the cairo
mailing list