annotate scripts/plot/util/print.m @ 33617:ec2635a02328 bytecode-interpreter tip

maint: Merge default to bytecode-interpreter.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 21 May 2024 18:29:03 +0200
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32487
diff changeset
3 ## Copyright (C) 2008-2024 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27801
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
7 ##
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
8 ## This file is part of Octave.
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24423
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24423
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22578
diff changeset
13 ## (at your option) any later version.
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
14 ##
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
15 ## 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
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22578
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22578
diff changeset
18 ## GNU General Public License for more details.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
19 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
20 ## 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
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24423
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
25
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
27 ## @deftypefn {} {} print ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
28 ## @deftypefnx {} {} print (@var{options})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
29 ## @deftypefnx {} {} print (@var{filename}, @var{options})
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
30 ## @deftypefnx {} {} print (@var{hfig}, @dots{})
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
31 ## @deftypefnx {} {@var{RGB} =} print (@qcode{"-RGBImage"}, @dots{})
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
32 ## Format a figure for printing and either save it to a file, send it to a
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
33 ## printer, or return an RGB image.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
34 ##
20713
2469d78a1d8b Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents: 20231
diff changeset
35 ## @var{filename} defines the name of the output file. If the filename has
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
36 ## no suffix then one is inferred from the specified device and appended to the
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
37 ## filename. When neither a filename nor the @qcode{"-RGBImage"} option is
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
38 ## present, the output is sent to the printer. The various options and
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
39 ## filename arguments may be given in any order, except for the figure handle
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
40 ## argument @var{hfig} which must be first if it is present.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
41 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
42 ## Example: Print to a file using PDF and JPEG formats.
14456
05635e4c605a Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents: 14382
diff changeset
43 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
44 ## @example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
45 ## @group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
46 ## figure (1);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
47 ## clf ();
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
48 ## surf (peaks);
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
49 ## print figure1.pdf # The extension specifies the format
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
50 ## print -djpg figure1 # Will produce "figure1.jpg" file
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
51 ## @end group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
52 ## @end example
15301
3d05b55c91c7 doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents: 15214
diff changeset
53 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
54 ## If the first argument is a handle @var{hfig} to a figure object then it
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
55 ## specifies the figure to print. By default, the current figure returned
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
56 ## by @code{gcf} is printed.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
57 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
58 ## For outputs to paged formats, for example, PostScript and PDF, the page size
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
59 ## is specified by the figure's @code{papersize} property together with the
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
60 ## @code{paperunits} property. The location and size of the plot on the page
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
61 ## are specified by the figure's @code{paperposition} property. The
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
62 ## orientation of the page is specified by the figure's @code{paperorientation}
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
63 ## property.
14456
05635e4c605a Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents: 14382
diff changeset
64 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
65 ## For non-page formats---for example, image formats like JPEG---the width and
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
66 ## height of the output are specified by the figure's @code{paperposition(3:4)}
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
67 ## property values.
14456
05635e4c605a Improve documentation for print().
Ben Abbott <bpabbott@mac.com>
parents: 14382
diff changeset
68 ##
15301
3d05b55c91c7 doc: Clean up docstring for print.m.
Rik <rik@octave.org>
parents: 15214
diff changeset
69 ## The @code{print} command supports many @var{options}:
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
70 ##
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
71 ## @table @code
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
72 ## @item -f@var{h}
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
73 ## Specify the handle, @var{h}, of the figure to be printed.
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
74 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
75 ## Example: Print figure 1.
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
76 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
77 ## @example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
78 ## @group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
79 ## figure (1);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
80 ## clf ();
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
81 ## surf (peaks);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
82 ## figure (2);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
83 ## print -f1 figure1.pdf
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
84 ## ## Equivalent functional form:
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
85 ## print (1, "figure1.pdf")
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
86 ## @end group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
87 ## @end example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
88 ##
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
89 ## @item -P@var{printer}
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
90 ## Set the @var{printer} name to which the plot is sent if no @var{filename}
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
91 ## is specified.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
92 ##
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
93 ## Example: Print to printer named PS_printer using PostScript format.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
94 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
95 ## @example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
96 ## @group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
97 ## clf ();
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
98 ## surf (peaks);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
99 ## print -dpswrite -PPS_printer
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
100 ## @end group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
101 ## @end example
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
102 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
103 ## @item -RGBImage
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
104 ## Return an M-by-N-by-3 RGB image of the figure. The size of the image
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
105 ## depends on the formatting options. This is similar to taking a screen
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
106 ## capture of the plot, but formatting options may be changed such as the
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
107 ## resolution or monochrome/color.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
108 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
109 ## Example: Get the pixels of a figure image.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
110 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
111 ## @example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
112 ## @group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
113 ## clf ();
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
114 ## surf (peaks);
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
115 ## @var{rgb} = print ("-RGBImage");
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
116 ## @end group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
117 ## @end example
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
118 ##
30958
8a8f82c0235e print.m: Add options "-image"/"-vector" for Matlab compatibility.
Rik <rik@octave.org>
parents: 30875
diff changeset
119 ## @item -image | -opengl
8a8f82c0235e print.m: Add options "-image"/"-vector" for Matlab compatibility.
Rik <rik@octave.org>
parents: 30875
diff changeset
120 ## @itemx -vector | -painters
31375
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
121 ## Specifies whether the pixel-based renderer (@option{-image} or
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
122 ## @option{-opengl}) or vector-based renderer (@option{-vector} or
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
123 ## @option{-painters}) is used. This is equivalent to changing the figure's
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
124 ## @qcode{"Renderer"} property. When the figure
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
125 ## @nospell{@qcode{"RendererMode"}} property is @qcode{"auto"} (the default)
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
126 ## Octave will use the @qcode{"opengl"} renderer for raster formats (e.g.,
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
127 ## JPEG) and @qcode{"painters"} for vector formats (e.g., PDF)@. These options
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31253
diff changeset
128 ## are only supported for the "qt" graphics toolkit.
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
129 ##
31593
0f93c3a756f7 doc: grammarcheck documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31432
diff changeset
130 ## @item -svgconvert (default)
0f93c3a756f7 doc: grammarcheck documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 31432
diff changeset
131 ## @itemx -nosvgconvert
31432
df8bdaf1164b print.m: Use -svgconvert by default (bug #62979)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 31375
diff changeset
132 ## When using the @option{-painters} renderer, this enables or disables the
df8bdaf1164b print.m: Use -svgconvert by default (bug #62979)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 31375
diff changeset
133 ## SVG based backend toolchain with enhanced characteristics:
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
134 ##
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
135 ## @table @asis
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
136 ## @item Font handling:
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29359
diff changeset
137 ## For interpreters "none" and "tex", the actual font is embedded in the output
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29359
diff changeset
138 ## file which allows for printing arbitrary characters and fonts in all vector
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29359
diff changeset
139 ## formats.
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29359
diff changeset
140 ##
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29359
diff changeset
141 ## Strings using the @qcode{"latex"} interpreter, are rendered using path
30353
212461a26e9c doc: grammarcheck m-files in scripts/ directory ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29670
diff changeset
142 ## objects. This looks good but note that textual info (font,
212461a26e9c doc: grammarcheck m-files in scripts/ directory ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29670
diff changeset
143 ## characters@dots{}) are lost.
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
144 ##
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
145 ## @item Output Simplification:
29008
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
146 ## By default, the option @option{-painters} renders patch and surface objects
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
147 ## using assemblies of triangles. This may lead to anti-aliasing artifacts
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
148 ## when viewing the file. The @option{-svgconvert} option reconstructs
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
149 ## polygons in order to avoid those artifacts (particularly for 2-D figures).
27794
45ad2127582b doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents: 27622
diff changeset
150 ##
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
151 ## @item Transparency:
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
152 ## Allows for printing transparent graphics objects in PDF format.
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
153 ## For PostScript formats the presence of any transparent object will cause the
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
154 ## output to be rasterized.
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
155 ## @end table
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
156 ##
31212
55415fa6a20f svgconvert: Use Lossless encoding of images when available (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 30958
diff changeset
157 ## Caution: If Octave was built against Qt version earlier than 5.13,
55415fa6a20f svgconvert: Use Lossless encoding of images when available (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 30958
diff changeset
158 ## @option{-svgconvert} may lead to inaccurate rendering of image objects.
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
159 ##
32487
998cba4600e9 doc: grammarcheck m-files before 9.1 release.
Rik <rik@octave.org>
parents: 32286
diff changeset
160 ## @item -polymerge
31798
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
161 ## @itemx -nopolymerge
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
162 ## @itemx -polymerge-all
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
163 ## When using the SVG based backend @option{-svgconvert}, faces are rendered
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
164 ## as triangles. In some cases, some viewers might display fine lines where
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
165 ## those triangles share an edge. These options control whether all triangles
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
166 ## that share edges are merged into polygons (@option{-polymerge-all} which
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
167 ## might take some time for graphics consisting of many triangles -- including
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
168 ## line markers), only consecutive polygons are merged (@option{-polymerge}),
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
169 ## or no triangles are merged at all (@option{-no-polymerge}). By default,
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
170 ## only consecutive triangles sharing an edge are merged, unless the printed
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
171 ## figure contains patch or surface graphics objects in which case all
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
172 ## triangles that are sharing an edge are merged.
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
173 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
174 ## @item -portrait
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
175 ## @itemx -landscape
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
176 ## Specify the orientation of the plot for printed output.
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
177 ## For non-printed output the aspect ratio of the output corresponds to the
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
178 ## plot area defined by the @qcode{"paperposition"} property in the
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
179 ## orientation specified. This option is equivalent to changing the figure's
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
180 ## @qcode{"paperorientation"} property.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
181 ##
26103
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
182 ## @item -fillpage
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
183 ## @itemx -bestfit
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
184 ## When using a page-based format (PDF, PostScript, printer) ignore the
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
185 ## @qcode{"paperposition"} property and have the plot occupy the entire page.
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
186 ## The option @option{-fillpage} will stretch the plot to occupy the page with
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
187 ## 0.25 inch margins all around. The option @option{-bestfit} will expand the
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
188 ## plot to take up as much room as possible on the page @strong{without}
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
189 ## distorting the original aspect ratio of the plot.
9cfbe7688368 Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents: 26102
diff changeset
190 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
191 ## @item -color
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
192 ## @itemx -mono
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
193 ## Color or monochrome output.
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
194 ##
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
195 ## @item -solid
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
196 ## @itemx -dashed
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
197 ## Force all lines to be solid or dashed, respectively.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
198 ##
26104
0e4b9df85361 Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents: 26103
diff changeset
199 ## @item -noui
0e4b9df85361 Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents: 26103
diff changeset
200 ## Don't print uicontrol objects such as pushbuttons which may overlay the
0e4b9df85361 Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents: 26103
diff changeset
201 ## plot. This is the default behavior and it is not possible to include
0e4b9df85361 Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents: 26103
diff changeset
202 ## uicontrol objects in the output without using an external screen capture
0e4b9df85361 Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents: 26103
diff changeset
203 ## tool.
0e4b9df85361 Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents: 26103
diff changeset
204 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
205 ## @item -r@var{NUM}
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
206 ## Resolution of bitmaps in dots per inch (DPI). For both metafiles and SVG
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
207 ## the default is the screen resolution; for other formats the default is 150
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
208 ## DPI@. To specify screen resolution, use @qcode{"-r0"}.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
209 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
210 ## Example: high resolution raster output.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
211 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
212 ## @example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
213 ## @group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
214 ## clf ();
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
215 ## surf (peaks (), "facelighting", "gouraud");
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
216 ## light ();
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
217 ## print ("-r600", "lit_peaks.png");
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
218 ## @end group
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
219 ## @end example
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
220 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
221 ## @item -S@var{xsize},@var{ysize}
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
222 ## Plot size in pixels for raster formats including PNG, JPEG, PNG, and
29008
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
223 ## @emph{unusually} SVG@. For all vector formats, including PDF, PS, and EPS,
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
224 ## the plot size is specified in points. This option is equivalent to changing
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
225 ## the width and height of the output by setting the figure property
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
226 ## @code{paperposition(3:4)}. When using the command form of the print
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
227 ## function you must quote the @var{xsize},@var{ysize} option to prevent the
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
228 ## Octave interpreter from recognizing the embedded comma (','). For example,
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
229 ## by writing @w{"-S640,480"}.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
230 ##
26739
0c18acaa8b58 Revert changeset 3a10bdbe6839 which is only for stable branch.
Rik <rik@octave.org>
parents: 26738
diff changeset
231 ## @item -tight
0c18acaa8b58 Revert changeset 3a10bdbe6839 which is only for stable branch.
Rik <rik@octave.org>
parents: 26738
diff changeset
232 ## @itemx -loose
0c18acaa8b58 Revert changeset 3a10bdbe6839 which is only for stable branch.
Rik <rik@octave.org>
parents: 26738
diff changeset
233 ## Force a tight or loose bounding box for EPS files. The default is tight.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
234 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
235 ## @item -@var{preview}
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
236 ## Add a preview to EPS files. Supported formats are:
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
237 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
238 ## @table @code
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
239 ## @item -interchange
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
240 ## Provide an interchange preview.
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
241 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
242 ## @item -metafile
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
243 ## Provide a metafile preview.
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
244 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
245 ## @item -pict
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
246 ## Provide a pict preview.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
247 ##
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
248 ## @item -tiff
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
249 ## Provide a TIFF preview.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
250 ## @end table
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
251 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
252 ## @item -append
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
253 ## Append PostScript or PDF output to an existing file of the same type.
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
254 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
255 ## @item -F@var{fontname}
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
256 ## @itemx -F@var{fontname}:@var{size}
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
257 ## @itemx -F:@var{size}
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
258 ## Use @var{fontname} and/or @var{fontsize} for all text.
26934
1771bed38482 Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26933
diff changeset
259 ## @var{fontname} is ignored for some devices: fig, etc.
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
260 ##
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
261 ## @item -d@var{device}
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
262 ## The available output format is specified by the option @var{device}, and
27931
0fa21907e54c doc: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents: 27923
diff changeset
263 ## is one of the following (devices marked with a @qcode{'*'} are only
0fa21907e54c doc: grammarcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents: 27923
diff changeset
264 ## available with the Gnuplot toolkit):
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
265 ##
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
266 ## Vector Formats
14366
b76f0740940e doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents: 14356
diff changeset
267 ##
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
268 ## @table @code
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
269 ## @item svg
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
270 ## Scalable Vector Graphics.
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
271 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
272 ## @item pdf
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
273 ## @itemx pdfcrop
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
274 ## Portable Document Format. The @code{pdf} device formats the figure for
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
275 ## printing on paper. The size of the surrounding page and the position of the
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
276 ## figure inside the page are defined by the
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
277 ## @ref{XREFfigurepaperorientation,, paper* figure properties}.
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
278 ##
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
279 ## Use @code{pdfcrop} if you don't want the surrounding page.
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
280 ##
31432
df8bdaf1164b print.m: Use -svgconvert by default (bug #62979)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 31375
diff changeset
281 ## Caution: with @option{-nosvgconvert} option, PDF inherits the same
df8bdaf1164b print.m: Use -svgconvert by default (bug #62979)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 31375
diff changeset
282 ## limitations as PostScript (limited set of fonts and lack of transparency).
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
283 ##
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
284 ## @item eps(2)
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
285 ## @itemx epsc(2)
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
286 ## Encapsulated PostScript (level 1 and 2, mono and color).
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
287 ##
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
288 ## The OpenGL-based graphics toolkits always generate PostScript level 3.0.
27794
45ad2127582b doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents: 27622
diff changeset
289 ## They have limited support for text unless using the @option{-svgconvert}
31432
df8bdaf1164b print.m: Use -svgconvert by default (bug #62979)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 31375
diff changeset
290 ## option (the default).
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
291 ## Limitations include using only ASCII characters (e.g., no Greek letters)
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
292 ## and support for just three base PostScript fonts: Helvetica (the default),
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
293 ## Times, or Courier. Any other font will be replaced by Helvetica.
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
294 ##
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
295 ## @item ps(2)
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
296 ## @itemx psc(2)
27971
ec769a7ab9fb fix more spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 27931
diff changeset
297 ## Same as @code{eps} except that the figure is formatted for printing on
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
298 ## paper. The size of the surrounding page and position of the figure inside
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
299 ## the page are defined by the
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
300 ## @ref{XREFfigurepaperorientation,, paper* figure properties}.
10841
1577accf2ed8 print.m: Update documentation string. Change to active voice.
Rik <octave@nomad.inbox5.com>
parents: 10834
diff changeset
301 ##
19026
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
302 ## @item pslatex
6739
db0a05a61d09 [project @ 2007-06-15 21:59:16 by jwe]
jwe
parents: 6727
diff changeset
303 ## @itemx epslatex
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
304 ## @itemx pdflatex
19026
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
305 ## @itemx pslatexstandalone
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
306 ## @itemx epslatexstandalone
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
307 ## @itemx pdflatexstandalone
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
308 ## Generate a @LaTeX{} file @file{@var{filename}.tex} for the text portions
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
309 ## of a plot and a file @file{@var{filename}.(ps|eps|pdf)} for the remaining
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
310 ## graphics. The graphics file suffix .ps|eps|pdf is determined by the
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
311 ## specified device type. The @LaTeX{} file produced by the @samp{standalone}
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
312 ## option can be processed directly by @LaTeX{}. The file generated without
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
313 ## the @samp{standalone} option is intended to be included from another
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
314 ## @LaTeX{} document. In either case, the @LaTeX{} file contains an
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
315 ## @code{\includegraphics} command so that the generated graphics file is
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
316 ## automatically included when the @LaTeX{} file is processed. The text that
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
317 ## is written to the @LaTeX{} file contains the strings @strong{exactly} as
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
318 ## they were specified in the plot. If any special characters of the @TeX{}
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
319 ## mode interpreter were used, the file must be edited before @LaTeX{}
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
320 ## processing. Specifically, the special characters must be enclosed with
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
321 ## dollar signs @w{(@code{$ @dots{} $})}, and other characters that are
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
322 ## recognized by @LaTeX{} may also need editing (e.g., braces). The
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
323 ## @samp{pdflatex} device, and any of the @samp{standalone} formats, are not
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
324 ## available with the Gnuplot toolkit.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
325 ##
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
326 ## @item epscairo*
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
327 ## @itemx pdfcairo*
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
328 ## @itemx epscairolatex*
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
329 ## @itemx pdfcairolatex*
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
330 ## @itemx epscairolatexstandalone*
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
331 ## @itemx pdfcairolatexstandalone*
29008
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
332 ## Generate output with Cairo renderer. The devices @code{epscairo} and
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
333 ## @code{pdfcairo} are synonymous with the @code{epsc} device. The @LaTeX{}
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
334 ## variants generate a @LaTeX{} file, @file{@var{filename}.tex}, for the text
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
335 ## portions of a plot, and an image file, @file{@var{filename}.(eps|pdf)}, for
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
336 ## the graph portion of the plot. The @samp{standalone} variants behave as
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
337 ## described for @samp{epslatexstandalone} above.
20964
6ac3d299c5ad Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20936
diff changeset
338 ##
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
339 ## @item canvas*
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
340 ## Javascript-based drawing on an HTML5 canvas viewable in a web browser.
20971
22318eeaca3b Add gnuplot "canvas" terminal to the print.m doc-string.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20970
diff changeset
341 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
342 ## @item emf
9107
d0d507cbd123 Improvements to printing functionality.
Ben Abbott <bpabbott@mac.com>
parents: 9056
diff changeset
343 ## @itemx meta
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
344 ## Microsoft Enhanced Metafile
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
345 ##
6965
c962cc09067a [project @ 2007-10-06 04:54:36 by jwe]
jwe
parents: 6895
diff changeset
346 ## @item fig
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
347 ## XFig. For the Gnuplot graphics toolkit, the additional options
29008
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
348 ## @option{-textspecial} or @option{-textnormal} (default) can be used to
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
349 ## control whether the special flag should be set for the text in the figure.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
350 ##
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
351 ## @item latex*
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
352 ## @itemx eepic*
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
353 ## @LaTeX{} picture environment and extended picture environment.
20969
984678f19352 Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20968
diff changeset
354 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
355 ## @item tikz
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
356 ## @itemx tikzstandalone*
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
357 ## Generate a @LaTeX{} file using PGF/TikZ format. The OpenGL-based
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
358 ## toolkits create a PGF file while Gnuplot creates a TikZ file. The
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
359 ## @samp{tikzstandalone} device produces a @LaTeX{} document which includes the
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
360 ## TikZ file.
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
361 ##
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
362 ## @end table
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
363 ##
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
364 ## Raster Formats
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
365 ##
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
366 ## @table @code
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
367 ## @item png
25582
0df6454f58ea print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents: 25307
diff changeset
368 ## Portable Network Graphics
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
369 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
370 ## @item jpg
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
371 ## @itemx jpeg
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
372 ## JPEG image
25582
0df6454f58ea print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents: 25307
diff changeset
373 ##
0df6454f58ea print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents: 25307
diff changeset
374 ## @item tif
0df6454f58ea print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents: 25307
diff changeset
375 ## @itemx tiff
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
376 ## @itemx tiffn
26048
d02e4b1df697 doc: Spellcheck documentation.
Rik <rik@octave.org>
parents: 26043
diff changeset
377 ## TIFF image with LZW compression (@nospell{tif}, tiff) or uncompressed
d02e4b1df697 doc: Spellcheck documentation.
Rik <rik@octave.org>
parents: 26043
diff changeset
378 ## (@nospell{tiffn}).
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
379 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
380 ## @item gif
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
381 ## GIF image
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
382 ##
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
383 ## @item pbm
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
384 ## PBMplus
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
385 ##
26191
f41494a4977f Add "dumb" terminal to produce ASCII art with gnuplot (patch #8203).
Rüdiger Sonderfeld <ruediger@c-plusplus.de>
parents: 26173
diff changeset
386 ## @item dumb*
f41494a4977f Add "dumb" terminal to produce ASCII art with gnuplot (patch #8203).
Rüdiger Sonderfeld <ruediger@c-plusplus.de>
parents: 26173
diff changeset
387 ## ASCII art
f41494a4977f Add "dumb" terminal to produce ASCII art with gnuplot (patch #8203).
Rüdiger Sonderfeld <ruediger@c-plusplus.de>
parents: 26173
diff changeset
388 ##
24207
f3d754deb41d print.m: fix device table formating in docstring
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24139
diff changeset
389 ## @end table
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
390 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
391 ## If the device is omitted, it is inferred from the file extension,
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
392 ## or if there is no filename then it is sent to the printer as PostScript.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
393 ##
10423
dfc662a47b7a print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents: 10422
diff changeset
394 ## @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
395 ## Additional devices are supported by Ghostscript.
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
396 ## Some examples are:
9152
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
397 ##
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
398 ## @table @code
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11576
diff changeset
399 ## @item ljet2p
16826
a4969508008e doc: Periodic spellcheck of the documentation.
Rik <rik@octave.org>
parents: 16766
diff changeset
400 ## HP LaserJet @nospell{IIP}
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
401 ##
9152
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
402 ## @item pcx24b
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
403 ## 24-bit color PCX file format
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
404 ##
9152
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
405 ## @item ppm
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
406 ## Portable Pixel Map file format
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
407 ## @end table
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
408 ##
26102
15ebd65f18c9 print.m: Rewrite complex docstring in an attempt to be clearer.
Rik <rik@octave.org>
parents: 26063
diff changeset
409 ## For a complete list of available formats and devices type
29008
24cb3f34a8c5 print.m: Improve documentation.
Rik <rik@octave.org>
parents: 28648
diff changeset
410 ## @kbd{system ("gs -h")}.
9152
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
411 ##
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
412 ## When Ghostscript output is sent to a printer the size is determined by
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
413 ## the figure's @qcode{"papersize"} property. When the output is sent to a
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
414 ## file the size is determined by the plot box defined by the figure's
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19990
diff changeset
415 ## @qcode{"paperposition"} property.
9152
4c9aff0c9a61 print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents: 9107
diff changeset
416 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
417 ## @item -G@var{ghostscript_command}
26043
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
418 ## Specify the command for calling Ghostscript. For Unix the default is
5cef57130cb9 doc: grammar check m-files in scripts/ directory.
Rik <rik@octave.org>
parents: 26027
diff changeset
419 ## @qcode{"gs"} and for Windows it is @qcode{"gswin32c"}.
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
420 ##
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
421 ## @item -TextAlphaBits=@var{n}
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
422 ## @itemx -GraphicsAlphaBits=@var{n}
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
423 ## Octave is able to produce output for various printers, bitmaps, and
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
424 ## vector formats by using Ghostscript. For bitmap and printer output
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
425 ## anti-aliasing is applied using Ghostscript's TextAlphaBits and
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
426 ## GraphicsAlphaBits options. The default number of bits are 4 and 1
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
427 ## respectively. Allowed values for @var{N} are 1, 2, or 4.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
428 ##
32283
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
429 ## @item -no-append-file-extension
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
430 ## With this option, @var{filename} is used verbatim. That means no file
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
431 ## extension matching the file format is appended automatically.
32285
d2540b8c9fdd print.m: Fix texinfo syntax (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32283
diff changeset
432 ## @end table
32283
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
433 ##
28082
8ddecbd15a88 doc: Add "savefig" to @seealso list for print().
Rik <rik@octave.org>
parents: 27987
diff changeset
434 ## @seealso{saveas, getframe, savefig, hgsave, orient, figure}
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
435 ## @end deftypefn
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
436
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
437 function RGB = print (varargin)
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
438
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
439 opts = __print_parse_opts__ (varargin{:});
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
440
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
441 ## Check the requested file is writable
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
442 if (! opts.rgb_output)
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
443 folder = fileparts (opts.name);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
444 if (! isempty (folder) && ! isfolder (folder))
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
445 error ("print: directory %s does not exist", folder);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
446 endif
23118
46b914a213db Workaround segfault when an error occurs while printing (bug #49779)
Avinoam Kalma <a.kalma@gmail.com>
parents: 23083
diff changeset
447
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
448 do_unlink = (exist (opts.name, "file") != 2);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
449 fid = fopen (opts.name, "a");
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
450 if (fid == -1)
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
451 error ("print: cannot open file %s for writing", opts.name);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
452 endif
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
453 fclose (fid);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
454 if (do_unlink)
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
455 unlink (opts.name);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
456 endif
23189
0c9195baea1a print.m: fix regression with -append option (bug #50318)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23139
diff changeset
457 endif
23139
900ae902aa90 maint: strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23118
diff changeset
458
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
459 opts.pstoedit_cmd = @pstoedit;
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
460 opts.fig2dev_cmd = @fig2dev;
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
461 opts.latex_standalone = @latex_standalone;
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
462 opts.lpr_cmd = @lpr;
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
463 opts.epstool_cmd = @epstool;
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
464 opts.svgconvert_cmd = @svgconvert;
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
465
19026
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
466 if (isempty (opts.figure) || ! isfigure (opts.figure))
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
467 error ("print: no figure to print");
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
468 endif
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
469
22099
4c0f78b3c86f print.m: Fix typo "1" (char) to 1 (integer) as argument to findall -depth (bug #48478).
Rik <rik@octave.org>
parents: 21859
diff changeset
470 if (isempty (findall (opts.figure, "-depth", 1, "type", "axes")))
19990
9a2d8b1f931e Issue error when trying to print a figure with no axes object (bug #44655).
Rik <rik@octave.org>
parents: 19833
diff changeset
471 error ("print: no axes object in figure to print");
9a2d8b1f931e Issue error when trying to print a figure with no axes object (bug #44655).
Rik <rik@octave.org>
parents: 19833
diff changeset
472 endif
9a2d8b1f931e Issue error when trying to print a figure with no axes object (bug #44655).
Rik <rik@octave.org>
parents: 19833
diff changeset
473
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
474 orig_figure = get (0, "currentfigure");
17146
bbda4d952eb5 Fix pop-up of invisible figures during printing.
Rik <rik@octave.org>
parents: 17129
diff changeset
475 set (0, "currentfigure", opts.figure);
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
476
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
477 if (opts.append_to_file)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
478 [~, ~, ext] = fileparts (opts.ghostscript.output);
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19078
diff changeset
479 opts.ghostscript.prepend = [tempname() ext];
11014
92bb25c0da9e When appending, delete temporary files at the end of the ghostscript pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 11009
diff changeset
480 copyfile (opts.ghostscript.output, opts.ghostscript.prepend);
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
481 endif
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
482
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
483 unwind_protect
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
484
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
485 ## Modify properties as specified by options
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
486 tk = get (opts.figure, "__graphics_toolkit__");
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
487 props = [];
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
488 nfig = 0;
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
489
14355
a6a5c5008e39 Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents: 14335
diff changeset
490 drawnow ();
a6a5c5008e39 Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents: 14335
diff changeset
491
26728
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
492 ## Set the __printing__ property first
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
493 props(1).h = opts.figure;
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
494 props(1).name = "__printing__";
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
495 props(1).value = {"off"};
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
496 set (opts.figure, "__printing__", "on");
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
497 nfig += 1;
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
498
28678
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
499 ## print() requires children of axes to have units = "normalized" or "data"
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
500 ## FIXME: Bug #59015. The only graphics object type to which this
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
501 ## requirement applies seems to be 'text' objects. It is simpler, and
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
502 ## clearer, to just select those objects. The old code is left commented
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
503 ## out until sufficient testing has been done.
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
504 ## Change made: 2020/09/02.
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
505 ##hobj = findall (opts.figure, "-not", "type", "figure", ...
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
506 ## "-not", "type", "axes", "-not", "type", "hggroup", ...
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
507 ## "-property", "units", ...
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
508 ## "-not", "units", "normalized", "-not", "units", "data");
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
509 ##hobj(strncmp (get (hobj, "type"), "ui", 2)) = [];
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
510
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
511 hobj = findall (opts.figure, "type", "text",
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
512 "-not", "units", "normalized", "-not", "units", "data");
28678
e44ab1089f61 print.m: Fix printing when some "units" properties are not "data" (bug #59015).
Rik <rik@octave.org>
parents: 28649
diff changeset
513 for n = 1:numel (hobj)
28648
60d2b3d903d4 Fix indexing error in print.m (bug #58998).
Valdas <zmogas@hotmail.com>
parents: 28208
diff changeset
514 props(end+1).h = hobj(n);
60d2b3d903d4 Fix indexing error in print.m (bug #58998).
Valdas <zmogas@hotmail.com>
parents: 28208
diff changeset
515 props(end).name = "units";
60d2b3d903d4 Fix indexing error in print.m (bug #58998).
Valdas <zmogas@hotmail.com>
parents: 28208
diff changeset
516 props(end).value = {get(hobj(n), "units")};
21323
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
517 set (hobj(n), "units", "data");
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
518 nfig += 1;
20936
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
519 endfor
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
520
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
521 if (strcmp (opts.renderer, "opengl"))
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
522 ## Scale the figure to reach the required resolution
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
523 scale = opts.ghostscript.resolution / 72;
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
524 if (scale != 1)
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
525 props(end+1).h = opts.figure;
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
526 props(end).name = "__device_pixel_ratio__";
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
527 props(end).value{1} = get (opts.figure, "__device_pixel_ratio__");
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
528 set (opts.figure, "__device_pixel_ratio__", scale);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
529 nfig += 1;
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
530 endif
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
531 elseif (strcmp (tk, "qt"))
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
532 ## Don't account for the actual pixel density
25884
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
533 props(end+1).h = opts.figure;
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
534 props(end).name = "__device_pixel_ratio__";
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
535 props(end).value = {get(opts.figure, "__device_pixel_ratio__")};
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
536 set (opts.figure, "__device_pixel_ratio__", 1);
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
537 nfig += 1;
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
538 endif
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25787
diff changeset
539
20936
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
540 ## print() requires axes units = "normalized"
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
541 hax = findall (opts.figure, "-depth", 1, "type", "axes", ...
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
542 "-not", "units", "normalized");
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
543 for n = 1:numel (hax)
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
544 props(end+1).h = hax(n);
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
545 props(end).name = "units";
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
546 props(end).value = {get(hax(n), "units")};
21323
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
547 set (hax(n), "units", "normalized");
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
548 nfig += 1;
20936
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
549 endfor
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
550
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
551 ## With the -painters (gl2ps) renderer, line transparency is only
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
552 ## handled for svg and pdf outputs using svgconvert.
26063
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
553 ## Otherwise, switch grid lines color to light gray so that the image
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
554 ## output approximately matches on-screen experience.
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
555 hax = findall (opts.figure, "type", "axes");
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
556 if (! strcmp (tk, "gnuplot") && ! strcmp (opts.renderer, "opengl")
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
557 && ! (opts.svgconvert && strcmp (opts.devopt, "pdfwrite"))
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
558 && ! strcmp (opts.devopt, "svg"))
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
559 for n = 1:numel (hax)
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
560 if (strcmp (get (hax(n), "gridcolormode"), "auto"))
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
561 props(end+1).h = hax(n);
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
562 props(end).name = "gridcolormode";
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
563 props(end).value = {"auto"};
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
564 props(end+1).h = hax(n);
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
565 props(end).name = "gridcolor";
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
566 props(end).value = {get(hax(n), "gridcolor")};
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
567 set (hax(n), "gridcolor", [0.85 0.85 0.85]);
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
568 nfig += 2;
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
569 endif
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
570 if (strcmp (get (hax(n), "gridalphamode"), "auto"))
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
571 props(end+1).h = hax(n);
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
572 props(end).name = "gridalphamode";
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
573 props(end).value = {"auto"};
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
574 props(end+1).h = hax(n);
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
575 props(end).name = "gridalpha";
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
576 props(end).value = {get(hax(n), "gridalpha")};
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
577 set (hax(n), "gridalpha", 1);
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
578 nfig += 2;
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
579 endif
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
580
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
581 if (strcmp (get (hax(n), "minorgridcolormode"), "auto"))
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
582 props(end+1).h = hax(n);
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
583 props(end).name = "minorgridcolormode";
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
584 props(end).value = {"auto"};
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
585 props(end+1).h = hax(n);
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
586 props(end).name = "minorgridcolor";
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
587 props(end).value = {get(hax(n), "minorgridcolor")};
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
588 set (hax(n), "minorgridcolor", [0.75 0.75 0.75]);
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
589 nfig += 2;
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
590 endif
27343
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
591 if (strcmp (get (hax(n), "minorgridalphamode"), "auto"))
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
592 props(end+1).h = hax(n);
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
593 props(end).name = "minorgridalphamode";
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
594 props(end).value = {"auto"};
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
595 props(end+1).h = hax(n);
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
596 props(end).name = "minorgridalpha";
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
597 props(end).value = {get(hax(n), "minorgridalpha")};
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
598 set (hax(n), "minorgridalpha", 1);
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
599 nfig += 2;
2c9795736894 print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27069
diff changeset
600 endif
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
601 endfor
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
602 endif
24208
eec262017c6a maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 24207
diff changeset
603
14355
a6a5c5008e39 Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents: 14335
diff changeset
604 ## print() requires figure units to be "pixels"
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
605 props(end+1).h = opts.figure;
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
606 props(end).name = "units";
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
607 props(end).value = {get(opts.figure, "units")};
14355
a6a5c5008e39 Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents: 14335
diff changeset
608 set (opts.figure, "units", "pixels");
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
609 nfig += 1;
14355
a6a5c5008e39 Print() function requires figure units to be "pixels".
Ben Abbott <bpabbott@mac.com>
parents: 14335
diff changeset
610
17742
4e225f952885 Fix shrinking axes when printing plots with legends (bug #40333).
Rik <rik@octave.org>
parents: 17723
diff changeset
611 ## graphics toolkit translates figure position to eps bbox (points)
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
612 fpos = get (opts.figure, "position");
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
613 props(end+1).h = opts.figure;
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
614 props(end).name = "position";
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
615 props(end).value = {fpos};
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
616 fpos(3:4) = opts.canvas_size;
26728
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
617 set (opts.figure, "position", fpos);
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
618 nfig += 1;
7550
bffb1e2ab732 print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents: 7543
diff changeset
619
21323
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
620 ## Implement InvertHardCopy option
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
621 do_hardcopy = strcmp (get (opts.figure, "inverthardcopy"), "on");
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
622
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
623 if (do_hardcopy)
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
624 ## Set figure background to white.
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
625 props(end+1).h = opts.figure;
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
626 props(end).name = "color";
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
627 props(end).value{1} = get (opts.figure, "color");
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
628 set (opts.figure, "color", "white");
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
629 nfig += 1;
21323
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
630 endif
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
631
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
632 if (do_hardcopy)
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
633 ## Set background to white for all top-level axes objects
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
634 hax = findall (opts.figure, "-depth", 1, "type", "axes",
21859
ec3adcec1337 Fix "inverthardcopy" for transparent axes and plotyy (bug #48161).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 21759
diff changeset
635 "-not", "tag", "legend",
ec3adcec1337 Fix "inverthardcopy" for transparent axes and plotyy (bug #48161).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 21759
diff changeset
636 "-not", "color", "none");
22578
956f5c71dc3c Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents: 22571
diff changeset
637 if (! isempty (hax))
956f5c71dc3c Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents: 22571
diff changeset
638 for n = 1:numel (hax)
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
639 props(end+1).h = hax(n);
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
640 props(end).name = "color";
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
641 props(end).value{1} = get(hax(n), "color");
22578
956f5c71dc3c Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents: 22571
diff changeset
642 set (hax(n), "color", "white");
22783
219c70d2ba28 print.m: Don't change ui* objects units (bug #49600).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
643 nfig += 1;
22578
956f5c71dc3c Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents: 22571
diff changeset
644 endfor
956f5c71dc3c Fix printing when axes has color "none" (bug #49243).
Rik <rik@octave.org>
parents: 22571
diff changeset
645 endif
21323
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21122
diff changeset
646 endif
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
647
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
648 if (opts.force_solid != 0)
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
649 h = findall (opts.figure, "-property", "linestyle");
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
650 m = numel (props);
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14852
diff changeset
651 for n = 1:numel (h)
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
652 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
653 props(m+n).name = "linestyle";
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
654 props(m+n).value = {get(h(n), "linestyle")};
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
655 endfor
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
656 if (opts.force_solid > 0)
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
657 linestyle = "-";
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
658 else
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
659 linestyle = "--";
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
660 endif
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
661 set (h, "linestyle", linestyle);
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
662 endif
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
663
21365
5b9618f4f841 Rely upon print.m for mono/color conversion. This simplifies gnuplot support
Ben Abbott <bpabbott@mac.com>
parents: 21323
diff changeset
664 if (opts.use_color < 0)
10866
045558999570 print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents: 10860
diff changeset
665 color_props = {"color", "facecolor", "edgecolor", "colormap"};
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14852
diff changeset
666 for c = 1:numel (color_props)
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
667 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
668 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
669 h = setdiff (h, hnone);
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
670 m = numel (props);
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14852
diff changeset
671 for n = 1:numel (h)
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 24370
diff changeset
672 if (ishghandle (h(n)))
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
673 ## 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
674 ## 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
675 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
676 props(end+1).h = h(n);
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
677 props(end).name = color_props{c};
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
678 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
679 if (isnumeric (rgb))
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
680 ## convert RGB color to RGB gray scale
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14868
diff changeset
681 xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1);
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
682 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
683 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
684 endif
10866
045558999570 print.m: Include 'colormap' when converting RGB to mono.
Ben Abbott <bpabbott@mac.com>
parents: 10860
diff changeset
685 endif
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
686 endfor
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
687 endfor
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
688 endif
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
689
27007
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
690 do_font = ! isempty (opts.font);
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
691 do_scalefontsize = ! isempty (opts.scalefontsize) && opts.scalefontsize != 1;
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
692 do_fontsize = ! isempty (opts.fontsize) || do_scalefontsize;
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
693 if (do_font || do_fontsize)
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
694 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
695 m = numel (props);
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14852
diff changeset
696 for n = 1:numel (h)
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 24370
diff changeset
697 if (ishghandle (h(n)))
27007
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
698 if (do_font)
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
699 props(end+1).h = h(n);
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
700 props(end).name = "fontname";
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
701 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
702 endif
27007
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
703 if (do_fontsize)
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
704 props(end+1).h = h(n);
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
705 props(end).name = "fontsize";
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
706 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
707 endif
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
708 endif
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
709 endfor
27007
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
710 if (do_font)
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 24370
diff changeset
711 set (h(ishghandle (h)), "fontname", opts.font);
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
712 endif
27007
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
713 if (do_fontsize)
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
714 if (! isempty (opts.fontsize))
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
715 ## Changing all fontsizes to a fixed value
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
716 if (ischar (opts.fontsize))
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
717 fontsize = str2double (opts.fontsize);
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
718 else
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
719 fontsize = opts.fontsize;
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
720 endif
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
721 if (do_scalefontsize)
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
722 ## This is done to work around the bbox being whole numbers.
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
723 fontsize *= opts.scalefontsize;
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
724 endif
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
725
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
726 ## FIXME: legend child objects need to be acted on first.
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
727 ## or legend fontsize callback will destroy them.
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
728 hlist = h(ishghandle (h));
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
729 haxes = strcmp (get (hlist, "type"), "axes");
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
730 set (hlist(! haxes), "fontsize", fontsize);
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
731 set (hlist(haxes), "fontsize", fontsize);
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
732
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
733 else
27007
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
734 ## Scaling fonts
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
735 ## FIXME: legend child objects need to be acted on first.
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
736 ## or legend fontsize callback will destroy them.
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
737 hlist = h(ishghandle (h));
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
738 haxes = strcmp (get (hlist, "type"), "axes");
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
739 for h = hlist(! haxes).'
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
740 fontsz = get (h, "fontsize");
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
741 set (h, "fontsize", fontsz * opts.scalefontsize);
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
742 endfor
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
743 for h = hlist(haxes).'
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
744 fontsz = get (h, "fontsize");
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
745 set (h, "fontsize", fontsz * opts.scalefontsize);
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
746 endfor
dd31206c87c0 Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents: 26994
diff changeset
747
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
748 endif
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
749 endif
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
750 endif
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
751
26055
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
752 ## When exporting latex files use "latex" for the ticklabelinterpreter.
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
753 ## It will format tick labels in log axes correctly
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
754 if (strfind (opts.devopt, "latex"))
26935
d17eecaf4a14 Don't issue warning about unsupported latex when printing with -dpdflatexstandalone (bug #55946).
Rik <rik@octave.org>
parents: 26934
diff changeset
755 ## Disable warnings about Latex being unsupported since Octave will be
d17eecaf4a14 Don't issue warning about unsupported latex when printing with -dpdflatexstandalone (bug #55946).
Rik <rik@octave.org>
parents: 26934
diff changeset
756 ## passing Latex code directly to interpreter with no rendering.
d17eecaf4a14 Don't issue warning about unsupported latex when printing with -dpdflatexstandalone (bug #55946).
Rik <rik@octave.org>
parents: 26934
diff changeset
757 warning ("off", "Octave:text_interpreter", "local");
26055
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
758 h = findall (opts.figure, "type", "axes");
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
759 for n = 1:numel (h)
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
760 if (ishghandle (h(n)))
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
761 props(end+1).h = h(n);
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
762 props(end).name = "ticklabelinterpreter";
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
763 props(end).value = {get(h(n), "ticklabelinterpreter")};
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
764 set (h(n), "ticklabelinterpreter", "latex");
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
765 endif
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
766 endfor
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
767 endif
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26048
diff changeset
768
19026
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
769 ## call the graphics toolkit print script
24139
5d2d0e570e46 print.m: fake grid transparency with gray color (bug #49705)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23991
diff changeset
770 switch (tk)
17174
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
771 case "gnuplot"
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
772 opts = __gnuplot_print__ (opts);
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
773 otherwise
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
774 if (strcmp (opts.renderer, "opengl"))
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
775 if (opts.rgb_output)
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
776 RGB = __get_frame__ (opts.figure);
25998
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
777 else
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
778 compression = "none";
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
779
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
780 if (strcmp (opts.devopt, "tiff"))
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
781 compression = "lzw";
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
782 elseif (strcmp (opts.devopt, "tiffn"))
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
783 opts.devopt = "tiff";
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
784 endif
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
785
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
786 imwrite (__get_frame__ (opts.figure), opts.name, ...
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
787 opts.devopt, "Compression", compression);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
788 endif
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
789 else
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
790 opts = __opengl_print__ (opts);
8d2b3e3ff182 print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25884
diff changeset
791 endif
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
792 endswitch
19706
18fd412c7dc3 Remove erroneously added "keyboard" in cset ef3cdadc2a08
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19705
diff changeset
793
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
794 unwind_protect_cleanup
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
795 ## restore modified properties
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
796 if (isstruct (props))
17751
e2f83152e64a print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents: 17744
diff changeset
797 ## Restore figure position and units first
20936
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
798 for n = nfig:-1:1
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 24370
diff changeset
799 if (ishghandle (props(n).h))
17751
e2f83152e64a print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents: 17744
diff changeset
800 set (props(n).h, props(n).name, props(n).value{1});
e2f83152e64a print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents: 17744
diff changeset
801 endif
e2f83152e64a print.m: Restore figure position first (in pixels) and then original units.
Rik <rik@octave.org>
parents: 17744
diff changeset
802 endfor
20936
80dd7b3529ee Convert figure's descendants units to "normalized" during printing (Bug #46292).
Ben Abbott <bpabbott@mac.com>
parents: 20852
diff changeset
803 for n = numel (props):-1:(nfig + 1)
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 24370
diff changeset
804 if (ishghandle (props(n).h))
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
805 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
806 endif
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
807 endfor
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
808 endif
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
809
26728
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
810 ## Avoid a redraw since the figure should not have changed
28189
5624fd0c5efb Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 28082
diff changeset
811 ## FIXME: Bug #57552, marker sizes, requires that redraw be done.
31253
a40c0b7aa376 maint: changes to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 31212
diff changeset
812 ## set (gcf, "__modified__", "off");
26728
f034b29320ad Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26689
diff changeset
813
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
814 ## Unlink temporary files
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14852
diff changeset
815 for n = 1:numel (opts.unlink)
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
816 [status, output] = unlink (opts.unlink{n});
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
817 if (status != 0)
26936
72fab319b47d Capitalize "Octave" in warning IDs.
Rik <rik@octave.org>
parents: 26935
diff changeset
818 warning ("Octave:print:unlinkerror", ...
72fab319b47d Capitalize "Octave" in warning IDs.
Rik <rik@octave.org>
parents: 26935
diff changeset
819 "print: %s, '%s'", output, opts.unlink{n});
10913
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
820 endif
dd6b90f44ae5 Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents: 10866
diff changeset
821 endfor
10860
3a5f5c99cc39 print.m: Modify texinfo. Add unwind_protect block.
Ben Abbott <bpabbott@mac.com>
parents: 10854
diff changeset
822 end_unwind_protect
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
823
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
824 if (isfigure (orig_figure))
17146
bbda4d952eb5 Fix pop-up of invisible figures during printing.
Rik <rik@octave.org>
parents: 17129
diff changeset
825 set (0, "currentfigure", orig_figure);
10834
05ba991794d4 Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
826 endif
28945
6e460773bdda maint: Use newlines after "function" and before "endfunction" for clarity.
Rik <rik@octave.org>
parents: 28892
diff changeset
827
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
828 endfunction
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
829
32283
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
830 ## Print to file with and without file extension
32286
774c54278e97 print.m: Run new test only with graphics toolkit "qt" (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32285
diff changeset
831 %!testif ; (have_window_system () && any (strcmp ("qt", available_graphics_toolkits ())))
774c54278e97 print.m: Run new test only with graphics toolkit "qt" (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32285
diff changeset
832 %! toolkit = graphics_toolkit ();
774c54278e97 print.m: Run new test only with graphics toolkit "qt" (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32285
diff changeset
833 %! graphics_toolkit ("qt");
32283
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
834 %! hf = figure ("visible", "off");
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
835 %! unwind_protect
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
836 %! x = 0:0.1:1;
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
837 %! hax = axes (hf);
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
838 %! plot (hax, x, x);
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
839 %! tmp_name = tempname ();
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
840 %! print (hf, tmp_name, "-dpng");
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
841 %! assert (isfile ([tmp_name ".png"]));
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
842 %! unlink ([tmp_name ".png"]);
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
843 %! print (hf, tmp_name, "-dpng", "-no-append-file-extension");
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
844 %! assert (isfile (tmp_name));
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
845 %! unlink (tmp_name);
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
846 %! unwind_protect_cleanup
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
847 %! close (hf);
32286
774c54278e97 print.m: Run new test only with graphics toolkit "qt" (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32285
diff changeset
848 %! graphics_toolkit (toolkit);
32283
d668c52cf2e6 print.m: Optionally don't append file extension to file name (bug #64510).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31798
diff changeset
849 %! end_unwind_protect
30379
363fb10055df maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30362
diff changeset
850
30362
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
851 %!error <a graphics handle>
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
852 %! hf = figure ("visible", "off");
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
853 %! unwind_protect
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
854 %! x = 0:0.1:1;
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
855 %! y1 = x;
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
856 %! y2 = 2*x;
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
857 %! ax = plotyy (x, y1, x, y2);
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
858 %! saveas (ax, [tempname(), ".png"]);
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
859 %! unwind_protect_cleanup
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
860 %! close (hf);
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
861 %! end_unwind_protect
512f3d68bb49 print: Use clearer error message on invalid input (bug #61557).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30353
diff changeset
862
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
863 function cmd = epstool (opts, filein, fileout)
30379
363fb10055df maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30362
diff changeset
864
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
865 ## As epstool does not work with pipes, a subshell is used to
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21578
diff changeset
866 ## permit piping. Since this solution does not work with the DOS
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
867 ## command shell, the -tight and -preview options are disabled if
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
868 ## output must be piped.
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
869
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
870 ## DOS Shell:
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
871 ## gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein>
28892
3cac3ceb9629 maint: Use coding style with parentheses after function name to distinguish from a variable.
Rik <rik@octave.org>
parents: 28678
diff changeset
872 ## Unix Shell:
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
873 ## cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein>
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
874
27057
986128cf1e07 print.m: Fix error when using -tight but Ghostscript is not available (bug #56193).
Rik <rik@octave.org>
parents: 27007
diff changeset
875 dos_shell = (ispc () && ! isunix ());
986128cf1e07 print.m: Fix error when using -tight but Ghostscript is not available (bug #56193).
Rik <rik@octave.org>
parents: 27007
diff changeset
876
19724
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
877 ## HACK: Keep track of whether ghostscript supports epswrite or eps2write.
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
878 persistent epsdevice;
27057
986128cf1e07 print.m: Fix error when using -tight but Ghostscript is not available (bug #56193).
Rik <rik@octave.org>
parents: 27007
diff changeset
879 if (dos_shell && isempty (epsdevice))
986128cf1e07 print.m: Fix error when using -tight but Ghostscript is not available (bug #56193).
Rik <rik@octave.org>
parents: 27007
diff changeset
880 if (isempty (opts.ghostscript.binary))
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
881 error ("Octave:print:nogs",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
882 "print: 'gs' (Ghostscript) is required for specified output format, but binary is not available in PATH");
27057
986128cf1e07 print.m: Fix error when using -tight but Ghostscript is not available (bug #56193).
Rik <rik@octave.org>
parents: 27007
diff changeset
883 endif
986128cf1e07 print.m: Fix error when using -tight but Ghostscript is not available (bug #56193).
Rik <rik@octave.org>
parents: 27007
diff changeset
884
19724
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
885 [status, devlist] = system (sprintf ("%s -h", opts.ghostscript.binary));
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
886 if (isempty (strfind (devlist, "eps2write")))
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
887 epsdevice = "epswrite";
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
888 else
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
889 epsdevice = "eps2write";
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
890 endif
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
891 endif
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19725
diff changeset
892
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
893 cleanup = "";
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
894 if (nargin < 3)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
895 fileout = opts.name;
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
896 elseif (isempty (fileout))
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
897 fileout = "-";
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
898 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
899
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
900 if (nargin < 2 || strcmp (filein, "-") || isempty (filein))
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
901 pipein = true;
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19078
diff changeset
902 filein = [tempname() ".eps"];
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
903 if (dos_shell)
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
904 cleanup = sprintf ('& del "%s" ', strrep (filein, '/', '\'));
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
905 else
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
906 cleanup = sprintf ('; rm "%s" ', filein);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
907 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
908 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
909 pipein = false;
20778
8513c84a13cb Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents: 20713
diff changeset
910 filein = ["'" strtrim(filein) "'"];
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
911 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
912 if (strcmp (fileout, "-"))
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
913 pipeout = true;
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19078
diff changeset
914 fileout = [tempname() ".eps"];
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
915 if (dos_shell)
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
916 cleanup = [cleanup, sprintf('& del "%s" ', strrep (fileout, '/', '\'))];
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
917 else
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
918 cleanup = [cleanup, sprintf('; rm "%s" ', fileout)];
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
919 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
920 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
921 pipeout = false;
20778
8513c84a13cb Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents: 20713
diff changeset
922 fileout = ["'" strtrim(fileout) "'"];
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
923 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
924
26173
0a145a1600e3 Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents: 26104
diff changeset
925 if (! isempty (opts.preview) && opts.tight)
26936
72fab319b47d Capitalize "Octave" in warning IDs.
Rik <rik@octave.org>
parents: 26935
diff changeset
926 warning ("Octave:print:previewandtight",
72fab319b47d Capitalize "Octave" in warning IDs.
Rik <rik@octave.org>
parents: 26935
diff changeset
927 "print: eps preview may not be combined with -tight");
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
928 endif
26173
0a145a1600e3 Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents: 26104
diff changeset
929 if (! isempty (opts.preview) || opts.tight)
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
930
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
931 if (isempty (opts.epstool_binary))
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
932 error ("Octave:print:noepstool", "print: 'epstool' is required for specified output format, but binary is not available in PATH");
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
933 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
934
26173
0a145a1600e3 Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents: 26104
diff changeset
935 if (opts.tight)
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
936 cmd = "--copy --bbox";
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
937 elseif (! isempty (opts.preview))
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
938 switch (opts.preview)
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
939 case "tiff"
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
940 cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
941 case {"tiff6u", "tiff6p", "metafile"}
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
942 cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
943 case {"tiff4", "interchange"}
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
944 cmd = sprintf ("--add-%s-preview", opts.preview);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
945 case "pict"
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
946 cmd = sprintf ("--add-%s-preview --mac-single", opts.preview);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
947 otherwise
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
948 error ("Octave:print:invalidpreview",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
949 "print: epstool cannot include preview for format '%s'",
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
950 opts.preview);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
951 endswitch
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
952 if (! isempty (opts.ghostscript.resolution))
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
953 cmd = sprintf ("%s --dpi %d", cmd, fix (opts.ghostscript.resolution));
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
954 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
955 else
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
956 cmd = "";
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
957 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
958 if (! isempty (cmd))
28208
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
959 if (dos_shell)
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
960 ## ghostscript expects double, not single, quotes
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
961 fileout(fileout == "'") = '"';
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
962 ## epstool implicitly uses ghostscript and it needs the command name
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
963 cmd = sprintf ("%s --gs %s --quiet %s %s %s ", opts.epstool_binary,
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
964 opts.ghostscript.binary, cmd, filein, fileout);
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
965 else
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
966 cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary,
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
967 cmd, filein, fileout);
c3dd445fcc2f print.m: Fix printing eps files with -tight option on Windows (bug #57143).
Rik <rik@octave.org>
parents: 28189
diff changeset
968 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
969 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
970 if (pipein)
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
971 if (dos_shell)
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 24208
diff changeset
972 filein(filein=="'") = '"';
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
973 gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
974 "device", epsdevice,
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
975 "source", "-",
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
976 "output", filein);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
977 cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
978 else
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
979 cmd = sprintf ("cat > %s ; %s", filein, cmd);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
980 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
981 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
982 if (pipeout)
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
983 if (dos_shell)
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
984 cmd = sprintf ("%s & type %s", cmd, fileout);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
985 else
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
986 cmd = sprintf ("%s ; cat %s", cmd, fileout);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
987 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
988 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
989 if (! isempty (cleanup))
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
990 if (pipeout && dos_shell)
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
991 error ("Octave:print:epstoolpipe",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
992 "print: cannot pipe output of 'epstool' for DOS shell");
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
993 elseif (pipeout)
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
994 cmd = sprintf ("( %s %s )", cmd, cleanup);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
995 else
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
996 cmd = sprintf ("%s %s", cmd, cleanup);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
997 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
998 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
999 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1000 if (pipein && pipeout)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1001 if (dos_shell)
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1002 cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
19724
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
1003 "device", epsdevice,
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1004 "source", "-",
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1005 "output", "-");
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1006 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1007 cmd = " cat ";
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1008 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1009 elseif (pipein && ! pipeout)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1010 if (dos_shell)
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1011 ## ghostscript expects double, not single, quotes
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 24208
diff changeset
1012 fileout(fileout=="'") = '"';
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1013 cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
19724
abc158e7122e Use epswrite/eps2write depending on capabilities of ghostscript (bug #44186).
Rik <rik@octave.org>
parents: 19706
diff changeset
1014 "device", epsdevice,
11551
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1015 "source", "-",
84fa2ba414ee print.m: Fix printing to eps for DOS.
Ben Abbott <bpabbott@mac.com>
parents: 11523
diff changeset
1016 "output", fileout);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1017 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1018 cmd = sprintf (" cat > %s ", fileout);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1019 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1020 elseif (! pipein && pipeout)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1021 if (dos_shell)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1022 cmd = sprintf (" type %s ", filein);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1023 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1024 cmd = sprintf (" cat %s ", filein);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1025 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1026 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1027 if (dos_shell)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1028 cmd = sprintf (" copy %s %s ", filein, fileout);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1029 else
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1030 cmd = sprintf (" cp %s %s ", filein, fileout);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1031 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1032 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1033 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1034 if (opts.debug)
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1035 fprintf ("epstool command: '%s'\n", cmd);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1036 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1037
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1038 endfunction
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1039
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1040 function cmd = fig2dev (opts, devopt)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1041
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1042 if (nargin < 2)
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19725
diff changeset
1043 devopt = opts.devopt;
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1044 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1045
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1046 if (isempty (opts.fig2dev_binary))
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1047 error ("Octave:print:nofig2dev", "print: 'fig2dev' is required for specified output format, but binary is not available in PATH");
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1048 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1049
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1050 dos_shell = (ispc () && ! isunix ());
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1051 if (dos_shell)
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1052 ## FIXME: Is this the right thing to do for DOS?
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1053 cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt);
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1054 else
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1055 cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1056 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1057
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1058 if (opts.debug)
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1059 fprintf ("fig2dev command: '%s'\n", cmd);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1060 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1061
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1062 endfunction
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1063
12199
3fc07861449b Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
1064 function latex_standalone (opts)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1065
12199
3fc07861449b Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
1066 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
1067 if (! isempty (n))
3fc07861449b Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
1068 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
1069 endif
20778
8513c84a13cb Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents: 20713
diff changeset
1070 latexfile = [opts.name ".tex"];
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1071
16933
e39f00a32dc7 maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents: 16826
diff changeset
1072 switch (opts.devopt)
17174
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
1073 case {"pdflatexstandalone"}
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
1074 packages = "\\usepackage{graphicx,color}";
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
1075 case {"pslatexstandalone"}
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
1076 packages = "\\usepackage{epsfig,color}";
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
1077 otherwise
c3c1ebfaa7dc maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents: 17146
diff changeset
1078 packages = "\\usepackage{epsfig,color}";
12199
3fc07861449b Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
1079 endswitch
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1080
27344
8ff5628d8b55 print.m: Assume .tex files are always encoded in UTF-8 (bug #49338)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27343
diff changeset
1081 packages = {packages "\\usepackage[utf8]{inputenc}"};
8ff5628d8b55 print.m: Assume .tex files are always encoded in UTF-8 (bug #49338)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27343
diff changeset
1082
12199
3fc07861449b Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
1083 papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}",
19725
5f2c0ca0ef51 Ensure that numbers passed to integer *printf format codes are integers (bug #44245).
Rik <rik@octave.org>
parents: 19724
diff changeset
1084 fix (opts.canvas_size), fix (opts.canvas_size));
27344
8ff5628d8b55 print.m: Assume .tex files are always encoded in UTF-8 (bug #49338)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27343
diff changeset
1085
8ff5628d8b55 print.m: Assume .tex files are always encoded in UTF-8 (bug #49338)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27343
diff changeset
1086 prepend = {"\\documentclass{minimal}", packages{:}, papersize, ...
8ff5628d8b55 print.m: Assume .tex files are always encoded in UTF-8 (bug #49338)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27343
diff changeset
1087 "\\begin{document}", "\\centering"};
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1088 postpend = {"\\end{document}"};
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1089
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1090 fid = fopen (latexfile, "r");
21759
b002b4331a12 maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents: 21758
diff changeset
1091 if (fid < 0)
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1092 error ("Octave:print:erroropeningfile",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
1093 "print: error opening file '%s'", latexfile);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1094 endif
21759
b002b4331a12 maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents: 21758
diff changeset
1095 latex = fscanf (fid, "%c", Inf);
b002b4331a12 maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents: 21758
diff changeset
1096 status = fclose (fid);
b002b4331a12 maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents: 21758
diff changeset
1097 if (status != 0)
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1098 error ("Octave:print:errorclosingfile",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
1099 "print: error closing file '%s'", latexfile);
21759
b002b4331a12 maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents: 21758
diff changeset
1100 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1101
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1102 fid = fopen (latexfile, "w");
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1103 if (fid >= 0)
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1104 fprintf (fid, "%s\n", prepend{:});
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1105 fprintf (fid, "%s", latex);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1106 fprintf (fid, "%s\n", postpend{:});
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1107 status = fclose (fid);
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1108 if (status != 0)
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1109 error ("Octave:print:errorclosingfile",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
1110 "print: error closing file '%s'", latexfile);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1111 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1112 else
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1113 error ("Octave:print:erroropeningfile",
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
1114 "print: error opening file '%s'", latexfile);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1115 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1116
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1117 endfunction
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1118
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1119 function cmd = lpr (opts)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1120
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1121 if (nargin < 2)
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19725
diff changeset
1122 devopt = opts.devopt;
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1123 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1124
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1125 if (! isempty (opts.lpr_binary))
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1126 cmd = opts.lpr_binary;
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1127 if (! isempty (opts.lpr_options))
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1128 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
1129 endif
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1130 if (! isempty (opts.printer))
19026
d6f1f46e5b8f Fix double '-P' in print command to printer (bug #41957).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17751
diff changeset
1131 cmd = sprintf ("%s %s", cmd, opts.printer);
11113
a8ac114ec9ab Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 11107
diff changeset
1132 endif
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1133 elseif (isempty (opts.lpr_binary))
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1134 error ("Octave:print:nolpr", "print: 'lpr' not found in PATH");
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1135 endif
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1136 if (opts.debug)
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1137 fprintf ("lpr command: '%s'\n", cmd);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1138 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1139
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1140 endfunction
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1141
26932
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1142 function cmd = pstoedit (opts, devopt, do_svg = true)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1143
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1144 if (nargin < 2)
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19725
diff changeset
1145 devopt = opts.devopt;
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1146 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1147
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1148 if (isempty (opts.pstoedit_binary))
27069
0a62d9a6aa2d Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents: 27059
diff changeset
1149 error ("Octave:print:nopstoedit", ...
27059
2bf6dcb1563c Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents: 27057
diff changeset
1150 "print: 'pstoedit' is required for specified output format, but binary is not available in PATH");
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1151 endif
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1152
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1153 dos_shell = (ispc () && ! isunix ());
26993
119353eb6b38 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 26932
diff changeset
1154
26932
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1155 if (! do_svg)
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1156 if (dos_shell)
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1157 cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt);
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1158 else
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1159 cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt);
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1160 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1161 else
26932
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1162 cmd = svgconvert (opts, devopt);
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1163 if (dos_shell)
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
1164 cmd = sprintf ('%s & %s -ssp -f %s "%%s" 2> NUL', cmd, ...
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
1165 undo_string_escapes (opts.pstoedit_binary), ...
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
1166 undo_string_escapes (devopt));
26932
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1167 else
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
1168 cmd = sprintf ('%s ; %s -ssp -f %s "%%s" 2> /dev/null', cmd, ...
26932
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1169 opts.pstoedit_binary, devopt);
aa9745a1114a Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26737
diff changeset
1170 endif
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1171 endif
23991
fcf7543e0d49 Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents: 23486
diff changeset
1172
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1173 if (opts.debug)
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1174 fprintf ("pstoedit command: '%s'\n", cmd);
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1175 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
1176
11009
064aaf82222f Print via a pipeline.
Ben Abbott <bpabbott@mac.com>
parents: 10954
diff changeset
1177 endfunction
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1178
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1179 function cmd = svgconvert (opts, devopt)
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1180
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1181 cmd = "";
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1182
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1183 if (nargin < 2)
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1184 devopt = opts.devopt;
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1185 endif
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1186
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1187 if (isempty (opts.svgconvert_binary))
26936
72fab319b47d Capitalize "Octave" in warning IDs.
Rik <rik@octave.org>
parents: 26935
diff changeset
1188 warning ("Octave:print:nosvgconvert", ...
72fab319b47d Capitalize "Octave" in warning IDs.
Rik <rik@octave.org>
parents: 26935
diff changeset
1189 ["print: unable to find octave-svgconvert, ", ...
27983
44a019d01aa5 fix more spelling errors (bug #57613)
Mike Miller <mtmiller@octave.org>
parents: 27345
diff changeset
1190 "falling back to eps conversion"]);
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1191 else
26063
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1192 fontdir = getenv ("OCTAVE_FONTS_DIR");
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1193
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1194 if (isempty (fontdir))
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1195 fontdir = __octave_config_info__ ("octfontsdir");
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1196 endif
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1197
27622
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
1198 cmd = sprintf ('%s - %%s %3.2f "%s" %d "%%s"', ...
df8942d19b7b Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27347
diff changeset
1199 undo_string_escapes (opts.svgconvert_binary), ...
26063
4407b315339d print.m: Fix localization of the default font file (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26055
diff changeset
1200 get (0, "screenpixelsperinch"), ...
31798
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
1201 undo_string_escapes (fullfile (fontdir, "FreeSans.otf")),
82128f652585 print: Add option to merge only subsequent triangles with SVG toolchain (bug #63646).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31706
diff changeset
1202 opts.polymerge);
26027
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1203
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1204 if (opts.debug)
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1205 fprintf ("svgconvert command: '%s'\n", cmd);
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1206 endif
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1207 endif
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1208
98d7a111786a Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25998
diff changeset
1209 endfunction