Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!swrinde!cs.utexas.edu!mailrus!ncar!boulder!grunwald@foobar.colorado.edu From: grunwald@foobar.colorado.edu (Dirk Grunwald) Newsgroups: comp.text Subject: reverse engineering PK extensions Message-ID: <12425@boulder.Colorado.EDU> Date: 5 Oct 89 19:31:47 GMT Sender: news@boulder.Colorado.EDU Reply-To: grunwald@foobar.colorado.edu Distribution: comp Organization: University of Colorado at Boulder Lines: 47 I'm writing a program that produces a Makefile to build fonts using metafont. The input is a striped version of the \font declerations in lfonts.tex, i.e.: cmssi10 scaled 900 One option to this program is the DPI for metafont. E.g., at 85dpi, the above yields: # # NAME=cmssi10 # SCALE = 900 # EXTENSION = 77 # cmssi10.77pk: -mf '\mode:=sun;mag=900/1000;input cmssi10' -gftopk cmssi10.77gf && rm -f cmssi10.77gf The question is ``how does metafont generate the number used in the pk/gf suffix.'' I'm using ROUND( DPI * scale * mag ) / ( 1000 * 1000 ) ), which gives me ``77gf'' above. Metafont generates a .76gf. Aha, you say, it must TRUNCATE, not ROUND, i.e. ROUND( 85 * 900 * 1000 ) / (1000 * 1000 ) -> 77 TRUNC( 85 * 900 * 1000 ) / (1000 * 1000 ) -> 76 But, then, consider: mf '\mode:=sun;mag=700/1000;input cmssi10' this gives me cmssi10.60gf, but I compute ROUND( 85 * 700 * 1000 ) / (1000 * 1000 ) -> 60 TRUNC( 85 * 700 * 1000 ) / (1000 * 1000 ) -> 59 and in this case, metafont rounds. So what gives? Anyone have a simple way to compute what the PK/GF extension is going to be? The reason it's important is that the next entry in the generated makefile depends on that PK/GF file, to wit: cmssi10.77.snf: cmssi10.77pk -mftobdf -dpi 85 cmssi10.77pk bdftosnf < cmssi10.77.bdf > cmssi10.77.snf Dirk Grunwald -- Univ. of Colorado at Boulder (grunwald@foobar.colorado.edu)