mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-07-24 10:25:42 -04:00
pspdf.pl: GhostScript font integration seems broken with -dSAFER
-dSAFER seems to break font integration on some systems. Furthermore, once given -dSAFER seems to not be possible to override, so instead of calling via the ps2pdf script, call GhostScript explicitly with the equivalent options, sans -dSAFER. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
10c0f66570
commit
ab2c4dfff9
30
doc/pspdf.pl
30
doc/pspdf.pl
@ -23,6 +23,9 @@ while ($ARGV[0] =~ /^-(.*)$/) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ghostscript executable name. "gs" on Unix-based systems.
|
||||||
|
my $gs = 'gs';
|
||||||
|
|
||||||
my ($in, $out) = @ARGV;
|
my ($in, $out) = @ARGV;
|
||||||
|
|
||||||
if (!defined($out)) {
|
if (!defined($out)) {
|
||||||
@ -70,6 +73,17 @@ sub win32_gs_help() {
|
|||||||
$ENV{'PATH'} .= ';' . $gs[0]->{'/GS_LIB'};
|
$ENV{'PATH'} .= ';' . $gs[0]->{'/GS_LIB'};
|
||||||
$ENV{'GS_FONTPATH'} .= (defined($ENV{'GS_FONTPATH'}) ? ';' : '')
|
$ENV{'GS_FONTPATH'} .= (defined($ENV{'GS_FONTPATH'}) ? ';' : '')
|
||||||
. $ENV{'windir'}.'\\fonts';
|
. $ENV{'windir'}.'\\fonts';
|
||||||
|
|
||||||
|
my $gsp = undef;
|
||||||
|
foreach my $p (split(/\;/, $gs[0]->{'/GS_LIB'})) {
|
||||||
|
foreach my $exe ('gswin64c.exe', 'gswin32c.exe', 'gs.exe') {
|
||||||
|
last if (defined($gsp));
|
||||||
|
my $e = File::Spec->catpath($p, $exe);
|
||||||
|
$gsp = $e if (-f $e && -x _);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gs = $gsp if (defined($gsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove output file
|
# Remove output file
|
||||||
@ -80,13 +94,19 @@ my $r = system('acrodist', '-n', '-q', '--nosecurity', '-o', $out, $in);
|
|||||||
exit 0 if ( !$r && -f $out );
|
exit 0 if ( !$r && -f $out );
|
||||||
|
|
||||||
# 2. ps2pdf (from Ghostscript)
|
# 2. ps2pdf (from Ghostscript)
|
||||||
# The -I clause helps Ghostscript pick up the Fontdir file written by findfont.ph
|
#
|
||||||
# GhostScript uses # rather than - to separate options and values on Windows, it seems...
|
# GhostScript uses # rather than = to separate options and values on Windows,
|
||||||
|
# it seems. Call gs directly rather than ps2pdf, because -dSAFER
|
||||||
|
# breaks font discovery on some systems, apparently.
|
||||||
win32_gs_help();
|
win32_gs_help();
|
||||||
my $o = $win32_ok ? '#' : '-';
|
my $o = $win32_ok ? '#' : '=';
|
||||||
my $r = system('ps2pdf', "-dOptimize${o}true", "-dEmbedAllFonts${o}true",
|
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",
|
||||||
"-dCompressPages${o}" . ($compress ? 'true' : 'false'),
|
"-dCompressPages${o}" . ($compress ? 'true' : 'false'),
|
||||||
"-dUseFlateCompression${o}true", $in, $out);
|
"-dUseFlateCompression${o}true",
|
||||||
|
"-c", ".setpdfwrite", "-f", $in);
|
||||||
exit 0 if ( !$r && -f $out );
|
exit 0 if ( !$r && -f $out );
|
||||||
|
|
||||||
# 3. pstopdf (BSD/MacOS X utility)
|
# 3. pstopdf (BSD/MacOS X utility)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user