[pdftex] Re: [MiKTeX] pdfLaTeX

Reinhard Kotucha reinhard at ms25.ath.cx
Thu Mar 6 01:23:00 CET 2003


>>>>> "Martin" == Martin Schroeder <martin at oneiros.de> writes:

    > Confirmed. A dvi, ps, pdf from pdfTeX and pdf from Distiller
    > (all with cm-super) are at
    > http://www.oneiros.de/tex/pdftex/fonts.zip

    > I suspect Distiller subsets the fonts much better.

Hi,
I just converted the pdf files to ps and disassembled the first font,
SFBX1728.

Both, distiller and pdftex include them as type1 and are using the
same subset, /.notdef, /f and /o.  

PdfTeX replaces all unused subroutines by dummies that only contain
the "return" instruction.

The first 5 subroutines (0...4) are left in the font.  They are not
called explicitly by the subsetted font, which is the case in the
original font as well.

Subroutines 5...319 are dummies, as mentioned above and 320 is used by
the letter "f".

Obviously the empty subrs (5...319) are responsible for the large size
of the file.  BTW, subsetting in dvips is very similar.

Distiller removes *all* subroutines and replaces the call to subr 230
by its content.


I do not know whether it's a good idea that distiller removes the
first four subroutines.  The Type1 spec says:

"If Flex or hint replacement is used in a Type 1 font program, the
first four entries in the Subrs array in the Private dictionary must
be assigned charstrings that correspond to the following code
sequences. ..."

Probably hinting does not work if they are omitted, but I'm not sure.

Another thing which one has to keep in mind is that it might be
possible that there are some fonts that do some array arithmetic, for
instance instead of "call_subroutine(200)" they could say
"call_subroutine(188+2)", though I do not see any good reason for
doing so and I have never seen such a font yet.  In this case you need
a complete Type1 interpreter.

An important point is that the example file is too small to compare
the efficiency of the two programs.  It only needs two characters to
typeset the word "foo".  In real life a subsetted font is much larger
and there are much less subroutines that can be omitted.

As I said, Distiller replaces the subroutine call by the contents of
the subroutine.  This save a few bytes but I hope it determines how
often the subroutine is used.  If it is used more than once, it really
doesn't make any sense.

It might be possible to improve the font subsetting code of PdfTeX and
dvips but I think that it is quite good as it is.  At least it seems
to be very safe.

And before wasting any time to improve Type1 subsetting it would be
much more valuable to think about CFF (Compressed Font Format).  With
CFF it should be possible to embed a font once and use it as an
upright font and a slanted and extended font.  This would reduce the
size of the pdf files dramatically if one uses the HZ algorithm.

A Type1-to-CFF converter is definitely not a weekend project.  I tried
to search for such a library and I only found a "cfflib" written in
Python.  It doesn't help very much for PdfTeX but it might be
interesting to see how much work it is.  I searched for "libcff" as
well, but Google told me that I misspelled the search pattern and
searched for something different instead.  I like those programs that
always know better what I want to do than me...

    > This should be discussed at the pdfTeX mailing list (reply-to is
    > set).

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			             Phone: +49-511-27060390
Marschnerstr. 25
D-30167 Hannover	                         mailto:reinhard at ms25.ath.cx
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------




More information about the pdftex mailing list