summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-08-02 21:44:19 +0000
committerKarl Berry <karl@freefriends.org>2016-08-02 21:44:19 +0000
commitdee6f4ffb48dc92e9a94268b82905c905912ce29 (patch)
treef7c93fa373acc70c219cb72ccdb569c878a39bf9 /Build
parentaa056b71d1092508574f00e95a11c3587fc8b364 (diff)
pdflatexpicscale (2aug16)
git-svn-id: svn://tug.org/texlive/trunk@41789 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/pdflatexpicscale/pdflatexpicscale.pl42
1 files changed, 25 insertions, 17 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/pdflatexpicscale/pdflatexpicscale.pl b/Build/source/texk/texlive/linked_scripts/pdflatexpicscale/pdflatexpicscale.pl
index 638f0bdd2a7..5e236e4f9b5 100755
--- a/Build/source/texk/texlive/linked_scripts/pdflatexpicscale/pdflatexpicscale.pl
+++ b/Build/source/texk/texlive/linked_scripts/pdflatexpicscale/pdflatexpicscale.pl
@@ -1,19 +1,20 @@
#!/usr/bin/perl -w
# Scale pictures to be included into a LaTeX generated PDF file.
-# version 0.1 written by peter willadt
+# version 0.2 written by peter willadt
# contact willadt at t-online.de
# this software is subject to the LaTeX project public license.
# changes:
-# 2016-08-01 first public release
-
+# 2016-07-27 first public release
+# 2016-08-02 changed regex to prevent problem with long filenames
+# 2016-08-02 changed > to gt (shame on me)
use strict;
use File::Basename;
use File::Spec;
use File::Copy;
use Getopt::Long;
-my $version = '0.1';
-my $versiondate = '2016-07-28';
+my $version = '0.2';
+my $versiondate = '2016-08-02';
my $showversion;
my $verbose;
@@ -72,7 +73,7 @@ sub handleImage
$dstdirs[1] = $printfolderprefix;
$dstfilename = File::Spec->catfile(@dstdirs, basename($filename));
if($filename eq $dstfilename){
- unless ($srcfolder > ' ') {
+ unless ($srcfolder gt ' ') {
printInplaceError($filename);
$skipped++;
return;
@@ -159,25 +160,32 @@ sub readlog
my $logfilename = shift;
$logfilename .= '.log';
my ($picname, $picext, $picwidth, $picheight);
- my ($picextu, $needsize);
+ my ($picextu, $state, $buffer);
open LOGFILE, "<$logfilename" or die "Cannot read $logfilename";
- $needsize = 0;
+ $state = 0;
while (<LOGFILE>){
- if (/^Package pdftex\.def Info\: (\S*)\.(\w+) used /){
- $picname = $1;
- $picext = $2;
- ($picextu = $picext) =~ tr/a-z/A-Z/;
- if( defined $canhandle{$picextu}){
- $needsize = 1;
- next;
+ if (/^Package pdftex\.def\sInfo\:\s/){
+ $buffer = $_;
+ unless (/\sused/){
+ chomp $buffer;
+ $buffer .= <LOGFILE>;
+ }
+ if($buffer =~ /Info:\s(\S*)\.(\w+)\sused/){
+ $picname = $1;
+ $picext = $2;
+ ($picextu = $picext) =~ tr/a-z/A-Z/;
+ if(defined $canhandle{$picextu}){
+ $state = 1;
+ next;
+ }
}
}
- next unless ($needsize == 1);
+ next unless ($state == 1);
next unless /Requested size: (\d+\.\d+)pt x (\d+\.\d+)pt/;
$picwidth = $1;
$picheight = $2;
handleImage("$picname.$picext", $picwidth, $picheight);
- $needsize = 0;
+ $state = 0;
}
}