[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
%%EndComments
[...]

currentdict end
currentfile eexec
dup
% Notices  2
%6CBF8C
%5504B252C76A15A120D17456E273F3963EDF7CE7C7630EA32ACB7DA1C37A5CDDB32FDD44A6ED841C8E27D66AEF8476A6D174F29242C5BB5EC7604ED
D8F36AC49E32342EA967625BD58D27A1FB16D3AAB5FF97716B56B53D0B935CC5CC96E18AC6C5DA4EF396532D347F18F0EBD1D0FCA67E28D3FDC4AA69
69F71EEDE3E65F175019963BCED861FA878F39406B04ECF6252C96211B46854D5B92D8DBF56CF6703987E0C9526AD5FE9701EF02C77C1A252DE3E48D
16BF89708B86455BBF3AE
/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

  http://www.thphy.uni-duesseldorf.de/~vieth/src/mmapfb.tgz
                                                /mmaafm.tgz  

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.