[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MMa fonts (was: core dump reading .pfa)

A few days ago, Michael Gruber wrote on tex-k:

> Problem: error when reading the Mathematica fonts (e.g. Math1.pfa)
> distributed with Mathematica 3.0:

> dvips dumps core (segmentation fault) while reading font data in
> OutHEX() of t1part.c (switch: case FLG_BINARY, line "bin=(*temp ..."),

> pdflatex says
> <Math1.pfa
> ! Error: pdflatex (file Math1.pfa):
> unexpected end of file

and I answered:

> When I tried  t1disasm Math1.pfa  I got binary junk after the first
> few lines of the encrypted section, i.e. t1disasm wasn't able to
> decrypt the font, while it works fine for any other font I have.
> If the pdftex program uses the same algorithm for decrypting the
> font, it's not surprising that it can't grok the font.

whereupon Louis Vosloo replied:

>> The real question is what happened to these fonts that they can't
>> even be properly decrypted and subsetted anymore with standard
>> utilities like t1disasm, but still work when you download them to
>> the printer.

> That is odd.  It suggests a weakness in t1disasm triggered by an
> `unusual' construction in the font - something that is still valid
> Type 1 syntax, but on the edge of the envelope.  
> (Our tools decrypt them OK, just show poor style inside).

Now, I've analysed the problem a little further and found a solution:

The reason why t1diasm wasn't able to decrypt the Mma fonts was
simply due to exceeding the default LINESIZE of 256 in t1utils/*.c

After increasing it to 512 and recompiling t1utils, I could decrypt
the fonts and found that the encrypted section starts with a very long
comment lines of 384 characters before the start of the actual font.

%!PS-AdobeFont-1.0: Math1 001.000
%%CreationDate: 1/31/97 at 11:59 AM
%%VMusage: 1024 32924  
% Mathematica typeface design by Andre Kuzniarek, with Gregg Snyder and Stephen Wolfram. 
% Copyright 1996 Wolfram Research Inc. [http://www.wolfram.com]. All rights reserved. [Font version 1.0]
% ADL: 800 200 0

currentdict end
currentfile eexec
% Notices  2
/Private 20 dict dup begin

I disassembled, edited, and reassembled the fonts to remove these
apparently useless comment lines, but there was another problem
I already observed for some other fonts.

The CharStrings section in the encrypted part started with

2 index                 % stk: font_dict font_dict --
/CharStrings 225 dict dup begin

while the parsing code in some version of pdftex/write1.c expects 
to find either "2 index /CharStrings" or "dup /CharStrings".

I'm not sure if this already fixed in the latest pdfTeX version,
but you can always correct the problem by editing the font.

After these changes everything works me, both with dvipsk-5.78 
and with pdftex-0.12k using partial downloading by default.

I've put up a the edited and cleaned-up version of the fonts at


While I was at it, I also fixed some other minor problems, such 
as fixing the encodings (glyphs 0 to 31 declared as /.notdef, 
/space  and /nbspace spelled consistenlty in lowercase).

Hope this helps.

Cheers, Ulrik.