mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
doc: fix yet another set of Ghostscript font problems
Seems like Ghostscript has managed to break fontconfig support again, at least in Fedora 30. Help Ghostscript along by giving it an explicit font path. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
e678020878
commit
186f9a0514
@ -70,6 +70,8 @@ sub add_file_to_font_hash($) {
|
||||
|
||||
return unless (defined($fontdata));
|
||||
|
||||
$fontdata->{filename} = $filename;
|
||||
|
||||
my $oldinfo = $font_info_hash{$fontdata->{name}};
|
||||
|
||||
if (!defined($oldinfo) ||
|
||||
|
24
doc/genps.pl
24
doc/genps.pl
@ -99,7 +99,7 @@ $epsdir = File::Spec->curdir();
|
||||
#
|
||||
# Parse the command line
|
||||
#
|
||||
undef $input;
|
||||
undef $input, $fontpath;
|
||||
while ( $arg = shift(@ARGV) ) {
|
||||
if ( $arg =~ /^\-(|no\-)(.*)$/ ) {
|
||||
$parm = $2;
|
||||
@ -119,6 +119,8 @@ while ( $arg = shift(@ARGV) ) {
|
||||
$epsdir = shift(@ARGV);
|
||||
} elsif ( $true && $parm eq 'headps' ) {
|
||||
$headps = shift(@ARGV);
|
||||
} elsif ( $true && $parm eq 'fontpath' ) {
|
||||
$fontpath = shift(@ARGV);
|
||||
} else {
|
||||
die "$0: Unknown option: $arg\n";
|
||||
}
|
||||
@ -166,6 +168,26 @@ foreach my $fset ( @AllFonts ) {
|
||||
}
|
||||
}
|
||||
|
||||
# Create a font path. At least some versions of Ghostscript
|
||||
# don't seem to get it right any other way.
|
||||
if (defined($fontpath)) {
|
||||
my %fontdirs = ();
|
||||
foreach my $fname (sort keys(%ps_all_fonts)) {
|
||||
my $fdata = $ps_all_fonts{$fname};
|
||||
if (defined($fdata->{filename})) {
|
||||
my($vol,$dir,$basename) =
|
||||
File::Spec->splitpath(File::Spec->rel2abs($fdata->{filename}));
|
||||
$dir = File::Spec->catpath($vol, $dir, '');
|
||||
$fontdirs{$dir}++;
|
||||
}
|
||||
}
|
||||
open(my $fp, '>', $fontpath) or die "$0: $fontpath: $!\n";
|
||||
foreach $d (sort(keys(%fontdirs))) {
|
||||
print $fp $d, "\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
|
||||
|
21
doc/pspdf.pl
21
doc/pspdf.pl
@ -26,10 +26,10 @@ while ($ARGV[0] =~ /^-(.*)$/) {
|
||||
# Ghostscript executable name. "gs" on Unix-based systems.
|
||||
my $gs = 'gs';
|
||||
|
||||
my ($in, $out) = @ARGV;
|
||||
my ($in, $out, $fontpath) = @ARGV;
|
||||
|
||||
if (!defined($out)) {
|
||||
die "Usage: $0 [-nocompress] infile ou{ tfile\n";
|
||||
die "Usage: $0 [-nocompress] infile outfile [fontpath]\n";
|
||||
}
|
||||
|
||||
# If Win32, help GhostScript out with some defaults
|
||||
@ -96,14 +96,29 @@ exit 0 if ( !$r && -f $out );
|
||||
# 2. ps2pdf (from Ghostscript)
|
||||
#
|
||||
# GhostScript uses # rather than = to separate options and values on Windows,
|
||||
# it seems. Call gs directly rather than ps2pdf, because -dSAFER
|
||||
# it seems. Similary it uses ; in path lists rather than :.
|
||||
# Call gs directly rather than ps2pdf, because -dSAFER
|
||||
# breaks font discovery on some systems, apparently.
|
||||
win32_gs_help();
|
||||
my $o = $win32_ok ? '#' : '=';
|
||||
my $p = $win32_ok ? ';' : ':';
|
||||
my $fpopt;
|
||||
if (defined($fontpath)) {
|
||||
my @fplist = ();
|
||||
open(my $fp, '<', $fontpath) or die "$0: $fontpath: $!\n";
|
||||
while (my $fpe = <$fp>) {
|
||||
chomp $fpe;
|
||||
push(@fplist, $fpe);
|
||||
}
|
||||
close($fp);
|
||||
$fpopt = "-sFONTPATH${o}" . join($p, @fplist);
|
||||
}
|
||||
|
||||
my $r = system($gs, "-dCompatibilityLevel${o}1.4", "-q",
|
||||
"-P-", "-dNOPAUSE", "-dBATCH", "-sDEVICE${o}pdfwrite",
|
||||
"-sstdout${o}%stderr", "-sOutputFile${o}${out}",
|
||||
"-dOptimize${o}true", "-dEmbedAllFonts${o}true",
|
||||
$fpopt,
|
||||
"-dCompressPages${o}" . ($compress ? 'true' : 'false'),
|
||||
"-dUseFlateCompression${o}true",
|
||||
"-c", ".setpdfwrite", "-f", $in);
|
||||
|
Loading…
Reference in New Issue
Block a user