diff options
author | Karl Berry <karl@freefriends.org> | 2006-09-27 18:11:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-09-27 18:11:21 +0000 |
commit | e95557faa7717d1933720a2cda89a99c6aab1dd7 (patch) | |
tree | c1867e637598f20d71977e893a6bf29ad95c1483 | |
parent | c31daf21a745dc6c14ad116918ba562d16727493 (diff) |
exteps update (27sep06)
git-svn-id: svn://tug.org/texlive/trunk@2208 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/metapost/exteps/README | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/exteps/delfin | 108 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/exteps/exteps.pdf | bin | 116101 -> 179682 bytes | |||
-rw-r--r-- | Master/texmf-dist/metapost/exteps/exteps.mp | 141 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/exteps.tpm | 7 | ||||
-rw-r--r-- | Master/texmf/lists/exteps | 1 |
6 files changed, 217 insertions, 48 deletions
diff --git a/Master/texmf-dist/doc/metapost/exteps/README b/Master/texmf-dist/doc/metapost/exteps/README index e1f96065426..2710a87f200 100644 --- a/Master/texmf-dist/doc/metapost/exteps/README +++ b/Master/texmf-dist/doc/metapost/exteps/README @@ -1,5 +1,5 @@ -exteps is a module for inclusion of external EPS figures into MetaPost -figures. It is written solely in MetaPost, and whence does not require -any post processing of the MetaPost output. +exteps is a module for including external EPS figures into MetaPost +figures. It is written entirely in MetaPost, and therefore does not +require any post processing of the MetaPost output. -Palle Jørgensen
\ No newline at end of file +Palle Jorgensen diff --git a/Master/texmf-dist/doc/metapost/exteps/delfin b/Master/texmf-dist/doc/metapost/exteps/delfin new file mode 100644 index 00000000000..e3f7c2b692d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/exteps/delfin @@ -0,0 +1,108 @@ +#! /usr/bin/perl -w +# +# Program for inserting EPS files into MetaPost output files. Requires +# the extpeps module for MetaPost -- and it is probably not even +# necessary to run this program +# +# Copyright (C) 2005 Palle Jorgensen <hamselv@pallej.dk> +# http://pallej.dk/exteps/ +# http://pallej.dk/ +# +# 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. +# +# Bugs and comments can be reported to Palle Jorgensen, +# <hamselv@pallej.dk>. +# +# This is version 0.12 Mon Dec 26 2005 + +use strict; +our($opt_h,$opt_q,$opt_v,$opt_V,$opt_i); + +use Getopt::Std; +getopts('-helpvqVi'); + +use Env qw(HOME); + +my $progversion = 0.12; +my $progname = "delfin"; +my $prognamelong = "Delfin, the Exteps Large File INserter"; +if ($opt_h) { version(); help(); exit; } +if ($opt_v) { version(); exit; } +if ($opt_V) { versionbrief(); exit; } + +unless ( $opt_q ) { + print "This is $progname version $progversion\n"; + print "$prognamelong\n"; +} + +foreach ( @ARGV ) { + my $mpsfile = $_; + my $elffound = 0; + open (MPSIN, "$mpsfile") or die "Cannot open file $mpsfile"; + my @OUT; + foreach ( <MPSIN> ) { + if ($_ =~ /^%% MetaPost exteps large file->/) { + $elffound = 1; + my $epsfile = (split(/->|\n/,$_))[1]; + unless ( $opt_q ) { + print "Inserting $epsfile into $mpsfile\n"; + } + open(EPS, "$epsfile") or die "cannot open file $epsfile"; + push (@OUT, <EPS>); + } else { + push (@OUT, $_); + } + } + close MPSIN; + if ( $elffound ) { + open (MPSOUT, ">$_") or die "Cannot write to file $_"; + print MPSOUT @OUT; + close MPSOUT; + } + else { + unless ( $opt_q ) { + print "No file to insert into $mpsfile\n" + } + } +} + +sub help { + print << "EOF"; +Usage: +$progname [options] file.n [file.m [file.l ... ]] +Options: + -h\tPrint this message end exit + -q\tBe quiet + -i\tIgnore configuration file + -v\tDisplay version and license and exit + -V\tDisplay version number and exit +See exteps.pdf for further documentation +(texdoc exteps on most unix systems) +EOF +} + +sub version { + print << "EOF" +This is $progname version $progversion +$prognamelong +Copyright 2005 by Palle Jorgensen +The license of $progname is GNU General Public License (GPL) +EOF +} + +sub versionbrief { + print "$progversion\n"; +} diff --git a/Master/texmf-dist/doc/metapost/exteps/exteps.pdf b/Master/texmf-dist/doc/metapost/exteps/exteps.pdf Binary files differindex 50bdeb3d7bf..007b5864de1 100644 --- a/Master/texmf-dist/doc/metapost/exteps/exteps.pdf +++ b/Master/texmf-dist/doc/metapost/exteps/exteps.pdf diff --git a/Master/texmf-dist/metapost/exteps/exteps.mp b/Master/texmf-dist/metapost/exteps/exteps.mp index 0ec3626f26b..fafd0abd3fa 100644 --- a/Master/texmf-dist/metapost/exteps/exteps.mp +++ b/Master/texmf-dist/metapost/exteps/exteps.mp @@ -1,4 +1,4 @@ -% Copyright 2005 by Palle Jørgensen +% Copyright 2005, 2006 by Palle Jorgensen % % This file is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -15,11 +15,14 @@ % Foundation, Inc., 59 Temple Place - Suite 330, Boston, % MA 02111-1307, USA. % -% This is version 0.1 Wed Aug 10 2005 +% This is version 0.41 Tue Sep 26 2006 Dec % % The module is documentet in exteps.pdf picture epspicture; +string extra_begineps; extra_begineps = ""; +string extra_endeps; extra_endeps = ""; +boolean extepsverbose; extepsverbose = true; %% String handling tool string string_split[]; @@ -48,7 +51,7 @@ def begineps text F = begingroup; save file; string file; file = F; save angle; numeric angle; angle = 0; - save clip; boolean clip; clip = false; + save clipping; boolean clipping; clipping = false; save scale; pair scale; scale = (1,1); save base; pair base; base = origin; save __bbxfound; boolean __bbxfound; __bbxfound = false; @@ -61,10 +64,17 @@ def begineps text F = save pct; numeric pct; save width; numeric width; save height; numeric height; + save clippath; path clippath; + save largefile; boolean largefile; largefile = false; + save gridllx; numeric gridllx; + save gridlly; numeric gridlly; + save gridurx; numeric gridurx; + save gridury; numeric gridury; %% Finding the bounding box forever: __eps__currentline := readfrom F; if substring(0,14) of __eps__currentline = "%%BoundingBox:": + exitif __eps__currentline = EOF; % PATCH D. Roegel 23-sep-2006 __bbxline := substring(14, infinity) of __eps__currentline; __bbxfound := true; splitstring __bbxline; @@ -75,27 +85,24 @@ def begineps text F = fi exitif __bbxfound; endfor + if not __bbxfound: + message "Warning: No bounding box found."; + message " Setting bounding box to 0 0 1 1"; + llx = lly = 0; + urx = ury = 1; + fi closefrom F; + scantokens extra_begineps; __base = -(llx,lly); pct = (urx - llx)/100; %% To ensure the right bounding box of the output file %% a picture with the same size as the eps figure is added. epspicture := nullpicture; - setbounds epspicture to ((0,0)--(0,ury-lly)--(urx-llx,ury-lly)--(urx-llx,0)--cycle); + clippath = (0,0)--(0,ury-lly)--(urx-llx,ury-lly)--(urx-llx,0)--cycle; + setbounds epspicture to clippath; enddef; def endeps = -%% Drawing the grid - if grid: - for i = 0 step gridstep*pct until (urx - llx): - epsdraw (i,0)--(i,ury - lly); - epslabel.bot(((decimal.(i/pct) & "%") infont defaultfont) rotated -90, (i,0)); - endfor - for i = 0 step gridstep*pct until (epsilon + ury - lly): - epsdraw (0,i)--(urx - llx,i); - epslabel.lft(((decimal.(i/pct) & "%") infont defaultfont), (0,i)); - endfor - fi %% Calculating scale if width and/or height is known if (known width) and (known height): scale := (width/(urx - llx),height/(ury - lly)); @@ -109,14 +116,10 @@ def endeps = if base <> origin: special decimal.xpart.base & " " & decimal.ypart.base & " translate"; fi - if scale <> (1,1): - special decimal xpart.scale & " " & decimal ypart.scale & " scale"; - fi if angle <> 0: special decimal angle & " rotate"; - epspicture := epspicture rotatedaround(origin)(angle); fi - if __base <> origin: + if __base <> origin: special decimal.xpart.__base & " " & decimal.ypart.__base & " translate"; fi if scale <> (1,1): @@ -124,30 +127,86 @@ def endeps = if xpart.scale <> ypart.scale: yscaled (ypart.scale/xpart.scale) fi; + special decimal xpart.scale & " " & decimal ypart.scale & " scale"; fi - if clip: - special "newpath "; - special decimal llx & " " & decimal lly & " moveto"; - special decimal llx & " " & decimal ury & " lineto"; - special decimal urx & " " & decimal ury & " lineto"; - special decimal urx & " " & decimal lly & " lineto"; - special decimal llx & " " & decimal lly & " lineto"; - special "closepath clip"; + if angle <> 0: + epspicture := epspicture rotatedaround(origin)(angle); fi - special "%%BeginDocument: " & file; - forever: - __eps__currentline := readfrom file; - exitunless __eps__currentline <> EOF; - special __eps__currentline; - endfor - special "%%EndDocument: " & file; - special "grestore"; - closefrom file; - if base <> (0,0): - epspicture := epspicture shifted base; +%% Drawing the grid !! After the scaling :-) + if unknown gridllx: + gridllx = 0; fi - addto currentpicture also epspicture; -endgroup; + if unknown gridlly: + gridlly = 0; + fi + if unknown gridurx: + gridurx = (urx - llx)/pct; + fi + if unknown gridury: + gridury = (ury - lly)/pct; + fi + if grid: + save __gridpicture; picture __gridpicture; __gridpicture := nullpicture; + for i = gridllx*pct step gridstep*pct until (epsilon + gridurx*pct): + addto __gridpicture doublepath (i*xpart.scale,gridlly*pct*ypart.scale)--(i*xpart.scale,gridury*pct*ypart.scale) withpen currentpen; + addto __gridpicture also thelabel.bot(((decimal.(i/pct) & "%") infont defaultfont) rotated -90, (i*xpart.scale,gridlly*pct*ypart.scale)); + endfor + for i = gridlly*pct step gridstep*pct until (epsilon + gridury*pct): + addto __gridpicture doublepath (gridllx*pct*xpart.scale,i*ypart.scale)--(gridurx*pct*xpart.scale,i*ypart.scale) withpen currentpen; + addto __gridpicture also thelabel.lft(((decimal.(i/pct) & "%") infont defaultfont), (gridllx*pct*xpart.scale,i*ypart.scale)); + endfor + if angle <> 0: + __gridpicture := __gridpicture rotatedaround(origin)(angle); + fi + addto epspicture also __gridpicture; + fi + if clipping: + save __clippath; path __clippath; + __clippath=clippath shifted (llx,lly); + special "newpath " & decimal.xpart.point 0 of __clippath + & " " & decimal.ypart.point 0 of __clippath & " moveto"; + for i = 0 upto length.__clippath-1: + special decimal.xpart.postcontrol i of __clippath & " " & + decimal.ypart.postcontrol i of __clippath & " " & + decimal.xpart.precontrol (i+1) of __clippath & " " & + decimal.ypart.precontrol (i+1) of __clippath & " " & + decimal.xpart.point (i+1) of __clippath & " " & + decimal.ypart.point (i+1) of __clippath & " curveto"; + endfor; + special "closepath clip"; + fi + special "save"; + special "userdict begin"; + special "/showpage {} def"; + special "%%BeginDocument: " & file; + if largefile: + special "%% MetaPost exteps large file->" & file; + if extepsverbose: + message "exteps notification: File " & file & " not inserted into " & jobname & "." & decimal.charcode; + message " Run 'delfin " & jobname & "." & decimal.charcode & "' to insert " & file; + message " This is caused by setting 'largefile:=true'"; + message ""; + fi + else: + if extepsverbose: + message "Inserting " & file & " into " & jobname & "." & decimal.charcode; + fi + forever: + __eps__currentline := readfrom file; + exitunless __eps__currentline <> EOF; + special __eps__currentline; + endfor + fi + special "%%EndDocument: " & file; + scantokens extra_endeps; + special "end restore"; + special "grestore"; + closefrom file; + if base <> (0,0): + epspicture := epspicture shifted base; + fi + addto currentpicture also epspicture; + endgroup; enddef; %% Special drawing commands diff --git a/Master/texmf-dist/tpm/exteps.tpm b/Master/texmf-dist/tpm/exteps.tpm index 3d1467d8568..50da4a25f7b 100644 --- a/Master/texmf-dist/tpm/exteps.tpm +++ b/Master/texmf-dist/tpm/exteps.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/exteps.zip"> <TPM:Name>exteps</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/01/09 00:45:48</TPM:Date> + <TPM:Date>2006/09/26 15:20:00</TPM:Date> <TPM:Version></TPM:Version> <TPM:Creator>karl</TPM:Creator> <TPM:Title>The exteps package.</TPM:Title> @@ -11,13 +11,14 @@ <TPM:Author></TPM:Author> <TPM:Size>141076</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="6765"> + <TPM:RunFiles size="9287"> texmf-dist/metapost/exteps/exteps.mp texmf-dist/tpm/exteps.tpm </TPM:RunFiles> - <TPM:DocFiles size="134311"> + <TPM:DocFiles size="200805"> texmf-dist/doc/metapost/exteps/LICENSE texmf-dist/doc/metapost/exteps/README +texmf-dist/doc/metapost/exteps/delfin texmf-dist/doc/metapost/exteps/exteps.pdf </TPM:DocFiles> <TPM:Provides>Package/exteps</TPM:Provides> diff --git a/Master/texmf/lists/exteps b/Master/texmf/lists/exteps index eda04bc74f7..59bbbfa6727 100644 --- a/Master/texmf/lists/exteps +++ b/Master/texmf/lists/exteps @@ -1,5 +1,6 @@ texmf-dist/doc/metapost/exteps/LICENSE texmf-dist/doc/metapost/exteps/README +texmf-dist/doc/metapost/exteps/delfin texmf-dist/doc/metapost/exteps/exteps.pdf texmf-dist/metapost/exteps/exteps.mp |