diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/CJK/contrib/wadalab/makefont')
-rwxr-xr-x | Master/texmf-dist/source/latex/CJK/contrib/wadalab/makefont | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/CJK/contrib/wadalab/makefont b/Master/texmf-dist/source/latex/CJK/contrib/wadalab/makefont new file mode 100755 index 00000000000..7c70ef0c1ce --- /dev/null +++ b/Master/texmf-dist/source/latex/CJK/contrib/wadalab/makefont @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Version 1.0 +# +# This script transforms Wadalab PFA and AFM files created by the +# wftodm program into PFB and TFM files. All files in the current +# directory and its subdirectories are converted. +# +# Additionally, it normalizes the font matrix so that the subfonts work +# with pdfTeX; for convenience, it also inserts `closepath' commands to +# end subpaths in glyphs. +# +# Note that an older version of this script (without a version number) has +# some flaws; you should either regenerate all Wadalab subfonts or use the +# `fixwada' script to fix PFB fonts which have already been created with +# this older version. +# +# The programs t1asm, t1disasm, and afm2tfm must be in the path. + +for f in `find . -name '*.pfa' -print`; do + echo processing $f + name=`basename $f .pfa` + t1disasm < $name.pfa > $name.old + + cat $name.old | \ + awk ' + { + sub(/001\.001/, "001.002") + sub(/\[.001 0 0 .001 0 -0.16\]/, "[.001 0 0 .001 0 0]") + sub(/\[0 0 1000 1000\]/, "[0 -160 1000 840]") + + if (/%%Creation/) { + print "%%CreationDate: 2003-Feb-07" + next + } + + if (/hsbw/) + waiting_for_Xmoveto = 1 + + if (waiting_for_Xmoveto) { + if (/rmoveto/) { + printf "\t%d %d rmoveto\n", $1, $2 - 160 + waiting_for_Xmoveto = 0 + next + } + if (/vmoveto/) { + printf "\t%d vmoveto\n", $1 - 160 + waiting_for_Xmoveto = 0 + next + } + if (/hmoveto/) { + printf "\t%d %d rmoveto\n", $1, -160 + waiting_for_Xmoveto = 0 + next + } + } + + if (/moveto/) + print "\tclosepath" + + if (/hstem/) { + printf "\t%d %d hstem\n", $1 - 160, $2 + next + } + + print + } + ' > $name.asm + rm $name.old + + t1asm < $name.asm > $name.pfb + rm $name.asm +done + +for f in `find . -name '*.afm' -print`; do + echo processing $f + name=`basename $f .afm` + mv $name.afm $name.old + + cat $name.old | \ + sed -e " + s/FontBBox 0 0 1000 1000/FontBBox 0 -160 1000 840/ + s/B 0 0 1000 1000/B 0 -160 1000 840/ + " > $name.afm + + rm $name.old + + afm2tfm $name.afm &> /dev/null +done + +# EOF |