[XeTeX] Linking with FreeType 2 on Mac OS X

Jonathan Kew jonathan_kew at sil.org
Sun Feb 11 00:39:10 CET 2007


On 10 Feb 2007, at 11:33 pm, Jjgod Jiang wrote:

> Hi,
>
> 2007/2/11, Jonathan Kew <jonathan_kew at sil.org>:
>> Maybe --with-old-mac-fonts? I'm not sure what the defaults are. There
>> was talk of changes to the Mac-specific stuff, so it may be different
>> in 2.3.x from 2.2.1; we haven't updated the code in TL yet, as it was
>> too close to the release.
>
> Ok, with --with-old-mac-fonts, problem solved! (It's really hard to
> determinate from the name...)
>
> Hmm, the original problem I was talking about appears to be some bugs
> in Sun-ExtB.ttf [1] - the font I was using. I tried with HAN NOM  
> B.ttf [2] and
> succeed to get all the characters I tested displayed in PDF now.  
> (The tex
> file I used for testing is attached.)
>
> When trace down the code to the root, there are still some questions I
> can't answer, with Sun-ExtB.ttf, xdvipdfmx reports
> ** ERROR ** sfnt: Freetype failure and exit. The backtrace should be:
>
> sfnt.c:ft_unsigned_pair
> sfnt.c:ft_signed_pair (sfnt_get_short)
> tt_table.c:tt_read_longMetrics
>
> So I add fprintf(stderr, "%d ", gid); after last_adv =
> sfnt_get_ushort(sfont); in
> tt_table.c, then got some output like this:
>
> 0 1 2 ... 47656 0 1 2 3 ... 42807 42808 42809
> ** ERROR ** sfnt: Freetype failure 2...
>
> Very weird, huh? (47656 is the max number of characters Sun-ExtB.ttf
> contains...)

I haven't checked the truetype spec, but I seem to remember that it's  
legal for a font to have fewer metrics than glyphs, and then all the  
remaining glyphs have the same metrics as the last entry.... perhaps  
the code in xdvipdfmx doesn't handle this case, and tries to read  
beyond the end of the hmtx table. I don't have time to investigate  
tonight, though.

JK



More information about the XeTeX mailing list