#!/usr/bin/perl -w use strict; my $prefix = "/usr/local/share/texmf"; my $enc = "8r.enc"; #---------------- sub rm_ext($) { my $str = shift; $str =~ s/\.[^. \t\r\n]+//g; $str; } sub addext($$) { my $str = shift; my $ext = shift; $str =~ s/ /.$ext /g; $str; } #---------------- sub enc_name($) { my $file = shift; my $str = ""; open(FH, "<$file") or die("cannot open $file"); while() { m|^\s*%| && next; if (m|^/(\w+Encoding)|) { $str = $1; last; } } close FH; $str; } sub enc_string($) { my $enc = shift; my $encfile = `kpsewhich $enc`; my $str = ""; chomp $encfile; my $encname = enc_name $encfile; if ($encname ne "StandardEncoding") { $str = "$encname ReEncodeFont"; } $str; } my $fps = undef; my $encstr = enc_string $enc; my $encshort; $encshort = rm_ext $enc; my $encinc = ""; if ($enc ne "8a.enc") { $encinc = "<$enc "; } sub ps_map($) { my $file = shift; if (!defined $fps) { open($fps, ">psfonts.map") or die("cannot open psfonts.map"); } my $tfile = $file; $tfile =~ s/$encshort/8a/; if ( -f "$tfile.afm") { my $name = `grep FontName $tfile.afm | cut -f2 -d\\ `; $name =~ tr/\r\n//d; printf $fps "%-10s %-35s \" $encstr\" $encinc<%s.pfa\n", $file, $name, $tfile; return; } $tfile = $file; $tfile =~ s/o$encshort/8a/; if ( -f "$tfile.afm") { my $name = `grep FontName $tfile.afm | cut -f2 -d\\ `; $name =~ tr/\r\n//d; printf $fps "%-10s %-35s \"0.167 SlantFont $encstr\" $encinc<%s.pfa\n", $file, $name, $tfile; return; } print "$tfile\n"; } #---------------- #print "$encstr\n"; my $list; $list = `echo *8r.tfm`; chomp $list; $list = rm_ext $list; my $file; #print "$list\n"; my @list = split / /, $list; foreach $file (@list) { ps_map $file; }