[cairo] Separating Cairo from Fontconfig

Ned Konz ned at squeakland.org
Mon Nov 1 09:58:02 PST 2004


Hi all...

I'm looking at using Cairo for Squeak, on various platforms.

Looking at the API, I see that there is a dependency on the fontconfig 
library. But as far as I can tell, the only real use of fontconfig in Cairo 
that's visible in cairo.h is for the "Toy" text API (and of course for the 
cairo_ft_font_create() and cairo_ft_font_pattern() functions).

In very simple applications (i.e. ones that are part of a full distribution 
that includes known fonts), we may want to manage the fonts in Squeak itself. 
This is especially important in a device that lacks a writeable filesystem, 
since fontconfig seems to assume that files exist.

I don't mind opening a face using FreeType using the 
cairo_ft_font_create_for_ft_face() routine.

I would like to be able to build libcairo without having to have fontconfig.

However, I see from reading cairo_ft_font.c that fontconfig is deeply 
intertwingled into the cairo_ft_font_t and cairo_ft_cache_key_t structures.

I can't tell at a glance whether fontconfig is actually necessary for the 
operation of libcairo if there was no toy API and every font were opened 
using the cairo_ft_font_create_for_ft_face() routine. It seems like it 
shouldn't be, as Freetype2 itself does caching and can provide lots of 
information about a face.

Though this isn't on my critical path right now (given that I can get a 
version of fontconfig for my first platforms), I thought I'd write the list 
to see what your thoughts are on this so if I do get around to changing it I 
won't make something that you're not interested in using.

Thanks,
-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the cairo mailing list