aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-10-04 13:09:30 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-10-04 13:09:30 -0700
commit18e87ce7bd64de013e55813a837b38d46252f30d (patch)
treed38e5767f8fd0bccf6116c5177d63a18df4e7322 /doc
parentbef71a86b949009f8fd2d194b1d9f1ce1595ffb4 (diff)
downloadnasm-18e87ce7bd64de013e55813a837b38d46252f30d.tar.gz
nasm-18e87ce7bd64de013e55813a837b38d46252f30d.tar.xz
nasm-18e87ce7bd64de013e55813a837b38d46252f30d.zip
doc: we really need a Fontmap file
It turns out that we need a Fontmap file after all, *and* -I. to make gs find it. Inconsistent results came from stray Fontmap files from previous debug attempts. Now generate both fontpath and Fontmap, and hopefully at least one of them should work. We might, in fact, need both, one for gs to know where the files are and one for gs to know it is allowed to read them. The core problem seems to be that gs will find OTF fonts by its normal discovery mechanisms, but for some reason don't seem to use them unless it can find them in a Fontmap, Font directory, of CIDFont directory. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.in11
-rwxr-xr-xdoc/genps.pl55
-rwxr-xr-xdoc/pspdf.pl5
3 files changed, 46 insertions, 25 deletions
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",