annotate scripts/plot/print.m @ 14456:05635e4c605a

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