Mercurial > hg > octave-lyh
annotate scripts/plot/print.m @ 10866:045558999570
print.m: Include 'colormap' when converting RGB to mono.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 08 Aug 2010 14:49:49 -0400 |
parents | 3a5f5c99cc39 |
children | dd6b90f44ae5 |
rev | line source |
---|---|
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10711
diff
changeset
|
1 ## Copyright (C) 2008, 2009 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} |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
38 ## Specify the handle, @var{h}, of the figure to be printed. The |
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 | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
59 ## Specify the orientation of the plot for printed output. For |
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 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
62 ## orientation specified. This options is equivalent to changing |
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 | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
72 ## Postscript (level 1 and 2, mono and color). The FLTK backend |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
73 ## 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 | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
79 ## Encapsulated postscript (level 1 and 2, mono and color). The FLTK backend |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
80 ## 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 |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
92 ## is the same as the @code{epslatex} device. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
93 ## |
9468
5af462716bff
Add support for gnuplot's Lua-TikZ terminal.
Ben Abbott <bpabbott@mac.com>
parents:
9393
diff
changeset
|
94 ## @item tikz |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
95 ## Generate a @LaTeX{} file using PGF/TikZ. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
96 ## |
5361 | 97 ## @item ill |
98 ## @itemx aifm | |
99 ## Adobe Illustrator | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
100 ## |
5361 | 101 ## @item cdr |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
102 ## @itemx @nospell{corel} |
5361 | 103 ## CorelDraw |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
104 ## |
6965 | 105 ## @item dxf |
106 ## AutoCAD | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
107 ## |
6965 | 108 ## @item emf |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
109 ## @itemx meta |
6965 | 110 ## Microsoft Enhanced Metafile |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
111 ## |
6965 | 112 ## @item fig |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
113 ## XFig. For the Gnuplot backend, the additional options |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
114 ## @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
|
115 ## whether the special flag should be set for the text in |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
116 ## the figure (default is @option{-textnormal}). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
117 ## |
5361 | 118 ## @item hpgl |
119 ## HP plotter language | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
120 ## |
5361 | 121 ## @item mf |
122 ## Metafont | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
123 ## |
5361 | 124 ## @item png |
125 ## Portable network graphics | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
126 ## |
7543
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
127 ## @item jpg |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
128 ## @itemx jpeg |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
129 ## JPEG image |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
130 ## |
7543
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
131 ## @item gif |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
132 ## GIF image (only available for the Gnuplot backend) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
133 ## |
5361 | 134 ## @item pbm |
135 ## PBMplus | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
136 ## |
6965 | 137 ## @item svg |
138 ## Scalable vector graphics | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
139 ## |
7396 | 140 ## @item pdf |
141 ## Portable document format | |
5361 | 142 ## @end table |
143 ## | |
144 ## 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
|
145 ## or if there is no filename it is sent to the printer as postscript. |
5361 | 146 ## |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
147 ## @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
|
148 ## 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
|
149 ## Some examples are; |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
150 ## |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
151 ## @table @code |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
152 ## @item ljet2p |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
153 ## HP LaserJet IIP |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
154 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
155 ## @item ljet3 |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
156 ## HP LaserJet III |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
157 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
158 ## @item deskjet |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
159 ## HP DeskJet and DeskJet Plus |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
160 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
161 ## @item cdj550 |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
162 ## HP DeskJet 550C |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
163 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
164 ## @item paintjet |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
165 ## HP PointJet |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
166 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
167 ## @item pcx24b |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
168 ## 24-bit color PCX file format |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
169 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
170 ## @item ppm |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
171 ## Portable Pixel Map file format |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
172 ## |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
173 ## @item pdfwrite |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
174 ## 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
|
175 ## @end table |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
176 ## |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
177 ## 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
|
178 ## and devices are available. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
179 ## |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
180 ## When Ghostscript output is sent to a printer the size is determined |
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
181 ## 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
|
182 ## 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
|
183 ## 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
|
184 ## |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
185 ## @itemx -append |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
186 ## Appends the PS, PDF, or EPS output to a pre-existing file of the |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
187 ## same type. |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
188 ## |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
189 ## @itemx -r@var{NUM} |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9157
diff
changeset
|
190 ## 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
|
191 ## 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
|
192 ## 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
|
193 ## |
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
|
194 ## @item -tight |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
195 ## Forces a tight bounding box for eps-files. Since Ghostscript |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
196 ## is used to produce other devices, this option works for those |
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
|
197 ## devices as well. |
fce7315c1eee
print.m: Fix typo, improvments to code, and allow for creation of tight bbox.
Ben Abbott <bpabbott@mac.com>
parents:
9152
diff
changeset
|
198 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
199 ## @item -S@var{xsize},@var{ysize} |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
200 ## Plot size in pixels for EMF, GIF, JPEG, PBM, PNG and SVG. For |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
201 ## 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
|
202 ## This option is equivalent to changing the size of the plot box |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
203 ## associated with "paperposition" property. Using the command form of |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
204 ## 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
|
205 ## option. For example, by writing @w{@code{"-S640,480"}}. |
6965 | 206 ## |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
207 ## @item -F@var{fontname} |
5361 | 208 ## @itemx -F@var{fontname}:@var{size} |
209 ## @itemx -F:@var{size} | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
210 ## 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
|
211 ## @var{fontname} is ignored for some devices; dxf, fig, hpgl, etc. |
5361 | 212 ## @end table |
213 ## | |
214 ## The filename and options can be given in any order. | |
215 ## @end deftypefn | |
216 | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
217 function print (varargin) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
218 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
219 opts = __print_parse_opts__ (varargin{:}); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
220 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
221 if (! isfigure (opts.figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
222 error ("print: no figure to print.") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
223 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
224 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
225 orig_figure = get (0, "currentfigure"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
226 figure (opts.figure) |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10711
diff
changeset
|
227 drawnow (); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
228 backend = (get (opts.figure, "__backend__")); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
229 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
230 if (strcmp (backend, "gnuplot")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
231 ## FIXME - this can be removed when __gnuplot_print__ has been modified |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
232 ## to work consistently with __fltk_print__ |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
233 opts.ghostscript_binary = opts.ghostscript.binary; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
234 opts.resolution = opts.ghostscript.resolution; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
235 opts.canvas_size = opts.canvas_size * opts.resolution / 72; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
236 opts.resolution = sprintf ("%d", opts.resolution); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
237 opts.fontsize = sprintf ("%d", opts.fontsize); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
238 if (strcmp (opts.devopt, "tiff")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
239 error ("print:notiffoutput", |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
240 "print.m: TIFF output is not available for the Gnuplot backend.") |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
241 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
242 __gnuplot_print__ (opts); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
243 return |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
244 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
245 if (strcmp (opts.devopt, "gif")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
246 error ("print:notiffoutput", |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
247 "print.m: GIF output is not available for the FLTK backend.") |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
248 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
249 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
250 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
251 if (opts.append_to_file && ! (strncmp (opts.devopt, "pdf", 3) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
252 || strncmp (opts.devopt(1:2), "ps", 2))) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
253 warning ("print:cannotappendfile", |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
254 "print.m: Cannot append files of type '%s'.", opts.devopt) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
255 opts.append_to_file = false; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
256 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
257 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
258 if (opts.append_to_file) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
259 saved_original_file = strcat (tmpnam (), ".", opts.devopt); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
260 opts.unlink(end+1) = {saved_original_file}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
261 movefile (opts.name, saved_original_file); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
262 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
263 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
264 ## Modify properties as specified by options |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
265 ## FIXME - need an unwind_protect block |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
266 props = []; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
267 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
268 unwind_protect |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
269 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
270 ## backend tranlates figure position to eps bbox in points |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
271 fpos = get (opts.figure, "position"); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
272 props(1).h = opts.figure; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
273 props(1).name = "position"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
274 props(1).value = {fpos}; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
275 fpos(3:4) = opts.canvas_size; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
276 set (opts.figure, "position", fpos) |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
277 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
278 if (opts.force_solid != 0) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
279 h = findobj (opts.figure, "-property", "linestyle"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
280 m = numel (props); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
281 for n = 1:numel(h) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
282 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
|
283 props(m+n).name = "linestyle"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
284 props(m+n).value = {get(h(n), "linestyle")}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
285 endfor |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
286 if (opts.force_solid > 0) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
287 linestyle = "-"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
288 else |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
289 linestyle = "--"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
290 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
291 set (h, "linestyle", linestyle) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
292 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
293 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
294 if (opts.use_color < 0) |
10866
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
295 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
|
296 for c = 1:numel(color_props) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
297 h = findobj (opts.figure, "-property", color_props{c}); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
298 hnone = findobj (opts.figure, color_props{c}, "none"); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
299 h = setdiff (h, hnone); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
300 m = numel (props); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
301 for n = 1:numel(h) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
302 rgb = get (h(n), color_props{c}); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
303 props(m+n).h = h(n); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
304 props(m+n).name = color_props{c}; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
305 props(m+n).value = {get(h(n), color_props{c})}; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
306 xfer = repmat ([0.30, 0.59, 0.11], size (rgb, 1), 1); |
10866
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
307 if (isnumeric (rgb)) |
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
308 ## convert RGB color to RGB gray scale |
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
309 ggg = repmat (sum (xfer .* rgb, 2), 1, 3); |
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
310 set (h(n), color_props{c}, ggg) |
045558999570
print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents:
10860
diff
changeset
|
311 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
312 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
313 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
314 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
315 |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
316 if (! isempty (opts.font) || ! isempty (opts.fontsize)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
317 h = findobj (opts.figure, "-property", "fontname"); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
318 m = numel (props); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
319 for n = 1:numel(h) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
320 if (! isempty (opts.font)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
321 props(end+1).h = h(n); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
322 props(end).name = "fontname"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
323 props(end).value = {get(h(n), "fontname")}; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
324 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
325 if (! isempty (opts.fontsize)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
326 props(end+1).h = h(n); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
327 props(end).name = "fontsize"; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
328 props(end).value = {get(h(n), "fontsize")}; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
329 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
330 endfor |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
331 if (! isempty (opts.font)) |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
332 set (h, "fontname", opts.font) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
333 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
334 if (! isempty (opts.fontsize)) |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
335 if (ischar (opts.fontsize)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
336 fontsize = str2double (opts.fontsize); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
337 else |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
338 fontsize = opts.fontsize; |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
339 endif |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
340 set (h, "fontsize", fontsize) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
341 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
342 endif |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
343 |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
344 ## call the backend print script |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
345 drawnow ("expose") |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
346 feval (strcat ("__", backend, "_print__"), opts); |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
347 |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
348 unwind_protect_cleanup |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
349 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
350 ## restore modified properties |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
351 if (isstruct (props)) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
352 for n = 1:numel(props) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
353 set (props(n).h, props(n).name, props(n).value{1}) |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
354 endfor |
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
355 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
356 |
10860
3a5f5c99cc39
print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
357 end_unwind_protect |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
358 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
359 ## Send to the printer |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
360 if (opts.send_to_printer) |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
361 if (isempty (opts.ghostscript.output)) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
362 prn_datafile = opts.name; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
363 else |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
364 prn_datafile = opts.ghostscript.output; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
365 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
366 if (isempty (opts.printer)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
367 prn_cmd = sprintf ("lpr %s '%s' 2>&1", opts.lpr_options, prn_datafile); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
368 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
369 prn_cmd = sprintf ("lpr %s -P %s '%s' 2>&1", opts.lpr_options, |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
370 opts.printer, prn_datafile); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
371 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
372 if (opts.debug) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
373 fprintf ("lpr command: %s\n", prn_cmd) |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
374 [status, output] = system ("lpq"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
375 disp (output) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
376 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
377 [status, output] = system (prn_cmd); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
378 if (status != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
379 disp (output) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
380 warning ("print.m: printing failed.") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
381 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
382 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
383 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
384 ## Append to file using GS |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
385 if (opts.append_to_file) |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
386 if (strncmp (opts.devopt, "pdf", 3)) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
387 suffix = "pdf"; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
388 device = suffix; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
389 elseif (strncmp (opts.devopt(1:2), "ps", 2)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
390 ## FIXME - For FLTK the fonts get mangled |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
391 ## See the seciton "How to concatenate several PS files" at the link, |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
392 ## http://en.wikibooks.org/wiki/PostScript_FAQ |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
393 suffix = "ps"; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
394 device = suffix; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
395 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
396 tmp_combined_file = strcat (tmpnam (), ".", suffix); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
397 opts.unlink{end+1} = tmp_combined_file; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
398 gs_opts = "-dQUIET -dNOPAUSE -dBATCH -dSAFER -dFIXEDMEDIA"; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
399 gs_cmd = sprintf ("%s %s -sDEVICE=%swrite -sOutputFile=%s %s %s", |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
400 opts.ghostscript.binary, gs_opts, device, tmp_combined_file, |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
401 saved_original_file, opts.name); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
402 [status, output] = system (gs_cmd); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
403 if (opts.debug) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
404 fprintf ("Append files: %s\n", gs_cmd); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
405 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
406 if (status != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
407 warning ("print:failedtoappendfile", |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
408 "print.m: failed to append output to file '%s'.", opts.name) |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
409 copyfile (saved_original_file, opts.name); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
410 else |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
411 copyfile (tmp_combined_file, opts.name); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
412 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
413 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
414 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
415 ## Unlink temporary files |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
416 for n = 1:numel(opts.unlink) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
417 [status, output] = unlink (opts.unlink{n}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
418 if (status != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
419 disp (output) |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10841
diff
changeset
|
420 warning ("print.m: failed to delete temporay file, '%s'.", opts.unlink{n}) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
421 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
422 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
423 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
424 if (isfigure (orig_figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
425 figure (orig_figure); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
426 endif |
5363 | 427 |
5361 | 428 endfunction |