mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
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>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
55
doc/genps.pl
55
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 ) {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user