ajayshah@aludra.usc.edu (Ajay Shah) (09/12/90)
How does one do this, in general? I'm basically planning on using Metafont to create some strange effects and then be able to use 'em as normal HP soft fonts. -- _______________________________________________________________________________ Ajay Shah, (213)747-9991, ajayshah@usc.edu The more things change, the more they stay insane. _______________________________________________________________________________
lee@sq.sq.com (Liam R. E. Quin) (09/14/90)
Ajay Shah <ajayshah@aludra.usc.edu> askes how one uses Metafont to generate HP soft fonts. Since I get asked this quite often (especially after posting the list of Metafont fonts to comp.fonts!), I'm posting this... I am also cross-posting to comp.fonts, as that is a more usual place for this sort of stuff. Questions about specific desk-top publishing packages probably belong only in comp.text.desktop, however... If you want to use the fonts with TeX, you need a dvi driver that makes TeX (or LaTeX, or MuTeX, or AMSTeX...) produce HP-style output. There are at least a couple of these in various archives. If you want to use the fonts with another package, well, here's what I do: * run metafont to produce a gf font $ virmf '&black \mode:=laserjet; mag:=1.3; input cmr10.mf' where $ --- shell prompt virmf -- metafont *without* cmbase loaded. I use this because some fonts must be generated without loading cmbase -- e.g. the AMS ones. You can always link "cmbase.mf" to the current directory to get it loaded automatically if needed... &black -- read the mode definitions for a write-black laser printer (the laserjet, like the LaserWriter, is a Write Black laser printer. The Xerox 2700 and 3700 are examples of a write white printer. You must use the correct one or things will look _ghastly_) \mode:=laserjet; -- use the LaserJet-specific parameters, if you have them in your "black.mf" file... if not, just use "\mode:=localfont;" instead. mag:=1.3; -- the font generated will be 10 point (because of the 10 in the filename, see below), but at a resolution of 1.3 times that specified in the "black.mf" file for this mode. This has the effect of generating a 1.3*10 = 13pt font. It is better to use cmr13.mf instead if you have it... cmr10.mf -- the input file for the font. The cm means it's a Computer Modern font, the 10 means it's for a 10 point font, and the .mf is an extension for metafont files. Obviously you'll generally use another file or you'll always get the same font :-) :-) This first step makes a "gf" file: $ ls *gf cmr10.300gf $ Yes, there it is, I'm convinced. :-) So now we make a pk file: $ gftopk cmr10.300gf $ ls cmr10.* cmr10.300gf cmr10.300pk cmr10.log cmr10.mf cmr10.tfm OK... Now it gets difficult, because the program you need for the next step is not included in the TeX distribution. Wail! Misery! Fear not. You can get it by ftp... as it's part of Chris Lewis' psroff package. From the Announcement: - Psroff 2.0 will appear in comp.sources.unix shortly. - Psroff 2.0 is available for anonymous FTP from: - gatekeeper.dec.com (16.1.0.2) as anonymous, file /pub/misc/psroff-2.0.tar.Z, courtesy Paul Vixie - cs.toronto.edu as anonymous, file ~ftp/pub/psroff.tar.Z, courtesy Mark Moraes $ pk2sfp cmr10.300pk > cmr10.300sfp Now I have an HP soft font... (In my case I convert these to a Xerox format for the X3700, but that's another story. You don't want to do that. It makes you go insane.) If you want to use the new font with troff, you'll need to make a width table. I suspect that psroff might have software to do this -- I've not looked, since we use a different format for troff width files at SoftQuad (mostly in order to support the various kerning stuff) and have our own software... If you want to download it... well, here is a (System V) shell script that might help. (more comments follow the short script) : use /bin/sh # (this should be the first line) # Liam Quin's hp font download-and-print-sample program # check echo version: if test x"`echo -n hello`" = x"hello" then N='-n'; C= else N=; C='\c' fi export N C ( FontId=100 # reset the printer: echo $N "\033E$C" for i do echo $N "\033*c${FontId}D$C" case "$i" in *.Z) zcat $i ;; *) if [ ! -f "$i" -a -f "$i" ] then zcat "$i.Z" else cat "$i" fi ;; esac # ESC * C 4 F makes the last font specified a temporary one echo $N "\033*c${FontId}\033*c4F$C" FontId=`expr $FontId + 1` done FontId=100 # initial set up: echo "\r\n\r\b" # skip the 1st couple of output lines... for i do echo $N "\033&l6D$C" echo $N "\033&l0O\033(8U\033(s0p10h12v0s0b3T$C" echo "\033&a500H----- $i -----\r" echo "\033&l2D$C" echo "\033*c${FontId}D\033(${FontId}X\r" echo "\033&a500H0 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r" echo "\033&a500H1 abcdefghijklmnopqrstuvwxyz\r" echo "\033&a500H2 1234567890!@#$%^&*()-=_+[]{};':\r" echo '\033&a500H3 \|;:<>,.`~"/?\r' # possibly a line here with control characters in it. Avoid control-S # and control-Q, though... FontId=`expr $FontId + 1` done # final form feed: echo $N "\014$C" ) | lp -dhpII # end of shell script. I call mine "liam.dl", and say (for example) liam.dl cmr10.300sfp If you leave out the "| lp" at the end, it will make your terminal try to explode (and possibly succeed). I do not accept liability :-) If you get a line or two of garbage at or near the top of lots and lots of otherwise blank pages that are suddenly printed, either * you don't have 8-bit transparency (SysV: stty -parenb cs8 -opost) * the font is too big (there are limits) * something is being corrupted) * your echo doesn't understand \033 to be escape. In this case, change the octal escapes in the program to be the appropriate characters, and try once more, perhaps into a file to see that it looks OK... I can't give help on this sort of problem at all. Please don't even ask. There are so many possible causes that unless you can really isolate it, I can't begin. And if you've isolated it you can probably fix it! * * * Using Metafont turns out to be difficult. There are a number of tantalising but basically unrevealing articles in TugBoat, and a single book (by Knuth) on the subject. The Pandora report is good reading if you're getting serious, as is everything by {Zapf, Morris, Morrison, Johnston,....} and too many others to mention. Font design is more subtle than it looks. And more tedious. And more fun. %Title Metamarks: Preliminary Studies for a Pandora's Box of Shapes %Auth Billawala, Neenie %Inst Dept. of Computer Science, Stanford University, Stanford, CA 94305 %Date May 1989 %Other Report No. STAN-CS-89-1256 You can get it from the TeX Users' Group, P.O. Box 9506, Providence, RI 02940-9506 USA (No, I don't _think_ the long string of digits is a 'phone number, but I amn't sure). Pandora has a way to go yet as a font, by the way... but thre isn't much more literature (of which I'm aware) about using Metafont other than that by Knuth. Lee -- Liam R. E. Quin, lee@sq.com, SoftQuad Inc., Toronto, +1 (416) 963-8337 [Granny weatherwax] was opposed to books on strict moral grounds, since she had heard that many of them were written by dead people and therefore it stod to reason reading them would be as bad as necromancy. [Equal Rites 118]