Mercurial > octave
annotate scripts/plot/util/private/__print_parse_opts__.m @ 30308:a9de8cde1b22
Revert work-around from 7aa1994c0ca2.
* scripts/plot/util/private/__print_parse_opts__.m (__svgconv_binary__):
"archlibdir" is now a directory that can be used also on Windows (where it is
the same as "bindir"). Remove work-around.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 20 Nov 2021 18:52:33 +0100 |
parents | 7aa1994c0ca2 |
children | 512f3d68bb49 |
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 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
28388
diff
changeset
|
3 ## Copyright (C) 2010-2021 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27343
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/>. |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
7 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
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:
24370
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:
22571
diff
changeset
|
13 ## (at your option) any later version. |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
14 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22571
diff
changeset
|
18 ## GNU General Public License for more details. |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
19 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
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:
24370
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 ######################################################################## |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
25 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
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 {} {@var{args} =} __print_parse_opts__ (@var{propname}, @var{propvalue}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
28 ## @deftypefnx {} {@var{args} =} __print_parse_opts__ (@var{struct}) |
14130
e13bfbc2c4c5
__print_parse_opts__.m: Fix doc string and copyright.
Ben Abbott <bpabbott@mac.com>
parents:
13728
diff
changeset
|
29 ## Undocumented internal function. |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
30 ## @end deftypefn |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
31 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
32 function arg_st = __print_parse_opts__ (varargin) |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
33 |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
34 persistent warn_on_missing_ghostscript = true; |
11009 | 35 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
36 arg_st.append_to_file = false; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
37 arg_st.canvas_size = []; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
38 arg_st.debug = false; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
39 arg_st.debug_file = "octave-print-commands.log"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
40 arg_st.devopt = ""; |
11009 | 41 arg_st.epstool_binary = __quote_path__ (__find_binary__ ("epstool")); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
42 arg_st.figure = get (0, "currentfigure"); |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
43 arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev")); |
27007
dd31206c87c0
Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents:
26936
diff
changeset
|
44 arg_st.fontsize = []; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
45 arg_st.font = ""; |
14206
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
46 arg_st.scalefontsize = 1; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
47 arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
48 arg_st.formatted_for_printing = false; |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
49 arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ()); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
50 arg_st.ghostscript.debug = false; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
51 arg_st.ghostscript.device = ""; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
52 arg_st.ghostscript.epscrop = true; |
19567
6a9bde1ba0ea
Stop using deprecated and removed ghostscript device pswrite (bug #41141)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
53 arg_st.ghostscript.level = 2; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
54 arg_st.ghostscript.output = ""; |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
55 arg_st.ghostscript.papersize = "letter"; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
56 arg_st.ghostscript.pageoffset = []; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
57 arg_st.ghostscript.resolution = 150; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
58 arg_st.ghostscript.antialiasing = false; |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
59 arg_st.ghostscript.antialiasing_textalphabits = 4; |
22517
34f98c1e4d56
Disable anti-aliasing for graphics in raster outputs (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22488
diff
changeset
|
60 arg_st.ghostscript.antialiasing_graphicsalphabits = 1; |
11009 | 61 arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr")); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
62 arg_st.name = ""; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
63 arg_st.orientation = ""; |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
64 arg_st.pstoedit_binary = __quote_path__ (__find_binary__ ("pstoedit")); |
11009 | 65 arg_st.preview = ""; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
66 arg_st.printer = ""; |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
67 arg_st.renderer = "auto"; |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
68 arg_st.resize_flag = ""; |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
69 arg_st.rgb_output = false; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
70 arg_st.send_to_printer = false; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
71 arg_st.special_flag = "textnormal"; |
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
|
72 arg_st.svgconvert = false; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
73 arg_st.svgconvert_binary = __quote_path__ (__svgconv_binary__ ()); |
26739
0c18acaa8b58
Revert changeset 3a10bdbe6839 which is only for stable branch.
Rik <rik@octave.org>
parents:
26737
diff
changeset
|
74 arg_st.tight = true; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
75 arg_st.use_color = 0; # 0=default, -1=mono, +1=color |
11009 | 76 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
77 if (isunix ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
78 arg_st.lpr_options = "-l"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
79 elseif (ispc ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
80 arg_st.lpr_options = "-o l"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
81 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
82 arg_st.lpr_options = ""; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
83 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
84 arg_st.unlink = {}; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
85 |
11268
1ddf64be9cbd
__print_parse_opts__.m: For tests, allow __print_parse_opts__ to run with no inputs.
Ben Abbott <bpabbott@mac.com>
parents:
11253
diff
changeset
|
86 if (nargin > 0 && isfigure (varargin{1})) |
11253 | 87 arg_st.figure = varargin{1}; |
88 varargin(1) = []; | |
89 endif | |
90 | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14774
diff
changeset
|
91 for i = 1:numel (varargin) |
11009 | 92 arg = strtrim (varargin{i}); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
93 if (ischar (arg)) |
28388
56e7b2bb1dc6
Ignore empty arguments passed to print() (bug #58477).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
94 if (isempty (arg)) |
56e7b2bb1dc6
Ignore empty arguments passed to print() (bug #58477).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
95 continue; |
56e7b2bb1dc6
Ignore empty arguments passed to print() (bug #58477).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
96 elseif (strcmp (arg, "-color")) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
97 arg_st.use_color = 1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
98 elseif (strcmp (arg, "-append")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
99 arg_st.append_to_file = true; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
100 elseif (strcmp (arg, "-mono")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
101 arg_st.use_color = -1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
102 elseif (strcmp (arg, "-solid")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
103 arg_st.force_solid = 1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
104 elseif (strcmp (arg, "-dashed")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
105 arg_st.force_solid = -1; |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
106 elseif (any (strcmp (arg, {"-opengl", "-painters"}))) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
107 arg_st.renderer = arg(2:end); |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
108 elseif (strcmp (arg, "-RGBImage")) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
109 arg_st.rgb_output = true; |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
110 arg_st.renderer = "opengl"; |
17405
3f0ed69d21c6
Replace unnecessary instances of strncmp with strcmp.
Rik <rik@octave.org>
parents:
17380
diff
changeset
|
111 elseif (strncmp (arg, "-portrait", length (arg))) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
112 arg_st.orientation = "portrait"; |
17405
3f0ed69d21c6
Replace unnecessary instances of strncmp with strcmp.
Rik <rik@octave.org>
parents:
17380
diff
changeset
|
113 elseif (strncmp (arg, "-landscape", length (arg))) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
114 arg_st.orientation = "landscape"; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
115 elseif (strcmp (arg, "-loose")) |
26173
0a145a1600e3
Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents:
26104
diff
changeset
|
116 arg_st.tight = false; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
117 elseif (strcmp (arg, "-tight")) |
26173
0a145a1600e3
Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents:
26104
diff
changeset
|
118 arg_st.tight = true; |
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
|
119 elseif (strcmp (arg, "-svgconvert")) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
120 arg_st.svgconvert = true; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
121 elseif (strcmp (arg, "-textspecial")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
122 arg_st.special_flag = "textspecial"; |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
123 elseif (strcmp (arg, "-fillpage")) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
124 arg_st.resize_flag = "fillpage"; |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
125 elseif (strcmp (arg, "-bestfit")) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
126 arg_st.resize_flag = "bestfit"; |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
127 elseif (any (strcmp (arg, |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
128 {"-interchange", "-metafile", "-pict", "-tiff"}))) |
11009 | 129 arg_st.preview = arg(2:end); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
130 elseif (strncmp (arg, "-debug", 6)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
131 arg_st.debug = true; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
132 arg_st.ghostscript.debug = true; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
133 if (length (arg) > 7) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
134 arg_st.debug_file = arg(8:end); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
135 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
136 elseif (length (arg) > 2 && arg(1:2) == "-d") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
137 arg_st.devopt = tolower (arg(3:end)); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
138 elseif (length (arg) > 2 && arg(1:2) == "-P") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
139 arg_st.printer = arg; |
11009 | 140 elseif (strncmp (arg, "-EPSTOOL:", 9)) |
20950
165ba7463ca9
Fix indexing bugs in __print_parse_opts__.m (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
141 arg_st.epstool_binary = arg(10:end); |
11009 | 142 elseif (strncmp (arg, "-FIG2DEV:", 9)) |
20950
165ba7463ca9
Fix indexing bugs in __print_parse_opts__.m (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
143 arg_st.fig2dev_binary = arg(10:end); |
11009 | 144 elseif (strncmp (arg, "-PSTOEDIT:", 9)) |
20950
165ba7463ca9
Fix indexing bugs in __print_parse_opts__.m (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
145 arg_st.pstoedit_binary = arg(10:end); |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
146 elseif (strncmpi (arg, "-textalphabits=", 15)) |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
147 if (length (arg) == 16 && any (arg(end) == "124")) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
148 arg_st.ghostscript.antialiasing_textalphabits = str2double (arg(end)); |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
149 else |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14872
diff
changeset
|
150 error ("print: improper syntax, or value, for TextAlphaBits"); |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
151 endif |
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
152 elseif (strncmpi (arg, "-graphicsalphabits=", 19)) |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
153 if (numel (arg) == 20 && any (arg(end) == "124")) |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
154 arg_st.ghostscript.antialiasing_graphicsalphabits = str2double (arg(end)); |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
155 else |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14872
diff
changeset
|
156 error ("print: improper syntax, or value, for GraphicsAlphaBits"); |
14774
0d6dae0f6bc2
Allow setting of ghostscript TextAlphaBits and GraphicsAlphaBits.
John Hunt <huntj@gmx.us>
parents:
14549
diff
changeset
|
157 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
158 elseif (length (arg) > 2 && arg(1:2) == "-G") |
11300
4ecc7bc5bc83
search PATH from environment for programs, not EXEC_PATH
John W. Eaton <jwe@octave.org>
parents:
11268
diff
changeset
|
159 arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end)); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
160 if (isempty (arg_st.ghostscript.binary)) |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
161 error ('print: Ghostscript binary "%s" not found in PATH', |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
162 arg(3:end)); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
163 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
164 arg_st.ghostscript.binary = __quote_path__ (arg_st.ghostscript.binary); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
165 elseif (length (arg) > 2 && arg(1:2) == "-F") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
166 idx = rindex (arg, ":"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
167 if (idx) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
168 arg_st.font = arg(3:idx-1); |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
169 arg_st.fontsize = str2double (arg(idx+1:end)); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
170 else |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
171 arg_st.font = arg(3:end); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
172 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
173 elseif (length (arg) > 2 && arg(1:2) == "-S") |
24688
dd68506c0926
Fix print "-S" option parsing (bug #45285)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
174 arg_st.canvas_size = str2double (strsplit (arg(3:end), ",")); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
175 elseif (length (arg) > 2 && arg(1:2) == "-r") |
11333
492e7b587352
Convert print resolution from char to double.
Rik <octave@nomad.inbox5.com>
parents:
11300
diff
changeset
|
176 arg_st.ghostscript.resolution = str2double (arg(3:end)); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
177 elseif (length (arg) > 2 && arg(1:2) == "-f") |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
178 arg_st.figure = str2double (arg(3:end)); |
20038
6b78feb92f53
Accept, but warn about unimplemented Matlab print options (bug #44760).
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
179 elseif (strcmp (arg, "-noui")) |
26104
0e4b9df85361
Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents:
26103
diff
changeset
|
180 ## Accepted, but nothing needs to be done since Octave already |
0e4b9df85361
Don't issue a warning when -noui option used with print.
Rik <rik@octave.org>
parents:
26103
diff
changeset
|
181 ## excludes uicontrol objects when printing. |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
182 elseif (length (arg) >= 1 && arg(1) == "-") |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14530
diff
changeset
|
183 error ("print: unknown option '%s'", arg); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
184 elseif (length (arg) > 0) |
16488
d4ce14c19c2c
Fix print to work with filenames which begin with '~' (bug #38694).
Rik <rik@octave.org>
parents:
15624
diff
changeset
|
185 arg_st.name = tilde_expand (arg); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
186 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
187 elseif (isfigure (arg)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
188 arg_st.figure = arg; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
189 else |
20711
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20231
diff
changeset
|
190 error ("print: first argument must be string or figure handle"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
191 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
192 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
193 |
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
|
194 ## Resolution |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
195 if (arg_st.ghostscript.resolution == 0) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
196 ## Do as Matlab does. |
14530
93cb513ed5fc
Fix regression after 3.4.0 with '-r0' option to print (bug #36092).
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
197 arg_st.ghostscript.resolution = get (0, "screenpixelsperinch"); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
198 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
199 |
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
|
200 ## Orientation |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
201 if (isempty (arg_st.orientation)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
202 if (isfigure (arg_st.figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
203 arg_st.orientation = get (arg_st.figure, "paperorientation"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
204 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
205 ## Allows tests to be run without error. |
10861 | 206 arg_st.orientation = "portrait"; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
207 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
208 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
209 |
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
|
210 ## The device is infered from extension if not provided |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
211 dot = rindex (arg_st.name, "."); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
212 if (isempty (arg_st.devopt)) |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
213 if (arg_st.rgb_output) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
214 arg_st.devopt = "png"; |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
215 elseif (dot == 0) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
216 arg_st.devopt = "psc"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
217 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
218 arg_st.devopt = tolower (arg_st.name(dot+1:end)); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
219 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
220 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
221 |
26934
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
222 ## Warn about deprecated output formats |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
223 persistent unsupported = {"aifm", "ill","cdr", "corel", ... |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
224 "hpgl", "mf", "cgm", "dxf"} |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
225 |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
226 if (any (strcmp (unsupported, arg_st.devopt))) |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
227 warning ('Octave:print:deprecated-format', |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
228 'print: "%s" format is no more officially supported', ... |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
229 arg_st.devopt); |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
230 endif |
1771bed38482
Remove some formats from the list of supported formats (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26739
diff
changeset
|
231 |
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
|
232 ## By default, postprocess svg files using svgconvert. |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
233 if (strcmp (arg_st.devopt, "svg")) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
234 arg_st.svgconvert = true; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
235 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
|
236 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
237 ## By default, use the "opengl" renderer for all raster outputs |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
238 ## supported by "imwrite". |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
239 fmts = imformats (); |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
240 persistent gl_devlist = [fmts(! cellfun (@isempty, {fmts.write})).ext, ... |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
241 "tiffn"]; |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
242 opengl_ok = any (strcmp (gl_devlist, arg_st.devopt)); |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
243 |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
244 if (strcmp (arg_st.renderer, "auto") |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
245 && strcmp (get (arg_st.figure, "renderermode"), "manual")) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
246 arg_st.renderer = get (arg_st.figure, "renderer"); |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
247 endif |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
248 |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
249 if (strcmp (arg_st.renderer, "auto")) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
250 if (opengl_ok && strcmp (graphics_toolkit (arg_st.figure), "qt")) |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
251 arg_st.renderer = "opengl"; |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
252 else |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
253 arg_st.renderer = "painters"; |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
254 endif |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
255 elseif (strcmp (arg_st.renderer, "opengl") && ! opengl_ok) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
256 arg_st.renderer = "painters"; |
26567
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
257 warning (['print: unsupported output format "%s" for renderer ', ... |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
258 '"opengl".'], arg_st.devopt); |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
259 elseif (! strcmp (graphics_toolkit (arg_st.figure), "qt") |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
260 && strcmp (arg_st.renderer, "opengl")) |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
261 ## The opengl renderer only works with the "qt" toolkit |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
262 arg_st.renderer = "painters"; |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
263 warning ('Octave:print:unsupported-renderer', |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
264 'print: "opengl" renderer unsupported for "%s" toolkit', |
bf05a7c16e9e
Choose "painters" renderer when printing rotated text (bug #55485)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
265 graphics_toolkit (arg_st.figure)); |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
266 endif |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
267 |
26617
98afb8bbd1f6
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
26567
diff
changeset
|
268 |
10918
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
269 if (arg_st.use_color == 0) |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
270 if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt))) |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
271 arg_st.use_color = -1; |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
272 else |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
273 arg_st.use_color = 1; |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
274 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
275 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
276 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
277 if (strcmp (arg_st.devopt, "tex")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
278 arg_st.devopt = "epslatex"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
279 elseif (strcmp (arg_st.devopt, "ill")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
280 arg_st.devopt = "aifm"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
281 elseif (strcmp (arg_st.devopt, "cdr")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
282 arg_st.devopt = "corel"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
283 elseif (strcmp (arg_st.devopt, "meta")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
284 arg_st.devopt = "emf"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
285 elseif (strcmp (arg_st.devopt, "jpg")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
286 arg_st.devopt = "jpeg"; |
25582
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
287 elseif (strcmp (arg_st.devopt, "tif")) |
0df6454f58ea
print.m: Allow 'tif' to indicate 'tiff' format (bug #54282).
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
288 arg_st.devopt = "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
|
289 elseif (strcmp (arg_st.devopt, "pdfcrop")) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
290 arg_st.devopt = "pdfwrite"; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
291 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
292 |
26191
f41494a4977f
Add "dumb" terminal to produce ASCII art with gnuplot (patch #8203).
Rüdiger Sonderfeld <ruediger@c-plusplus.de>
parents:
26173
diff
changeset
|
293 persistent dev_list = [{"aifm", "corel", "dumb", "fig", "png", "jpeg", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
294 "gif", "pbm", "pbmraw", "dxf", "mf", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
295 "svg", "hpgl", "ps", "ps2", "psc", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
296 "psc2", "eps", "eps2", "epsc", "epsc2", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
297 "emf", "pdf", "pslatex", "epslatex", "epslatexstandalone", ... |
10861 | 298 "pslatexstandalone", "pdflatexstandalone", ... |
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
|
299 "pstex", "tiff", "tiffn", "tikz", "tikzstandalone", "pcxmono", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
300 "pcx24b", "pcx256", "pcx16", "pgm", "pgmraw", ... |
11009 | 301 "ppm", "ppmraw", "pdflatex", "texdraw", ... |
22571
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22533
diff
changeset
|
302 "epscairo", "pdfcairo", "pngcairo", "cairolatex", ... |
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22533
diff
changeset
|
303 "pdfcairolatex", "pdfcairolatexstandalone", ... |
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22533
diff
changeset
|
304 "epscairolatex", "epscairolatexstandalone", "pstricks", ... |
25307
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
305 "epswrite", "eps2write", "pswrite", "ps2write", "pdfwrite", ... |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
306 "canvas", "cgm", "latex", "eepic"}, gl_devlist]; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
307 |
26191
f41494a4977f
Add "dumb" terminal to produce ASCII art with gnuplot (patch #8203).
Rüdiger Sonderfeld <ruediger@c-plusplus.de>
parents:
26173
diff
changeset
|
308 persistent suffixes = [{"ai", "cdr", "txt", "fig", "png", "jpg", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
309 "gif", "pbm", "pbm", "dxf", "mf", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
310 "svg", "hpgl", "ps", "ps", "ps", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
311 "ps", "eps", "eps", "eps", "eps", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
312 "emf", "pdf", "tex", "tex", "tex", ... |
10861 | 313 "tex", "tex", ... |
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
|
314 "ps", "tiff", "tiff", "tikz", "tikz", "pcx", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
315 "pcx", "pcx", "pcx", "pgm", "pgm", ... |
11009 | 316 "ppm", "ppm", "tex", "tex", ... |
22571
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22533
diff
changeset
|
317 "eps", "pdf", "png", "tex", ... |
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22533
diff
changeset
|
318 "tex", "tex", ... |
83f106bfcb37
Make "pdflatex" an alias of "pdfcairolatex" for gnuplot toolkit print (bug #49223).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22533
diff
changeset
|
319 "tex", "tex", "tex", ... |
25307
f2eb8bfcccb6
Use consistent gnuplot toolkit font syntax allow SVG fractional font size (bug #53737)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25054
diff
changeset
|
320 "eps", "eps", "ps", "ps", "pdf", ... |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
321 "js", "cgm", "tex", "tex"}, gl_devlist]; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
322 |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
323 if (isfigure (arg_st.figure)) |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
324 __graphics_toolkit__ = get (arg_st.figure, "__graphics_toolkit__"); |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
325 else |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
326 ## Allow tests when no figures are present. |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
327 __graphics_toolkit__ = get (0, "defaultfigure__graphics_toolkit__"); |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
328 endif |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
329 |
22488
a666e3ee6af8
Require gnuplot 4.4 as mininimum supported version.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
330 if (strcmp (__graphics_toolkit__, "gnuplot")) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
331 suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"}; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
332 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
333 |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
334 unknown_device = true; |
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
335 default_suffix = ""; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
336 match = strcmpi (dev_list, arg_st.devopt); |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
337 if (any (match)) |
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
338 unknown_device = false; |
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
339 default_suffix = suffixes{match}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
340 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
341 |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
342 if (dot == 0 && ! isempty (arg_st.name) && ! isempty (default_suffix)) |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
343 arg_st.name = [arg_st.name "." default_suffix]; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
344 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
345 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
346 if (arg_st.append_to_file) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
347 if (isempty (arg_st.name)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
348 arg_st.append_to_file = false; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
349 elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ... |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
350 "ps", "ps2", "psc", "psc2", "pdf"}))) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
351 have_ghostscript = ! isempty (__ghostscript_binary__ ()); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
352 if (have_ghostscript) |
25781
e04c56bbbace
isdir.m: Make m-file a legacy function (bug #54489)
Rik <rik@octave.org>
parents:
25626
diff
changeset
|
353 file_exists = (numel (dir (arg_st.name)) == 1 |
e04c56bbbace
isdir.m: Make m-file a legacy function (bug #54489)
Rik <rik@octave.org>
parents:
25626
diff
changeset
|
354 && ! isfolder (arg_st.name)); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
355 if (! file_exists) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
356 arg_st.append_to_file = false; |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11031
diff
changeset
|
357 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
358 else |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
359 arg_st.append_to_file = false; |
27059
2bf6dcb1563c
Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents:
27007
diff
changeset
|
360 warning ("print: appended output requires Ghostscript to be installed"); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
361 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
362 else |
27059
2bf6dcb1563c
Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents:
27007
diff
changeset
|
363 warning ("print: appended output is not supported for device '%s'", |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
364 arg_st.devopt); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
365 arg_st.append_to_file = false; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
366 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
367 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
368 |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
369 if (arg_st.rgb_output) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
370 if (! isempty (arg_st.printer) || ! isempty (arg_st.name)) |
26936 | 371 warning ("Octave:print:ignored_argument", |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
372 "print: ignoring file name and printer argument when using -RGBImage option"); |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
373 endif |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
374 elseif (! isempty (arg_st.printer) || isempty (arg_st.name)) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
375 arg_st.send_to_printer = true; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
376 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
377 |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
378 if (any (strcmp (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"}))) |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
379 arg_st.formatted_for_printing = true; |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
380 endif |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
381 |
27343
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
382 aliases = gs_aliases (arg_st.svgconvert); |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
383 if (any (strcmp (arg_st.devopt, fieldnames (aliases))) |
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
384 && ! strcmp (arg_st.renderer, "opengl")) |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
385 arg_st.devopt = aliases.(arg_st.devopt); |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
386 unknown_device = false; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
387 endif |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
388 |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
389 if ((any (strcmp (arg_st.devopt, gs_device_list)) |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
390 && ! arg_st.formatted_for_printing) |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
391 || any (strcmp (arg_st.devopt, {"pswrite", "ps2write", "pdfwrite"}))) |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
392 unknown_device = false; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
393 ## Use ghostscript for graphic formats |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
394 arg_st.ghostscript.device = arg_st.devopt; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
395 arg_st.ghostscript.output = arg_st.name; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
396 arg_st.ghostscript.antialiasing = true; |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
397 if (arg_st.formatted_for_printing) |
26173
0a145a1600e3
Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents:
26104
diff
changeset
|
398 arg_st.ghostscript.epscrop = arg_st.tight; |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
399 else |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
400 ## pstoedit throws errors if the EPS file isn't cropped |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
401 arg_st.ghostscript.epscrop = true; |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
402 endif |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
403 elseif (all (! strcmp (arg_st.devopt, dev_list))) |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
404 ## Assume we are formatting output for a printer |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
405 arg_st.formatted_for_printing = true; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
406 arg_st.ghostscript.device = arg_st.devopt; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
407 arg_st.ghostscript.output = arg_st.name; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
408 arg_st.ghostscript.antialiasing = false; |
26173
0a145a1600e3
Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents:
26104
diff
changeset
|
409 arg_st.ghostscript.epscrop = arg_st.tight; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
410 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
411 |
25583
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
412 if (unknown_device) |
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
413 error ("print: unknown device %s", arg_st.devopt); |
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
414 endif |
18148dc92122
Fix regression in 4.2.0 which disallowed printing with some Ghostscript devices.
Rik <rik@octave.org>
parents:
25307
diff
changeset
|
415 |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
416 if (arg_st.resize_flag) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
417 if (! (arg_st.send_to_printer || arg_st.formatted_for_printing |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
418 || strncmp (arg_st.devopt, "pdf", 3) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
419 || strncmp (arg_st.devopt, "ps", 2))) |
28905
89a425f2c202
maint: Use Octave convention that error() messages don't end with a period.
Rik <rik@octave.org>
parents:
28390
diff
changeset
|
420 error ("print: the '%s' option is only valid for page formats and printers", arg_st.resize_flag); |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
421 endif |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
422 endif |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
423 |
17380
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
424 if (arg_st.send_to_printer) |
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
425 if (isempty (arg_st.name)) |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
426 ## Pipe the ghostscript output |
17380
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
427 arg_st.name = "-"; |
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
428 else |
21385
89fa0694aa2e
Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents:
20950
diff
changeset
|
429 error ("print: a filename may not specified when spooling to a printer"); |
17380
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
430 endif |
18601
077575fe9a7e
__print_parse_opts__.m: Add ')' missing in cset cdc16fbb513f.
Rik <rik@octave.org>
parents:
18600
diff
changeset
|
431 if (! any (strcmp (arg_st.devopt, gs_device_list))) |
18600
cdc16fbb513f
Allow only Ghostscript devices when spooling to a printer (bug #41957)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
432 ## Only supported ghostscript devices |
21385
89fa0694aa2e
Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents:
20950
diff
changeset
|
433 error ("print: format must be a valid Ghostscript format for spooling to a printer"); |
17380
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
434 endif |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25781
diff
changeset
|
435 elseif (isempty (arg_st.name) && ! arg_st.rgb_output) |
21385
89fa0694aa2e
Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents:
20950
diff
changeset
|
436 error ("print: an output filename must be specified"); |
17380
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
437 endif |
50794f5e2323
Set gs sOutputFile option to "-" when spooling to the system printer.
Ben Abbott <bpabbott@mac.com>
parents:
17174
diff
changeset
|
438 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
439 if (isempty (arg_st.canvas_size)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
440 if (isfigure (arg_st.figure)) |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
441 [arg_st.ghostscript.papersize, papersize_points, paperposition] = ... |
11009 | 442 gs_papersize (arg_st.figure, arg_st.orientation); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
443 else |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
444 ## allows BIST tests to be run |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
445 arg_st.ghostscript.papersize = "letter"; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
446 paperposition = [0.25, 2.50, 8.00, 6.00] * 72; |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
447 papersize_points = [8.5, 11.0] * 72; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
448 endif |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
449 |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
450 ## resize paper |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
451 if (arg_st.resize_flag) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
452 if (strcmp (arg_st.resize_flag, "fillpage")) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
453 ## leave a 0.25 inch margin on all sides of the page. |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
454 paperposition = [0.25 * 72, 0.25 * 72, ... |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
455 papersize_points(1) - 0.5*72, ... |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
456 papersize_points(2) - 0.5*72]; |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
457 elseif (strcmp (arg_st.resize_flag, "bestfit")) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
458 ## leaves a minimum page margin of 0.25 inches |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
459 if (paperposition(3) > paperposition(4)) |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
460 fit_scale = papersize_points(1) / paperposition(3); |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
461 else |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
462 fit_scale = papersize_points(2) / paperposition(4); |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
463 endif |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
464 paperposition = [(papersize_points(1) - fit_scale*paperposition(3)) * 0.5, ... |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
465 (papersize_points(2) - fit_scale*paperposition(4)) * 0.5, ... |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
466 fit_scale * paperposition(3), ... |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
467 fit_scale * paperposition(4)]; |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
468 endif |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
469 endif |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
470 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
471 arg_st.canvas_size = paperposition(3:4); |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
472 if (strcmp (__graphics_toolkit__, "gnuplot") |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
473 && ! arg_st.ghostscript.epscrop) |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
474 arg_st.ghostscript.pageoffset = paperposition(1:2) - 50; |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
475 else |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
476 arg_st.ghostscript.pageoffset = paperposition(1:2); |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
477 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
478 else |
27007
dd31206c87c0
Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents:
26936
diff
changeset
|
479 ## Size specified with -S option |
dd31206c87c0
Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents:
26936
diff
changeset
|
480 if (arg_st.ghostscript.resolution != 150) |
dd31206c87c0
Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents:
26936
diff
changeset
|
481 warning ("print: '-Sxsize,ysize' overrides resolution option -r\n"); |
14206
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
482 endif |
27007
dd31206c87c0
Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents:
26936
diff
changeset
|
483 arg_st.scalefontsize = arg_st.canvas_size(1) / ... |
dd31206c87c0
Fix scaling of fonts when printing with -Sxsz,ysz option (bug #55907).
Rik <rik@octave.org>
parents:
26936
diff
changeset
|
484 6 / get (0, "screenpixelsperinch"); |
14206
df695e37d404
Make sure "print '-SX,Y' ..." doesn't round down a pixel. Bug # 35307.
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
485 arg_st.ghostscript.resolution = 72; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
486 arg_st.ghostscript.papersize = arg_st.canvas_size; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
487 arg_st.ghostscript.epscrop = true; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
488 arg_st.ghostscript.pageoffset = [0, 0]; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
489 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
490 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
491 if (arg_st.formatted_for_printing) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
492 arg_st.ghostscript.resolution = []; |
29442
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
493 |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
494 ## Warn if the figure is too large for the selected paper size |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
495 if (any (papersize_points < (arg_st.canvas_size + paperposition(1:2))) |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
496 || any (paperposition(1:2) < 0)) |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
497 warning ("Octave:print:figure-too-large", ... |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
498 ['print: given the current "paperposition" and ', ... |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
499 '"papersize" properties, the figure is too large ', ... |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
500 "and will be cropped to fit on the output page."]); |
3a27122022f7
print.m: Warn when figure is too large to be printed to output page (bug #60236)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29358
diff
changeset
|
501 endif |
11009 | 502 else |
503 arg_st.ghostscript.papersize = ""; | |
504 arg_st.ghostscript.pageoffset = [0, 0]; | |
505 endif | |
506 | |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
507 if (warn_on_missing_ghostscript) |
11009 | 508 if (isempty (arg_st.ghostscript.binary)) |
27068
2cede23e44c3
Warn gently if ghostscript binary is missing (bug #56201).
Rik <rik@octave.org>
parents:
27059
diff
changeset
|
509 warning ("print:nogs", ... |
2cede23e44c3
Warn gently if ghostscript binary is missing (bug #56201).
Rik <rik@octave.org>
parents:
27059
diff
changeset
|
510 "print: 'gs' (Ghostscript) binary is not available. Many formats may not be available\n"); |
11009 | 511 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
512 warn_on_missing_ghostscript = false; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
513 endif |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
514 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
515 endfunction |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
516 |
21759
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
517 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
518 ## Test blocks are not allowed (and not needed) for private functions |
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
519 #%!test |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
520 %! opts = __print_parse_opts__ (); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
521 %! assert (opts.devopt, "pswrite"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
522 %! assert (opts.use_color, 1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
523 %! assert (opts.send_to_printer, true); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
524 %! assert (opts.canvas_size, [576, 432]); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
525 %! assert (opts.ghostscript.device, "pswrite"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
526 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
527 #%!test |
10861 | 528 %! opts = __print_parse_opts__ ("test.pdf", "-S640,480"); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
529 %! assert (opts.canvas_size, [307.2, 230.4], 0.1); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
530 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
531 #%!test |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
532 %! opts = __print_parse_opts__ ("-dpsc", "-append", "-loose"); |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
533 %! assert (opts.devopt, "pswrite"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
534 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
535 %! assert (opts.use_color, 1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
536 %! assert (opts.append_to_file, false); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
537 %! assert (opts.ghostscript.device, "pswrite"); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
538 %! assert (opts.ghostscript.epscrop, false); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
539 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
540 #%!test |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
541 %! opts = __print_parse_opts__ ("-deps", "-tight"); |
26173
0a145a1600e3
Use -tight option by default when printing EPS files (bug #53535).
Rik <rik@octave.org>
parents:
26104
diff
changeset
|
542 %! assert (opts.tight, true); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
543 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
544 %! assert (opts.use_color, -1); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
545 %! assert (opts.ghostscript.device, ""); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
546 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
547 #%!test |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
548 %! opts = __print_parse_opts__ ("-djpg", "foobar", "-mono", "-loose"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
549 %! assert (opts.devopt, "jpeg"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
550 %! assert (opts.name, "foobar.jpg"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
551 %! assert (opts.ghostscript.device, "jpeg"); |
11031
d81b6144c4ba
__print_parse_opts__.m: Fix test.
Ben Abbott <bpabbott@mac.com>
parents:
11027
diff
changeset
|
552 %! assert (opts.ghostscript.epscrop, true); |
11009 | 553 %! assert (opts.ghostscript.papersize, ""); |
554 %! assert (opts.ghostscript.pageoffset, [0, 0]); | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
555 %! assert (opts.send_to_printer, false); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
556 %! assert (opts.printer, ""); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
557 %! assert (opts.use_color, -1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
558 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
559 #%!test |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
560 %! opts = __print_parse_opts__ ("-ddeskjet", "foobar", "-mono", "-Pmyprinter"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
561 %! assert (opts.ghostscript.output, "foobar.deskjet"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
562 %! assert (opts.ghostscript.device, "deskjet"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
563 %! assert (opts.devopt, "deskjet"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
564 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
565 %! assert (opts.printer, "-Pmyprinter"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
566 %! assert (opts.use_color, -1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
567 |
12793
6f91ca83d2be
codesprint : Make many plot helper functions private.
Rik <octave@nomad.inbox5.com>
parents:
12460
diff
changeset
|
568 #%!test |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
569 %! opts = __print_parse_opts__ ("-f5", "-dljet3"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
570 %! assert (opts.ghostscript.device, "ljet3"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
571 %! assert (strfind (opts.ghostscript.output, ".ljet3")); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
572 %! assert (opts.devopt, "ljet3"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
573 %! assert (opts.send_to_printer, true); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14206
diff
changeset
|
574 %! assert (opts.figure, 5); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
575 |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
576 function cmd = __quote_path__ (cmd) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
577 |
14403
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
578 if (! isempty (cmd)) |
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
579 is_quoted = all (cmd([1, end]) == "'"); |
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
580 if (! is_quoted) |
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
581 dos_shell = ! isunix () && ispc (); |
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
582 if (dos_shell && any (cmd == "/")) |
24370
b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents:
23991
diff
changeset
|
583 cmd = strrep (cmd, '/', '\'); |
14403
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
584 endif |
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
585 if (any (cmd == " ")) |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
586 cmd = ['"' strrep(cmd, '"', '""') '"']; |
14403
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
587 endif |
61cc4c715962
Replace file-separater "/" with "\" for MinGW MSYS shell.
Ben Abbott <bpabbott@mac.com>
parents:
14366
diff
changeset
|
588 endif |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
589 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
590 |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
591 endfunction |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
592 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
593 function gs = __ghostscript_binary__ () |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
594 |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
595 persistent ghostscript_binary = ""; |
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
596 persistent warn_on_bad_gsc = true; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
597 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
598 if (isempty (ghostscript_binary)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
599 GSC = getenv ("GSC"); |
11300
4ecc7bc5bc83
search PATH from environment for programs, not EXEC_PATH
John W. Eaton <jwe@octave.org>
parents:
11268
diff
changeset
|
600 if (exist (GSC, "file") |
4ecc7bc5bc83
search PATH from environment for programs, not EXEC_PATH
John W. Eaton <jwe@octave.org>
parents:
11268
diff
changeset
|
601 || (! isempty (GSC) && file_in_path (getenv ("PATH"), GSC))) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
602 gs_binaries = {GSC}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
603 elseif (! isempty (GSC) && warn_on_bad_gsc) |
26936 | 604 warning ("Octave:print:badgscenv", |
605 "print: GSC environment variable not set properly"); | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
606 warn_on_bad_gsc = false; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
607 gs_binaries = {}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
608 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
609 gs_binaries = {}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
610 endif |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
611 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
612 if (isunix ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
613 ## Unix - Includes Mac OSX and Cygwin. |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
614 gs_binaries = [gs_binaries, {"gs", "gs.exe"}]; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
615 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
616 ## pc - Includes Win32 and mingw. |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
617 gs_binaries = [gs_binaries, ... |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
618 {"gs.exe", "gswin32c.exe", "gswin64c.exe", "mgs.exe"}]; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
619 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
620 n = 0; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
621 while (n < numel (gs_binaries) && isempty (ghostscript_binary)) |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
622 ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{++n}); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
623 endwhile |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
624 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
625 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
626 gs = ghostscript_binary; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
627 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
628 endfunction |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
629 |
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
|
630 function bin = __svgconv_binary__ () |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
631 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
632 persistent binary = ""; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
633 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
634 if (isempty (binary)) |
29464
7aa1994c0ca2
Prefer "octave-svgconvert" in "bin" directory on Windows (bug #59546).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29443
diff
changeset
|
635 ## default installation location is the archlib directory |
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
|
636 bindir = getenv ("OCTAVE_ARCHLIBDIR"); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
637 if (isempty (bindir)) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
638 bindir = __octave_config_info__ ("archlibdir"); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
639 endif |
26617
98afb8bbd1f6
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
26567
diff
changeset
|
640 |
29464
7aa1994c0ca2
Prefer "octave-svgconvert" in "bin" directory on Windows (bug #59546).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29443
diff
changeset
|
641 binary = fullfile (bindir, ... |
7aa1994c0ca2
Prefer "octave-svgconvert" in "bin" directory on Windows (bug #59546).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29443
diff
changeset
|
642 ["octave-svgconvert", ... |
7aa1994c0ca2
Prefer "octave-svgconvert" in "bin" directory on Windows (bug #59546).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29443
diff
changeset
|
643 __octave_config_info__("EXEEXT")]); |
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
|
644 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
645 if (! exist (binary, "file")) |
29464
7aa1994c0ca2
Prefer "octave-svgconvert" in "bin" directory on Windows (bug #59546).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29443
diff
changeset
|
646 binary = ""; |
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
|
647 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
|
648 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
|
649 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
650 bin = binary; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
651 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
652 endfunction |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
653 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
654 function bin = __find_binary__ (binary) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
655 |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
656 persistent data = struct (); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
657 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
658 if (! isfield (data, binary)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
659 data.(binary).bin = ""; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
660 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
661 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
662 if (isempty (data.(binary).bin)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
663 if (isunix ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
664 ## Unix - Includes Mac OSX and Cygwin. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
665 binaries = strcat (binary, {"", ".exe"}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
666 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
667 ## pc - Includes Win32 and mingw. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
668 binaries = strcat (binary, {".exe"}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
669 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
670 n = 0; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
671 while (n < numel (binaries) && isempty (data.(binary).bin)) |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
672 data.(binary).bin = file_in_path (getenv ("PATH"), binaries{++n}); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
673 endwhile |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
674 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
675 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
676 bin = data.(binary).bin; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
677 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
678 endfunction |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
679 |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
680 function [papersize, papersize_points, paperposition] = gs_papersize (hfig, paperorientation) |
23991
fcf7543e0d49
Only print warning messages about missing print tools when needed (bug #44152).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
681 persistent papertypes papersizes; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
682 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
683 if (isempty (papertypes)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
684 papertypes = {"usletter", "uslegal", "a0", "a1", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
685 "a2", "a3", "a4", "a5", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
686 "b0", "b1", "b2", "b3", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
687 "b4", "b5", "arch-a", "arch-b", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
688 "arch-c", "arch-d", "arch-e", "a", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
689 "b", "c", "d", "e", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
690 "tabloid"}; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
691 papersizes = [ 8.5, 11.0; 8.5, 14.0; 33.1, 46.8; 23.4, 33.1; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
692 16.5, 23.4; 11.7, 16.5; 8.3, 11.7; 5.8, 8.3; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
693 39.4, 55.7; 27.8, 39.4; 19.7, 27.8; 13.9, 19.7; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
694 9.8, 13.9; 6.9, 9.8; 9.0, 12.0; 12.0, 18.0; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
695 18.0, 24.0; 24.0, 36.0; 36.0, 48.0; 8.5, 11.0; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
696 11.0, 17.0; 18.0, 24.0; 24.0, 36.0; 36.0, 48.0; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
697 11.0, 17.0] * 72; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
698 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
699 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
700 papertype = get (hfig, "papertype"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
701 paperunits = get (hfig, "paperunits"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
702 paperposition = get (hfig, "paperposition"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
703 if (strcmp (papertype, "<custom>")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
704 papersize = get (hfig, "papersize"); |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
705 papersize = convert2points (papersize, paperunits); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
706 else |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
707 papersize = papersizes(strcmp (papertypes, papertype), :); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
708 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
709 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
710 if (strcmp (paperunits, "normalized")) |
20231
83792dd9bcc1
Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
711 paperposition .*= papersize([1,2,1,2]); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
712 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
713 paperposition = convert2points (paperposition, paperunits); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
714 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
715 |
18857
7bbe3658c5ef
maint: Use "FIXME:" coding convention in m-files.
Rik <rik@octave.org>
parents:
18601
diff
changeset
|
716 ## FIXME: This will be obsoleted by listeners for paper properties. |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
717 ## papersize is tall when portrait, and wide when landscape. |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
718 if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
719 || (papersize(1) < papersize(2) && strcmpi (paperorientation, "landscape"))) |
14872
c2dbdeaa25df
maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents:
14868
diff
changeset
|
720 papersize = papersize([2,1]); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
721 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
722 |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
723 ## papersize is now [h,w] and measured in points. |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
724 ## Return it for possible resize outside of this function. |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
725 papersize_points = papersize; |
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
726 |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
727 if (! strcmp (papertype, "<custom>") |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
728 && (strcmp (paperorientation, "portrait"))) |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
729 ## For portrait use the ghostscript name |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
730 papersize = papertype; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
731 papersize(papersize=="-") = ""; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
732 papersize = strrep (papersize, "us", ""); |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
733 switch (papersize) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
734 case "a" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
735 papersize = "letter"; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
736 case {"b", "tabloid"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
737 papersize = "11x17"; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
738 case {"c", "d", "e"} |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
739 papersize = ["arch" papersize]; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
740 endswitch |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
741 if (strncmp (papersize, "arch", 4)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
742 papersize(end) = upper (papersize(end)); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
743 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
744 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
745 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
746 endfunction |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
747 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
748 function value = convert2points (value, units) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
749 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
750 switch (units) |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
751 case "inches" |
20231
83792dd9bcc1
Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
752 value *= 72; |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
753 case "centimeters" |
26103
9cfbe7688368
Add -fillpage and -bestfit print options (bug #52838).
Jun Wang <jstzwj@aliyun.com>
parents:
26027
diff
changeset
|
754 value *= (72 / 2.54); |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
755 case "normalized" |
27069
0a62d9a6aa2d
Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents:
27068
diff
changeset
|
756 error ("Octave:print:customnormalized", |
27059
2bf6dcb1563c
Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents:
27007
diff
changeset
|
757 "print: papersize=='<custom>' and paperunits='normalized' may not be combined"); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
16488
diff
changeset
|
758 endswitch |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
759 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
760 endfunction |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
761 |
22767
212333a97d8d
maint: Remove dangling ';' from m-file function declarations.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
762 function device_list = gs_device_list () |
19568
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
763 ## Graphics formats/languages, not printers. |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
764 device_list = {"bmp16"; "bmp16m"; "bmp256"; "bmp32b"; "bmpgray"; ... |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
765 "epswrite"; "eps2write"; "jpeg"; "jpegcymk"; "jpeggray"; |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
766 "pbm"; "pbmraw"; "pcx16"; "pcx24b"; "pcx256"; "pcx2up"; ... |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
767 "pcxcmyk"; "pcxgray"; "pcxmono"; "pdfwrite"; "pgm"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
768 "pgmraw"; "pgnm"; "pgnmraw"; "png16"; "png16m"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
769 "png256"; "png48"; "pngalpha"; "pnggray"; "pngmono"; ... |
25626
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
770 "pnm"; "pnmraw"; "ppm"; "ppmraw"; "pswrite"; "ps2write"; ... |
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
771 "tiff12nc"; "tiff24nc"; "tiff32nc"; "tiff48nc"; ... |
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
772 "tiff64nc"; "tiffcrle"; "tiffg3"; "tiffg32d"; "tiffg4"; ... |
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
773 "tiffgray"; "tifflzw"; "tiffpack"; "tiffscaled"; ... |
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
774 "tiffscaled24"; "tiffscaled32"; "tiffscaled4"; ... |
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
775 "tiffscaled8"; "tiffsep"; "tiffsep1" }; |
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
776 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
777 endfunction |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
778 |
27343
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
779 function aliases = gs_aliases (do_eps) |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
780 |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
781 ## Ghostscript device names |
19568
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
782 aliases.bmp = "bmp32b"; |
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
783 aliases.pdf = "pdfwrite"; |
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
784 aliases.png = "png16m"; |
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
785 aliases.ps = "ps2write"; |
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
786 aliases.ps2 = "ps2write"; |
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
787 aliases.psc = "ps2write"; |
f88ee85d4da9
Restore valid uses of pswrite device in cset a402493c0605.
Rik <rik@octave.org>
parents:
19567
diff
changeset
|
788 aliases.psc2 = "ps2write"; |
25626
306e2ce55f27
Use compression by default for printing TIFF images (bug #54290).
Rik <rik@octave.org>
parents:
25584
diff
changeset
|
789 aliases.tiff = "tiffscaled24"; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
790 aliases.tiffn = "tiff24nc"; |
27343
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
791 |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
792 if (do_eps) |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
793 aliases.eps = "ps2write"; |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
794 aliases.eps2 = "ps2write"; |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
795 aliases.epsc = "ps2write"; |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
796 aliases.epsc2 = "ps2write"; |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
797 endif |
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
798 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
799 endfunction |