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