[Fontconfig] fc-glyphname bug

James Cloos cloos at jhcloos.com
Wed Mar 7 23:16:04 PST 2007


>>>>> "Keith" == Keith Packard <keithp at keithp.com> writes:

Keith> If that's not true, we should just fix the code; it's a bug
Keith> that you are masking by adding piles of data to the library.

Understood.  I was quite exhausted by the time I debugged it enough to
have any idea of why it was looping.

Anyway, in fontconfig/src/fcfreetype.c in a section within:

#if HAVE_FT_HAS_PS_GLYPH_NAMES
#endif

has the function 

static FT_UInt
FcFreeTypeGlyphNameIndex (FT_Face face, const FcChar8 *name)
{
    FT_UInt gindex;
    FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2];

    for (gindex = 0; gindex < (FT_UInt) face->num_glyphs; gindex++)
    {
	if (FT_Get_Glyph_Name (face, gindex, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0)
	    if (!strcmp ((char *) name, (char *) name_buf))
		return gindex;
    }
    return 0;
}

That gets triggered by urw's Standard Symbol L, and
FT_Get_Glyph_Name() needs its last arg to be large enough to handle
all of the glyph names in the font.

With only the dingbat names added in fcglyphlist, FC_GLYPHNAME_MAXLEN
is 4, and passing 5 to FT_Get_Glyph_Name() causes a loop.

So, if FC_GLYPHNAME_MAXLEN is not to be enlarged, then
FcFreeTypeGlyphNameIndex() needs to use a different constant.

The largest legal value it could need in a PostScript font is 127, so
name_buf[128] should be a sufficient initialization.

At least for PostScript-legal fonts. :-/

All of the glyph names in Standard Symbol L are in the glyphlist.txt
file.  Can fc deal with a font with a non-standard encoding when it
does not have a list of the unicode values of those glyph names?

Is the answer to add just those 189 glyph names rather than all of the
names in glyphlist.txt?

Adobe Symbol, as it was distributed in the linux version of acroread 5
(where it was included as a type1 font), has all of the same glyphnames,
except only that it lacks a Euro glyph which is in the URW version.

The glyph names in GohaTibebZemen.otf (from xorg/font/misc-ethiopic)
are completely non-standard.  It looks like the fonts from misc-meltho
mostly follow the AGL, except they use a majuscule U rather than a
miniscule uni as the prefix before the hex digits.  I'm guessing the
ethiopic font was the one causing the segv.

Some of the fonts designed by the TeX community use some non-standard
glyph names.  Or at least have done so.  Since there is a movement
towards using fontconfig to find fonts by TeX engines, that may be (or
may become) a relevant issue.

I can't think of any other fonts that may trigger this.

Here are the 189 glyph names (other that .notdef) found in URW's
Standard Symbol L, grep(1)ed out of glyphlist.txt:

space;0020
exclam;0021
universal;2200
numbersign;0023
existential;2203
percent;0025
ampersand;0026
suchthat;220B
parenleft;0028
parenright;0029
asteriskmath;2217
plus;002B
comma;002C
minus;2212
period;002E
slash;002F
zero;0030
one;0031
two;0032
three;0033
four;0034
five;0035
six;0036
seven;0037
eight;0038
nine;0039
colon;003A
semicolon;003B
less;003C
equal;003D
greater;003E
question;003F
congruent;2245
Alpha;0391
Beta;0392
Chi;03A7
Delta;2206
Epsilon;0395
Phi;03A6
Gamma;0393
Eta;0397
Iota;0399
theta1;03D1
Kappa;039A
Lambda;039B
Mu;039C
Nu;039D
Omicron;039F
Pi;03A0
Theta;0398
Rho;03A1
Sigma;03A3
Tau;03A4
Upsilon;03A5
sigma1;03C2
Omega;2126
Xi;039E
Psi;03A8
Zeta;0396
bracketleft;005B
therefore;2234
bracketright;005D
perpendicular;22A5
underscore;005F
radicalex;F8E5
alpha;03B1
beta;03B2
chi;03C7
delta;03B4
epsilon;03B5
phi;03C6
gamma;03B3
eta;03B7
iota;03B9
phi1;03D5
kappa;03BA
lambda;03BB
mu;00B5
nu;03BD
omicron;03BF
pi;03C0
theta;03B8
rho;03C1
sigma;03C3
tau;03C4
upsilon;03C5
omega1;03D6
omega;03C9
xi;03BE
psi;03C8
zeta;03B6
braceleft;007B
bar;007C
braceright;007D
similar;223C
Upsilon1;03D2
Euro;20AC
minute;2032
lessequal;2264
fraction;2044
infinity;221E
florin;0192
club;2663
diamond;2666
heart;2665
spade;2660
arrowboth;2194
arrowleft;2190
arrowup;2191
arrowright;2192
arrowdown;2193
degree;00B0
plusminus;00B1
second;2033
greaterequal;2265
multiply;00D7
proportional;221D
partialdiff;2202
bullet;2022
divide;00F7
notequal;2260
equivalence;2261
approxequal;2248
ellipsis;2026
arrowvertex;F8E6
arrowhorizex;F8E7
carriagereturn;21B5
aleph;2135
Ifraktur;2111
Rfraktur;211C
weierstrass;2118
circlemultiply;2297
circleplus;2295
emptyset;2205
intersection;2229
union;222A
propersuperset;2283
reflexsuperset;2287
notsubset;2284
propersubset;2282
reflexsubset;2286
element;2208
notelement;2209
angle;2220
gradient;2207
registerserif;F6DA
copyrightserif;F6D9
trademarkserif;F6DB
product;220F
radical;221A
dotmath;22C5
logicalnot;00AC
logicaland;2227
logicalor;2228
arrowdblboth;21D4
arrowdblleft;21D0
arrowdblup;21D1
arrowdblright;21D2
arrowdbldown;21D3
lozenge;25CA
angleleft;2329
registersans;F8E8
copyrightsans;F8E9
trademarksans;F8EA
summation;2211
parenlefttp;F8EB
parenleftex;F8EC
parenleftbt;F8ED
bracketlefttp;F8EE
bracketleftex;F8EF
bracketleftbt;F8F0
bracelefttp;F8F1
braceleftmid;F8F2
braceleftbt;F8F3
braceex;F8F4
angleright;232A
integral;222B
integraltp;2320
integralex;F8F5
integralbt;2321
parenrighttp;F8F6
parenrightex;F8F7
parenrightbt;F8F8
bracketrighttp;F8F9
bracketrightex;F8FA
bracketrightbt;F8FB
bracerighttp;F8FC
bracerightmid;F8FD
bracerightbt;F8FE

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


More information about the Fontconfig mailing list