Mercurial > hg > octave-nkf
annotate scripts/plot/print.m @ 8855:a909d8c01adf
remove duplicate conversions in OPERATORS
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 24 Feb 2009 11:12:38 +0100 |
parents | 5dd06f19e9be |
children | 665b264b6a50 |
rev | line source |
---|---|
7341 | 1 ## Copyright (C) 1999, 2005, 2006, 2007, 2008 Daniel Heiserer |
5361 | 2 ## Copyright (C) 2001 Laurent Mazet |
3 ## | |
5362 | 4 ## This file is part of Octave. |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
5362 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
5361 | 15 ## |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
5361 | 19 |
20 ## -*- texinfo -*- | |
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 | 23 ## Print a graph, or save it to a file |
24 ## | |
25 ## @var{filename} defines the file name of the output file. If no | |
26 ## filename is specified, output is sent to the printer. | |
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 | 31 ## @var{options}: |
32 ## @table @code | |
33 ## @item -P@var{printer} | |
34 ## Set the @var{printer} name to which the graph is sent if no | |
35 ## @var{filename} is specified. | |
36 ## @item -color | |
37 ## @itemx -mono | |
38 ## Monochrome or colour lines. | |
39 ## @item -solid | |
40 ## @itemx -dashed | |
41 ## Solid or dashed lines. | |
42 ## @item -portrait | |
43 ## @itemx -landscape | |
44 ## Plot orientation, as returned by "orient". | |
45 ## @item -d@var{device} | |
46 ## Output device, where @var{device} is one of: | |
47 ## @table @code | |
48 ## @item ps | |
49 ## @itemx ps2 | |
50 ## @itemx psc | |
51 ## @itemx psc2 | |
52 ## Postscript (level 1 and 2, mono and color) | |
53 ## @item eps | |
54 ## @itemx eps2 | |
55 ## @itemx epsc | |
56 ## @itemx epsc2 | |
57 ## Encapsulated postscript (level 1 and 2, mono and color) | |
6739 | 58 ## @item tex |
59 ## @itemx epslatex | |
60 ## @itemx epslatexstandalone | |
61 ## @itemx pstex | |
62 ## @itemx pslatex | |
63 ## Generate a LaTeX (or TeX) file for labels, and eps/ps for | |
64 ## graphics. The file produced by @code{epslatexstandalone} can be | |
65 ## processed directly by LaTeX. The other formats are intended to | |
66 ## be included in a LaTeX (or TeX) document. The @code{tex} device | |
67 ## is the same as the @code{epslatex} device. | |
5361 | 68 ## @item ill |
69 ## @itemx aifm | |
70 ## Adobe Illustrator | |
71 ## @item cdr | |
72 ## @itemx corel | |
73 ## CorelDraw | |
6965 | 74 ## @item dxf |
75 ## AutoCAD | |
76 ## @item emf | |
77 ## Microsoft Enhanced Metafile | |
78 ## @item fig | |
7037 | 79 ## XFig. If this format is selected the additional options |
7040 | 80 ## @code{-textspecial} or @code{-textnormal} can be used to control |
7037 | 81 ## whether the special flag should be set for the text in the figure |
7040 | 82 ## (default is @code{-textnormal}). |
5361 | 83 ## @item hpgl |
84 ## HP plotter language | |
85 ## @item mf | |
86 ## Metafont | |
87 ## @item png | |
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 | 94 ## @item pbm |
95 ## PBMplus | |
6965 | 96 ## @item svg |
97 ## Scalable vector graphics | |
7396 | 98 ## @item pdf |
99 ## Portable document format | |
5361 | 100 ## @end table |
101 ## | |
102 ## Other devices are supported by "convert" from ImageMagick. Type | |
103 ## system("convert") to see what formats are available. | |
104 ## | |
105 ## If the device is omitted, it is inferred from the file extension, | |
106 ## or if there is no filename it is sent to the printer as postscript. | |
107 ## | |
6965 | 108 ## @itemx -S@var{xsize},@var{ysize} |
109 ## Plot size in pixels for PNG and SVG. If using the command form of | |
110 ## the print function, you must quote the @var{xsize},@var{ysize} | |
111 ## option. For example, by writing @code{"-S640,480"}. | |
112 ## | |
5361 | 113 ## @item -F@var{fontname} |
114 ## @itemx -F@var{fontname}:@var{size} | |
115 ## @itemx -F:@var{size} | |
116 ## @var{fontname} set the postscript font (for use with postscript, | |
117 ## aifm, corel and fig). By default, 'Helvetica' is set for PS/Aifm, | |
118 ## and 'SwitzerlandLight' for Corel. It can also be 'Times-Roman'. | |
119 ## @var{size} is given in points. @var{fontname} is ignored for the | |
120 ## fig device. | |
121 ## @end table | |
122 ## | |
123 ## The filename and options can be given in any order. | |
124 ## @end deftypefn | |
125 | |
126 ## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de> | |
5362 | 127 ## Adapted-By: jwe |
5361 | 128 |
5362 | 129 function print (varargin) |
5361 | 130 |
5365 | 131 orientation = orient (); |
5361 | 132 use_color = 0; # 0=default, -1=mono, +1=color |
133 force_solid = 0; # 0=default, -1=dashed, +1=solid | |
5363 | 134 fontsize = ""; |
135 font = ""; | |
6965 | 136 size = ""; |
5363 | 137 name = ""; |
138 devopt = ""; | |
139 printer = ""; | |
6870 | 140 debug = false; |
6872 | 141 debug_file = "octave-print-commands.log"; |
7037 | 142 special_flag = "textnormal"; |
5361 | 143 |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
144 old_fig = get (0, "currentfigure"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
145 unwind_protect |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
146 ## 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
|
147 ## plot(...); print(...); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
148 drawnow (); |
7032 | 149 |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
150 for i = 1:nargin |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
151 arg = varargin{i}; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
152 if (ischar (arg)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
153 if (strcmp (arg, "-color")) |
5361 | 154 use_color = 1; |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
155 elseif (strcmp (arg, "-mono")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
156 use_color = -1; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
157 elseif (strcmp (arg, "-solid")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
158 force_solid = 1; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
159 elseif (strcmp (arg, "-dashed")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
160 force_solid = -1; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
161 elseif (strcmp (arg, "-portrait")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
162 orientation = "portrait"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
163 elseif (strcmp (arg, "-landscape")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
164 orientation = "landscape"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
165 elseif (strcmp (arg, "-textspecial")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
166 special_flag = "textspecial"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
167 elseif (strncmp (arg, "-debug", 6)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
168 debug = true; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
169 if (length (arg) > 7) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
170 debug_file = arg(8:end); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
171 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
172 elseif (length (arg) > 2 && arg(1:2) == "-d") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
173 devopt = arg(3:end); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
174 elseif (length (arg) > 2 && arg(1:2) == "-P") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
175 printer = arg; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
176 elseif (length (arg) > 2 && arg(1:2) == "-F") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
177 idx = rindex (arg, ":"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
178 if (idx) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
179 font = arg(3:idx-1); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
180 fontsize = arg(idx+1:length(arg)); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
181 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
182 font = arg(3:length(arg)); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
183 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
184 elseif (length (arg) > 2 && arg(1:2) == "-S") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
185 size = arg(3:length(arg)); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
186 elseif (length (arg) >= 1 && arg(1) == "-") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
187 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
|
188 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
|
189 name = arg; |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
190 endif |
8239
041bb0c64f07
orient.m,print.f: validate figure handle
Ben Abbott <bpabbott@mac.com>
parents:
8049
diff
changeset
|
191 elseif (isfigure (arg)) |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
192 figure (arg); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
193 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
194 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
|
195 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
196 endfor |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
197 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
198 doprint = isempty (name); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
199 if (doprint) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
200 if (isempty (devopt)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
201 printname = cstrcat (tmpnam, ".ps"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
202 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
203 printname = cstrcat (tmpnam, ".", devopt); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
204 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
205 name = printname; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
206 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
207 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
208 if (isempty (devopt)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
209 dot = rindex (name, "."); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
210 if (dot == 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
211 error ("print: no format specified"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
212 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
213 dev = tolower (name(dot+1:end)); |
5361 | 214 endif |
215 else | |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
216 dev = devopt; |
5361 | 217 endif |
218 | |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
219 if (strcmp (dev, "tex")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
220 dev = "epslatex"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
221 ## 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
|
222 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
|
223 name = cstrcat (name(1:dot), "eps"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
224 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
225 elseif (strcmp (dev, "ill")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
226 dev = "aifm"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
227 elseif (strcmp (dev, "cdr")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
228 dev = "corel"; |
5361 | 229 endif |
230 | |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
231 ## check if we have to use convert |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
232 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
|
233 "gif", "pbm", "dxf", "mf", "svg", "hpgl", ... |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
234 "ps", "ps2", "psc", "psc2", "eps", "eps2", ... |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
235 "epsc", "epsc2", "emf", "pdf", "pslatex", ... |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
236 "epslatex", "epslatexstandalone", "pstex"}; |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
237 convertname = ""; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
238 [idx, errmsg] = cellidx (dev_list, dev); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
239 if (! idx) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
240 if (! isempty (devopt)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
241 convertname = cstrcat (devopt, ":", name); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
242 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
243 convertname = name; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
244 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
245 dev = "epsc"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
246 name = cstrcat (tmpnam, ".eps"); |
5361 | 247 endif |
5363 | 248 |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
249 if (strcmp (dev, "ps") || strcmp (dev, "ps2") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
250 || strcmp (dev, "psc") || strcmp (dev, "psc2") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
251 || strcmp (dev, "epsc") || strcmp (dev, "epsc2") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
252 || strcmp (dev, "eps") || strcmp (dev, "eps2") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
253 || strcmp (dev, "pstex")|| strcmp (dev, "pslatex") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
254 || strcmp (dev, "epslatex") || strcmp (dev, "epslatexstandalone")) |
6727 | 255 |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
256 ## Various postscript options |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
257 if (strcmp (dev, "pstex")|| strcmp (dev, "pslatex") |
6727 | 258 || strcmp (dev, "epslatex")) |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
259 termn = dev; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
260 options = ""; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
261 elseif (strcmp (dev, "epslatexstandalone")) |
8639
399af34bb4bf
# User Ben Abbott <bpabbott@mac.com>
John W. Eaton <jwe@octave.org>
parents:
8239
diff
changeset
|
262 if (__gnuplot_has_feature__ ("epslatexstandalone_terminal")) |
6727 | 263 termn = "epslatex"; |
264 options = "standalone "; | |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
265 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
266 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
|
267 endif |
6727 | 268 else |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
269 if (dev(1) == "e") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
270 options = "eps "; |
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 options = cstrcat (orientation, " "); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
273 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
274 termn = "postscript"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
275 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
276 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
277 if (any (dev == "c") || use_color > 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
278 if (force_solid < 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
279 options = cstrcat (options, "color dashed "); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
280 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
281 options = cstrcat (options, "color solid "); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
282 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
283 else |
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, "mono solid "); |
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, "mono dashed "); |
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 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
290 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
291 if (! isempty (font)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
292 options = cstrcat (options, "\"", font, "\" "); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
293 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
294 if (! isempty (fontsize)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
295 options = cstrcat (options, " ", fontsize); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
296 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
297 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
298 new_terminal = cstrcat (termn, " ", options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
299 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
300 elseif (strcmp (dev, "aifm") || strcmp (dev, "corel")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
301 ## Adobe Illustrator, CorelDraw |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
302 if (use_color >= 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
303 options = " color"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
304 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
305 options = " mono"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
306 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
307 if (! isempty (font)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
308 options = cstrcat (options, " \"", font, "\""); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
309 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
310 if (! isempty (fontsize)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
311 options = cstrcat (options, " ", fontsize); |
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 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
314 new_terminal = cstrcat (dev, " ", options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
315 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
316 elseif (strcmp (dev, "fig")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
317 ## XFig |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
318 options = orientation; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
319 if (use_color >= 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
320 options = " color"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
321 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
322 options = " mono"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
323 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
324 options = cstrcat (options, " ", special_flag); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
325 if (! isempty (fontsize)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
326 options = cstrcat (options, " fontsize ", fontsize); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
327 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
328 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
329 new_terminal = cstrcat ("fig ", options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
330 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
331 elseif (strcmp (dev, "emf")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
332 ## Enhanced Metafile format |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
333 options = " "; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
334 if (use_color >= 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
335 options = " color"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
336 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
337 options = " mono"; |
6727 | 338 endif |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
339 if (force_solid >= 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
340 options = cstrcat (options, " solid"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
341 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
342 if (! isempty (font)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
343 options = cstrcat (options, " \"", font, "\""); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
344 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
345 if (! isempty (fontsize)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
346 options = cstrcat (options, " ", fontsize); |
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 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
349 new_terminal = cstrcat ("emf ", options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
350 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
351 elseif (strcmp (dev, "png") || strcmp (dev, "gif") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
352 || strcmp (dev, "jpg") || strcmp (dev, "jpeg") |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
353 || strcmp (dev, "pbm")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
354 if (strcmp (dev, "jpg")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
355 dev = "jpeg"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
356 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
357 ## Portable network graphics, PBMplus |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
358 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
359 ## FIXME -- New PNG interface takes color as "xRRGGBB" |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
360 ## 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
|
361 ## 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
|
362 ## 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
|
363 ## 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
|
364 ## DAS |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
365 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
366 ## if (use_color >= 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
367 ## eval (sprintf ("__gnuplot_set__ term %s color medium", dev)); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
368 ##else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
369 ##eval (sprintf ("__gnuplot_set__ term %s mono medium", dev)); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
370 ##endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
371 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
372 if (isempty (size)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
373 options = " large"; |
6727 | 374 else |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
375 options = cstrcat (" size ", size); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
376 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
377 new_terminal = cstrcat (dev, options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
378 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
379 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
|
380 ## AutoCad DXF, METAFONT, HPGL |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
381 new_terminal = dev; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
382 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
383 elseif (strcmp (dev, "svg")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
384 ## SVG |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
385 options = ""; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
386 if (! isempty (size)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
387 options = cstrcat (" size ", size); |
6727 | 388 endif |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
389 new_terminal = cstrcat ("svg", options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
390 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
391 elseif (strcmp (dev, "pdf")) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
392 ## Portable Document format |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
393 options = " "; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
394 if (use_color >= 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
395 options = "color"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
396 else |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
397 options = "mono"; |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
398 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
399 if (force_solid > 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
400 options = cstrcat (options, " solid"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
401 elseif (force_solid < 0) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
402 options = cstrcat (options, " dashed"); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
403 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
404 if (! isempty (font)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
405 options = cstrcat (options, "\"", font, "\" "); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
406 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
407 if (! isempty (fontsize)) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
408 options = cstrcat (options, " ", fontsize); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
409 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
410 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
411 new_terminal = cstrcat ("pdf ", options); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
412 |
6179 | 413 endif |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
414 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
415 mono = use_color < 0; |
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 if (debug) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
418 drawnow (new_terminal, name, mono, debug_file); |
6179 | 419 else |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
420 drawnow (new_terminal, name, mono); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
421 endif |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
422 |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
423 if (! isempty (convertname)) |
8049
e36e891f2349
undo spurious change in last commit
John W. Eaton <jwe@octave.org>
parents:
8048
diff
changeset
|
424 command = sprintf ("convert '%s' '%s'", name, convertname); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
425 [errcode, output] = system (command); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
426 unlink (name); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
427 if (errcode) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
428 error ("print: could not convert"); |
5625 | 429 endif |
6179 | 430 endif |
6178 | 431 |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
432 ## 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
|
433 ## DAS |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
434 if (doprint) |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
435 system (sprintf ("lpr %s '%s'", printer, printname)); |
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
436 unlink (printname); |
6179 | 437 endif |
438 | |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
439 unwind_protect_cleanup |
8239
041bb0c64f07
orient.m,print.f: validate figure handle
Ben Abbott <bpabbott@mac.com>
parents:
8049
diff
changeset
|
440 if (isfigure (old_fig)) |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
441 figure (old_fig) |
6965 | 442 endif |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
443 end_unwind_protect |
5363 | 444 |
5361 | 445 endfunction |