[cairo] Bug with missing fonts

Owen Taylor otaylor at redhat.com
Fri Jan 21 15:16:38 PST 2005


On Fri, 2005-01-21 at 15:00 -0800, Ned Konz wrote:
> 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.

Don't think that's your freetype version. Maybe you mean 2.0.3?

> 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.

A patch to add AC_CHECK_LIB on the missing symbols to automatically
disable freetype would be appreciated.

> 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.

I think rather this means that you don't have fontconfig configured
to find *any* fonts on your system. fontconfig always returns some
font if it can find any.

Do you get anything from 'fc-list'?

> 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
> ----

This conditional is backwards ... the ATSUI backend should be the
default if you have both. (I have some doubts that the ATSUI backend
fully works from looking at the code, but that's a separate issue)

> 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"?

We should probably be doing translations for the CSS names "sans-serif",
serif, monospace on all platforms rather than changing the default font
name.

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

Would we really want this to be compile-time configuration rather than
runtime?

> 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.

You need font logic somewhere to implement even the trivial "toy" text
API that Cairo contains. If you have different font logic, you have a
different font backend. It's conceivable that you could share some code
with the freetype backend, but a lot of the code would be different as
well.

Perhaps using the name 'freetype' for the fontconfig backend is a little
funny...

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050121/b3e4daa9/attachment.pgp


More information about the cairo mailing list