summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2005-06-27 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2005-06-27 00:00:00 +0200
commit606ac7d65f5f5974ae7926e84dfb34849ce96db8 (patch)
tree0107133567b9472301c3b8345cf2f4b0e2085d6f /scripts
parentdddd4cf24fcf8ef5f9c76acb7da468f502cd0bcd (diff)
downloadcontext-606ac7d65f5f5974ae7926e84dfb34849ce96db8.tar.gz
stable 2005.06.27
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/perl/texfont.pl6
-rw-r--r--scripts/context/ruby/base/tex.rb1
-rw-r--r--scripts/context/ruby/base/tool.rb1
-rw-r--r--scripts/context/ruby/graphics/gs.rb38
4 files changed, 28 insertions, 18 deletions
diff --git a/scripts/context/perl/texfont.pl b/scripts/context/perl/texfont.pl
index 732fb0f3e..6a569ddfd 100644
--- a/scripts/context/perl/texfont.pl
+++ b/scripts/context/perl/texfont.pl
@@ -855,7 +855,7 @@ foreach my $file (@files)
print "$command\n" if $trace ;
$font = `$command` ;
chomp $font ;
- $cleanfont = $font }
+ $cleanname = $cleanfont = $font }
else
{ my $command = "afm2tfm \"$file\" -p texnansi.enc texfont.tfm" ;
print "$command\n" if $trace ;
@@ -1035,8 +1035,8 @@ foreach my $file (@files)
report("no mapfile from otftotfm : texfont.map") ;
}
if ($preproc) {
- $mapline =~ s/^(\S+)/$1 </;
- $mapline =~ s/<<(\S+)\.otf$// ;
+ $mapline =~ s/<\[/</;
+ $mapline =~ s/<<(\S+)\.otf$/<$1\.pfb/ ;
} else {
$mapline =~ s/<<(\S+)\.otf$/<< $ttfpath\/$fontname.$extension/ ;
}
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb
index 2be0548d3..1ec2a6ea1 100644
--- a/scripts/context/ruby/base/tex.rb
+++ b/scripts/context/ruby/base/tex.rb
@@ -767,7 +767,6 @@ class TEX
when 'interface' then
contextinterface = value
end
- end
end
end
end
diff --git a/scripts/context/ruby/base/tool.rb b/scripts/context/ruby/base/tool.rb
index c9e6a1890..7f40e773d 100644
--- a/scripts/context/ruby/base/tool.rb
+++ b/scripts/context/ruby/base/tool.rb
@@ -88,6 +88,7 @@ module Tool
begin
if f = open(filename,'rb') then
str = f.read(4000)
+ str.gsub!(/(.*?)\%\!PS/mo, "%!PS") # don't look into preamble crap
f.close
nn = str.count("\n")
nr = str.count("\r")
diff --git a/scripts/context/ruby/graphics/gs.rb b/scripts/context/ruby/graphics/gs.rb
index e9ad2a07f..807cad10c 100644
--- a/scripts/context/ruby/graphics/gs.rb
+++ b/scripts/context/ruby/graphics/gs.rb
@@ -213,7 +213,7 @@ class GhostScript
else report("invalid conversion method #{gsmethod}")
end
rescue
- report('job aborted due to some error')
+ report("job aborted due to some error #{$!}")
begin
File.delete(resultfile) if test(?e,resultfile)
rescue
@@ -321,7 +321,7 @@ class GhostScript
arguments = ''
arguments << "\@gsprofile.ini "
arguments << "-q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH "
-arguments << "#{gsdefaults} "
+ arguments << "#{gsdefaults} "
arguments << "#{gscolorswitch} "
arguments << "-sOutputFile=#{outfile} #{inpfile} -c quit "
@@ -352,14 +352,14 @@ arguments << "#{gsdefaults} "
arguments << "\@gsprofile.ini "
arguments << "-q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH -dSAFER"
arguments << "#{gscolorswitch} "
-arguments << "#{gsdefaults} "
+ arguments << "#{gsdefaults} "
arguments << "-sOutputFile=#{outfile} #{gsstream} -c quit "
debug("ghostscript: #{arguments}")
debug('opening input file')
@rs = Tool.line_separator(inpfile)
- debug("platform #{mac}") if @rs == "\r"
+ debug("platform mac") if @rs == "\r"
return false unless tmp = open(inpfile, 'rb')
@@ -402,6 +402,7 @@ arguments << "#{gsdefaults} "
report('no output file due to error')
File.delete(outfile) if test(?e,outfile)
rescue
+ # debug("fatal error: #{$!}")
debug('file',outfile,'may be invalid')
end
end
@@ -483,14 +484,11 @@ arguments << "#{gsdefaults} "
epsbbox, skip, buffer = false, false, ''
- debug('stripping preamble crap')
-
while str = eps.gets(rs=@rs) do
- if str =~ /%!PS/mois
- str = str.sub(/(.*)%!PS/mois, "%!PS")
- out.puts(str)
+ if str =~ /^%!PS/oi then
+ debug("looks like a valid ps file")
break
- elsif str =~ /%PDF\-\d+\.\d+/mois
+ elsif str =~ /%PDF\-\d+\.\d+/oi then
debug("looks like a pdf file, so let\'s quit")
return false
end
@@ -500,23 +498,35 @@ arguments << "#{gsdefaults} "
# why no BeginData check
- while str = eps.gets(rs=@rs)
+ eps.rewind
+
+ while str = eps.gets(rs=@rs) do
case str
when /^%%Page:/io then
break
- when /^%%(Crop|HiResBounding|ExactBounding)Box:#{@@bboxspec}/mois then
+ when /^%%(Crop|HiResBounding|ExactBounding)Box:#{@@bboxspec}/moi then
debug('high res boundingbox found')
setdimensions($2,$3,$4,$5)
break
- when /^%%BoundingBox:#{@@bboxspec}/mois then
+ when /^%%BoundingBox:#{@@bboxspec}/moi then
debug('low res boundingbox found')
setdimensions($1,$2,$3,$4)
end
end
+ debug('no boundingbox found') if @width == 0
+
eps.rewind
while str = eps.gets(rs=@rs) do
+ if str.sub!(/^(.*)%!PS/moi, "%!PS") then
+ debug("removing pre banner data")
+ out.puts(str)
+ break
+ end
+ end
+
+ while str = eps.gets(rs=@rs) do
if skip then
skip = false if str =~ /^%+(EndData|EndPhotoshop|BeginProlog).*$/o
out.puts(str) if $1 == "BeginProlog"
@@ -608,7 +618,7 @@ arguments << "#{gsdefaults} "
arguments = ''
arguments << "-dPDFSETTINGS=/#{method} -dEmbedAllFonts=true "
arguments << "#{gscolorswitch} "
-arguments << "#{gsdefaults} "
+ arguments << "#{gsdefaults} "
arguments << "-q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH -dSAFER "
arguments << "-sOutputFile=#{outfile} #{inpfile} -c quit "
unless ok = System.run('ghostscript',arguments) then