summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-03 01:34:39 +0000
committerKarl Berry <karl@freefriends.org>2008-03-03 01:34:39 +0000
commit5b74b3a54380de895a795d9a2971f640ae75bef5 (patch)
tree797c079f83a4786fb82eb9ccb7a3299caed49457 /Master
parentd7c545c466114d9a1ccd5a5928c26590a43a9c7c (diff)
symlink pkfix and ps2eps
git-svn-id: svn://tug.org/texlive/trunk@6814 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
l---------[-rwxr-xr-x]Master/bin/i386-linux/pkfix861
l---------[-rwxr-xr-x]Master/bin/i386-linux/ps2eps930
-rwxr-xr-x[-rw-r--r--]Master/texmf/scripts/pkfix/pkfix.pl0
-rw-r--r--Master/tlpkg/tlpsrc/bin-pstools.tlpsrc2
4 files changed, 2 insertions, 1791 deletions
diff --git a/Master/bin/i386-linux/pkfix b/Master/bin/i386-linux/pkfix
index 1429889b9ec..7d1c767c21f 100755..120000
--- a/Master/bin/i386-linux/pkfix
+++ b/Master/bin/i386-linux/pkfix
@@ -1,860 +1 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
-use strict;
-$^W=1; # turn warning on
-#
-# pkfix.pl
-#
-# Copyright (C) 2001, 2005 Heiko Oberdiek.
-#
-# This work may be distributed and/or modified under the
-# conditions of the LaTeX Project Public License, either version 1.3
-# of this license or (at your option) any later version.
-# The latest version of this license is in
-# http://www.latex-project.org/lppl.txt
-# and version 1.3 or later is part of all distributions of LaTeX
-# version 2003/12/01 or later.
-# This work has the LPPL maintenance status "maintained".
-# This Current Maintainer of this work is Heiko Oberdiek.
-#
-# See file "README" for a list of files that belongs to this project.
-#
-# This file "pkfix.pl" may be renamed to "pkfix"
-# for installation purposes.
-#
-my $file = "pkfix.pl";
-my $program = uc($&) if $file =~ /^\w+/;
-my $project = lc($program);
-my $version = "1.3";
-my $date = "2005/02/25";
-my $author = "Heiko Oberdiek";
-my $copyright = "Copyright (c) 2001, 2005 by $author.";
-#
-# Reqirements: Perl5, dvips
-# History:
-# 2001/04/12 v0.1:
-# * First try.
-# 2001/04/13 v0.2:
-# * TeX/dvips is called for each font for the case of errors.
-# * First release.
-# 2001/04/15 v0.3:
-# * Call of kpsewhich with option --progname.
-# * Extracting of texps.pro from temporary PostScript file,
-# if kpsewhich failed.
-# * Option -G0 for dvips run added.
-# 2001/04/16 v0.4:
-# * Support for merging PostScript fonts added.
-# * \special{!...}/@fedspecial detection added.
-# * Bug fix: I detection.
-# 2001/04/17 v0.5:
-# * Redirection of stderr (dvips run) if possible.
-# 2001/04/20 v0.6:
-# * Bug fix: dvips font names can contain numbers.
-# 2001/04/21 v0.7:
-# * Bug fix: long dvi file name in ps file.
-# 2001/04/23 v0.8:
-# * Bug fix: post string parsing.
-# 2001/04/26 v0.9:
-# * Check of version number of dvips in PostScript file.
-# 2001/06/30 v1.0:
-# * Problem with DOS line endings fixed.
-# 2005/01/28 v1.1:
-# * Bug fix: encoding files are now included also.
-# * The intermediate DVI files are written directly.
-# * LPPL 1.3
-# 2005/01/29 v1.2:
-# * Merging is now based on type 1 names. This solves
-# the problem, if different bitmap fonts maps to the
-# same type 1 font, eg. (ecrm1000, larm1000) -> SFRM1000.
-# * Suppression of PK generation, if environment variable
-# MKTEXPK is supported.
-# * If output file is "-" (standard output) then messages of
-# pkfix are written to standard error output.
-# 2005/02/25 v1.3:
-# * Bug fix: Detection of "@fedspecial end" improved.
-# * Bug fix: Typo corrected (PRT -> $PRT).
-#
-
-### program identification
-my $title = "$program $version, $date - $copyright\n";
-
-### error strings
-my $Error = "!!! Error:"; # error prefix
-my $Warning = "!!! Warning:"; # warning prefix
-
-### variables
-my $envvar = uc($project);
-my $infile = "";
-my $outfile = "";
-my $texpsfile = "texps.pro";
-my $prefix = "_${project}_$$";
-# my $prefix = "_${project}_";
-my $tempfile = "$prefix";
-my $texfile = "$tempfile.tex";
-my $dvifile = "$tempfile.dvi";
-my $logfile = "$tempfile.log";
-my $psfile = "$tempfile.ps";
-my $missfile = "missfont.log";
-my @cleanlist = ($dvifile, $psfile);
-push(@cleanlist, $missfile) unless -f $missfile;
-
-my $err_redirect = " 2>&1";
-$err_redirect = "" if $^O =~ /dos/i ||
- $^O =~ /os2/i ||
- $^O =~ /mswin32/i ||
- $^O =~ /cygwin/i;
-
-my $x_resolution = 0;
-my $y_resolution = 0;
-my $blocks_found = 0;
-my $fonts_converted = 0;
-my $fonts_merged = 0;
-my $fonts_misses = 0;
-my $PRT = \*STDOUT;
-
-### option variables
-my @bool = ("false", "true");
-$::opt_tex = "tex";
-$::opt_dvips = "dvips";
-$::opt_kpsewhich = "kpsewhich --progname $project";
-$::opt_options = "-Ppdf -G0";
-$::opt_usetex = 0;
-$::opt_help = 0;
-$::opt_quiet = 0;
-$::opt_debug = 0;
-$::opt_verbose = 0;
-$::opt_clean = 1;
-
-my $usage = <<"END_OF_USAGE";
-${title}Syntax: \L$program\E [options] <inputfile.ps> <outputfile.ps>
-Function: This program tries to replace pk fonts in <inputfile.ps>
- by the type 1 versions. The result is written in <outputfile.ps>.
-Options: (defaults:)
- --help print usage
- --(no)quiet suppress messages ($bool[$::opt_quiet])
- --(no)verbose verbose printing ($bool[$::opt_verbose])
- --(no)debug debug informations ($bool[$::opt_debug])
- --(no)clean clear temp files ($bool[$::opt_clean])
- --(no)usetex use TeX for generating the DVI file ($bool[$::opt_usetex])
- --tex texcmd tex command name (plain format) ($::opt_tex)
- --dvips dvipscmd dvips command name ($::opt_dvips)
- --options opt dvips options ($::opt_options)
-END_OF_USAGE
-
-### environment variable PKFIX
-if ($ENV{$envvar}) {
- unshift(@ARGV, split(/\s+/, $ENV{$envvar}));
-}
-
-### process options
-my @OrgArgv = @ARGV;
-use Getopt::Long;
-GetOptions(
- "help!",
- "quiet!",
- "debug!",
- "verbose!",
- "clean!",
- "usetex!",
- "tex=s",
- "dvips=s",
- "options=s"
-) or die $usage;
-!$::opt_help or die $usage;
-@ARGV < 3 or die "$usage$Error Too many files!\n";
-@ARGV == 2 or die "$usage$Error Missing file names!\n";
-
-$::opt_quiet = 0 if $::opt_verbose;
-$::opt_clean = 0 if $::opt_debug;
-
-push(@cleanlist, $texfile, $logfile) if $::opt_usetex;
-
-### get file names
-$infile = $ARGV[0];
-$outfile = $ARGV[1];
-
-### suppress PK generation
-$ENV{'MKTEXPK'} = "0";
-
-$PRT = \*STDERR if $outfile eq "-";
-
-print $PRT $title unless $::opt_quiet;
-
-print $PRT "*** input file: `$infile'\n" if $::opt_verbose;
-print $PRT "*** output file: `$outfile'\n" if $::opt_verbose;
-
-if ($::opt_debug) {
- print $PRT <<"END_DEB";
-*** OSNAME: $^O
-*** PERL_VERSION: $]
-*** ARGV: @OrgArgv
-END_DEB
-}
-
-### get texps.pro
-my $texps_data = 0;
-my $texps_string = get_texps_pro();
-
-### Encoding definitions
-my %encoding_files = ();
-my $encoding_string = "";
-
-### open input and output files
-open(IN, $infile) or die "$Error Cannot open `$infile'!\n";
-open(OUT, ">$outfile") or die "$Error Cannot write `$outfile'!\n";
-
-##################################
-# expected format:
-# ...
-# %%DVIPSParameters:... dpi=([\dx]+)...
-# ...
-# TeXDict begin \d+ \d+ \d+ \d+ \d+ \(\S+\)
-# @start ...
-# ...
-# %DVIPSBitmapFont: (\S+) (\S+) ([\d\.]+) (\d+)
-# /(\S+) ...
-# ...
-# %EndDVIPSBitmapFont
-# ...
-# ... end
-# %%EndProlog
-#
-# or if \special{!...} was used, the lines with TeXDict:
-# TeXdict begin @defspecial
-#
-# ...
-#
-# @fedspecial end TeXDict begin
-# \d+ \d+ \d+ \d+ \d+ \(\S+\) @start
-#
-# or
-# @fedspecial end
-# ...
-#
-# bitmap font:
-# start:
-# %%DVIPSBitmapFont: {dvips font} {font name} {at x pt} {chars}
-# /{dvips font} {chars} {max. char number + 1} df
-# character, variant a:
-# <{hex code}>{char number} D
-# character, variant b:\
-# [<{hex code}>{num1} {num2} {num3} {num4} {num5} {char number} D
-# end:
-# E
-# %%EndDVIPSBitmapFont
-#
-# type 1 font:
-# before TeXDict line:
-# %%BeginFont: CMR10
-# ...
-# %%EndFont
-# after @start:
-# /Fa ... /CMR10 rf
-#
-# Font names: /[F-Z][a-zA-Z0-9]
-#
-# Encoding files before texps.pro:
-# %%BeginProcSet: {file name}.enc 0 0
-# ...
-# %%EndProcSet
-###################################
-
-my $x_comment_resolution = 0;
-my $y_comment_resolution = 0;
-my $start_string = "";
-my $post_string = "";
-my $dvips_resolution = "";
-my $texps_found = 0;
-my @font_list = ();
-my %font_txt = ();
-my %font_count = ();
-my %font_entry = ();
-
-sub init {
- $x_comment_resolution = 0;
- $y_comment_resolution = 0;
- $x_resolution = 0;
- $y_resolution = 0;
- $start_string = "";
- $texps_found = 0;
- @font_list = ();
- %font_txt = ();
- %font_count = ();
- %font_entry = ();
-}
-
-init();
-
-while (<IN>) {
-
- if (/^%%Creator: (dvips\S*) (\S+)\s/) {
- print $PRT "*** %%Creator: $1 $2\n" if $::opt_debug;
- my $foundversion = $2;
- if ($foundversion =~ /(\d+\.\d+)/) {
- $foundversion = $1;
- # 5.62 is ok, 5.58 does not produce font comments
- if ($foundversion <= 5.58) {
- print $PRT "$Warning dvips version $1 does not generate " .
- "the required font comments!\n";
- }
- }
- }
-
- if (/^%%BeginProcSet:\s*(.+)\.enc/) {
- $encoding_files{$1} = "";
- }
-
- if (/^%DVIPSParameters:.*dpi=([\dx]+)/) {
- print OUT;
- my $str = $1;
- $x_comment_resolution = 0;
- $y_comment_resolution = 0;
- if ($str =~ /^(\d+)x(\d+)$/) {
- $x_comment_resolution = $1;
- $y_comment_resolution = $2;
- }
- if ($str =~ /^(\d+)$/) {
- $x_comment_resolution = $1;
- $y_comment_resolution = $1;
- }
- print $PRT "*** %DVIPSParameters: dpi=$str " .
- "(x=$x_comment_resolution, y=$y_comment_resolution)\n"
- if $::opt_debug;
- $x_comment_resolution > 0 && $y_comment_resolution > 0 or
- die "$Error Wrong resolution value " .
- "($x_comment_resolution x $y_comment_resolution)!\n";
- next;
- }
-
- if (/^%%BeginProcSet: texps.pro/) {
- $texps_found = 1;
- print $PRT "*** texps.pro found\n" if $::opt_debug;
- }
-
- if (/^TeXDict begin \@defspecial/) {
- my $saved = $_;
- print $PRT "*** \@defspecial found.\n" if $::opt_debug;
- $start_string = $_;
- while (<IN>) {
- $start_string .= $_;
- if (/^\@fedspecial end/) {
- s/^\@fedspecial end\s*(\S)/$1/;
- last;
- }
- }
- }
- elsif (/^TeXDict begin \d+ \d+ \d+ \d+ \d+/) {
- print $PRT "*** TeXDict begin <5 nums> found.\n" if $::opt_debug;
- $start_string = $_;
- }
- if ($start_string ne "") {
- # look for @start
- unless (/\@start/) {
- while (<IN>) {
- $start_string .= $_;
- last if /\@start/;
- }
- }
-
- # divide post part
- $start_string =~ /^([\s\S]*\@start)\s*([\s\S]*)$/ or
- die "$Error Parse error (\@start)!\n";
- $start_string = "$1\n";
- $post_string = $2;
- $post_string =~ s/\s*$//;
- $post_string .= "\n" unless $post_string eq "";
-
- $start_string =~
- /\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)\s+\((.*)\)\s+\@start/ or
- die "$Error Parse error (\@start parameters)!\n";
-
- $blocks_found++;
- print $PRT "*** dvi file: $3\n" if $::opt_debug;
-
- # get and check resolution values
- $x_resolution = $1;
- $y_resolution = $2;
- print $PRT "*** resolution: $x_resolution x $y_resolution\n"
- if $::opt_debug;
- $x_comment_resolution > 0 or
- die "$Error Missing comment `%DVIPSParameters'!\n";
- $x_resolution == $x_comment_resolution &&
- $y_resolution == $y_comment_resolution or
- die "$Error Resolution values in comment and PostScript " .
- "does not match!\n";
- # setting dvips resolution option(s)
- if ($x_resolution == $y_resolution) {
- $dvips_resolution = "-D $x_resolution";
- }
- else {
- $dvips_resolution = "-X $x_resolution -Y $y_resolution";
- }
-
- while (<IN>) {
- if (/^%%EndProlog/) {
- print OUT $encoding_string;
- $texps_data > 0 or die "$Error File `texps.pro' not found!\n";
- print OUT $texps_string unless $texps_found;
- foreach (@font_list) {
- my $fontname = $_;
- print $PRT "*** Adding font `$fontname'\n"
- if $::opt_debug;
- my ($dummy1, $dummy2, $err);
- if ($font_count{$fontname} > 1) {
- $fonts_merged++;
- print $PRT "*** Merging font `$fontname' ($font_count{$fontname}).\n"
- unless $::opt_quiet;
- ($dummy1, $font_txt{$fontname}, $dummy2, $err) =
- get_font($font_entry{$fontname});
- $err == 0 or die "$Error Cannot merge font `$fontname'!\n";
- }
- print OUT $font_txt{$fontname};
- }
- print OUT $start_string,
- $post_string,
- $_;
- print $PRT "*** %%EndProlog\n" if $::opt_debug;
- init();
- last;
- }
-
- if (/^%DVIPSBitmapFont: (\S+) (\S+) ([\d.]+) (\d+)/) {
- my $bitmap_string = $_;
- my $dvips_fontname = $1;
- my $fontname = $2;
- my $entry = "\\Font\{$1\}\{$2\}\{$3\}\{";
- print $PRT "*** Font $1: $2 at $3pt, $4 chars\n" if $::opt_verbose;
- my $line = "";
- my $num = -1;
- my $chars = $4;
- my $count = 0;
- while (<IN>) {
- $bitmap_string .= $_;
- last if /^%EndDVIPSBitmapFont/;
- s/\r$//; # remove \r of possible DOS line ending
- chomp;
- $line .= " " . $_;
- }
- $line =~ s/<[0-9A-F ]*>/ /g;
-
- print $PRT "*** <Font> $line\n" if $::opt_debug;
-
- while ($line =~ /\s(\d+)\s+D(.*)/) {
- $num = $1;
- $count++;
- $entry .= "$num,";
- $line = $2;
- while ($line =~ /^[\s\d\[]*I(.*)/) {
- $num++;
- $count++;
- $entry .= "$num,";
- $line = $1;
- }
- }
- $chars == $count or
- die "$Error Parse error, $count chars of $chars found " .
- "($fontname)!\n";
-
- $entry =~ s/,$//;
- $entry .= "\}";
-
- print $PRT "*** Font conversion of `$fontname' started.\n"
- if $::opt_verbose;
- my ($newfontname, $font_part, $start_part, $err) = get_font($entry);
- if ($err == 0) {
- print $PRT "*** Font conversion: `$fontname' -> `$newfontname'.\n"
- unless $::opt_quiet;
- if (defined($font_count{$newfontname})) {
- $font_count{$newfontname}++;
- $font_entry{$newfontname} .= "\n$entry";
- }
- else {
- push @font_list, $newfontname;
- $font_txt{$newfontname} = $font_part;
- $font_count{$newfontname} = 1;
- $font_entry{$newfontname} = $entry;
- }
- $start_part =~ s/\/Fa/\/$dvips_fontname/;
- $start_string .= $start_part;
- $fonts_converted++;
- }
- else {
- print $PRT "!!! Failed font conversion of `$fontname'!\n";
- $start_string .= $bitmap_string;
- $fonts_misses++;
- }
-
- next;
- }
-
- $post_string .= $_;
- }
- next;
- }
-
- print OUT;
-}
-
-close(IN);
-close(OUT);
-
-if ($::opt_clean) {
- print $PRT "*** clear temp files\n" if $::opt_verbose;
- foreach (@cleanlist) {
- unlink;
- }
-}
-
-if (!$::opt_quiet) {
- if ($blocks_found > 1) {
- print $PRT "==> $blocks_found blocks.\n";
- }
- if ($fonts_misses) {
- print $PRT "==> $fonts_misses font conversion",
- (($fonts_misses > 1) ? "s" : ""),
- " failed.\n";
- }
- if ($fonts_converted) {
- print $PRT "==> ",
- (($fonts_converted > 0) ? $fonts_converted : "No"),
- " converted font",
- (($fonts_converted > 1) ? "s" : ""),
- ".\n";
- if ($fonts_merged) {
- print $PRT "==> $fonts_merged merged font",
- (($fonts_merged > 1) ? "s" : ""),
- ".\n";
- }
- }
- else {
- print $PRT "==> no fonts converted\n";
- }
-}
-
-
-# get type 1 font
-# param: $entry: font entry as TeX string
-# return: $name: type 1 font name
-# $font: font file as string
-# $start: font definition after @start
-# $err: error indication
-sub get_font {
- my $entry = shift;
- my $name = "";
- my $font = "";
- my $start = "";
- my $err = 0;
- my @err = ("", "", "", 1);
- local *OUT;
- local *IN;
-
- if ($::opt_usetex) {
- ### write temp tex file
- open(OUT, ">$texfile") or die "$Error Cannot write `$texfile'!\n";
- print OUT <<'TEX_HEADER';
-\nonstopmode
-\nopagenumbers
-\def\Font#1#2#3#4{%
- \expandafter\font\csname font@#1\endcsname=#2 at #3pt\relax
- \csname font@#1\endcsname
- \hbox to 0pt{%
- \ScanChar#4,\NIL
- \hss
- }%
-}
-\def\ScanChar#1,#2\NIL{%
- \char#1\relax
- \ifx\\#2\\%
- \else
- \ReturnAfterFi{%
- \ScanChar#2\NIL
- }%
- \fi
-}
-\long\def\ReturnAfterFi#1\fi{\fi#1}
-\noindent
-TEX_HEADER
-
- print OUT "$entry\n\\bye\n";
- close(OUT);
-
- ### run tex
- {
- print $PRT "*** run TeX\n" if $::opt_verbose;
-
- my $cmd = "$::opt_tex $tempfile";
- print $PRT ">>> $cmd\n" if $::opt_verbose;
- my @capture = `$cmd`;
- if (!defined(@capture)) {
- print $PRT "$Warning Cannot execute TeX!\n";
- return @err;
- }
- if ($::opt_verbose) {
- print $PRT @capture;
- }
- else {
- foreach (@capture) {
- print $PRT if /^!\s/;
- }
- }
- if ($?) {
- my $exitvalue = $?;
- if ($exitvalue > 255) {
- $exitvalue >>= 8;
- print $PRT "$Warning Closing TeX (exit status: $exitvalue)!\n";
- return @err;
- }
- print $PRT "$Warning Closing TeX ($exitvalue)!\n";
- return @err;
- }
- }
- }
- else {
- # write dvi directly
-
- # DVI format description: dvitype.web
- my $DVI_pre = 247;
- my $DVI_id_byte = 2;
- my $DVI_num = 25400000;
- my $DVI_den = 473628672; # 7227 * 2^16
- my $DVI_mag = 1000;
- my @t = localtime(time);
- my $DVI_comment = "$program $version output "
- . sprintf("%04d/%02d/%02d %02d:%02d:%02d",
- ($t[5] + 1900), ($t[4] + 1), $t[3], $t[2], $t[1], $t[0]);
- my $DVI_comment_len = length($DVI_comment);
- my $DVI_bop = 139;
- my $DVI_eop = 140;
- my $DVI_fontdef1 = 243;
- my $DVI_fontdef2 = 244;
- my $DVI_fontdef4 = 246;
- my $DVI_design_size = 10; # an arbitrary value
- # A wrong value will trigger a dvips warning
- # (it can be seen in verbose mode):
- # dvips: Design size mismatch in [...].tfm
- # But other consequences could not be noticed.
- # Thus a TFM lookup will be saved.
- my $DVI_checksum = 0; # because of unknown checksum
- my $DVI_fnt_num_0 = 171;
- my $DVI_fnt1 = 235;
- my $DVI_fnt2 = 236;
- my $DVI_fnt4 = 238;
- my $DVI_set1 = 128;
- my $DVI_push = 141;
- my $DVI_pop = 142;
- my $DVI_post = 248;
- my $DVI_u = 67108864; # 1024 pt, an arbitrary value
- my $DVI_l = 67108864; # 1024 pt, an arbitrary value
- my $DVI_post_post = 249;
- my $DVI_trailing = 223;
-
- open(OUT, ">$dvifile") or die "$Error Cannot write `$dvifile'!\n";
- binmode(OUT);
-
- # Preamble (pre)
- print OUT pack("C2N3Ca$DVI_comment_len",
- $DVI_pre, $DVI_id_byte, $DVI_num, $DVI_den, $DVI_mag,
- $DVI_comment_len, $DVI_comment);
- # Begin of page (bop)
- my $pos_bop = tell(OUT);
- print OUT pack("CN1x[N9]l", $DVI_bop, 1, -1);
-
- my $font_defs = "";
- my $font_num = 0;
- foreach(split("\n", $entry)) {
- my $font_def = "";
- /\\Font\{[^}]*\}\{([^}]*)\}\{([^}]*)\}\{([^}]*)\}/ or
- die "!!! Error: Internal parsing error!\n";
- my $font_name = $1;
- my $font_name_len = length($font_name);
- my $font_size = $2;
- my $font_chars = $3;
-
- # define font
- if ($font_num < 256) {
- $font_def = pack("CC", $DVI_fontdef1, $font_num);
- }
- # The other cases are very unlikely, especially there are
- # more than one font in the merging case only.
- elsif ($font_num < 65536) {
- $font_def = pack("Cn", $DVI_fontdef2, $font_num);
- }
- else {
- $font_def = pack("CN", $DVI_fontdef4, $font_num);
- }
- $font_def .= pack("x[N]N2xCa$font_name_len",
- ($font_size * 65536), $DVI_design_size,
- $font_name_len, $font_name);
- print OUT $font_def;
- $font_defs .= $font_def;
-
- # use font
- my $fnt_num;
- if ($font_num < 64) {
- $fnt_num = pack("C", $DVI_fnt_num_0 + $font_num);
- }
- # Other cases are unlikely, see above.
- elsif ($font_num < 256) {
- $fnt_num = pack("CC", $DVI_fnt1, $font_num);
- }
- elsif ($font_num < 65536) {
- $fnt_num = pack("Cn", $DVI_fnt2, $font_num);
- }
- else {
- $fnt_num = pack("CN", $DVI_fnt4, $font_num);
- }
- print OUT $fnt_num;
-
- # print characters
- print OUT pack("C", $DVI_push);
- foreach (split(",", $font_chars)) {
- if ($_ < 128) {
- print OUT pack("C", $_);
- }
- else {
- print OUT pack("CC", $DVI_set1, $_);
- }
- }
- print OUT pack("C", $DVI_pop);
-
- $font_num++;
- }
-
- print OUT pack("C", $DVI_eop);
-
- # Begin of postamble (post)
- my $pos_post = tell(OUT);
- print OUT pack("CN6n2",
- $DVI_post, $pos_bop, $DVI_num, $DVI_den, $DVI_mag,
- $DVI_l, $DVI_u, 1, 1);
- print OUT $font_defs;
- # End of postamble (post_post)
- print OUT pack("CNC5",
- $DVI_post_post, $pos_post, $DVI_id_byte,
- $DVI_trailing, $DVI_trailing, $DVI_trailing, $DVI_trailing);
- my $t_num = (4 - (tell(OUT) % 4)) % 4;
- print OUT pack("C", $DVI_trailing) x $t_num;
- close(OUT);
- }
-
- ### run dvips
- {
- print $PRT "*** run dvips\n" if $::opt_verbose;
-
- my $cmd = "$::opt_dvips $::opt_options $dvips_resolution $tempfile";
- print $PRT ">>> $cmd\n" if $::opt_verbose;
- # dvips writes on stderr :-(
- my @capture = `$cmd$err_redirect`;
- if ($::opt_verbose) {
- print $PRT @capture;
- }
- if ($?) {
- my $exitvalue = $?;
- if ($exitvalue > 255) {
- $exitvalue >>= 8;
- print $PRT "$Warning Closing dvips (exit status: $exitvalue)!\n";
- return @err;
- }
- print $PRT "$Warning Closing dvips ($exitvalue)!\n";
- return @err;
- }
- }
-
- ### get font and start part
- open(IN, $psfile) or die "$Error Cannot open `$psfile'!\n";
-
- while (<IN>) {
- ### get possible encoding files
- if (/^%%BeginProcSet:\s*(.+)\.enc/) {
- my $encoding_file = $1;
- print $PRT "*** encoding file `$encoding_file.enc' found.\n"
- if $::opt_debug;
- next if defined($encoding_files{$encoding_file});
- $encoding_files{$encoding_file} = "";
- $encoding_string .= $_;
- while (<IN>) {
- $encoding_string .= $_;
- last if /^%%EndProcSet/;
- }
- next;
- }
-
- ### get texps.pro if get_texps_pro() has failed
- if ($texps_data == 0 && /^%%BeginProcSet: texps.pro/) {
- $texps_string = $_;
- while (<IN>) {
- $texps_string .= $_;
- last if /^%%EndProcSet/;
- }
- $texps_data = 1;
- print $PRT "*** texps.pro extracted.\n" if $::opt_debug;
- next;
- }
-
- if (/^%%BeginFont:\s*(\S+)/) {
- $name = $1;
- $font .= $_;
- while (<IN>) {
- $font .= $_;
- last if /^%%EndFont/;
- }
- next;
- }
- if (/^\@start/) {
- s/^\@start\s*//;
- $start .= $_;
- while (<IN>) {
- last if /^%%EndProlog/;
- $start .= $_;
- }
- if (($start =~ s/\s*end\s*$/\n/) != 1) {
- $err = 1;
- print $PRT "$Warning Parse error, `end' not found!\n";
- }
- print $PRT "*** start: $start" if $::opt_debug;
- last;
- }
- }
- close(IN);
-
- if ($font eq "") {
- print $PRT "$Warning `%%BeginFont' not found!\n";
- return @err;
- }
- return ($name, $font, $start, $err);
-}
-
-
-# get_texps_pro
-# return: string with content of texps.pro
-sub get_texps_pro {
- $texps_data = 0;
- # get file name
- my $backupWarn = $^W;
- $^W = 0;
- my $file = `$::opt_kpsewhich $texpsfile`;
- $^W = $backupWarn;
- if (!defined($file) or $file eq "") {
- print $PRT "$Warning: Cannot find `$texpsfile' with kpsewhich!\n"
- if $::opt_debug;
- return "";
- }
- chomp $file;
- print $PRT "*** texps.pro: $file\n" if $::opt_debug;
-
- # read file
- local *IN;
- open(IN, $file) or die "$Error: Cannot open `$file'!\n";
- my @lines = <IN>;
- @lines > 0 or die "$Error: Empty file `$file'!\n";
- chomp $lines[@lines-1];
- my $str = "%%BeginProcSet: texps.pro\n";
- $"="";
- $str .= "@lines\n";
- $"=" ";
- $str .= "%%EndProcSet\n";
- $texps_data = 1;
- return $str;
-}
-
-__END__
+../../texmf/scripts/pkfix/pkfix.pl \ No newline at end of file
diff --git a/Master/bin/i386-linux/ps2eps b/Master/bin/i386-linux/ps2eps
index aeb0e9a8e43..81d5f53cfde 100755..120000
--- a/Master/bin/i386-linux/ps2eps
+++ b/Master/bin/i386-linux/ps2eps
@@ -1,929 +1 @@
-#!/usr/bin/env perl
-# The expression in the previous line replaces the unix specific line
-# {#!/usr/bin/perl}.
-# ps2eps - convert PostScript to EPS (Encapsulated PostScript) files
-# -------------------------------------------------------------------
-# $Id: ps2eps,v 1.61 2006/12/28 16:34:06 bless Exp $
-# -------------------------------------------------------
-# (C)opyright 1999-2006 Roland Bless
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Author: Roland Bless
-# Send bug reports to roland <at> bless.de
-# -------------------------------------------------------------------
-# Additional filtering is performed when Windows generated PostScript files
-# are processed. Some instructions will otherwise lead to bad output
-# if EPS-file gets embedded into other PostScript files.
-#
-# Requirements:
-# + perl
-# + gs (ghostscript supporting pbm output)
-# + bbox (a little C program [ANSI-C - should work on every platform]
-# for calculation of the actual BoundingBox)
-
-use POSIX;
-
-#use warnings;
-
-#use Getopt package
-use Getopt::Long;
-Getopt::Long::Configure("no_ignore_case");
-
-$prgname= "ps2eps";
-
-if (! -d "/usr/bin")
-{ # we assume that we are running under native windows
- $ghostscriptname = "gswin32c";
- $NULLDEV = "nul";
-}
-else
-{ # Unix or cygwin
- $ghostscriptname = "gs";
- $NULLDEV = "/dev/null 2>&1";
-}
-
-$bboxver=`bbox >$NULLDEV -V`;
-$bboxname= ($?== -1) ? "" : "bbox";
-$version= '$Id: ps2eps,v 1.61 2006/12/28 16:34:06 bless Exp $'; #'
-$insertPScode= 1; # Insert surrounding Postscript code
-$infhandle = STDIN; # Standard input is the default input file
-$outfhandle = STDOUT; # Standard output is default output if STDIN is input
-$infname= '-';
-$outfname= '-';
-$forceoverwrite=0; # do not overwrite existing files
-$ignoreBB= 0; # ignore existing Bounding Box comment
-$removeDSC= 1; # remove Adobe document structure comments
-$removeADO= 1; # remove Adobe printer Driver console Output [Page: ...]
-$ignoreEOFDSC= 0; # ignore %%EOF DSC hint
-$removePreview= 0; # remove preview
-$quiet= 0; # write progress to stdout
-$resolution= 144; # resolution for bounding box calculation is 2x72 dpi
-$trytofixps= 1; # try to fix postscript code
-$forcefixps= 0; # fix postscript code unconditionally if eq 1
-$filterorientation= 1;# filter Orientation line
-$looseBB=''; # default: tight bounding box
-$clip=0; # do not clip
-$warnings=0; # do not print warnings concerning postscript sanity
-$debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call
-$inch=2.54; # one inch is 2.54cm
-$fullcolors= 1; # use ppm format (24-bit full color)
-$trailerseen= 0; # Trailer comment seen?
-$PSversion="2.0"; # default Postscript Version
-$PSDSCversion="2.0"; # default Postscript DSC Version
-$translate_x= 0; # translate by x postscript points
-$translate_y= 0; # translate by y postscript points
-
-$defaultext = '(ps|prn)'; # default extension
-$defaultoutext = '.eps'; # default output extension
-$envname_size = 'PS2EPS_SIZE';
-$envname_gsbbox = 'PS2EPS_GSBBOX';
-
-$gpar="";
-$known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter";
-$papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\
-a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\
-b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\
-jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n";
-$trigger= 0;
-$notsane= 0;
-$dummy="";
-
-@ver= split(/ /,$version);
-
-# filename for temporary files
-if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i)
-{
- # it is less trouble to use the current directory if working on
- # cygwin and nevertheless using gswin32c.
- $tmpfname= "$prgname.$$";
- $win=1;
-}
-elsif (defined($ENV{'TMP'}))
-{
- $tmpdir= $ENV{'TMP'};
- $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/';
- if ($tmpdir =~ /$filesep$/)
- { $tmpfname= $tmpdir . "$prgname.$$"; }
- else
- { $tmpfname= $tmpdir . "$filesep$prgname.$$"; }
- $win=1;
-}
-else #assume we're on a UNIXBOX
-{
- $tmpfname= "/tmp/" . "$prgname.$$";
- $win=0;
-}
-
-
-$licensetxt= "\
- This program is free software; you can redistribute it and/or modify\
- it under the terms of the GNU General Public License as published by\
- the Free Software Foundation; either version 2 of the License, or\
- (at your option) any later version.\
-\
- This program is distributed in the hope that it will be useful,\
- but WITHOUT ANY WARRANTY; without even the implied warranty of\
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
- GNU General Public License for more details.\
-\
- You should have received a copy of the GNU General Public License\
- along with this program; if not, write to the Free Software\
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n";
-
-@prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n",
- "(C)opyright 1998-2006 Roland Bless\n\n" );
-
-@helptxt= ("Version: $ver[2]\n",
- "Operation:\n",
- " Without any argument, $prgname reads from standard input\n",
- " and writes to standard output.\n",
- " If filenames are given as arguments they are processed\n",
- " one by one and output files are written to filenames\n",
- " with extension '$defaultoutext'. If input filenames have the extension\n",
- " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n",
- " In all other cases '$defaultoutext' is appended to the input filename.\n",
- " Please note that PostScript files for input should contain\n",
- " only one single page.\n\n",
- " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" );
-
-@usagetxt= ("Syntax:\n",
- " $prgname [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s <pagedim>] [-R +|-|^] [-t <x,y>] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n",
- "Options:\n",
- " -f, --force force overwriting existing files\n",
- " -q, --quiet quiet operation (no output while processing files)\n",
- " -N, --noinsert do not insert any postscript code\n",
- " -O, --preserveorientation do not filter Orientation: header comment\n",
- " -n, --nofix do not try to fix postscript code\n",
- " -P, --removepreview remove preview image (smaller file, but no preview)\n",
- " -F, --fixps fix postscript code unconditionally\n",
- " -c, --comments preserve document structure comments\n",
- " -C, --clip insert postscript code for clipping\n",
- " -m, --mono use black/white bitmap as base for calculation\n",
- " -s, --size=<pagedim> page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n",
- " use --size=list to list pre-defined page sizes\n",
- " -R, --rotate=<direction> rotate resulting EPS. <direction>: +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n",
- " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n",
- " -r, --resolution specify dpi resolution to render with ghostscript (default 144)",
- " -l, --loose expand the original bounding box by one point in each direction\n",
- " -B, --ignoreBB do not use existing bounding box as page size for rendering\n",
- " -E, --ignoreEOF do not use %%EOF as hint for end of file\n",
- " -g, --gsbbox use internal bbox device of ghostscript\n",
- " -H, --no-hires do not use a HiResBoundingBox\n",
- " -h, --help help information\n",
- " -L, --license show licensing information\n",
- " -V, --version show version information\n",
- " -d, --debuggs show ghostscript call\n",
- " -W, --warnings show warnings about sanity of generated eps file\n",
- " -- all following arguments are treated as files\n",
- " (allows filenames starting with -)\n",
- "\n",
- "Arguments:\n",
- " One or more names of PostScript files for input\n");
-
-## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-## -- argument checking --
-## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-#environment variable for papersize
-if (defined($ENV{"$envname_size"}))
-{
- $opt_s= $ENV{"$envname_size"};
-}
-else
-{
- $opt_s = ''; # for s-option
-}
-
-if (defined($ENV{"$envname_gsbbox"}))
-{
- $bboxname="";
-}
-
-$opt_t = ''; # for t-option
-$opt_R = ''; # for R-option
-$opt_r = ''; # for r-option
-$stopnow = 0;
-die "Wrong option(s), please check usage with $prgname --help\n" unless
-GetOptions('f|force' => \$forceoverwrite,
- 'q|quiet' => \$quiet,
- 'm|mono' => sub { $fullcolors = 0 },
- 'n|nofix' => sub { $trytofixps = 0 },
- 'F|fixps' => \$forcefixps,
- 'N|noinsert' => sub { $insertPScode = 0 },
- 'O|preserveorientation' => sub { $filterorientation= 0 },
- 'P|removepreview' => \$removePreview,
- 'c|comments' => sub { $removeDSC = 0 },
- 'C|clip' => \$clip,
- 'l|loose' => sub { $looseBB = '-l' },
- 'B|ignoreBB' => \$ignoreBB,
- 'E|ignoreEOF'=> \$ignoreEOFDSC,
- 's|size=s' => \$opt_s,
- 't|translate=s' => \$opt_t,
- 'r|resolution=s' => \$opt_r,
- 'R|rotate=s' => \$opt_R,
- 'g|gsbbox' => sub { $bboxname=""; },
- 'H|nohires' => \$nohires,
- 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; },
- 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; },
- 'd|debuggs' => \$debuggs,
- 'W|warnings' => \$warnings,
- 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow);
-
-## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-## -- wildcard processing --
-## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-## internal wildcard processing for current directory,
-## only used for non UNIX-based OSs (which may lack shell wildcard expansion)
-@filenames = ();
-foreach $object (@ARGV) {
- if ($win && $object =~ m/\*/o) # asterisk is present in filename
- {
- $wildcard = $object;
- $wildcard =~ s/\./\\\./g; # replace . in pattern with \.
- $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*)
- opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory
- print STDERR $wildcard;
- @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR);
- foreach (@fid) { push @filenames, $_; }
- closedir DIR;
- }
- else { push @filenames, $object; }
-} # end foreach
-$filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input
-
-print STDERR "Input files: @filenames\n" if (!$quiet);
-
-if ($opt_r ne '')
-{
- $resolution=$opt_r;
-}
-
-# papersize stuff
-if ($opt_s ne '')
-{
- # if explicit size is given, ignore existing BoundingBox always
- $ignoreBB = 1;
- $pagedimension = $opt_s;
- if ($opt_s eq "list")
- {
- print STDERR "Available paper sizes: $papersize_help";
- exit 0;
- }
-
- #explicit format XxY[cm|in]
- if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/)
- {
- ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension);
- if ( $x_dim !~ /^\d*\.?\d+$/ )
- { die "$x_dim in $arg is not a valid number, stopped"; }
- if ( $y_dim !~ /^\d*\.?\d+$/ )
- { die "$y_dim in $arg is not a valid number, stopped"; }
-
- #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ;
- if (!defined($unit) )
- {
- $unit='cm';
- $opt_s=$opt_s . $unit;
- }
- if ( $unit ne 'in' ) # assume centimeters
- { # calculate dimension in pixels (remember: resolution is in dpi)
- $xpixels= int(($x_dim * $resolution) / $inch)+1;
- $ypixels= int(($y_dim * $resolution) / $inch)+1;
- $gpar= "-g${xpixels}x${ypixels}";
- }
- else
- {
- $xpixels= int($x_dim * $resolution)+1;
- $ypixels= int($y_dim * $resolution)+1;
- $gpar= "-g${xpixels}x${ypixels}";
- }
- } #endif XxY in opt_s
- else
- {
- if ($opt_s =~ /$known_papersizes/)
- {
- $gpar="-sPAPERSIZE=$opt_s";
- }
- else
- {
- print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n";
- exit 1;
- }
- }
-}
-
-#translate option
-if ($opt_t ne '')
-{
- ($translate_x,$translate_y)= split(/\,/,$opt_t);
-}
-
-#rotate
-$rotright='-90 rotate';
-$rotleft='90 rotate';
-$rotupsidedown='180 rotate';
-$rotate='';
-if ($opt_R ne '')
-{
- if ($opt_R eq '+') { $rotate=$rotright; }
- elsif ($opt_R eq '-') { $rotate=$rotleft; }
- elsif ($opt_R eq '^') { $rotate=$rotupsidedown; }
- else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; };
-}
-
-$device= $fullcolors ? "ppmraw" : "pbmraw";
-
-## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-## -- iterate over different input files --
-## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-PROCESSFILE:
-while ($infname= (shift @filenames))
-{
- # reset filter definitions for each file
- undef $linefilter;
- undef $rangefilter_begin;
- undef $rangefilter_end;
- $fixthisps= $trytofixps;
- $fixmsgprinted= 0;
-
- if (!$quiet) { print STDERR "Processing: $infname\n"; }
- unless (open($infhandle,"<$infname"))
- { # skip over this file
- print STDERR "$prgname: Can't open $infname: $!\n";
- next PROCESSFILE;
- }
-
- # buffer input from stdin into temporary file, because it has to be read twice
- # one time for ghostscript processing, the second time for generating output
- if ($infname eq '-') # input is stdin
- {
- $tmpfhandle='';
- open($tmpfhandle,">$tmpfname") or
- die "Cannot open temporary file $tmpfname for writing: $!\n";
- }
- else # input is not stdin
- {
- undef $tmpfhandle;
- #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext
- if ($infname =~ /\.$defaultext$/i)
- {
- $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i;
- }
- else # otherwise simply append the extension $defaultoutext
- {
- $outfname= $infname . "$defaultoutext";
- }
- if (!$forceoverwrite and -s "$outfname")
- {
- die "$prgname: Sorry, file named $outfname already exists,",
- " will not overwrite it.\n",
- " You will have to use the -f option, delete it or rename it",
- " before running $prgname again.\n";
- }
- else
- {
- open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n";
- }
- } #end else input is not stdin
-
- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ## -- process input file --
- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- $linefilter= '^$'; #'# filter empty lines by default
- while (<$infhandle>)
- {
- # get postscript and DSC version
- if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/)
- {
- $PSversion=$1;
- $PSDSCversion=$2;
- if (! ($PSversion =~ /\d+\.\d+/))
- {
- $PSDSCversion="2.0";
- }
- if (! ($PSDSCversion =~ /\d+\.\d+/))
- {
- $PSDSCversion="2.0";
- }
- }
-
- # check for existing BoundingBox parameters
- if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) )
- {
- $BBarg= $1;
- # accept even negative and fractional BBs
- if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\d+/ ) # ignore %% BoundingBox: (atend) comments
- {
- ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg;
- #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n";
- if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); }
- if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); }
-
- $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72)+1;
- $ypixels= int((($eBBury-$eBBlly) * $resolution)/72)+1;
- if (!$ignoreBB)
- {
- $gpar= "-g${xpixels}x${ypixels}";
- # check for meaningful values
- if (($xpixels <= 1) || ($ypixels <= 1))
- {
- $gpar=""; undef $eBBllx; undef $eBBlly;
- }
- else
- {
- if (!$quiet)
- {
- print STDERR "Rendering with existing $_";
- if (int($eBBllx) < 0 || int($eBBlly) < 0)
- {
- print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n";
- }
- }
- }
- } #endif !$ignoreBB
- } #endif $BBarg =~
- }
-
-
- if ($fixthisps) # try to fix bad postscript code
- {
- # check for Windows 3.x output
- if ( /^Win.*Dict/ )
- {
- if (!$quiet && !$fixmsgprinted)
- { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; }
- $linefilter= '^(EJ|RS)';
- $rangefilter_begin= '^statusdict';
- $rangefilter_end= 'cvx\ settransfer$'; #'
- $fixmsgprinted= 1; # stop printing message
- }
- else
- {
- if ( /^%%Creator:\s*Wind.U\s*Xprinter/ )
- {
- if (!$quiet && !$fixmsgprinted)
- { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; }
- $linefilter= '^rs';
- $fixmsgprinted= 1; # stop printing message
- }
- else
- {
- if ( $forcefixps ||
- /^\/NTPS/ ||
- /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output
- {
- if (!$quiet && !$fixmsgprinted)
- {
- if ($forcefixps)
- {
- print STDERR "Postscript filtering requested, fixing\n";
- }
- else
- {
- print STDERR "Windows generated Postscript file detected, fixing\n";
- }
- }
- $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #'
- $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)';
- $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #'
- $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature';
- #$triggered_rangefilter_begin= ''; #'
- #$triggered_rangefilter_end= ''; #'
- $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)';
- $fixreplacepat=' ';
- $fixmsgprinted= 1; # stop printing message
- } # end if NTPS
- } #end else
- }
- } #end if trytofixps
-
- if (defined($tmpfhandle))
- {
- print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname";
- }
-
- if (/^%%EOF\s*$/)
- {
- $totalEOFDSC++
- }
- } #end while <$infhandle>
-
- if (defined($tmpfhandle))
- {
- close($tmpfhandle);
- }
- else
- {
- $tmpfhandle= $infhandle;
- $tmpfname= $infname;
- }
-
- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ## -- calculate the bounding box --
- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- if ($translate_x!=0 || $translate_y!=0)
- {
- $translation="$translate_x $translate_y translate";
- $translatecmd="-c $translation";
- }
- else
- {
- $translation="";
- $translatecmd="";
- }
-
- if (!$quiet)
- {
- print STDERR "Calculating Bounding Box...";
- if ($opt_s)
- {
- print STDERR "using page size $opt_s...";
- }
- }
-
- $rotatecmd='';
- if ($rotate ne '')
- {
- $rotatecmd="-c \"$rotate\""
- }
- if ($bboxname ne '')
- {
- $cmdline="$ghostscriptname -dSAFER -dNOPAUSE -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f $tmpfname -c showpage -c quit | $bboxname -r $resolution";
- }
- else
- {
- if (!$quiet) {
- print STDERR "...using bbox device of $ghostscriptname...";
- }
- $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1";
- }
-
- if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; }
-
- # actual ghostscript call
- $boundingbox=`$cmdline`;
- if ($debuggs) { print STDERR "Call result: $boundingbox"; }
-
- # check result of gs call
- if ($boundingbox !~ /^%%BoundingBox/m)
- {
- print STDERR "Error: Could not determine bounding box!\n",
- "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n";
- }
-
- $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m;
- if (defined($1)) # HiResBoundingBox given
- {
- ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1);
- $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n";
- $cBBllx = floor($hcBBllx);
- $cBBlly = floor($hcBBlly);
- $cBBurx = ceil($hcBBurx);
- $cBBury = ceil($hcBBury);
- }
- else
- { #use normal BoundingBox
- $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/;
- ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1);
- }
- # if loose BB should be performed by ps2eps
- # apply changes to resulting bounding box if needed
- if ($looseBB ne '')
- {
- if ($cBBllx > 0) { $cBBllx--; }
- if ($cBBlly > 0) { $cBBlly--; }
- $cBBurx++; $cBBury++;
- }
- # extend clipping box by 1 point
- if ($clip)
- {
- if ($cBBllx > 0) { $cBBllx--; }
- if ($cBBlly > 0) { $cBBlly--; }
- $cBBurx++; $cBBury++;
- }
- if ($cBBllx < 0 || $cBBlly < 0)
- {
- if (!$quiet)
- {
- print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n";
- }
- $translate_x= -int($cBBllx);
- $translate_y= -int($cBBlly);
- $cBBllx=0;
- $cBBurx= $cBBurx + $translate_x;
- $cBBlly=0;
- $cBBury= $cBBury + $translate_y;
-
- $hcBBurx= $hcBBurx + $hcBBllx;
- $hcBBury= $hcBBury + $hcBBlly;
- $hcBBllx= 0;
- $hcBBlly= 0;
-
- $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n";
-
- $translation="$translate_x $translate_y translate";
- $translatecmd="-c \'$translation\'";
- }
- $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n";
-
- if (!$quiet) { print STDERR "ready. $boundingbox" };
-
- $before_startps= 1;
- $inserted_prolog= 0;
- $prolog_passed= 0;
-
- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ## -- Create output file --
- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- if (!$quiet) { print STDERR "Creating output file $outfname..."; }
-
- open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading";
- CREATEOUTPUT:
- while (<$tmpfhandle>)
- {
- # check whether we are in a binary section
-
- $binarysection=(/^(%%BeginBinary)|(beginimage)\r?\n?$/ ... /^(%%EndBinary)|^(endimage)/) ||
- (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0
- (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0
- (/^pdfIm/ ... /^%-EOD-/);
-
- if ( !$binarysection )
- {
- s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section
- }
-
- # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code
- if ($before_startps)
- {
- if ( /%!/ ) # This is usually the smallest magic sequence
- { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable
- if (! /%!PS-Adobe.*/i) # some strange programs use other magics
- {
- print STDERR "** Warning **: Weird heading line -- ",$_," -- ";
- }
- $before_startps= 0;
- }
- next CREATEOUTPUT;
- }
- else # we are hopefully in regular postscript code now
- {
- # count %%EOFs as we want to know when we got the last EOF
- if ( /^%%EOF\s*$/ )
- {
- $seenEOF++;
- }
-
- # We should insert our own prologue including the newly calculated BoundingBox
- if (! $inserted_prolog)
- {
- print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n";
- # check if we need to rotate
- $transrotcmd='';
- if ($rotatecmd)
- {
- if ($rotate eq $rotright)
- {
- $transrotcmd="-$cBBlly $cBBurx translate";
- $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n";
- if ($hiresboundingbox ne "")
- {
- $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n";
- }
-
- }
- elsif ($rotate eq $rotleft)
- {
- $transrotcmd="$cBBury -$cBBllx translate";
- $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n";
- if ($hiresboundingbox ne "")
- {
- $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n";
- }
- }
- elsif ($rotate eq $rotupsidedown)
- {
- $transrotcmd="$cBBurx $cBBury translate";
- $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n";
- if ($hiresboundingbox ne "")
- {
- $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n";
- }
- }
- }
- print $outfhandle $boundingbox;
- if (!defined($hiresboundingbox))
- {
- $nohires=1;
- }
- if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; }
- $inserted_prolog= 1;
- redo CREATEOUTPUT;
- }
- else # already inserted_prolog
- {
- if (! $prolog_passed)
- {
- #ignore the following lines in the prologue
- if ( /^%%(HiRes)?BoundingBox/ ||
- /^%%Pages/ ||
- /^%%BeginProlog/ ||
- /^%%EndProlog/ ||
- ($filterorientation && /^%%Orientation/) ||
- ($removeDSC && /^%%.*: \(atend\)/) ||
- ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) )
- {
- next CREATEOUTPUT;
- }
- else
- {
- if ( /^[^%].*/ ||
- /^%%EndComments/ ) # line is not a comment
- {
- #output postscript code for proper EPS file
- if ($insertPScode)
- {
- print $outfhandle "%%EndComments\n",
- "% EPSF created by ps2eps $ver[2]\n",
- "%%BeginProlog\n";
- }
- # Insert own postscript code for clipping
- if ($clip)
- {
- if (!defined($nohires))
- {
- printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx-0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBlly-0.1,$hcBBurx+0.1,$hcBBury+0.1,$hcBBllx-0.1,$hcBBury+0.1;
- }
- else
- {
- printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury;
- }
- } #endif clip
-
- if ($rotate ne '')
- {
- print $outfhandle "$transrotcmd\n";
- print $outfhandle "$rotate\n";
- }
- if ($translation ne '')
- {
- print $outfhandle "$translation\n";
- }
-
- #insert surrounding postscript code
- if ($insertPScode)
- {
- print $outfhandle "save\n",
- "countdictstack\n",
- "mark\n",
- "newpath\n",
- "/showpage {} def\n",
- "/setpagedevice {pop} def\n",
- "%%EndProlog\n",
- "%%Page 1 1\n";
- }
- $prolog_passed= 1;
- if (/^%%EndComments/) { next CREATEOUTPUT; }
- } #endif line is not a comment
- } #end else
- } #endif (we are in the prologue section)
- else #we are in the main part of postscript file
- {
- #end of postscript file reached?
- #Usually the DSC %%EOF signifies the end
- if ( eof($tmpfhandle) ||
- ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC)
- || ( $trailerseen && /^II\*\000.*/ )
- )
- {
- #do not forget to print last line if not terminated by LF
- if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice
- {
- print $outfhandle $_,"\n";
- }
- #add appropriate trailer
- if ($insertPScode)
- {
- print $outfhandle "%%Trailer\n",
- "cleartomark\n",
- "countdictstack\n",
- "exch sub { end } repeat\n",
- "restore\n",
- "%%EOF\n";
- }
- last CREATEOUTPUT;
- } # stop output
-
- # Trailer comment seen?
- if ( /^%%Trailer\s*$/ )
- {
- $trailerseen=1;
- }
- else
- {
- if (!/^\s*$/) #non empty lines follow
- {
- $trailerseen=0;
- }
- }
-
- # check for trigger
- if (defined($triggerstring) && /^$triggerstring$/)
- {
- $trigger= 1;
- };
-
- # remove complete lines if one of the expression matches
- if ( !$binarysection # only when not in binary section
- &&
- (
- ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/))
- || # no preview
- (defined($rangefilter_begin) &&
- (/$rangefilter_begin/ ... /$rangefilter_end/) &&
- (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/))
- )
- ||
- (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) &&
- $trigger &&
- (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/)
- )
- ||
- /$linefilter/ # lines by linefilter
- ||
- ($removeDSC && (/^%( |!)(\w )+/ || /^%%/)) # any type of structured comment
- ||
- ($removeADO &&
- (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ ||
- /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ ))
- ||
- /^$/ # empty lines
- )
- )
- {
- next CREATEOUTPUT;
- }
-
- # replacement
- if ( defined($fixsearchpat) )
- {
- #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; }
- #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";}
- s/$fixsearchpat/$fixreplacepat/;
- }
-
- # sanity check for potential dangerous commands
- if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ )
- {
- $notsane= 1;
- #print STDERR "Warning: dangerous command in line: ",$_,"\n";
- }
- } # end else (this is main part)
-
- # Output the postscript line to result file
- print $outfhandle $_;
-
- if (!$binarysection)
- {
- print $outfhandle "\n"; # terminate line with LF
- }
- } # end else prolog_passed
- } # end else inserted_prolog
- } # end while CREATEOUTPUT
-
- close($tmpfhandle);
-
- if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file
-
- close ($outfhandle);
-
- # print warning if magic sequence not found
- if ( $before_startps )
- {
- print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n";
- }
-
- if (!$quiet) { print STDERR "ready.\n"; }
- if ($warnings and $notsane and !$quiet)
- {
- print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n",
- "of the following commands was still present:\n",
- "clear erasepage initmatrix initclip initgraphics startjob\n",
- "cleardictstack setmatrix setpagedevice copypage grestoreall\n",
- "exitserver quit\n";
- }
-} #end while PROCESSFILE
-
-# ---- end of perl-script -------
+../../texmf/scripts/ps2eps/ps2eps.pl \ No newline at end of file
diff --git a/Master/texmf/scripts/pkfix/pkfix.pl b/Master/texmf/scripts/pkfix/pkfix.pl
index 1429889b9ec..1429889b9ec 100644..100755
--- a/Master/texmf/scripts/pkfix/pkfix.pl
+++ b/Master/texmf/scripts/pkfix/pkfix.pl
diff --git a/Master/tlpkg/tlpsrc/bin-pstools.tlpsrc b/Master/tlpkg/tlpsrc/bin-pstools.tlpsrc
index cb73e832040..9f7be2be529 100644
--- a/Master/tlpkg/tlpsrc/bin-pstools.tlpsrc
+++ b/Master/tlpkg/tlpsrc/bin-pstools.tlpsrc
@@ -2,9 +2,7 @@ name bin-pstools
category TLCore
runpattern f texmf/scripts/ps2eps/ps2eps.pl
docpattern f texmf/doc/man/man1/ps2frag.1
-docpattern f texmf/doc/man/man1/ps2frag.1.html
docpattern f texmf/doc/man/man1/pslatex.1
-docpattern f texmf/doc/man/man1/pslatex.1.html
binpattern f bin/${ARCH}/bbox
binpattern f bin/${ARCH}/ps2eps
binpattern f bin/${ARCH}/ps2frag