ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Stefan Wachter <Stefan.Wachter@gmx.de>
Subject: My way: Generating Small PDF Documents - more questions
Date: Thu, 03 Mar 2005 10:58:14 +0100	[thread overview]
Message-ID: <4226DFB6.4040606@gmx.de> (raw)

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>" 1>&2
  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

             reply	other threads:[~2005-03-03  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-03  9:58 Stefan Wachter [this message]
2005-03-03 10:08 ` Adam Lindsay
2005-03-15  7:35   ` Stefan Wachter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4226DFB6.4040606@gmx.de \
    --to=stefan.wachter@gmx.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).