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