clipper@csd.uwo.ca (Khun Yee Fung) (04/27/91)
I have written a simple Perl program to convert a Postscript font file that comes with dvips (e.g. times.sty) that uses the old font selection scheme to a equivalent file for the new font selection scheme. It does not know anything about math fonts yet. It will be difficult to handle them. I am not using \rmdefault, \ttdefault and \ssdefault. Should I use them instead of simply passing the postscript fonts as cm* fonts? So far I have not encountered any problem. However, I can't guarantee it is error-free. I hope correcting the ouput will be easier than convert such a file by hand... It takes one argument, the name of the file to be converted. A file in the current directory with "p" prepended to the input file name is created with the equivalent font definition for the new scheme. I call the program ptimes, you can call anything you want. Send any comments/ideas/suggestions you have to me. Khun Yee -- Name: Khun Yee Fung Email: clipper@csd.uwo.ca Paper mail: Department of Computer Science, Middlesex College The University of Western Ontario, London, Ontario, N6A 5B7 CANADA #!/usr2/new/bin/perl ($file) = @ARGV; @entities = split('/', $file); $outf = "p$entities[$#entities]"; die "Can't find $file\n" if (!open(FILE, $file)); die "Can't open a file in the current directory\n" if (!open(OUT, ">$outf")); @t = localtime(time); $filedate = sprintf("%02d/%02d/%02d", $t[5], $t[4]+1, $t[3]); $docdate = $filedate; while (<FILE>) { if ($_ =~ /\\def\\@mrm\{(.*)\}/) { $fonts{$1} = "m,n,r"; } elsif ($_ =~ /\\def\\@mit\{(.*)\}/) { $fonts{$1} = "m,it,r"; } elsif ($_ =~ /\\def\\@msl\{(.*)\}/) { $fonts{$1} = "m,sl,r"; } elsif ($_ =~ /\\def\\@mbf\{(.*)\}/) { $fonts{$1} = "bx,n,r"; } elsif ($_ =~ /\\def\\@mcsc\{(.*)\}/) { $fonts{$1} = "m,sc,r"; } elsif ($_ =~ /\\def\\@mtt\{(.*)\}/) { $fonts{$1} = "m,n,tt"; } elsif ($_ =~ /\\def\\@mss\{(.*)\}/) { $fonts{$1} = "m,n,ss"; } } print OUT " % Converted automatically by ptimes by Khun Yee Fung % Date: $filedate \\def\\fileversion\{v1.0a\} \\def\\filedate\{$filedate\} \\def\\docdate \{$docdate\} \\typeout\{Style Option: `$outf' \\fileversion\\space \<\\filedate\>\} \\@ifundefined\{selectfont\} \{\\@latexerr\{`$outf' style option could only be used with the new font selection scheme\}\\@eha \\endinput\}\{\} "; foreach $f (keys(%fonts)) { ($series, $shape, $family) = split(',', $fonts{$f}); print OUT "\\new@fontshape\{cm$family\}\{$series\}\{$shape\}\{%\n"; print OUT " \<5\>$f at 5pt%\n"; print OUT " \<6\>$f at 6pt%\n"; print OUT " \<7\>$f at 7pt%\n"; print OUT " \<8\>$f at 8pt%\n"; print OUT " \<9\>$f at 9pt%\n"; print OUT " \<10\>$f at 10pt%\n"; print OUT " \<11\>$f at 10.95pt%\n"; print OUT " \<12\>$f at 12pt%\n"; print OUT " \<14\>$f at 14.4pt%\n"; print OUT " \<17\>$f at 17.28pt%\n"; print OUT " \<20\>$f at 20.74pt%\n"; print OUT " \<25\>$f at 24.88pt\}\{\}\n"; } close(OUT); close(FILE);