[Fontconfig] t1_get_glyph_name vs URW StandardSymL

James Cloos cloos at jhcloos.com
Wed Mar 7 11:04:54 PST 2007


I just updated urw fonts on my gentoo laptop to the versions in:

ftp://rpmfind.net/linux/fedora/core/development/source/SRPMS/urw-fonts-2.3-6.1.1.src.rpm

I have freetype cvs HEAD and fontconfig git HEAD installed.

Attempts to run fc-cache(1) were stalling.  As, of course, were any
other programs linked to fontconfig.

I found a couple of issues.

First, any attempt to cache the StandardSymL font from the above rpm
(s050000l.pfb) spins.  After recompiling freetype and fontconfig with
ggdb and O0, I found that it was spinning around FT_Get_Glyph_Name():

,----<(gdb) where>
|#0  FT_Get_Glyph_Name (face=0x80745b0, glyph_index=3, buffer=0xbfd25b82, buffer_max=5)
|    at work/freetype2/src/base/ftobjs.c:2883
|#1  0x08056714 in IA__FcFreeTypeCharSetAndSpacing (face=0x80745b0, blanks=0x8074eb8, 
|    spacing=0xbfd25cb4) at fcfreetype.c:2722
|#2  0x080555bf in IA__FcFreeTypeQueryFace (face=0x80745b0, 
|    file=0x8077ed0 "/home/cloos/tmp/U/s050000l.pfa", id=0, blanks=0x8074eb8)
|    at fcfreetype.c:1666
|#3  0x08055ba3 in IA__FcFreeTypeQuery (file=0x8077ed0 "/home/cloos/tmp/U/s050000l.pfa", id=0, 
|    blanks=0x8074eb8, count=0xbfd25db8) at fcfreetype.c:1806
|#4  0x08053268 in FcFileScanFontConfig (set=0x80775d0, blanks=0x8074eb8, 
|    file=0x8077ed0 "/home/cloos/tmp/U/s050000l.pfa", config=0x8074008) at fcdir.c:61
|#5  0x080533c5 in FcFileScanConfig (set=0x80775d0, dirs=0x807d5a0, blanks=0x8074eb8, 
|    file=0x8077ed0 "/home/cloos/tmp/U/s050000l.pfa", config=0x8074008) at fcdir.c:109
|#6  0x08053667 in FcDirCacheScan (dir=0x8079390 "/home/cloos/tmp/U", config=0x8074008)
|    at fcdir.c:216
|#7  0x08053756 in IA__FcDirCacheRead (dir=0x8079390 "/home/cloos/tmp/U", force=1, 
|    config=0x8074008) at fcdir.c:263
|#8  0x08049dff in scanDirs (list=0x8077d50, config=0x8074008, force=0, really_force=0, 
|    verbose=1) at fc-cache.c:204
|#9  0x0804a678 in main (argc=3, argv=0xbfd26024) at fc-cache.c:463
`----

glyph_index spins from 0 to 1 to 2 to 3 to 1 to 2 to 3 to 1 ad inifinitum.

face is:

,----<(gdb) p *face>
| $3 = {num_faces = 1, face_index = 0, face_flags = 2577, style_flags = 0, num_glyphs = 190, 
|   family_name = 0x804c978 "Standard Symbols L", style_name = 0xb7f25d6f "Regular", 
|   num_fixed_sizes = 0, available_sizes = 0x0, num_charmaps = 2, charmaps = 0x804d358, 
|   generic = {data = 0x0, finalizer = 0}, bbox = {xMin = -180, yMin = -293, xMax = 1090, 
|     yMax = 1010}, units_per_EM = 1000, ascender = 1010, descender = -293, height = 1303, 
|   max_advance_width = 1042, max_advance_height = 1303, underline_position = -229, 
|   underline_thickness = 46, glyph = 0x804cdc0, size = 0x804f8d8, charmap = 0x80509a8, 
|   driver = 0x804c110, memory = 0x80555e0, stream = 0x804c580, sizes_list = {head = 0x804cea8, 
|     tail = 0x804cea8}, autohint = {data = 0x0, finalizer = 0}, extensions = 0x0, 
|   internal = 0x804f9e8}
`----

in FT_Get_Glyph_Name(), service->get_name returns 6, which seems to be:

,----(freetype2/include/freetype/fterrdef.h)
| FT_ERRORDEF_( Invalid_Argument, 0x06, "invalid argument" )
`----

but I don't see why....

In t1_get_glyph_name, gdb reports:

,----<(gdb) p *face->type1.glyph_names>
| $18 = (FT_String *) 0x807bc7c ".notdef"
`----

and using x/191a on the address returned by face->type1.glyph_names
shows the addresses of all of the FT_String*s for all of the glyphs,
followed by 0x0.  So it seems that service->get_name should return
T1_Err_Ok, 


Unless the problem is the value of buffer_max in the calls to
t1_get_glyph_name?  It is always set to 5, which comes from:

,----(fontconfig/src/fcfreetype.c)
| if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0)
`----

and FC_GLYPHNAME_MAXLEN is 4 becuase fc-glyphname is run as:

./fc-glyphname ../fc-glyphname/zapfdingbats.txt < ../fc-glyphname/fcglyphname.tmpl.h > fcglyphname.h

and the longest glyph name in zapfdingbats.txt is 4 chars long....

Attempts to run fc-glyphname with the agl were failing.  After
debugging that, if fc-glyphname is run with the agl and the zaph
dingbats names FC_GLYPHNAME_MAXLEN ends up as 39, which is long enough
for all of the glyph names in s050000l.pfb.

Was there a change in freetype that caused this to start failing?  Or
did something change in fontconfig?  I'm too tired now to grep the
histories....  (Almost 24 hours up and counting....)

Should FT_Get_Glyph_Name()'s last arg be sized to allow any legal
PostScript identifier (ie should it be 128)?

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the Fontconfig mailing list