Mercurial > hg > octave-lyh
annotate scripts/plot/print.m @ 16923:5d08a2ec7edb
doc: Move graphics object functions into the right section
* plot.txi: Merge node "Use of axis, line, and patch Functions" into
node "Graphics Objects".
* octave.texi: Remove node "Use of axis, line, and patch Functions"
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Mon, 08 Jul 2013 09:13:30 -0400 |
parents | a4969508008e |
children | e39f00a32dc7 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13141
diff
changeset
|
1 ## Copyright (C) 2008-2012 David Bateman |
5361 | 2 ## |
5362 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5362 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
5361 | 14 ## |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5361 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
20 ## @deftypefn {Function File} {} print () |
9393
d6c99b2ee941
print.m: reimplement options -landscape and -portrait.
Ben Abbott <bpabbott@mac.com>
parents:
9337
diff
changeset
|
21 ## @deftypefnx {Function File} {} print (@var{options}) |
d6c99b2ee941
print.m: reimplement options -landscape and -portrait.
Ben Abbott <bpabbott@mac.com>
parents:
9337
diff
changeset
|
22 ## @deftypefnx {Function File} {} print (@var{filename}, @var{options}) |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
23 ## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options}) |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
24 ## Print a plot, or save it to a file. Both output formatted for |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
25 ## printing (PDF and PostScript), and many bitmapped and vector |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
26 ## image formats are supported. |
5361 | 27 ## |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
28 ## @var{filename} defines the name of the output file. If the |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
29 ## file name has no suffix, one is inferred from the specified |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
30 ## device and appended to the file name. If no filename is |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
31 ## specified, the output is sent to the printer. |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
32 ## |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
33 ## @var{h} specifies the figure handle. If no handle is specified |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
34 ## the handle for the current figure is used. |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
35 ## |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
36 ## For output to a printer, PostScript file, or PDF file, |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
37 ## the paper size is specified by the figure's @code{papersize} |
14620
cd375519eab0
doc: Periodic grammar check of documentation
Rik <octave@nomad.inbox5.com>
parents:
14456
diff
changeset
|
38 ## property. The location and size of the image on the page are |
cd375519eab0
doc: Periodic grammar check of documentation
Rik <octave@nomad.inbox5.com>
parents:
14456
diff
changeset
|
39 ## specified by the figure's @code{paperposition} property. The |
14456
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
40 ## orientation of the page is specified by the figure's |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
41 ## @code{paperorientation} property. |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
42 ## |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
43 ## The width and height of images are specified by the figure's |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
44 ## @code{paperpositon(3:4)} property values. |
05635e4c605a
Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents:
14382
diff
changeset
|
45 ## |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
46 ## The @code{print} command supports many @var{options}: |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
47 ## |
5361 | 48 ## @table @code |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
49 ## @item -f@var{h} |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
50 ## Specify the handle, @var{h}, of the figure to be printed. The |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
51 ## default is the current figure. |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
52 ## |
5361 | 53 ## @item -P@var{printer} |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
54 ## Set the @var{printer} name to which the plot is sent if no |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
55 ## @var{filename} is specified. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
56 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
57 ## @item -G@var{ghostscript_command} |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
58 ## Specify the command for calling Ghostscript. For Unix and Windows |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
59 ## the defaults are 'gs' and 'gswin32c', respectively. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
60 ## |
5361 | 61 ## @item -color |
62 ## @itemx -mono | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
63 ## Monochrome or color output. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
64 ## |
5361 | 65 ## @item -solid |
66 ## @itemx -dashed | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
67 ## Force all lines to be solid or dashed, respectively. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
68 ## |
5361 | 69 ## @item -portrait |
70 ## @itemx -landscape | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
71 ## Specify the orientation of the plot for printed output. For |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
72 ## non-printed output the aspect ratio of the output corresponds to |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
73 ## the plot area defined by the "paperposition" property in the |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
74 ## orientation specified. This options is equivalent to changing |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
75 ## the figure's "paperorientation" property. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
76 ## |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
77 ## @item -TextAlphaBits=@var{n} |
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
78 ## @itemx -GraphicsAlphaBits=@var{n} |
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
79 ## Octave is able to produce output for various printers, bitmaps, and |
14852
53d2c3598d33
doc: Periodic spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14774
diff
changeset
|
80 ## vector formats by using Ghostscript. |
53d2c3598d33
doc: Periodic spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14774
diff
changeset
|
81 ## For bitmap and printer output anti-aliasing is applied using |
53d2c3598d33
doc: Periodic spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14774
diff
changeset
|
82 ## Ghostscript's TextAlphaBits and GraphicsAlphaBits options. |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
83 ## The default number of bits for each is 4. |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
84 ## Allowed values for @var{N} are 1, 2, or 4. |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
85 ## |
5361 | 86 ## @item -d@var{device} |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14620
diff
changeset
|
87 ## The available output format is specified by the option @var{device}, |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
88 ## and is one of: |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14356
diff
changeset
|
89 ## |
5361 | 90 ## @table @code |
91 ## @item ps | |
92 ## @itemx ps2 | |
93 ## @itemx psc | |
94 ## @itemx psc2 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
95 ## Postscript (level 1 and 2, mono and color). The FLTK graphics |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
96 ## toolkit generates Postscript level 3.0. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
97 ## |
5361 | 98 ## @item eps |
99 ## @itemx eps2 | |
100 ## @itemx epsc | |
101 ## @itemx epsc2 | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
102 ## Encapsulated postscript (level 1 and 2, mono and color). The FLTK |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
103 ## graphic toolkit generates Postscript level 3.0. |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
104 ## |
6739 | 105 ## @item tex |
106 ## @itemx epslatex | |
107 ## @itemx epslatexstandalone | |
108 ## @itemx pstex | |
109 ## @itemx pslatex | |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
110 ## @itemx pdflatex |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
111 ## Generate a @LaTeX{} (or @TeX{}) file for labels and eps/ps/pdf |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
112 ## for graphics. The file produced by @code{epslatexstandalone} can be |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9157
diff
changeset
|
113 ## processed directly by @LaTeX{}. The other formats are intended to |
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9157
diff
changeset
|
114 ## be included in a @LaTeX{} (or @TeX{}) document. The @code{tex} device |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
115 ## is the same as the @code{epslatex} device. The @code{pdflatex} device |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
116 ## is only available for the FLTK graphics toolkit. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
117 ## |
9468
5af462716bff
Add support for gnuplot's Lua-TikZ terminal.
Ben Abbott <bpabbott@mac.com>
parents:
9393
diff
changeset
|
118 ## @item tikz |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
119 ## Generate a @LaTeX{} file using PGF/TikZ@. For the FLTK toolkit |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
120 ## the result is PGF. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
121 ## |
5361 | 122 ## @item ill |
123 ## @itemx aifm | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
124 ## Adobe Illustrator (Obsolete for Gnuplot versions > 4.2) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
125 ## |
5361 | 126 ## @item cdr |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
127 ## @itemx @nospell{corel} |
5361 | 128 ## CorelDraw |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
129 ## |
6965 | 130 ## @item dxf |
131 ## AutoCAD | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
132 ## |
6965 | 133 ## @item emf |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
134 ## @itemx meta |
6965 | 135 ## Microsoft Enhanced Metafile |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
136 ## |
6965 | 137 ## @item fig |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
138 ## XFig. For the Gnuplot graphics toolkit, the additional options |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
139 ## @option{-textspecial} or @option{-textnormal} can be used to control |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
140 ## whether the special flag should be set for the text in |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
141 ## the figure. (default is @option{-textnormal}) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
142 ## |
5361 | 143 ## @item hpgl |
144 ## HP plotter language | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
145 ## |
5361 | 146 ## @item mf |
147 ## Metafont | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
148 ## |
5361 | 149 ## @item png |
150 ## Portable network graphics | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
151 ## |
7543
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
152 ## @item jpg |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
153 ## @itemx jpeg |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
154 ## JPEG image |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
155 ## |
7543
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
156 ## @item gif |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
157 ## GIF image (only available for the Gnuplot graphics toolkit) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
158 ## |
5361 | 159 ## @item pbm |
160 ## PBMplus | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
161 ## |
6965 | 162 ## @item svg |
163 ## Scalable vector graphics | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
164 ## |
7396 | 165 ## @item pdf |
166 ## Portable document format | |
5361 | 167 ## @end table |
168 ## | |
169 ## If the device is omitted, it is inferred from the file extension, | |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
170 ## or if there is no filename it is sent to the printer as postscript. |
5361 | 171 ## |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
172 ## @item -d@var{ghostscript_device} |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
173 ## Additional devices are supported by Ghostscript. |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
174 ## Some examples are; |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
175 ## |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
176 ## @table @code |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
177 ## @item ljet2p |
16826
a4969508008e
doc: Periodic spellcheck of the documentation.
Rik <rik@octave.org>
parents:
16766
diff
changeset
|
178 ## HP LaserJet @nospell{IIP} |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
179 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
180 ## @item ljet3 |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
181 ## HP LaserJet III |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
182 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
183 ## @item deskjet |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
184 ## HP DeskJet and DeskJet Plus |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
185 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
186 ## @item cdj550 |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
187 ## HP DeskJet 550C |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
188 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
189 ## @item paintjet |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
190 ## HP PointJet |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
191 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
192 ## @item pcx24b |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
193 ## 24-bit color PCX file format |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
194 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
195 ## @item ppm |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
196 ## Portable Pixel Map file format |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
197 ## |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
198 ## @item pdfwrite |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
199 ## Produces pdf output from eps |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
200 ## @end table |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
201 ## |
16766
7268845c0a1e
avoid backquote in error messages, some uses in doc strings
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
202 ## For a complete list, type @samp{system ("gs -h")} to see what formats |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
203 ## and devices are available. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
204 ## |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
205 ## When Ghostscript output is sent to a printer the size is determined |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
206 ## by the figure's "papersize" property. When the output |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
207 ## is sent to a file the size is determined by the plot box defined by |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
208 ## the figure's "paperposition" property. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
209 ## |
16094
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15301
diff
changeset
|
210 ## @item -append |
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15301
diff
changeset
|
211 ## Append Postscript or PDF output to a pre-existing file of the same type. |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
212 ## |
16094
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15301
diff
changeset
|
213 ## @item -r@var{NUM} |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
214 ## Resolution of bitmaps in pixels per inch. For both metafiles and |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
215 ## SVG the default is the screen resolution; for other formats it is 150 dpi. |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
216 ## To specify screen resolution, use "-r0". |
8889
665b264b6a50
Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents:
8746
diff
changeset
|
217 ## |
9157
fce7315c1eee
print.m: Fix typo, improvments to code, and allow for creation of tight bbox.
Ben Abbott <bpabbott@mac.com>
parents:
9152
diff
changeset
|
218 ## @item -tight |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
219 ## Force a tight bounding box for eps files. |
11009 | 220 ## |
221 ## @item -@var{preview} | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
222 ## Add a preview to eps files. Supported formats are: |
11009 | 223 ## |
224 ## @table @code | |
225 ## @item -interchange | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
226 ## Provide an interchange preview. |
11009 | 227 ## |
228 ## @item -metalfile | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
229 ## Provide a metafile preview. |
11009 | 230 ## |
231 ## @item -pict | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
232 ## Provide pict preview. |
11009 | 233 ## |
234 ## @item -tiff | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
235 ## Provide a tiff preview. |
11009 | 236 ## @end table |
9157
fce7315c1eee
print.m: Fix typo, improvments to code, and allow for creation of tight bbox.
Ben Abbott <bpabbott@mac.com>
parents:
9152
diff
changeset
|
237 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
238 ## @item -S@var{xsize},@var{ysize} |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
239 ## Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@. For |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
240 ## PS, EPS, PDF, and other vector formats the plot size is in points. |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
241 ## This option is equivalent to changing the size of the plot box |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
242 ## associated with the "paperposition" property. When using the command form |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
243 ## of the print function you must quote the @var{xsize},@var{ysize} |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
244 ## option. For example, by writing @w{"-S640,480"}. |
6965 | 245 ## |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
246 ## @item -F@var{fontname} |
5361 | 247 ## @itemx -F@var{fontname}:@var{size} |
248 ## @itemx -F:@var{size} | |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
249 ## Use @var{fontname} and/or @var{fontsize} for all text. |
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
250 ## @var{fontname} is ignored for some devices: dxf, fig, hpgl, etc. |
5361 | 251 ## @end table |
252 ## | |
253 ## The filename and options can be given in any order. | |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
254 ## |
15301
3d05b55c91c7
doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents:
15214
diff
changeset
|
255 ## Example: Print to a file using the svg device. |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
256 ## |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
257 ## @example |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
258 ## @group |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
259 ## figure (1); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
260 ## clf (); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
261 ## surf (peaks); |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
262 ## print -dsvg figure1.svg |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
263 ## @end group |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
264 ## @end example |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
265 ## |
16826
a4969508008e
doc: Periodic spellcheck of the documentation.
Rik <rik@octave.org>
parents:
16766
diff
changeset
|
266 ## Example: Print to an HP DeskJet 550C. |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
267 ## |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
268 ## @example |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
269 ## @group |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
270 ## figure (1); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
271 ## clf (); |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
272 ## surf (peaks); |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
273 ## print -dcdj550 |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11551
diff
changeset
|
274 ## @end group |
11107
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
275 ## @end example |
811b51cdddce
print.m: Add examples to the docstring.
Ben Abbott <bpabbott@mac.com>
parents:
11014
diff
changeset
|
276 ## |
11253 | 277 ## @seealso{figure, orient, saveas} |
5361 | 278 ## @end deftypefn |
279 | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
280 function print (varargin) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
281 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
282 opts = __print_parse_opts__ (varargin{:}); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
283 |
11009 | 284 opts.pstoedit_cmd = @pstoedit; |
285 opts.fig2dev_cmd = @fig2dev; | |
286 opts.latex_standalone = @latex_standalone; | |
287 opts.lpr_cmd = @lpr; | |
288 opts.epstool_cmd = @epstool; | |
289 | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
290 if (! isfigure (opts.figure)) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
291 error ("print: no figure to print"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
292 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
293 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
294 orig_figure = get (0, "currentfigure"); |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
295 figure (opts.figure); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
296 |
11009 | 297 if (opts.append_to_file) |
298 [~, ~, ext] = fileparts (opts.ghostscript.output); | |
299 opts.ghostscript.prepend = strcat (tmpnam (), ext); | |
11014
92bb25c0da9e
When appending, delete temporary files at the end of the ghostscript pipeline.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
300 copyfile (opts.ghostscript.output, opts.ghostscript.prepend); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
301 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
302 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
303 unwind_protect |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
304 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
305 ## Modify properties as specified by options |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
306 props = []; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
307 |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
308 drawnow (); |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
309 |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
310 ## print() requires figure units to be "pixels" |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
311 props(1).h = opts.figure; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
312 props(1).name = "units"; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
313 props(1).value = {get(opts.figure, "units")}; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
314 set (opts.figure, "units", "pixels"); |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
315 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
316 ## graphics toolkit tranlates figure position to eps bbox in points |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
317 fpos = get (opts.figure, "position"); |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
318 props(2).h = opts.figure; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
319 props(2).name = "position"; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
320 props(2).value = {fpos}; |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
321 fpos(3:4) = opts.canvas_size; |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
322 set (opts.figure, "position", fpos); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
323 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
324 ## Set figure background to none. This is done both for |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
325 ## consistency with Matlab and to elliminate the visible |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
326 ## box along the figure's perimeter. |
14355
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
327 props(3).h = opts.figure; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
328 props(3).name = "color"; |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
329 props(3).value{1} = get (props(3).h, props(3).name); |
a6a5c5008e39
Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents:
14335
diff
changeset
|
330 set (props(3).h, "color", "none"); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
331 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
332 if (opts.force_solid != 0) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
333 h = findall (opts.figure, "-property", "linestyle"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
334 m = numel (props); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
335 for n = 1:numel (h) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
336 props(m+n).h = h(n); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
337 props(m+n).name = "linestyle"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
338 props(m+n).value = {get(h(n), "linestyle")}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
339 endfor |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
340 if (opts.force_solid > 0) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
341 linestyle = "-"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
342 else |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
343 linestyle = "--"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
344 endif |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
345 set (h, "linestyle", linestyle); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
346 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
347 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
348 if (opts.use_color < 0 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
349 && ! strcmp (get (opts.figure, "__graphics_toolkit__"), "gnuplot")) |
10866
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
350 color_props = {"color", "facecolor", "edgecolor", "colormap"}; |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
351 for c = 1:numel (color_props) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
352 h = findall (opts.figure, "-property", color_props{c}); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
353 hnone = findall (opts.figure, color_props{c}, "none"); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
354 h = setdiff (h, hnone); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
355 m = numel (props); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
356 for n = 1:numel (h) |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
357 if (ishandle (h(n))) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
358 ## Need to verify objects exist since callbacks may delete objects |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
359 ## as the colors for others are modified. |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
360 rgb = get (h(n), color_props{c}); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
361 props(end+1).h = h(n); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
362 props(end).name = color_props{c}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
363 props(end).value = {get(h(n), color_props{c})}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
364 if (isnumeric (rgb)) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
365 ## convert RGB color to RGB gray scale |
14872
c2dbdeaa25df
maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents:
14868
diff
changeset
|
366 xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
367 ggg = repmat (sum (xfer .* rgb, 2), 1, 3); |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
368 set (h(n), color_props{c}, ggg); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
369 endif |
10866
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
370 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
371 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
372 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
373 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
374 |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
375 if (! isempty (opts.font) || ! isempty (opts.fontsize)) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
376 h = findall (opts.figure, "-property", "fontname"); |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
377 m = numel (props); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
378 for n = 1:numel (h) |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
379 if (ishandle (h(n))) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
380 if (! isempty (opts.font)) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
381 props(end+1).h = h(n); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
382 props(end).name = "fontname"; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
383 props(end).value = {get(h(n), "fontname")}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
384 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
385 endif |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
386 if (ishandle (h(n))) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
387 if (! isempty (opts.fontsize)) |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
388 props(end+1).h = h(n); |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
389 props(end).name = "fontsize"; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
390 props(end).value = {get(h(n), "fontsize")}; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
391 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
392 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
393 endfor |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
394 if (! isempty (opts.font)) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
395 set (h(ishandle (h)), "fontname", opts.font); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
396 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
397 if (! isempty (opts.fontsize)) |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
398 if (ischar (opts.fontsize)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
399 fontsize = str2double (opts.fontsize); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
400 else |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
401 fontsize = opts.fontsize; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
402 endif |
15214
ae6b7ee0a733
print.m: Correct typo preventing fontsize to be set (bug #37163)
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
403 if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1) |
14206
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
404 ## This is done to work around the bbox being whole numbers. |
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
405 fontsize = fontsize * opts.scalefontsize; |
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
406 endif |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
407 set (h(ishandle (h)), "fontsize", fontsize); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
408 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
409 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
410 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
411 ## call the graphcis toolkit print script |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
412 switch (get (opts.figure, "__graphics_toolkit__")) |
11009 | 413 case "gnuplot" |
414 opts = __gnuplot_print__ (opts); | |
415 otherwise | |
416 opts = __fltk_print__ (opts); | |
417 endswitch | |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
418 |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
419 unwind_protect_cleanup |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
420 ## restore modified properties |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
421 if (isstruct (props)) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
422 for n = numel (props):-1:1 |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
423 if (ishandle (props(n).h)) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
424 set (props(n).h, props(n).name, props(n).value{1}); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
425 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
426 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
427 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
428 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
429 ## Unlink temporary files |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14852
diff
changeset
|
430 for n = 1:numel (opts.unlink) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
431 [status, output] = unlink (opts.unlink{n}); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
432 if (status != 0) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
433 warning ("print.m: %s, '%s'", output, opts.unlink{n}); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
434 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10866
diff
changeset
|
435 endfor |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
436 end_unwind_protect |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
437 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
438 if (isfigure (orig_figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
439 figure (orig_figure); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
440 endif |
5363 | 441 |
5361 | 442 endfunction |
11009 | 443 |
444 function cmd = epstool (opts, filein, fileout) | |
445 ## As epstool does not work with pipes, a subshell is used to | |
446 ## permit piping. Since this solution does not work with the DOS | |
447 ## command shell, the -tight and -preview options are disabled if | |
448 ## output must be piped. | |
449 | |
450 ## DOS Shell: | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
451 ## gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein> |
11009 | 452 ## Unix Shell; |
453 ## cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein> | |
454 | |
455 dos_shell = (ispc () && ! isunix ()); | |
456 | |
457 cleanup = ""; | |
458 if (nargin < 3) | |
459 fileout = opts.name; | |
460 elseif (isempty (fileout)) | |
461 fileout = "-"; | |
462 endif | |
463 | |
464 if (nargin < 2 || strcmp (filein, "-") || isempty (filein)) | |
465 pipein = true; | |
466 filein = strcat (tmpnam (), ".eps"); | |
467 if (dos_shell) | |
11252
d048ce3f7cef
Replace "delete" with "del" in DOS shell commands.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
11120
diff
changeset
|
468 cleanup = sprintf ("& del %s ", strrep (filein, '/', '\')); |
11009 | 469 else |
470 cleanup = sprintf ("; rm %s ", filein); | |
471 endif | |
472 else | |
473 pipein = false; | |
474 filein = strcat ("'", strtrim (filein), "'"); | |
475 endif | |
476 if (strcmp (fileout, "-")) | |
477 pipeout = true; | |
478 fileout = strcat (tmpnam (), ".eps"); | |
479 if (dos_shell) | |
11252
d048ce3f7cef
Replace "delete" with "del" in DOS shell commands.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
11120
diff
changeset
|
480 cleanup = horzcat (cleanup, sprintf ("& del %s ", strrep (fileout, '/', '\'))); |
11009 | 481 else |
482 cleanup = horzcat (cleanup, sprintf ("; rm %s ", fileout)); | |
483 endif | |
484 else | |
485 pipeout = false; | |
486 fileout = strcat ("'", strtrim (fileout), "'"); | |
487 endif | |
488 | |
489 if (! isempty (opts.preview) && opts.tight_flag) | |
490 warning ("print:previewandtight", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
491 "print.m: eps preview may not be combined with -tight"); |
11009 | 492 endif |
493 if (! isempty (opts.preview) || opts.tight_flag) | |
494 if (! isempty (opts.epstool_binary)) | |
495 if (opts.tight_flag) | |
496 cmd = "--copy --bbox"; | |
497 elseif (! isempty (opts.preview)) | |
498 switch opts.preview | |
499 case "tiff" | |
500 cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview); | |
501 case {"tiff6u", "tiff6p", "metafile"} | |
502 cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview); | |
503 case {"tiff4", "interchange"} | |
504 cmd = sprintf ("--add-%s-preview", opts.preview); | |
505 case "pict" | |
506 cmd = sprintf ("--add-%s-preview --mac-single", opts.preview); | |
507 otherwise | |
508 error ("print:invalidpreview", | |
509 "print.m: epstool cannot include preview for format '%s'", | |
510 opts.preview); | |
511 endswitch | |
512 if (! isempty (opts.ghostscript.resolution)) | |
513 cmd = sprintf ("%s --dpi %d", cmd, opts.ghostscript.resolution); | |
514 endif | |
515 else | |
516 cmd = ""; | |
517 endif | |
518 if (! isempty (cmd)) | |
519 cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary, | |
520 cmd, filein, fileout); | |
521 endif | |
522 if (pipein) | |
523 if (dos_shell) | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
524 filein(filein=="'") = "\""; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
525 gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary, |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
526 "device", "epswrite", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
527 "source", "-", |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
528 "output", filein); |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
529 cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd); |
11009 | 530 else |
531 cmd = sprintf ("cat > %s ; %s", filein, cmd); | |
532 endif | |
533 endif | |
534 if (pipeout) | |
535 if (dos_shell) | |
536 cmd = sprintf ("%s & type %s", cmd, fileout); | |
537 else | |
538 cmd = sprintf ("%s ; cat %s", cmd, fileout); | |
539 endif | |
540 endif | |
541 if (! isempty (cleanup)) | |
542 if (pipeout && dos_shell) | |
543 error ("print:epstoolpipe", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
544 "print.m: cannot pipe output of 'epstool' for DOS shell"); |
11009 | 545 elseif (pipeout) |
546 cmd = sprintf ("( %s %s )", cmd, cleanup); | |
547 else | |
548 cmd = sprintf ("%s %s", cmd, cleanup); | |
549 endif | |
550 endif | |
551 elseif (isempty (opts.epstool_binary)) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
552 error ("print:noepstool", "print.m: 'epstool' not found in PATH"); |
11009 | 553 endif |
554 else | |
555 if (pipein && pipeout) | |
556 if (dos_shell) | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
557 cmd = __ghostscript__ ("binary", opts.ghostscript.binary, |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
558 "device", "epswrite", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
559 "source", "-", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
560 "output", "-"); |
11009 | 561 else |
562 cmd = " cat "; | |
563 endif | |
564 elseif (pipein && ! pipeout) | |
565 if (dos_shell) | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
566 ## ghostscript expects double, not single, quotes |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
567 fileout(fileout=="'") = "\""; |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
568 cmd = __ghostscript__ ("binary", opts.ghostscript.binary, |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
569 "device", "epswrite", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
570 "source", "-", |
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
571 "output", fileout); |
11009 | 572 else |
573 cmd = sprintf (" cat > %s ", fileout); | |
574 endif | |
575 elseif (! pipein && pipeout) | |
576 if (dos_shell) | |
577 cmd = sprintf (" type %s ", filein); | |
578 else | |
579 cmd = sprintf (" cat %s ", filein); | |
580 endif | |
581 else | |
582 if (dos_shell) | |
583 cmd = sprintf (" copy %s %s ", filein, fileout); | |
584 else | |
585 cmd = sprintf (" cp %s %s ", filein, fileout); | |
586 endif | |
587 endif | |
588 endif | |
589 if (opts.debug) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
590 fprintf ("epstool command: '%s'\n", cmd); |
11009 | 591 endif |
592 endfunction | |
593 | |
594 function cmd = fig2dev (opts, devopt) | |
595 if (nargin < 2) | |
596 devopt = opts.devopt; | |
597 endif | |
598 dos_shell = (ispc () && ! isunix ()); | |
599 if (! isempty (opts.fig2dev_binary)) | |
600 if (dos_shell) | |
601 ## FIXME - is this the right thing to do for DOS? | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
602 cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt); |
11009 | 603 else |
604 cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt); | |
605 endif | |
606 elseif (isempty (opts.fig2dev_binary)) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
607 error ("print:nofig2dev", "print.m: 'fig2dev' not found in PATH"); |
11009 | 608 endif |
609 if (opts.debug) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
610 fprintf ("fig2dev command: '%s'\n", cmd); |
11009 | 611 endif |
612 endfunction | |
613 | |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
614 function latex_standalone (opts) |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
615 n = find (opts.name == ".", 1, "last"); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
616 if (! isempty (n)) |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
617 opts.name = opts.name(1:n-1); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
618 endif |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
619 latexfile = strcat (opts.name, ".tex"); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
620 switch opts.devopt |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
621 case {"pdflatexstandalone"} |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
622 packages = "\\usepackage{graphicx,color}"; |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
623 graphicsfile = strcat (opts.name, "-inc.pdf"); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
624 case {"pslatexstandalone"} |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
625 packages = "\\usepackage{epsfig,color}"; |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
626 graphicsfile = strcat (opts.name, "-inc.ps"); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
627 otherwise |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
628 packages = "\\usepackage{epsfig,color}"; |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
629 graphicsfile = strcat (opts.name, "-inc.eps"); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
630 endswitch |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
631 papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}", |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
632 opts.canvas_size, opts.canvas_size); |
11009 | 633 prepend = {"\\documentclass{minimal}"; |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
634 packages; |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
635 papersize; |
11009 | 636 "\\begin{document}"; |
637 "\\centering"}; | |
638 postpend = {"\\end{document}"}; | |
639 fid = fopen (latexfile, "r"); | |
640 if (fid >= 0) | |
641 latex = fscanf (fid, "%c", Inf); | |
642 status = fclose (fid); | |
643 if (status != 0) | |
644 error ("print:errorclosingfile", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
645 "print.m: error closing file '%s'", latexfile); |
11009 | 646 endif |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
647 ## TODO - should this be fixed in GL2PS? |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12199
diff
changeset
|
648 latex = strrep (latex, "\\includegraphics{}", |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
649 sprintf ("\\includegraphics{%s}", graphicsfile)); |
11009 | 650 else |
651 error ("print:erroropeningfile", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
652 "print.m: error opening file '%s'", latexfile); |
11009 | 653 endif |
654 fid = fopen (latexfile, "w"); | |
655 if (fid >= 0) | |
656 fprintf (fid, "%s\n", prepend{:}); | |
657 fprintf (fid, "%s", latex); | |
658 fprintf (fid, "%s\n", postpend{:}); | |
659 status = fclose (fid); | |
660 if (status != 0) | |
661 error ("print:errorclosingfile", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
662 "print.m: error closing file '%s'", latexfile); |
11009 | 663 endif |
664 else | |
665 error ("print:erroropeningfile", | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
666 "print.m: error opening file '%s'", latexfile); |
11009 | 667 endif |
668 endfunction | |
669 | |
670 function cmd = lpr (opts) | |
671 if (nargin < 2) | |
672 devopt = opts.devopt; | |
673 endif | |
674 if (! isempty (opts.lpr_binary)) | |
675 cmd = opts.lpr_binary; | |
676 if (! isempty (opts.lpr_options)) | |
677 cmd = sprintf ("%s %s", cmd, opts.lpr_options); | |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11107
diff
changeset
|
678 endif |
11009 | 679 if (! isempty (opts.printer)) |
680 cmd = sprintf ("%s -P %s", cmd, opts.printer); | |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11107
diff
changeset
|
681 endif |
11009 | 682 elseif (isempty (opts.lpr_binary)) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
683 error ("print:nolpr", "print.m: 'lpr' not found in PATH"); |
11009 | 684 endif |
685 if (opts.debug) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
686 fprintf ("lpr command: '%s'\n", cmd); |
11009 | 687 endif |
688 endfunction | |
689 | |
690 function cmd = pstoedit (opts, devopt) | |
691 if (nargin < 2) | |
692 devopt = opts.devopt; | |
693 endif | |
694 dos_shell = (ispc () && ! isunix ()); | |
695 if (! isempty (opts.pstoedit_binary)) | |
696 if (dos_shell) | |
11551
84fa2ba414ee
print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents:
11523
diff
changeset
|
697 cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt); |
11009 | 698 else |
699 ## FIXME - is this the right thing to do for DOS? | |
700 cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt); | |
701 endif | |
702 elseif (isempty (opts.pstoedit_binary)) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
703 error ("print:nopstoedit", "print.m: 'pstoedit' not found in PATH"); |
11009 | 704 endif |
705 if (opts.debug) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
706 fprintf ("pstoedit command: '%s'\n", cmd); |
11009 | 707 endif |
708 endfunction | |
709 | |
710 |