summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--doc/Makefile.in11
-rwxr-xr-xdoc/genps.pl55
-rwxr-xr-xdoc/pspdf.pl5
4 files changed, 48 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index 827f05bf..63b3470a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
*.i
*.ith
*.lst
+*.map
*.mo32
*.mo64
*.o
@@ -69,6 +70,7 @@ TAGS
/doc/version.src
/doc/warnings.src
/doc/fontpath
+/doc/Fontmap
/include/warnings.h
/macros/macros.c
/misc/omfdump
diff --git a/doc/Makefile.in b/doc/Makefile.in
index e8da1450..ba44b44a 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -67,19 +67,24 @@ version.src: $(top_srcdir)/version.pl $(top_srcdir)/version
nasmdoc.ps: nasmdoc.dip genps.pl afmmetrics.ph ttfmetrics.ph \
pswidth.ph nasmlogo.eps psfonts.ph head.ps
$(PERL) $(srcdir)/genps.pl -epsdir "$(srcdir)" \
- -headps $(srcdir)/head.ps -fontpath fontpath nasmdoc.dip \
- > nasmdoc.ps
+ -headps $(srcdir)/head.ps \
+ -fontpath fontpath \
+ -fontmap Fontmap \
+ nasmdoc.dip > nasmdoc.ps
fontpath: nasmdoc.ps
@: Generated by side effect
+Fontmap: nasmdoc.ps
+ @: Generated by side effect
+
nasmdoc.pdf: nasmdoc.ps pspdf.pl fontpath
$(PERL) $(srcdir)/pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf fontpath
clean:
-$(RM_F) *.rtf *.hpj *.texi *.gid *.ipf *.dip
-$(RM_F) *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
- -$(RM_F) inslist.src version.src fontpath
+ -$(RM_F) inslist.src version.src fontpath Fontmap
-$(RM_F) nasmdoc*.ps
spotless: clean
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 ) {
diff --git a/doc/pspdf.pl b/doc/pspdf.pl
index 2bfa74f7..569f974b 100755
--- a/doc/pspdf.pl
+++ b/doc/pspdf.pl
@@ -113,8 +113,9 @@ if (defined($fontpath)) {
close($fp);
$fpopt = "-sFONTPATH${o}" . join($p, @fplist);
}
-
-my $r = system($gs, "-dCompatibilityLevel${o}1.4", "-q",
+
+my $r = system($gs, "-dCompatibilityLevel${o}1.4",
+ "-I".File::Spec->curdir(),
"-P-", "-dNOPAUSE", "-dBATCH", "-sDEVICE${o}pdfwrite",
"-sstdout${o}%stderr", "-sOutputFile${o}${out}",
"-dOptimize${o}true", "-dEmbedAllFonts${o}true",