Mercurial > octave
annotate scripts/plot/util/private/__opengl_print__.m @ 30198:a87e5f9d5446
improve graphics toolkit rendering failure error message
* __check_rendering_capability__.m: New function.
* getframe.m, __opengl_print__.m: Use it.
* scripts/plot/util/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 21 Sep 2021 12:30:32 -0400 |
parents | 7854d5752dd2 |
children | 1830a8f85476 |
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:
27957
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:
27622
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:
24221
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:
24221
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:
22323
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:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
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:
24221
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 {} {} __opengl_print__ (@var{@dots{}}) |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
28 ## Undocumented internal function. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
29 ## @end deftypefn |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
30 |
19640
3b0b4d55002d
rename __fltk_print__.m to __opengl_print__.m
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
31 function opts = __opengl_print__ (opts) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
32 |
11009 | 33 dos_shell = (ispc () && ! isunix ()); |
34 | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
35 if (! isempty (opts.fig2dev_binary)) |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
26932
diff
changeset
|
36 ## fig2dev is preferred for conversion to emf |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
37 fig2dev_devices = {"pstex", "mf", "emf"}; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
38 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
39 fig2dev_devices = {"pstex", "mf"}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
40 endif |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
41 |
11009 | 42 gl2ps_device = {}; |
43 pipeline = {}; | |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11009
diff
changeset
|
44 switch (lower (opts.devopt)) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
45 case {"eps", "eps2", "epsc", "epsc2"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
46 ## format GL2PS_EPS |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
47 gl2ps_device = {"eps"}; |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17174
diff
changeset
|
48 ## FIXME: use epstool to tighten bbox and provide preview. |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
49 pipeline = {opts.epstool_cmd(opts, "-", opts.name)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
50 case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ... |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
51 "pslatexstandalone", "pdflatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
52 ## format GL2PS_TEX |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
53 n = find (opts.devopt == "l", 1); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
54 suffix = opts.devopt(1:n-1); |
20444
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
55 [ndir, name, ext] = fileparts (opts.name); |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
56 if (isempty (ext)) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
57 ext = "tex"; |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
58 else |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
59 ext = ext(2:end); # remove leading '.' |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
60 endif |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
61 if (any (strcmpi (ext, {suffix, "tex"}))) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
62 name = fullfile (ndir, name); |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
63 if (any (strcmpi (ext, {"eps", "ps", "pdf"}))) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
64 suffix = ext; # If user provides eps/ps/pdf suffix, use it. |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
65 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
66 else |
27069
0a62d9a6aa2d
Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents:
27068
diff
changeset
|
67 error ("Octave:print:invalid-suffix", |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
68 "invalid suffix '%s' for device '%s'.", |
20444
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
69 ext, lower (opts.devopt)); |
10861 | 70 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
71 gl2ps_device = {sprintf("%snotxt", lower (suffix))}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
72 gl2ps_device{2} = "tex"; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
73 if (dos_shell) |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17174
diff
changeset
|
74 ## FIXME: this will only work on MinGW with the MSYS shell |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
75 pipeline = {sprintf('cat > "%s-inc.%s"', name, suffix)}; |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
76 pipeline{2} = sprintf ('cat > "%s.tex"', name); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
77 else |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
78 pipeline = {sprintf('cat > "%s-inc.%s"', name, suffix)}; |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
79 pipeline{2} = sprintf ('cat > "%s.tex"', name); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10864
diff
changeset
|
80 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
81 case "tikz" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
82 ## format GL2PS_PGF |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
83 gl2ps_device = {"pgf"}; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
84 pipeline = {sprintf('cat > "%s"', opts.name)}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
85 case "svg" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
86 ## format GL2PS_SVG |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
87 gl2ps_device = {"svg"}; |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
88 svgcmd = ""; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
89 if (opts.svgconvert) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
90 svgcmd = opts.svgconvert_cmd (opts, opts.ghostscript.device); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
91 endif |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
92 if (! isempty (svgcmd)) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
93 pipeline = {sprintf(svgcmd, "svg", opts.name)}; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
94 else |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
95 pipeline = {sprintf('cat > "%s"', opts.name)}; |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
96 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
97 case fig2dev_devices |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
98 cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
99 if (strcmp (opts.devopt, "pstex")) |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
100 cmd_pstoedit = opts.pstoedit_cmd (opts, "fig", false); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
101 [~, ~, ext] = fileparts (opts.name); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
102 if (any (strcmpi (ext, {".ps", ".tex", "."}))) |
28912
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
27957
diff
changeset
|
103 opts.name = opts.name(1:end-numel (ext)); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
104 endif |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20444
diff
changeset
|
105 opts.name = [opts.name ".ps"]; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
106 cmd = sprintf ('%s | %s > "%s"', cmd_pstoedit, cmd_fig2dev, opts.name); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
107 gl2ps_device = {"eps"}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
108 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
109 cmd_fig2dev = opts.fig2dev_cmd (opts, "pstex_t"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
110 gl2ps_device{2} = "eps"; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
111 pipeline{2} = sprintf ('%s | %s > "%s"', cmd_pstoedit, |
28912
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
27957
diff
changeset
|
112 cmd_fig2dev, strrep (opts.name, ".ps", ".tex")); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
113 else |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
114 ## Using svgconvert |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
115 tmp = tempname (); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
116 opts.unlink = [opts.unlink tmp]; |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
117 cmd_pstoedit = sprintf (opts.pstoedit_cmd (opts, "fig"), ... |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
118 "pdf", tmp, tmp); |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
119 cmd = sprintf ('%s | %s > "%s"', cmd_pstoedit, cmd_fig2dev, opts.name); |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
120 gl2ps_device = {"svg"}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
121 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
122 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
123 case "aifm" |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
124 tmp = tempname (); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
125 opts.unlink = [opts.unlink tmp]; |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
126 cmd = sprintf (opts.pstoedit_cmd (opts, "ps2ai"), "pdf", tmp, tmp); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
127 gl2ps_device = {"svg"}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
128 pipeline = {sprintf("%s > %s", cmd, opts.name)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
129 case {"dxf", "emf", "fig", "hpgl"} |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
130 tmp = tempname (); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
131 opts.unlink = [opts.unlink tmp]; |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
132 cmd = sprintf (opts.pstoedit_cmd (opts), "pdf", tmp, tmp); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
133 gl2ps_device = {"svg"}; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
134 pipeline = {sprintf('%s > "%s"', cmd, opts.name)}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
135 case opts.ghostscript.device |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
136 svgcmd = ""; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
137 if (opts.svgconvert) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
138 svgcmd = opts.svgconvert_cmd (opts, opts.ghostscript.device); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
139 endif |
27343
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
140 dosvg = ! isempty (svgcmd); |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
141 if (! dosvg) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
142 opts.ghostscript.source = "-"; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
143 else |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
144 tmp = tempname (); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
145 opts.ghostscript.source = tmp; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
146 opts.unlink = [opts.unlink tmp]; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
147 svgcmd = sprintf (svgcmd, "pdf", tmp); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
148 endif |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
149 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
150 opts.ghostscript.output = opts.name; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
151 if (opts.send_to_printer) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
152 opts.unlink(strcmp (opts.unlink, opts.ghostscript.output)) = []; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
153 opts.ghostscript.output = "-"; |
11009 | 154 endif |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
155 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
156 [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
157 if (opts.send_to_printer || isempty (opts.name)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
158 cmd_lpr = opts.lpr_cmd (opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
159 cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr); |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
160 elseif (dosvg) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
161 if (dos_shell) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
162 cmd = sprintf ("%s & %s", svgcmd, cmd_gs); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
163 else |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
164 cmd = sprintf ("%s ; %s", svgcmd, cmd_gs); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
165 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
166 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
167 cmd = sprintf ("%s", cmd_gs); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
168 endif |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
169 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
170 if (dosvg) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
171 gl2ps_device = {"svg"}; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
172 else |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
173 gl2ps_device = {"eps"}; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
174 endif |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
175 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
176 if (! isempty (cmd_cleanup)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
177 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
178 pipeline = {sprintf("%s & %s", cmd, cmd_cleanup)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
179 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
180 pipeline = {sprintf("%s ; %s", cmd, cmd_cleanup)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
181 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
182 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
183 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
184 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
185 otherwise |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
186 error (sprintf ("print:no%soutput", opts.devopt), |
27059
2bf6dcb1563c
Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents:
26934
diff
changeset
|
187 "print: %s output is not available for OpenGL toolkits", |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
188 upper (opts.devopt)); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
189 endswitch |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
190 |
11009 | 191 opts.pipeline = pipeline; |
192 | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
193 for n = 1:numel (pipeline) |
11009 | 194 if (opts.debug) |
19640
3b0b4d55002d
rename __fltk_print__.m to __opengl_print__.m
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
195 fprintf ("opengl-pipeline: '%s'\n", pipeline{n}); |
11009 | 196 endif |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
197 |
30198
a87e5f9d5446
improve graphics toolkit rendering failure error message
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
198 __check_rendering_capability__ ("print", opts.figure); |
a87e5f9d5446
improve graphics toolkit rendering failure error message
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
199 |
a87e5f9d5446
improve graphics toolkit rendering failure error message
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
200 ## Use toolkits "print_figure" method |
a87e5f9d5446
improve graphics toolkit rendering failure error message
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
201 if (ispc () && ! isunix ()) |
a87e5f9d5446
improve graphics toolkit rendering failure error message
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
202 drawnow (gl2ps_device{n}, ['| "' pipeline{n} '"']); |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
203 else |
30198
a87e5f9d5446
improve graphics toolkit rendering failure error message
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
204 drawnow (gl2ps_device{n}, ["| " pipeline{n}]); |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
205 endif |
11009 | 206 endfor |
207 | |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
208 if (! isempty (strfind (opts.devopt, "standalone"))) |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
209 opts.latex_standalone (opts); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
210 endif |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
211 |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
212 endfunction |