Mercurial > hg > octave-lyh
annotate scripts/plot/print.m @ 10841:1577accf2ed8
print.m: Update documentation string. Change to active voice.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 01 Aug 2010 07:20:28 -0700 |
parents | 05ba991794d4 |
children | d5a7db05d591 |
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}) |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
24 ## Print a plot, or save it to a file. |
5361 | 25 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
26 ## @var{filename} specifies the name of the output file. If the |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
27 ## file name has no suffix, then 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 |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
29 ## filename is specified the output is sent to the printer. |
5361 | 30 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
31 ## @var{h} specifies the figure handle to print. 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} |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
38 ## Specify the handle, @var{h}, of the figure to be printed. The |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
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} |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
42 ## Set the @var{printer} name to which the plot is sent when no |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
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} |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
46 ## Specify the command for invoking Ghostscript. The defaults for Unix and |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
47 ## Windows 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 | |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
51 ## Print monochrome or color lines. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
52 ## |
5361 | 53 ## @item -solid |
54 ## @itemx -dashed | |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
55 ## Print solid or dashed lines. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
56 ## |
5361 | 57 ## @item -portrait |
58 ## @itemx -landscape | |
9393
d6c99b2ee941
print.m: reimplement options -landscape and -portrait.
Ben Abbott <bpabbott@mac.com>
parents:
9337
diff
changeset
|
59 ## Specify the orientation of the plot for printed output. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
60 ## |
5361 | 61 ## @item -d@var{device} |
62 ## Output device, where @var{device} is one of: | |
63 ## @table @code | |
64 ## @item ps | |
65 ## @itemx ps2 | |
66 ## @itemx psc | |
67 ## @itemx psc2 | |
68 ## Postscript (level 1 and 2, mono and color) | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
69 ## |
5361 | 70 ## @item eps |
71 ## @itemx eps2 | |
72 ## @itemx epsc | |
73 ## @itemx epsc2 | |
74 ## Encapsulated postscript (level 1 and 2, mono and color) | |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
75 ## |
6739 | 76 ## @item tex |
77 ## @itemx epslatex | |
78 ## @itemx epslatexstandalone | |
79 ## @itemx pstex | |
80 ## @itemx pslatex | |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9157
diff
changeset
|
81 ## Generate a @LaTeX{} (or @TeX{}) file for labels, and eps/ps for |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
82 ## 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
|
83 ## 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
|
84 ## 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
|
85 ## is the same as the @code{epslatex} device. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
86 ## |
9468
5af462716bff
Add support for gnuplot's Lua-TikZ terminal.
Ben Abbott <bpabbott@mac.com>
parents:
9393
diff
changeset
|
87 ## @item tikz |
9758
09da0bd91412
Periodic grammar check of Octave documentation files to ensure common format
Rik <rdrider0-list@yahoo.com>
parents:
9468
diff
changeset
|
88 ## Generate a @LaTeX{} file using gnuplot's Lua/TikZ terminal. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
89 ## |
5361 | 90 ## @item ill |
91 ## @itemx aifm | |
92 ## Adobe Illustrator | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
93 ## |
5361 | 94 ## @item cdr |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
95 ## @itemx @nospell{corel} |
5361 | 96 ## CorelDraw |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
97 ## |
6965 | 98 ## @item dxf |
99 ## AutoCAD | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
100 ## |
6965 | 101 ## @item emf |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
102 ## @itemx meta |
6965 | 103 ## Microsoft Enhanced Metafile |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
104 ## |
6965 | 105 ## @item fig |
7037 | 106 ## XFig. If this format is selected the additional options |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
107 ## @option{-textspecial} or @option{-textnormal} can be used to control |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
108 ## whether the special flag should be set for the text in |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
109 ## the figure (default is @option{-textnormal}). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
110 ## |
5361 | 111 ## @item hpgl |
112 ## HP plotter language | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
113 ## |
5361 | 114 ## @item mf |
115 ## Metafont | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
116 ## |
5361 | 117 ## @item png |
118 ## Portable network graphics | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
119 ## |
7543
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
120 ## @item jpg |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
121 ## @itemx jpeg |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
122 ## JPEG image |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
123 ## |
7543
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
124 ## @item gif |
b84c5cbc0812
print.m: handle gif and jpg devices
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
125 ## GIF image |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
126 ## |
5361 | 127 ## @item pbm |
128 ## PBMplus | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
129 ## |
6965 | 130 ## @item svg |
131 ## Scalable vector graphics | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
132 ## |
7396 | 133 ## @item pdf |
134 ## Portable document format | |
5361 | 135 ## @end table |
136 ## | |
137 ## 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
|
138 ## or if there is no filename it is sent to the printer as postscript. |
5361 | 139 ## |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
140 ## @item -d@var{ghostscript_device} |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
141 ## Specify an output device supported by Ghostscript. |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
142 ## Some examples are: |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
143 ## |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
144 ## @table @code |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
145 ## @item ljet2p |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
146 ## HP LaserJet IIP |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
147 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
148 ## @item ljet3 |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
149 ## HP LaserJet III |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
150 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
151 ## @item deskjet |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
152 ## HP DeskJet and DeskJet Plus |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
153 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
154 ## @item cdj550 |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
155 ## HP DeskJet 550C |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
156 ## |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
157 ## @item paintjet |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
158 ## HP PointJet |
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 pcx24b |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
161 ## 24-bit color PCX file format |
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 ppm |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
164 ## Portable Pixel Map file format |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
165 ## |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
166 ## @item pdfwrite |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
167 ## Converts ps or eps to pdf |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
168 ## @end table |
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
169 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
170 ## For a complete list of available formats and devices type |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
171 ## @samp{system ("gs -h")}. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
172 ## |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
173 ## 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
|
174 ## by the figure's "papersize" property. When the output |
9393
d6c99b2ee941
print.m: reimplement options -landscape and -portrait.
Ben Abbott <bpabbott@mac.com>
parents:
9337
diff
changeset
|
175 ## is sent to a file the size is determined by the figure's |
d6c99b2ee941
print.m: reimplement options -landscape and -portrait.
Ben Abbott <bpabbott@mac.com>
parents:
9337
diff
changeset
|
176 ## "paperposition" property. |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
177 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
178 ## @item -append |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
179 ## Append the output to a pre-existing file. Only PDF |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
180 ## and Postscript files are currently supported. |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
181 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
182 ## @item -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
|
183 ## Resolution of bitmaps in pixels per inch. For both metafiles and |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
184 ## SVG the default is the screen resolution, for others it is 150 dpi. |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
185 ## 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
|
186 ## |
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
|
187 ## @item -tight |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
188 ## Force a tight bounding box for eps-files. Because the Ghostscript |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
189 ## devices are conversions of an eps-file, 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
|
190 ## 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
|
191 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
192 ## @item -S@var{xsize},@var{ysize} |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
193 ## Specify plot size in pixels for EMF, GIF, JPEG, PBM, PNG and SVG@. If |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
194 ## using the command form of the print function, the @var{xsize},@var{ysize} |
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
195 ## option must be quoted. For example, by writing |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9157
diff
changeset
|
196 ## @w{@code{"-S640,480"}}. The size defaults to that specified by the |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
197 ## figure's paperposition property. |
6965 | 198 ## |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
199 ## @item -F@var{fontname} |
5361 | 200 ## @itemx -F@var{fontname}:@var{size} |
201 ## @itemx -F:@var{size} | |
10841
1577accf2ed8
print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents:
10834
diff
changeset
|
202 ## Set the postscript font to @var{fontname} (for use with postscript, |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10727
diff
changeset
|
203 ## aifm, @nospell{corel} and fig). By default, 'Helvetica' is set for PS/aifm, |
9107
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
204 ## and 'SwitzerlandLight' for Corel. It can also be 'Times-Roman'. |
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
205 ## @var{size} is given in points. @var{fontname} is ignored for the |
d0d507cbd123
Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents:
9056
diff
changeset
|
206 ## fig device. |
5361 | 207 ## @end table |
208 ## | |
209 ## The filename and options can be given in any order. | |
210 ## @end deftypefn | |
211 | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
212 function print (varargin) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
213 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
214 opts = __print_parse_opts__ (varargin{:}); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
215 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
216 if (! isfigure (opts.figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
217 error ("print: no figure to print.") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
218 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
219 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
220 orig_figure = get (0, "currentfigure"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
221 figure (opts.figure) |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10711
diff
changeset
|
222 drawnow (); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
223 backend = (get (opts.figure, "__backend__")); |
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 if (strcmp (backend, "gnuplot")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
226 ## 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
|
227 ## to work consistently with __fltk_print__ |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
228 __gnuplot_print__ (varargin{:}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
229 return |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
230 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
231 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
232 ## FIXME - this can be moved to __print_parse_opts__ when __gnuplot_print__ |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
233 ## has been modified to work consistently with __fltk_print__ |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
234 if (! isempty (opts.canvas_size) && ischar (opts.resolution)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
235 opts.canvas_size = str2num (strrep (strrep (opts.canvas_size, "X", ""), "Y", "")); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
236 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
237 if (! isempty (opts.resolution) && ischar (opts.resolution)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
238 opts.resolution = str2num (opts.resolution); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
239 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
240 if (! isempty (opts.fontsize) && ischar (opts.fontsize)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
241 opts.fontsize = str2num (opts.fontsize); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
242 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
243 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
244 if (opts.append_to_file) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
245 saved_original_file = strcat (tmpnam (), ".", opts.devopt); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
246 opts.unlink(end+1) = {save_original_file}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
247 movefile (opts.name, saved_original_file); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
248 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
249 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
250 ## Modify properties as specified by options |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
251 ## FIXME - need an unwind_protect block |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
252 props = []; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
253 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
254 if ((! isempty (opts.canvas_size)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
255 || (! strcmpi (get (opts.figure, "paperorientation"), opts.orientation))) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
256 m = numel (props); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
257 props(m+1).h = opts.figure; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
258 props(m+1).name = "paperposition"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
259 props(m+1).value = {get(opts.figure, "paperposition")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
260 props(m+2).h = opts.figure; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
261 props(m+2).name = "paperunits"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
262 props(m+2).value = {get(opts.figure, "paperunits")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
263 props(m+3).h = opts.figure; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
264 props(m+3).name = "papersize"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
265 props(m+3).value = {get(opts.figure, "papersize")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
266 props(m+4).h = opts.figure; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
267 props(m+4).name = "paperorientation"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
268 props(m+4).value = {get(opts.figure, "paperorientation")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
269 props(m+5).h = opts.figure; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
270 props(m+5).name = "papertype"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
271 props(m+5).value = {get(opts.figure, "papertype")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
272 if (! isempty (opts.canvas_size)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
273 ## canvas_size is in pixels/points |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
274 set (opts.figure, "paperorientation", "portrait"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
275 set (opts.figure, "paperposition", [0, 0, opts.canvas_size]); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
276 set (opts.figure, "paperunits", "points"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
277 set (opts.figure, "papersize", opts.canvas_size); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
278 fpos = get (opts.figure, "position"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
279 props(m+6).h = opts.figure; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
280 props(m+6).name = "position"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
281 props(m+6).value = {fpos}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
282 fpos(3:4) = opts.canvas_size; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
283 set (opts.figure, "position", fpos); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
284 elseif (opts.paperoutput) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
285 ## FIXME - should the backend handle this? |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
286 orient (opts.orientation) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
287 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
288 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
289 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
290 if (opts.force_solid != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
291 h = findobj (opts.figure, "-property", "linestyle"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
292 m = numel (props); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
293 for n = 1:numel(h) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
294 props(m+n).h = h(n); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
295 props(m+n).name = "linestyle"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
296 props(m+n).value = {get(h(n), "linestyle")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
297 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
298 if (opts.force_solid > 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
299 linestyle = "-"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
300 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
301 linestyle = "--"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
302 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
303 set (h, "linestyle", linestyle) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
304 endif |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
305 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
306 if (opts.use_color < 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
307 color_props = {"color", "facecolor", "edgecolor"}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
308 for c = 1:numel(color_props) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
309 h = findobj (opts.figure, "-property", color_props{c}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
310 hnone = findobj (opts.figure, color_props{c}, "none"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
311 h = setdiff (h, hnone); |
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 rgb = get (h(n), color_props{c}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
315 props(m+n).h = h(n); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
316 props(m+n).name = color_props{c}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
317 props(m+n).value = {get(h(n), color_props{c})}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
318 xfer = repmat ([0.30, 0.59, 0.11], size (rgb, 1), 1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
319 ## convert RGB color to RGB gray scale |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
320 ggg = repmat (sum (xfer .* rgb, 2), 1, 3); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
321 set (h(n), color_props{c}, ggg) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
322 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
323 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
324 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
325 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
326 if (! isempty (opts.font) || ! isempty (opts.fontsize)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
327 h = findobj (opts.figure, "-property", "fontname"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
328 m = numel (props); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
329 for n = 1:numel(h) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
330 if (! isempty (opts.font)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
331 props(end+1).h = h(n); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
332 props(end).name = "fontname"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
333 props(end).value = {get(h(n), "fontname")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
334 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
335 if (! isempty (opts.fontsize)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
336 props(end+1).h = h(n); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
337 props(end).name = "fontsize"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
338 props(end).value = {get(h(n), "fontsize")}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
339 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
340 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
341 if (! isempty (opts.font)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
342 set (h, "fontname", opts.font) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
343 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
344 if (! isempty (opts.fontsize)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
345 if (ischar (opts.fontsize)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
346 fontsize = str2double (opts.fontsize); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
347 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
348 fontsize = opts.fontsize; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
349 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
350 set (h, "fontsize", fontsize) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
351 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
352 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
353 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
354 ## call the backend print script |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
355 drawnow ("expose") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
356 feval (strcat ("__", backend, "_print__"), opts); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
357 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
358 ## restore modified properties |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
359 if (isstruct (props)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
360 for n = 1:numel(props) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
361 set (props(n).h, props(n).name, props(n).value{1}) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
362 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
363 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
364 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
365 ## Send to the printer |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
366 if (opts.send_to_printer) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
367 if (isempty (opts.ghostscript_output)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
368 prn_datafile = opts.name; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
369 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
370 prn_datafile = opts.ghostscript_output; |
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 (isempty (opts.printer)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
373 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
|
374 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
375 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
|
376 opts.printer, prn_datafile); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
377 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
378 if (opts.debug) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
379 fprintf ("lpr command: %s\n", prn_cmd) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
380 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
381 [status, output] = system (prn_cmd); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
382 if (status != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
383 disp (output) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
384 warning ("print.m: printing failed.") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
385 endif |
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 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
388 ## Append to file using GS |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
389 if (opts.append_to_file) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
390 if (strcmp (opts.devopt, "pdf")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
391 suffix = "pdf"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
392 elseif (strcmp (opts.devopt(1:2), "ps")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
393 suffix = "ps"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
394 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
395 tmp_combined_file = strcat (tmpnam (), ".", suffix); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
396 opts.unlink{end+1} = tmp_combined_file; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
397 gs_opts = "-q -dNOPAUSE -dBATCH"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
398 gs_cmd = sprintf ("%s %s -sDEVICE=%swrite -sOutputFile=%s %s %s", |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
399 opts.ghostscript_binary, gs_opts, suffix, tmp_combined_file, |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
400 saved_original_file, opts.name); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
401 [status, output] = system (gs_cmd); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
402 if (opts.debug) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
403 fprintf ("Append files: %s\n", gs_cmd); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
404 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
405 if (status != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
406 warning ("print:failedtoappendfile", |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
407 "print.m: failed to append output to file '%s'.", opts.name) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
408 movefile (saved_original_file, opts.name); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
409 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
410 movefile (tmp_combined_file, opts.name); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
411 endif |
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 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
414 ## Unlink temporary files |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
415 for n = 1:numel(opts.unlink) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
416 [status, output] = unlink (opts.unlink{n}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
417 if (status != 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
418 disp (output) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
419 warning ("print.m: failed to delete temporay file, '%s'.", opts.name) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
420 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
421 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
422 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
423 if (isfigure (orig_figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
424 figure (orig_figure); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10821
diff
changeset
|
425 endif |
5363 | 426 |
5361 | 427 endfunction |