aboutsummaryrefslogtreecommitdiffstats
path: root/doc/genps.pl
diff options
context:
space:
mode:
Diffstat (limited to 'doc/genps.pl')
-rwxr-xr-xdoc/genps.pl55
1 files changed, 35 insertions, 20 deletions
diff --git a/doc/genps.pl b/doc/genps.pl
index 8d7a76d9..7cbe23c0 100755
--- a/doc/genps.pl
+++ b/doc/genps.pl
@@ -99,7 +99,7 @@ $epsdir = File::Spec->curdir();
#
# Parse the command line
#
-undef $input, $fontpath;
+undef $input, $fontpath, $fontmap;
while ( $arg = shift(@ARGV) ) {
if ( $arg =~ /^\-(|no\-)(.*)$/ ) {
$parm = $2;
@@ -121,6 +121,8 @@ while ( $arg = shift(@ARGV) ) {
$headps = shift(@ARGV);
} elsif ( $true && $parm eq 'fontpath' ) {
$fontpath = shift(@ARGV);
+ } elsif ( $true && $parm eq 'fontmap' ) {
+ $fontmap = shift(@ARGV);
} else {
die "$0: Unknown option: $arg\n";
}
@@ -129,6 +131,25 @@ while ( $arg = shift(@ARGV) ) {
}
}
+# Generate a PostScript string
+sub ps_string($) {
+ my ($s) = @_;
+ my ($i,$c);
+ my ($o) = '(';
+ my ($l) = length($s);
+ for ( $i = 0 ; $i < $l ; $i++ ) {
+ $c = substr($s,$i,1);
+ if ( ord($c) < 32 || ord($c) > 126 ) {
+ $o .= sprintf("\\%03o", ord($c));
+ } elsif ( $c eq '(' || $c eq ')' || $c eq "\\" ) {
+ $o .= "\\".$c;
+ } else {
+ $o .= $c;
+ }
+ }
+ return $o.')';
+}
+
# Configure post-paragraph skips for each kind of paragraph
# (subject to modification above)
%skiparray = ('chap' => $psconf{chapskip},
@@ -188,6 +209,19 @@ if (defined($fontpath)) {
close($fp);
}
+# Create a Fontmap. At least some versions of Ghostscript
+# don't seem to get it right any other way.
+if (defined($fontmap)) {
+ open(my $fm, '>', $fontmap) or die "$0: $fontmap: $!\n";
+ foreach my $fname (sort keys(%ps_all_fonts)) {
+ my $fdata = $ps_all_fonts{$fname};
+ if (defined($fdata->{filename})) {
+ print $fm '/', $fname, ' ', ps_string($fdata->{filename}), " ;\n";
+ }
+ }
+ close($fp);
+}
+
# Custom encoding vector. This is basically the same as
# ISOLatin1Encoding (a level 2 feature, so we dont want to use it),
# but with the "naked" accents at \200-\237 moved to the \000-\037
@@ -1113,25 +1147,6 @@ while ( defined($line = <PSHEAD>) ) {
close(PSHEAD);
print "%%EndProlog\n";
-# Generate a PostScript string
-sub ps_string($) {
- my ($s) = @_;
- my ($i,$c);
- my ($o) = '(';
- my ($l) = length($s);
- for ( $i = 0 ; $i < $l ; $i++ ) {
- $c = substr($s,$i,1);
- if ( ord($c) < 32 || ord($c) > 126 ) {
- $o .= sprintf("\\%03o", ord($c));
- } elsif ( $c eq '(' || $c eq ')' || $c eq "\\" ) {
- $o .= "\\".$c;
- } else {
- $o .= $c;
- }
- }
- return $o.')';
-}
-
# Generate PDF bookmarks
print "%%BeginSetup\n";
foreach $b ( @bookmarks ) {