[comp.lang.postscript] .tfm files for PostScript

lee@uhccux.UUCP (Greg Lee) (12/21/87)

Appended to this note is a shar file with a script for converting
Adobe afm files to pl files, from which one can make .tfm files
using the TeX utility pltotf.  Maybe you folks already have something
for doing this, but I haven't seen mention of it.  Now in this
connection, I have a question: Is there a version of dvi2ps, or
a related PS translator, that will use such .tfm files for Adobe
fonts?  I have one that I hacked out myself, but it's a little
crude.  There was mention of such a version some time ago, being
developed at Purdue, and it was going to be posted.  But I never
have seen it.  If something like that is available, I hope it will
be posted or made available through an archive server for the
benefit of those like me who cannot use ftp.


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  README aftopl
# Wrapped by lee@uhccux on Mon Dec 21 01:03:03 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(1295 characters\)
sed "s/^X//" >README <<'END_OF_README'
XProgram aftopl
XGreg Lee, lee@uhccux.uhcc.hawaii.edu, 12/87
X
XAftopl translates an Adobe afm file to TeX pl format.  The pl
Xfile can then be converted to a tfm file with the TeX utility
Xprogram pltotf.  Install with `chmod +x aftopl'.  Usage is:
X	aftopl afm-file-name >pl-file-name
X
XBugs
X
XTo use the tfm files derived by aftopl and pltotf, your printer
Xdriver, dvi2ps or whatever, must understand that it is not to
Xlook for pxl or pk files for these fonts, since the LW already
Xknows the character shapes.
X
XRecent ('87) versions of the Adobe afm files (available from
Xthe file server at ps-file-server@adobe.com) have kerning
Xinformation.  But if the afm file does not have kerning info
X(KPX lines), aftopl will not construct a ligature and kerning
Xtable.  In any case, ff will not be ligatured, since Adobe
Xfonts don't have ff, ffi, or ffl characters.
X
XOnly text fonts are handled, not math or symbol fonts.
X
XSpecial characters (diacritics, digraphs ae oe, etc.) are
Xtranslated from Adobe standard encoding to standard TeX encoding.
XHowever, (1) your version of dvi2ps must know to translate
Xthese back to Adobe encoding before sending to the LW, and
X(2) some standard TeX text font characters are undefined,
Xsince they have no Adobe counterparts (viz. Greek capitals,
Xff-ligatures, dotless j).
X
END_OF_README
if test 1295 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f aftopl -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"aftopl\"
else
echo shar: Extracting \"aftopl\" \(3370 characters\)
sed "s/^X//" >aftopl <<'END_OF_aftopl'
X#! /bin/awk -f
X# Translate Adobe afm file to TeX pl file.
X# usage: aftopl afm-file-name >pl-file-name
X# Greg Lee, lee@uhccux.uhcc.hawaii.edu, 12/87
XBEGIN {
X	cname["fi"]		= 12;	cname["fl"]	= 13;
X	cname["dotlessi"]	= 16;	cname["grave"]	= 18;
X	cname["acute"]		= 19;	cname["caron"]	= 20;
X	cname["breve"]		= 21;	cname["macron"] = 22;
X	cname["ring"]		= 23;	cname["cedilla"] = 24;
X	cname["germandbls"]	= 25;	cname["ae"]	= 26;
X	cname["oe"]		= 27;	cname["oslash"] = 28;
X	cname["AE"]		= 29;	cname["OE"]	= 30;
X	cname["Oslash"]		= 31;	cname["exclamdown"] = 60;
X	cname["questiondown"]	= 62;	cname["quotedblleft"] = 92;
X	cname["dotaccent"]	= 95;	cname["endash"]	= 123;
X	cname["emdash"]		= 124;	cname["hungarumlaut"] = 125;
X	cname["tilde"]		= 126;	cname["dieresis"] = 127;
X
X	print "(DESIGNSIZE R 10.0)"
X	print "(COMMENT DESIGNSIZE IS IN POINTS)"
X	print "(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)"
X	bold = 0
X	}
X
X/^IsFixedPitch/	{	fixed = $2
X			}
X
X/Bold/		{	bold = 1
X			}
X
X/FamilyName/	{	family = $2
X			}
X
X/ItalicAngle/	{	angle  = $2; slant = 0
X			if (angle != 0) slant = angle/-45.0
X			}
X
X/XHeight/	{	xheight  = $2/1000
X			}
X
X/^C 32/		 {	space = ($5 * 1.1)/1000
X			print "(FONTDIMEN"
X			printf("   (SLANT R %1.6f)\n", slant)
X			printf("   (SPACE R %1.6f)\n", space)
X 			if (fixed == "false") {
X			 printf("   (STRETCH R %1.6f)\n", (space*3)/5)
X			 printf("   (SHRINK R %1.6f)\n", space/3)
X			 }
X			printf("   (XHEIGHT R %1.6f)\n", xheight)
X			print "   (QUAD R 1.0)"
X			printf("   (EXTRASPACE R %1.6f)\n", space/3)
X			print "   )"
X
X			}
X
X/WX/ && $2 >= 0 {
X	ch = $2
X	w = $5
X	h = $14
X	d = -$12
X	rp = $13 - w
X	name[$8] = ch
X
X	c = cname[$8]
X	if (c == "") c = ch
X
X  if (c <  48)			printf("(CHARACTER O %o\n", c)
X  if (c >= 48 && c <= 57)	printf("(CHARACTER C %c\n", c)
X  if (c >  57 && c < 65)	printf("(CHARACTER O %o\n", c)
X  if (c >= 65 && c <= 89)	printf("(CHARACTER C %c\n", c)
X  if (c >  89 && c < 97)	printf("(CHARACTER O %o\n", c)
X  if (c >= 97 && c <= 122)	printf("(CHARACTER C %c\n", c)
X  if (c > 122)			printf("(CHARACTER O %o\n", c)
X
X				printf("   (CHARWD R %1.6f)\n", w/1000)
X
X  if (h > 0)			printf("   (CHARHT R %1.6f)\n", h/1000)
X  if (d > 0)			printf("   (CHARDP R %1.6f)\n", d/1000)
X  if (rp > 0)			printf("   (CHARIC R %1.6f)\n", rp/1000)
X				print "   )"
X	}
X
X/^KPX/	{  if (ck != $2) { if (ck != "") printf("   (STOP)\n");
X			   else  {
X		printf("(LIGTABLE\n");
X	   	printf("   (LABEL O %o)\n", name["hyphen"]);
X		printf("   (LIG O %o O %o)\n",name["hyphen"], cname["endash"]);
X		printf("   (STOP)\n");
X	   	printf("   (LABEL O %o)\n", cname["endash"]);
X		printf("   (LIG O %o O %o)\n",name["hyphen"], cname["emdash"]);
X		printf("   (STOP)\n");
X	   	printf("   (LABEL O %o)\n", name["exclam"]);
X	printf("   (LIG O %o O %o)\n",name["quoteleft"], cname["exclamdown"]);
X		printf("   (STOP)\n");
X	   	printf("   (LABEL O %o)\n", name["question"]);
X	printf("   (LIG O %o O %o)\n",name["quoteleft"], cname["questiondown"]);
X		printf("   (STOP)\n");
X			}
X			   c = cname[$2];
X			   if (c == "") c = name[$2];
X			   printf("   (LABEL O %o)\n", c);
X			   ck = $2;
X			   if (ck == "f")  {
X				printf("   (LIG C i O %o)\n",cname["fi"]);
X				printf("   (LIG C l O %o)\n",cname["fl"]);
X			   }
X			 }
X	cm = cname[$3];
X	if (cm == "") cm = name[$3];
X	   printf("   (KRN O %o R %1.6f)\n", cm, $4/1000)
X	   }
XEND	{  if (ck != "")  {
X		printf("   (STOP)\n")
X		printf("   )\n")
X		}
X	}
END_OF_aftopl
if test 3370 -ne `wc -c <aftopl`; then
    echo shar: \"aftopl\" unpacked with wrong size!
fi
chmod +x aftopl
# end of overwriting check
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 1 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0