[cairo] Bug with missing fonts

Ned Konz ned at squeakland.org
Fri Jan 21 15:00:30 PST 2005


I'm trying to build a version of libcairo from CVS for the Mac.
I'm using the autoconfig stuff, and I have older versions of fontconfig (2.20) 
and freetype2 (2.13) because those are what are currently available through 
fink.

I have mostly a vanilla version of Apple's X11 and fink, with a few additional 
packages.

I had to disable the PDF backend because it expects a freetype2 > 2.13.

I have *both* the freetype2 and the atsui font backends compiled. Does that 
make sense? Or is that redundant?

Anyway, when running the tests, 4 out of 6 of them die with the following bug:

#0  _reference_font_val (f=0x0) at cairo_ft_font.c:84
#1  0x0009593c in _cairo_ft_font_create (family=0xa98ac "serif", 
slant=CAIRO_FONT_SLANT_NORMAL, weight=CAIRO_FONT_WEIGHT_NORMAL) at 
cairo_ft_font.c:384
#2  0x00094ccc in _font_cache_create_entry (cache=0x0, key=0xbffffad0, 
return_value=0xbffffaf0) at cairo_font.c:109
#3  0x0009484c in _cairo_cache_lookup (cache=0x11014b0, key=0xbffffad0, 
entry_return=0xbffffaf0) at cairo_cache.c:403
#4  0x00094e34 in _cairo_unscaled_font_create (family=0xa98ac "serif", 
slant=CAIRO_FONT_SLANT_NORMAL, weight=CAIRO_FONT_WEIGHT_NORMAL) at 
cairo_font.c:217
#5  0x00097254 in _cairo_gstate_init (gstate=0x1101370) at cairo_gstate.c:80
#6  0x000971b0 in _cairo_gstate_create () at cairo_gstate.c:57
#7  0x00090590 in cairo_create () at cairo.c:83
#8  0x00002c18 in cairo_test (test=0x4020, draw=0) at cairo_test.c:121
#9  0x000022c4 in _start (argc=1, argv=0xbffffd40, envp=0xbffffd48) 
at /SourceCache/Csu/Csu-47/crt.c:267

Note that there is no font family called "serif" on my system.

However, in cairoint.h we have some code that assumes that everyone who has 
freetype2 will have a font family called "serif". 

This is obviously not the case, since I don't have such a font family.

----
#ifdef CAIRO_HAS_FT_FONT
#define CAIRO_FONT_FAMILY_DEFAULT  "serif"
/* XXX: Platform-specific. Other platforms may want a different default */
#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_font_backend
#elif defined(CAIRO_HAS_ATSUI_FONT)
#define CAIRO_FONT_FAMILY_DEFAULT  "Monaco"
#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_font_backend
#endif
----

I don't know whether this is a problem with my installation of fontconfig, or 
whether we need to change the logic for the default font.

Shouldn't it be legal to have freetype2 without having a font called "serif"?

Should we allow overriding the default font family in the configure script?

Also, we don't currently allow for using freetype2 without using fontconfig. 
On some of the systems we've been considering, we'd have our own font logic; 
at the simplest we'd start with a list of font files available on the system. 
In this case, we'd want to make FT_Face instances from font files directly 
and not use fontconfig.

I think that having a conditional like CAIRO_HAS_FONTCONFIG would be useful 
there; however, there would have to be a number of changes to the caching 
logic in the FT backend.

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



More information about the cairo mailing list