[NTG-context] My way: Generating Small PDF Documents - more questions

2005-03-03 Thread Stefan Wachter
Hi all,
for some time I try to generate small PDF documents that have no 
embedded fonts and do not reencoding fonts. In the meantime I was quite 
successful and I wanted to share my insights with others. Comments are 
welcome!

I generated new ec-encoded virtual fonts for the standard Adobe fonts 
that are based on 8a-encoded raw fonts. In other words, I used afm2tfm 
with the TeX encoding set to ec and the postscript encoding set to 8a. 
(See below for a batch file that does this job). Then I wrote a small 
type script (smallpdf.tex) that defines the necessary font synonymes 
(see below). Finally I wrote a map file (smallpdf.map) that prevents the 
8a-encoded raw fonts from being embedded or reencoded (see below).

After all these preparations I can now generate PDF documents that use 
the builtin fonts. The following example generates a PDF document that 
is only 3389 bytes long whereas the corresponding document with 
embedding and reencoding is 112966 bytes long! Of course these numbers 
are not representative because the document contains only a few lines of 
text but uses 12 different fonts.

Finally two issues remain:
1. In which situations is the call of \usetypescript[adobekb][ec] 
necessary. I had the impression that it is only needed if the document 
contains characters that are not containted in the builtin fonts.

2. I would also like to use the builtin symbol character sets Zapf 
Dingbats and Zapf Chancery. Adam Lindsay already showed how Zapf 
Dingbats can be used without embedding (cf. 
http://homepage.mac.com/atl/tex/). But is there also a possibility to 
use it without reencoding?

Thanks for your attention,
--Stefan
Test document
===
\enableregime[il1]
\setupencoding[default=ec]
\setupoutput[pdftex]
\pdfoptionpdfminorversion 4
\usetypescriptfile[smallpdf.tex]
\usetypescript[adobekb][ec] % Seems to be necessary to access characters 
that are not contained in the builtin fonts.
\usetypescript[postscript][ec]

\setupbodyfont[postscript,sans,20pt]
\mainlanguage[de]
\setupheadertexts[]
\def\Show{This is a test. \quotedblbase äöüßÄÖÜ\quotedblleft}
\def\ShowVariants{\Show\par{\bf\Show}\par{\it\Show}\par{\bi\Show}\par}
\starttext\pdfmapfile{+smallpdf.map}
{\ss Helvetica\par\ShowVariants}
{\rm Times-Roman\par\ShowVariants}
{\tt Courier\par\ShowVariants}
\stoptext


Batch file for generating the fonts

# 1: directory that contains the afm-files.
# 2: font vendor (eg. adobe)
# 3: font collection (eg. times, helvetic, or courier)
if [ $# -ne 3 ] ; then
 echo Usage: $0 afm-dir vendor collection 12
 exit 1
fi
vfDir=fonts/vf/$2/$3/
tfmDir=fonts/tfm/$2/$3/
mapDir=fonts/map/pdftex/context/
mapFile=8a-$2-$3.map
rm $mapFile
for datei in `find $1/$2/$3 -name *.afm` ; do
   name=`basename $datei .afm`
   echo processing $name
   afm2tfm $name -v ec-$name -t ec.enc -p 8a.enc 8a-raw-$name  $mapFile
   vptovf ec-$name.vpl ec-$name.vf ec-$name.tfm
done
mkdir -p $vfDir $tfmDir $mapDir
mv *.vf $vfDir
mv *.tfm $tfmDir
rm *.vpl
mv *.map $mapDir
smallpdf.tex
=
% Use of virtual fonts that are based on 8a encoded fonts.
\starttypescript [sans] [helvetica] [texnansi,ec,8r]
 \definefontsynonym [Helvetica] [\typefaceencoding-phvr8a] 
[encoding=\typefaceencoding]
 \definefontsynonym [Helvetica-Bold][\typefaceencoding-phvb8a] 
[encoding=\typefaceencoding]
 \definefontsynonym [Helvetica-BoldOblique] 
[\typefaceencoding-phvbo8a][encoding=\typefaceencoding]
 \definefontsynonym [Helvetica-Oblique] 
[\typefaceencoding-phvro8a][encoding=\typefaceencoding]
\stoptypescript

\starttypescript [serif] [times] [texnansi,ec,8r]
 \definefontsynonym [Times-Roman]  [\typefaceencoding-ptmr8a] 
[encoding=\typefaceencoding]
 \definefontsynonym [Times-Bold]   [\typefaceencoding-ptmb8a] 
[encoding=\typefaceencoding]
 \definefontsynonym [Times-BoldItalic] 
[\typefaceencoding-ptmbi8a][encoding=\typefaceencoding]
 \definefontsynonym [Times-Italic] 
[\typefaceencoding-ptmri8a][encoding=\typefaceencoding]
\stoptypescript

\starttypescript [mono] [courier] [texnansi,ec,8r]
 \definefontsynonym [Courier] [\typefaceencoding-pcrr8a] 
[encoding=\typefaceencoding]
 \definefontsynonym [Courier-Bold][\typefaceencoding-pcrb8a] 
[encoding=\typefaceencoding]
 \definefontsynonym [Courier-BoldOblique] 
[\typefaceencoding-pcrbo8a][encoding=\typefaceencoding]
 \definefontsynonym [Courier-Oblique] 
[\typefaceencoding-pcrro8a][encoding=\typefaceencoding]
\stoptypescript

smallpdf.map
=
8a-raw-phvr8a Helvetica
8a-raw-phvb8a Helvetica-Bold
8a-raw-phvbo8a Helvetica-BoldOblique
8a-raw-phvro8a Helvetica-Oblique
8a-raw-ptmr8a Times-Roman
8a-raw-ptmb8a Times-Bold
8a-raw-ptmbi8a Times-BoldItalic
8a-raw-ptmri8a Times-Italic
8a-raw-pcrr8a Courier
8a-raw-pcrb8a Courier-Bold
8a-raw-pcrbo8a Courier-BoldOblique
8a-raw-pcrro8a Courier-Oblique
___
ntg-context mailing list
ntg-context@ntg.nl

Re: [NTG-context] My way: Generating Small PDF Documents - more questions

2005-03-03 Thread Adam Lindsay
Stefan Wachter said this at Thu, 3 Mar 2005 10:58:14 +0100:

2. I would also like to use the builtin symbol character sets Zapf 
Dingbats and Zapf Chancery. Adam Lindsay already showed how Zapf 
Dingbats can be used without embedding (cf. 
http://homepage.mac.com/atl/tex/). But is there also a possibility to 
use it without reencoding?

It should be possible!

I chose that encoding only because the symbol definitions became a
trivial subset of the work I did on the Unicode symbols. It was mostly an
experiment/proof of concept (I'm not aware of anyone relying on that
little article for production code!), so I encourage you to take what you
need from that article/code, do what you like, and share and enjoy...

adam
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept. [EMAIL PROTECTED]
 Lancaster University, InfoLab21+44(0)1524/510.514
 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context