annotate scripts/plot/print.m @ 9000:cc916241e811

print.m: Restore the old behavior for -S<num>,<num>.
author Ben Abbott <bpabbott@mac.com>
date Sat, 21 Mar 2009 09:35:35 -0400
parents eb63fbe60fab
children 97aa01a85ea4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8889
diff changeset
1 ## Copyright (C) 1999, 2005, 2006, 2007, 2008, 2009 Daniel Heiserer
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
2 ## Copyright (C) 2001 Laurent Mazet
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
3 ##
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
4 ## This file is part of Octave.
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
5 ##
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
7 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6965
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6965
diff changeset
9 ## your option) any later version.
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
10 ##
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
14 ## General Public License for more details.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
15 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6965
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6965
diff changeset
18 ## <http://www.gnu.org/licenses/>.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
19
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefn {Function File} {} print (@var{filename}, @var{options})
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
22 ## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
23 ## Print a graph, or save it to a file
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
24 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
25 ## @var{filename} defines the file name of the output file. If no
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
26 ## filename is specified, output is sent to the printer.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
27 ##
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
28 ## @var{h} specifies the figure handle. If no handle is specified
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
29 ## the handle for the current figure is used.
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
30 ##
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
31 ## @var{options}:
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
32 ## @table @code
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
33 ## @item -P@var{printer}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
34 ## Set the @var{printer} name to which the graph is sent if no
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
35 ## @var{filename} is specified.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
36 ## @item -color
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
37 ## @itemx -mono
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
38 ## Monochrome or colour lines.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
39 ## @item -solid
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
40 ## @itemx -dashed
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
41 ## Solid or dashed lines.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
42 ## @item -portrait
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
43 ## @itemx -landscape
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
44 ## Plot orientation, as returned by "orient".
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
45 ## @item -d@var{device}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
46 ## Output device, where @var{device} is one of:
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
47 ## @table @code
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
48 ## @item ps
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
49 ## @itemx ps2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
50 ## @itemx psc
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
51 ## @itemx psc2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
52 ## Postscript (level 1 and 2, mono and color)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
53 ## @item eps
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
54 ## @itemx eps2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
55 ## @itemx epsc
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
56 ## @itemx epsc2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
57 ## Encapsulated postscript (level 1 and 2, mono and color)
6739
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
58 ## @item tex
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
59 ## @itemx epslatex
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
60 ## @itemx epslatexstandalone
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
61 ## @itemx pstex
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
62 ## @itemx pslatex
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
63 ## Generate a LaTeX (or TeX) file for labels, and eps/ps for
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
64 ## graphics. The file produced by @code{epslatexstandalone} can be
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
65 ## processed directly by LaTeX. The other formats are intended to
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
66 ## be included in a LaTeX (or TeX) document. The @code{tex} device
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
67 ## is the same as the @code{epslatex} device.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
68 ## @item ill
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
69 ## @itemx aifm
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
70 ## Adobe Illustrator
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
71 ## @item cdr
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
72 ## @itemx corel
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
73 ## CorelDraw
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
74 ## @item dxf
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
75 ## AutoCAD
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
76 ## @item emf
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
77 ## Microsoft Enhanced Metafile
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
78 ## @item fig
7037
b1ca2c453b77 [project @ 2007-10-17 21:25:44 by jwe]
jwe
parents: 7032
diff changeset
79 ## XFig. If this format is selected the additional options
7040
1f16da18d85d [project @ 2007-10-19 18:24:19 by jwe]
jwe
parents: 7037
diff changeset
80 ## @code{-textspecial} or @code{-textnormal} can be used to control
7037
b1ca2c453b77 [project @ 2007-10-17 21:25:44 by jwe]
jwe
parents: 7032
diff changeset
81 ## whether the special flag should be set for the text in the figure
7040
1f16da18d85d [project @ 2007-10-19 18:24:19 by jwe]
jwe
parents: 7037
diff changeset
82 ## (default is @code{-textnormal}).
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
83 ## @item hpgl
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
84 ## HP plotter language
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
85 ## @item mf
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
86 ## Metafont
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
87 ## @item png
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
88 ## Portable network graphics
7543
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
89 ## @item jpg
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
90 ## @itemx jpeg
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
91 ## JPEG image
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
92 ## @item gif
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
93 ## GIF image
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
94 ## @item pbm
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
95 ## PBMplus
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
96 ## @item svg
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
97 ## Scalable vector graphics
7396
0114d8cd1587 [project @ 2008-01-17 21:55:55 by jwe]
jwe
parents: 7341
diff changeset
98 ## @item pdf
0114d8cd1587 [project @ 2008-01-17 21:55:55 by jwe]
jwe
parents: 7341
diff changeset
99 ## Portable document format
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
100 ## @end table
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
101 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
102 ## Other devices are supported by "convert" from ImageMagick. Type
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
103 ## system("convert") to see what formats are available.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
104 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
105 ## If the device is omitted, it is inferred from the file extension,
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
106 ## or if there is no filename it is sent to the printer as postscript.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
107 ##
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
108 ## @itemx -r@var{NUM}
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
109 ## Resolution of bitmaps in pixels per inch.
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
110 ##
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
111 ## @itemx -S@var{xsize},@var{ysize}
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
112 ## Plot size in pixels for PNG and SVG. If using the command form of
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
113 ## the print function, you must quote the @var{xsize},@var{ysize}
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
114 ## option. For example, by writing @code{"-S640,480"}.
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
115 ##
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
116 ## @item -F@var{fontname}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
117 ## @itemx -F@var{fontname}:@var{size}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
118 ## @itemx -F:@var{size}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
119 ## @var{fontname} set the postscript font (for use with postscript,
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
120 ## aifm, corel and fig). By default, 'Helvetica' is set for PS/Aifm,
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
121 ## and 'SwitzerlandLight' for Corel. It can also be 'Times-Roman'.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
122 ## @var{size} is given in points. @var{fontname} is ignored for the
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
123 ## fig device.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
124 ## @end table
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
125 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
126 ## The filename and options can be given in any order.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
127 ## @end deftypefn
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
128
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
129 ## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
130 ## Adapted-By: jwe
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
131
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
132 function print (varargin)
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
133
5365
c9c773d8333f [project @ 2005-05-23 20:05:15 by jwe]
jwe
parents: 5363
diff changeset
134 orientation = orient ();
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
135 use_color = 0; # 0=default, -1=mono, +1=color
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
136 force_solid = 0; # 0=default, -1=dashed, +1=solid
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
137 fontsize = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
138 font = "";
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
139 size = "";
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
140 name = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
141 devopt = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
142 printer = "";
6870
e2e5425905ac [project @ 2007-09-06 20:18:20 by jwe]
jwe
parents: 6739
diff changeset
143 debug = false;
6872
bdbe9778d995 [project @ 2007-09-06 21:00:30 by jwe]
jwe
parents: 6870
diff changeset
144 debug_file = "octave-print-commands.log";
7037
b1ca2c453b77 [project @ 2007-10-17 21:25:44 by jwe]
jwe
parents: 7032
diff changeset
145 special_flag = "textnormal";
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
146 resolution = "";
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
147
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
148 old_fig = get (0, "currentfigure");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
149 unwind_protect
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
150 ## Ensure the last figure is on the screen for single line commands like
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
151 ## plot(...); print(...);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
152 drawnow ();
7032
4d4197ffb09d [project @ 2007-10-15 16:31:55 by jwe]
jwe
parents: 7017
diff changeset
153
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
154 for i = 1:nargin
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
155 arg = varargin{i};
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
156 if (ischar (arg))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
157 if (strcmp (arg, "-color"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
158 use_color = 1;
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
159 elseif (strcmp (arg, "-mono"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
160 use_color = -1;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
161 elseif (strcmp (arg, "-solid"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
162 force_solid = 1;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
163 elseif (strcmp (arg, "-dashed"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
164 force_solid = -1;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
165 elseif (strcmp (arg, "-portrait"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
166 orientation = "portrait";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
167 elseif (strcmp (arg, "-landscape"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
168 orientation = "landscape";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
169 elseif (strcmp (arg, "-textspecial"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
170 special_flag = "textspecial";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
171 elseif (strncmp (arg, "-debug", 6))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
172 debug = true;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
173 if (length (arg) > 7)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
174 debug_file = arg(8:end);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
175 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
176 elseif (length (arg) > 2 && arg(1:2) == "-d")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
177 devopt = arg(3:end);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
178 elseif (length (arg) > 2 && arg(1:2) == "-P")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
179 printer = arg;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
180 elseif (length (arg) > 2 && arg(1:2) == "-F")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
181 idx = rindex (arg, ":");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
182 if (idx)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
183 font = arg(3:idx-1);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
184 fontsize = arg(idx+1:length(arg));
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
185 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
186 font = arg(3:length(arg));
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
187 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
188 elseif (length (arg) > 2 && arg(1:2) == "-S")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
189 size = arg(3:length(arg));
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
190 elseif (length (arg) > 2 && arg(1:2) == "-r")
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
191 resolution = arg(3:length(arg));
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
192 elseif (length (arg) >= 1 && arg(1) == "-")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
193 error ("print: unknown option `%s'", arg);
7556
c69d4732d877 print.m: fix oops in applying last change (really, I mean it this time)
John W. Eaton <jwe@octave.org>
parents: 7555
diff changeset
194 elseif (length (arg) > 0)
c69d4732d877 print.m: fix oops in applying last change (really, I mean it this time)
John W. Eaton <jwe@octave.org>
parents: 7555
diff changeset
195 name = arg;
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
196 endif
8239
041bb0c64f07 orient.m,print.f: validate figure handle
Ben Abbott <bpabbott@mac.com>
parents: 8049
diff changeset
197 elseif (isfigure (arg))
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
198 figure (arg);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
199 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
200 error ("print: expecting inputs to be character string options or a figure handle");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
201 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
202 endfor
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
203
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
204 doprint = isempty (name);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
205 if (doprint)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
206 if (isempty (devopt))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
207 printname = cstrcat (tmpnam, ".ps");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
208 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
209 printname = cstrcat (tmpnam, ".", devopt);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
210 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
211 name = printname;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
212 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
213
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
214 if (isempty (devopt))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
215 dot = rindex (name, ".");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
216 if (dot == 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
217 error ("print: no format specified");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
218 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
219 dev = tolower (name(dot+1:end));
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
220 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
221 else
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
222 dev = devopt;
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
223 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
224
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
225 if (strcmp (dev, "tex"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
226 dev = "epslatex";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
227 ## gnuplot 4.0 wants ".eps" in the output name
8639
399af34bb4bf # User Ben Abbott <bpabbott@mac.com>
John W. Eaton <jwe@octave.org>
parents: 8239
diff changeset
228 if (! __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
229 name = cstrcat (name(1:dot), "eps");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
230 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
231 elseif (strcmp (dev, "ill"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
232 dev = "aifm";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
233 elseif (strcmp (dev, "cdr"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
234 dev = "corel";
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
235 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
236
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
237 ## check if we have to use convert
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
238 dev_list = {"aifm", "corel", "fig", "png", "jpg", "jpeg", ...
7543
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
239 "gif", "pbm", "dxf", "mf", "svg", "hpgl", ...
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
240 "ps", "ps2", "psc", "psc2", "eps", "eps2", ...
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
241 "epsc", "epsc2", "emf", "pdf", "pslatex", ...
b84c5cbc0812 print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
242 "epslatex", "epslatexstandalone", "pstex"};
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
243 convertname = "";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
244 [idx, errmsg] = cellidx (dev_list, dev);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
245 if (! idx)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
246 if (! isempty (devopt))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
247 convertname = cstrcat (devopt, ":", name);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
248 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
249 convertname = name;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
250 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
251 dev = "epsc";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
252 name = cstrcat (tmpnam, ".eps");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
253 endif
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
254
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
255 if (strcmp (dev, "ps") || strcmp (dev, "ps2")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
256 || strcmp (dev, "psc") || strcmp (dev, "psc2")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
257 || strcmp (dev, "epsc") || strcmp (dev, "epsc2")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
258 || strcmp (dev, "eps") || strcmp (dev, "eps2")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
259 || strcmp (dev, "pstex")|| strcmp (dev, "pslatex")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
260 || strcmp (dev, "epslatex") || strcmp (dev, "epslatexstandalone"))
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
261
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
262 ## Various postscript options
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
263 if (strcmp (dev, "pstex")|| strcmp (dev, "pslatex")
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
264 || strcmp (dev, "epslatex"))
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
265 termn = dev;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
266 options = "";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
267 elseif (strcmp (dev, "epslatexstandalone"))
8639
399af34bb4bf # User Ben Abbott <bpabbott@mac.com>
John W. Eaton <jwe@octave.org>
parents: 8239
diff changeset
268 if (__gnuplot_has_feature__ ("epslatexstandalone_terminal"))
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
269 termn = "epslatex";
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
270 options = "standalone ";
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
271 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
272 error ("print: epslatexstandalone needs gnuplot 4.2 or higher");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
273 endif
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
274 else
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
275 if (dev(1) == "e")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
276 options = "eps ";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
277 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
278 options = cstrcat (orientation, " ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
279 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
280 termn = "postscript";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
281 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
282
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
283 if (any (dev == "c") || use_color > 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
284 if (force_solid < 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
285 options = cstrcat (options, "color dashed ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
286 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
287 options = cstrcat (options, "color solid ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
288 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
289 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
290 if (force_solid > 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
291 options = cstrcat (options, "mono solid ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
292 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
293 options = cstrcat (options, "mono dashed ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
294 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
295 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
296
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
297 if (! isempty (font))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
298 options = cstrcat (options, "\"", font, "\" ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
299 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
300 if (! isempty (fontsize))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
301 options = cstrcat (options, " ", fontsize);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
302 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
303
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
304 new_terminal = cstrcat (termn, " ", options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
305
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
306 elseif (strcmp (dev, "aifm") || strcmp (dev, "corel"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
307 ## Adobe Illustrator, CorelDraw
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
308 if (use_color >= 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
309 options = " color";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
310 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
311 options = " mono";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
312 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
313 if (! isempty (font))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
314 options = cstrcat (options, " \"", font, "\"");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
315 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
316 if (! isempty (fontsize))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
317 options = cstrcat (options, " ", fontsize);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
318 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
319
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
320 new_terminal = cstrcat (dev, " ", options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
321
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
322 elseif (strcmp (dev, "fig"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
323 ## XFig
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
324 options = orientation;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
325 if (use_color >= 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
326 options = " color";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
327 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
328 options = " mono";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
329 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
330 options = cstrcat (options, " ", special_flag);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
331 if (! isempty (fontsize))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
332 options = cstrcat (options, " fontsize ", fontsize);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
333 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
334
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
335 new_terminal = cstrcat ("fig ", options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
336
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
337 elseif (strcmp (dev, "emf"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
338 ## Enhanced Metafile format
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
339 options = " ";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
340 if (use_color >= 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
341 options = " color";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
342 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
343 options = " mono";
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
344 endif
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
345 if (force_solid >= 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
346 options = cstrcat (options, " solid");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
347 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
348 if (! isempty (font))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
349 options = cstrcat (options, " \"", font, "\"");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
350 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
351 if (! isempty (fontsize))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
352 options = cstrcat (options, " ", fontsize);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
353 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
354
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
355 new_terminal = cstrcat ("emf ", options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
356
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
357 elseif (strcmp (dev, "png") || strcmp (dev, "gif")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
358 || strcmp (dev, "jpg") || strcmp (dev, "jpeg")
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
359 || strcmp (dev, "pbm"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
360 if (strcmp (dev, "jpg"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
361 dev = "jpeg";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
362 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
363 ## Portable network graphics, PBMplus
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
364
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
365 ## FIXME -- New PNG interface takes color as "xRRGGBB"
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
366 ## where x is the literal character 'x' and 'RRGGBB' are the red,
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
367 ## green and blue components in hex. For now we just ignore it
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
368 ## and use default. The png terminal now is so rich with options,
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
369 ## that one perhaps has to write a separate printpng.m function.
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
370 ## DAS
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
371
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
372 if (isempty (size) && isempty (resolution))
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
373 options = " large";
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
374 elseif (! isempty (size))
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
375 options = cstrcat (" size ", size);
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
376 else
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
377 options = "";
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
378 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
379 new_terminal = cstrcat (dev, options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
380
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
381 elseif (strcmp (dev, "dxf") || strcmp (dev, "mf") || strcmp (dev, "hpgl"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
382 ## AutoCad DXF, METAFONT, HPGL
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
383 new_terminal = dev;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
384
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
385 elseif (strcmp (dev, "svg"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
386 ## SVG
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
387 options = "";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
388 if (! isempty (size))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
389 options = cstrcat (" size ", size);
6727
3d1e0a056e6e [project @ 2007-06-14 20:45:10 by jwe]
jwe
parents: 6272
diff changeset
390 endif
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
391 new_terminal = cstrcat ("svg", options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
392
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
393 elseif (strcmp (dev, "pdf"))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
394 ## Portable Document format
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
395 options = " ";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
396 if (use_color >= 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
397 options = "color";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
398 else
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
399 options = "mono";
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
400 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
401 if (force_solid > 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
402 options = cstrcat (options, " solid");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
403 elseif (force_solid < 0)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
404 options = cstrcat (options, " dashed");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
405 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
406 if (! isempty (font))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
407 options = cstrcat (options, "\"", font, "\" ");
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
408 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
409 if (! isempty (fontsize))
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
410 options = cstrcat (options, " ", fontsize);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
411 endif
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
412
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
413 new_terminal = cstrcat ("pdf ", options);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
414
6179
235a1b456cf4 [project @ 2006-11-17 17:33:09 by jwe]
jwe
parents: 6178
diff changeset
415 endif
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
416
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
417 mono = use_color < 0;
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
418
8889
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
419 if (isempty (resolution))
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
420 resolution = get (0, "screenpixelsperinch");
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
421 else
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
422 resolution = str2num (resolution);
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
423 endif
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
424 figure_properties = get (gcf);
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
425 if (! isfield (figure_properties, "__pixels_per_inch__"))
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
426 addproperty ("__pixels_per_inch__", gcf, "double", resolution);
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
427 endif
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
428 set (gcf, "__pixels_per_inch__", resolution)
665b264b6a50 Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents: 8746
diff changeset
429
9000
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
430 unwind_protect
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
431 if (! isempty (size))
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
432 size_in_pixels = sscanf (size ,"%d, %d");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
433 size_in_pixels = reshape (size_in_pixels, [1, numel(size_in_pixels)]);
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
434 size_in_inches = size_in_pixels ./ resolution;
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
435 p.paperunits = get (gcf, "paperunits");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
436 p.papertype = get (gcf, "papertype");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
437 p.papersize = get (gcf, "papersize");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
438 p.paperposition = get (gcf, "paperposition");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
439 p.paperpositionmode = get (gcf, "paperpositionmode");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
440 set (gcf, "paperunits", "inches");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
441 set (gcf, "papertype", "<custom>");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
442 set (gcf, "papersize", size_in_inches);
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
443 set (gcf, "paperposition", [0, 0, size_in_inches]);
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
444 set (gcf, "paperpositionmode", "manual");
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
445 endif
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
446 if (debug)
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
447 drawnow (new_terminal, name, mono, debug_file);
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
448 else
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
449 drawnow (new_terminal, name, mono);
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
450 endif
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
451 unwind_protect_cleanup
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
452 ## FIXME - it would be preferred to delete the added properties here.
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
453 if (! isempty (size))
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
454 props = fieldnames (p);
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
455 for n = 1:numel(props)
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
456 set (gcf, props{n}, p.(props{n}))
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
457 endfor
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
458 endif
cc916241e811 print.m: Restore the old behavior for -S<num>,<num>.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
459 end_unwind_protect
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
460
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
461 if (! isempty (convertname))
8049
e36e891f2349 undo spurious change in last commit
John W. Eaton <jwe@octave.org>
parents: 8048
diff changeset
462 command = sprintf ("convert '%s' '%s'", name, convertname);
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
463 [errcode, output] = system (command);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
464 unlink (name);
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
465 if (errcode)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
466 error ("print: could not convert");
5625
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
467 endif
6179
235a1b456cf4 [project @ 2006-11-17 17:33:09 by jwe]
jwe
parents: 6178
diff changeset
468 endif
6178
830235f4984f [project @ 2006-11-17 00:16:57 by jwe]
jwe
parents: 6019
diff changeset
469
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
470 ## FIXME -- This looks like a dirty, Unix-specific hack.
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
471 ## DAS
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
472 if (doprint)
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
473 system (sprintf ("lpr %s '%s'", printer, printname));
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
474 unlink (printname);
6179
235a1b456cf4 [project @ 2006-11-17 17:33:09 by jwe]
jwe
parents: 6178
diff changeset
475 endif
235a1b456cf4 [project @ 2006-11-17 17:33:09 by jwe]
jwe
parents: 6178
diff changeset
476
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
477 unwind_protect_cleanup
8239
041bb0c64f07 orient.m,print.f: validate figure handle
Ben Abbott <bpabbott@mac.com>
parents: 8049
diff changeset
478 if (isfigure (old_fig))
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
479 figure (old_fig)
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
480 endif
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
481 end_unwind_protect
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
482
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
483 endfunction