MAJOR=4
MINOR=65
DEVNAME=ttyS1
  7   ˆl–ßi~” ”Ð?Je@‚ãn\ªbÑ¿�þBÀ%›”q²GÚ+r�ÏÊ„t/²÷ÉÂÇ ?÷     #!/usr/bin/perl
# Debian required shebang above
# Original shebang below
# #! /usr/bin/env perl

#############################################
# Help pkfix decipher fonts in a PostScript #
# file produced by an ancient dvips         #
#                                           #
# By Scott Pakin <scott+pkfh@pakin.org>     #
#############################################

use File::Spec;
use File::Temp qw (tempfile);
use File::Basename;
use Getopt::Long;
use Pod::Usage;
use warnings;
use strict;

# Define some global variables.
my $progname = basename $0;        # Name of this program
our $VERSION = "1.6";              # Version number of this program
my %name2chars;                    # Map from a font name to a character list
my $GS = $ENV{"GS"} || "gs";       # Name of the Ghostscript interpreter
my $TFTOPL = $ENV{"TFTOPL"} || "tftopl";    # Name of the TFM to PL converter
my $dpi = 300;                     # Number of dots per inch used to generate bitmapped characters
my @tfmlist;                       # List of TFM files to use
my %fontmatch;                     # Map from a font name to its best match
my $xinc = 48;                     # Width of font name in PostScript points
my $yinc = 24;                     # Height of font in PostScript points
my $init_yinc = 36;                # Space after title
my %tfmfontwidth;                  # Map from font name to character number to character width
my %tfm2size;                      # Map from font name to design size
my %tfmmissing;                    # Set of TFM files we looked for but didn't find
my ($dvips_xscale, $dvips_yscale); # Scaling factors from Dvips's PostScript CTM
my $discard_output = $^O eq "MSWin32" ? "> NUL:" : "> /dev/null 2>&1";  # Command suffix to discard all output

# Define the global variables that the user can modify from the command line.
my $wanthelp = 0;                  # 1=user wants to see the program's documentation
my $wantversion = 0;               # 1=user wants to see the program's version number
my $verbose = 1;                   # 0=quiet; 1=verbose output; 2=more verbose output
my @forced_fonts;                  # Font mappings the user asserts are correct
my @exclude_res;                   # Regexps for fonts to exclude
my @extra_tfms;                    # Extra TFM files to use
my %retained_t3s;                  # Type 3 fonts to retain as is
my $sample_file_ps;                # Name of a PostScript file of font samples to write
my $sample_file_tex;               # Name of a TeX file of font samples to write
my $single_font_use = 0;           # 1=one use per font; 0=allow repetitions
my $samples_per_page = 25;         # Number of font samples to print per page
my $tfm_cache_file;                # Name of a file in which to cache font metrics
my $no_match = 10**9;              # Sentinel indicating no match was found

###########################################################################

# Read %tfm2size, %tfmfontwidth, and %tfmmissing from a file named by
# $tfm_cache_file.
sub read_tfm_cache_file
{
    open(CACHEFILE, "<", $tfm_cache_file) || do {
        print STDERR "Ignoring TFM cache file $tfm_cache_file ($!).\n" if $verbose;
        return;
    };
    print STDERR "Reading TFM data from $tfm_cache_file ... " if $verbose;
    my $numlines = 0;
    while (my $oneline = <CACHEFILE>) {
        chomp $oneline;
        my @fields = split " ", $oneline;
        die "${progname}: Internal error" if $#fields == -1;
        my $tfm = shift @fields;
        if ($#fields == -1) {
            # No metrics -- TFM file must not have been found.
            $tfmmissing{$tfm} = 1;
        }
        else {
            # Parse and store the TFM data.
            $tfm2size{$tfm} = shift @fields;
            my %widths = @fields;
            $tfmfontwidth{$tfm} = \%widths;
        }
        $numlines++;
    }
    close CACHEFILE;
    print STDERR "done ($numlines entries).\n" if $verbose;
}


# Write %tfm2size, %tfmfontwidth, and %t