Mercurial > octave
annotate scripts/plot/util/private/__gnuplot_print__.m @ 21751:b571fc85953f
maint: Use two spaces after period to indicate sentence break.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 19 May 2016 18:48:52 -0700 |
parents | 21fdab18f857 |
children | ffad2baa90f7 |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1 ## Copyright (C) 1999-2015 Daniel Heiserer |
5361 | 2 ## Copyright (C) 2001 Laurent Mazet |
3 ## | |
5362 | 4 ## This file is part of Octave. |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
5362 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
5361 | 15 ## |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
5361 | 19 |
20 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
21 ## @deftypefn {} {} __gnuplot_print__ (@var{@dots{}}) |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10711
diff
changeset
|
22 ## Undocumented internal function. |
5361 | 23 ## @end deftypefn |
24 | |
25 ## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de> | |
5362 | 26 ## Adapted-By: jwe |
5361 | 27 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10915
diff
changeset
|
28 function opts = __gnuplot_print__ (opts) |
9157
fce7315c1eee
print.m: Fix typo, improvments to code, and allow for creation of tight bbox.
Ben Abbott <bpabbott@mac.com>
parents:
9152
diff
changeset
|
29 |
11009 | 30 dos_shell = (ispc () && ! isunix ()); |
31 | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
32 if (isempty (opts.fontsize)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
33 ## If no fontsize, determine the nominal axes fontsize. |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
34 defaultfontsize = get (0, "defaultaxesfontsize"); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
35 axesfontsize = get (findobj (opts.figure, "type", "axes"), "fontsize"); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
36 if (iscell (axesfontsize)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
37 axesfontsize = round (median (cell2mat (axesfontsize))); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
38 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
39 if (isempty (axesfontsize)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
40 opts.fontsize = defaultfontsize; |
5361 | 41 else |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
42 opts.fontsize = axesfontsize; |
5361 | 43 endif |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11009
diff
changeset
|
44 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
45 ## The axes-label and tick-label spacing is determined by |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
46 ## the font spec given in "set terminal ..." |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
47 gp_opts = font_spec (opts); |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
48 |
11009 | 49 pipeline = ""; |
50 | |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
51 switch (lower (opts.devopt)) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
52 case {"eps", "eps2", "epsc", "epsc2"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
53 if (any (strcmp (opts.devopt, {"eps", "epsc"}))) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
54 gp_opts = [gp_opts " level1"]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
55 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
56 if (opts.tight_flag || ! isempty (opts.preview)) |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 tmp_file = [tempname() ".eps"]; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
58 eps_drawnow (opts, tmp_file, gp_opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
59 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
60 cleanup = [" & del " strrep(tmp_file, '/', '\')]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
61 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
62 cleanup = [" ; rm " tmp_file]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
63 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
64 pipeline = {sprintf("%s %s", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
65 opts.epstool_cmd (opts, tmp_file, opts.name), |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
66 cleanup)}; |
11009 | 67 else |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
68 eps_drawnow (opts, opts.name, gp_opts); |
11009 | 69 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
70 case {"epslatex", "pslatex", "pstex", "epslatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
71 dot = find (opts.name == ".", 1, "last"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
72 n = find (opts.devopt == "l", 1); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
73 suffix = opts.devopt(1:n-1); |
20444
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
74 [ndir, name, ext] = fileparts (opts.name); |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
75 if (isempty (ext)) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
76 ext = "tex"; |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
77 else |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
78 ext = ext(2:end); # remove leading '.' |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
79 endif |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
80 if (any (strcmpi (ext, {suffix, "tex"}))) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
81 name = fullfile (ndir, name); |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
82 if (any (strcmpi (ext, {"eps", "ps", "pdf"}))) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
83 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
|
84 endif |
20444
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
85 else |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
86 error ("print:invalid-suffix", |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
87 "invalid suffix '%s' for device '%s'.", |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19725
diff
changeset
|
88 ext, lower (opts.devopt)); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
89 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
90 if (__gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix")) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
91 suffix = "tex"; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
92 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
93 ## Gnuplot 4.0 wants a ".eps" suffix. |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
94 suffix = "eps"; |
14170
2ff75e38c299
improve error message in __gnuplot_print__
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
95 endif |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
96 if (strfind (opts.devopt, "standalone")) |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
97 gp_opts = sprintf ("standalone %s", gp_opts); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
98 term = strrep (opts.devopt, "standalone", ""); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
99 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
100 local_drawnow ([term " " gp_opts], |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20444
diff
changeset
|
101 [name "." suffix], opts); |
20968
123da81b9176
Add support for the standalone option for the gnuplot tikz terminal.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20965
diff
changeset
|
102 case {"tikz", "tikzstandalone"} |
123da81b9176
Add support for the standalone option for the gnuplot tikz terminal.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20965
diff
changeset
|
103 if (strfind (opts.devopt, "standalone")) |
123da81b9176
Add support for the standalone option for the gnuplot tikz terminal.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20965
diff
changeset
|
104 gp_opts = sprintf ("standalone %s", gp_opts); |
123da81b9176
Add support for the standalone option for the gnuplot tikz terminal.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20965
diff
changeset
|
105 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
106 if (__gnuplot_has_terminal__ ("tikz")) |
20968
123da81b9176
Add support for the standalone option for the gnuplot tikz terminal.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20965
diff
changeset
|
107 local_drawnow (["tikz " gp_opts], opts.name, opts); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
108 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
109 error (sprintf ("print:no%soutput", opts.devopt), |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
110 "print.m: '%s' output is not available for gnuplot-%s", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
111 upper (opts.devopt), __gnuplot_version__ ()); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
112 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
113 case "svg" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
114 local_drawnow (["svg dynamic " gp_opts], opts.name, opts); |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
115 case {"eepic"} |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
116 local_drawnow ([opts.devopt " color rotate " gp_opts], opts.name, opts); |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
117 case {"aifm", "corel", "emf", "fig"} |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
118 local_drawnow ([opts.devopt " " gp_opts], opts.name, opts); |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
119 case {"cairolatex", "epscairo", "epscairolatex", ... |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
120 "epscairolatexstandalone", "pdfcairo", "pdfcairolatex", ... |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
121 "pdfcairolatexstandalone", "pngcairo"} |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
122 term = opts.devopt; |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
123 if (strfind (term, "standalone")) |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
124 gp_opts = sprintf ("standalone %s", gp_opts); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
125 term = strrep (term, "standalone", ""); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
126 endif |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
127 if (strfind (term, "epscairolatex")) |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
128 gp_opts = sprintf ("eps %s", gp_opts); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
129 term = strrep (term, "epscairolatex", "cairolatex"); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
130 elseif (strfind (term, "pdfcairolatex")) |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
131 gp_opts = sprintf ("pdf %s", gp_opts); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
132 term = strrep (term, "pdfcairolatex", "cairolatex"); |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
133 endif |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
134 if (__gnuplot_has_terminal__ (term)) |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
135 local_drawnow ([term " " gp_opts], opts.name, opts); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
136 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
137 error (sprintf ("print:no%soutput", opts.devopt), |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
138 "print.m: '%s' output is not available for gnuplot-%s", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
139 upper (opts.devopt), __gnuplot_version__ ()); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
140 endif |
20969
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
141 case {"canvas", "dxf", "hpgl", "latex", "mf", "gif", "pstricks", "texdraw"} |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
142 if (__gnuplot_has_terminal__ (opts.devopt)) |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
143 local_drawnow ([opts.devopt " " gp_opts], opts.name, opts); |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
144 else |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
145 error (sprintf ("print:no%soutput", opts.devopt), |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
146 "print.m: '%s' output is not available for gnuplot-%s", |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
147 upper (opts.devopt), __gnuplot_version__ ()); |
984678f19352
Impproved support gnuplot terminals "eepic", "latex", "pstricks", & "texdraw".
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20968
diff
changeset
|
148 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
149 case opts.ghostscript.device |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
150 gp_opts = font_spec (opts, "devopt", "eps"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
151 opts.ghostscript.output = opts.name; |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
152 opts.ghostscript.source = [tempname() ".eps"]; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
153 eps_drawnow (opts, opts.ghostscript.source, gp_opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
154 [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
155 if (opts.send_to_printer || isempty (opts.name)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
156 cmd_lpr = opts.lpr_cmd (opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
157 cmd = [cmd_gs " | " cmd_lpr]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
158 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
159 cmd = cmd_gs; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
160 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
161 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
162 cmd = sprintf ("%s & del %s", cmd, |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
163 strrep (opts.ghostscript.source, '/', '\')); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
164 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
165 cmd = sprintf ("%s ; rm %s", cmd, opts.ghostscript.source); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
166 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
167 if (! isempty (cmd_cleanup)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
168 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
169 pipeline = {[cmd " & " cmd_cleanup]}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
170 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
171 pipeline = {[cmd " ; " cmd_cleanup]}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
172 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
173 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
174 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
175 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
176 otherwise |
11009 | 177 error (sprintf ("print:no%soutput", opts.devopt), |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
178 "print.m: %s output is not available for the Gnuplot graphics toolkit", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
179 upper (opts.devopt)); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10915
diff
changeset
|
180 endswitch |
5363 | 181 |
11009 | 182 |
183 opts.pipeline = pipeline; | |
184 | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14174
diff
changeset
|
185 for n = 1:numel (pipeline) |
11009 | 186 if (opts.debug) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
187 fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n}); |
11009 | 188 endif |
189 [status, output] = system (pipeline{n}); | |
190 if (status) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
191 fprintf ("%s\n%s\n%s\n", |
11009 | 192 "---------- output begin ----------", |
193 output, | |
194 "----------- output end -----------"); | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
195 error ("gnuplot:failedpipe", "print: failed to print"); |
11009 | 196 endif |
197 endfor | |
198 | |
5361 | 199 endfunction |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
200 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
201 function eps_drawnow (opts, epsfile, gp_opts) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
202 [h, fontsize] = get_figure_text_objs (opts); |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
203 unwind_protect |
17386
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
204 fontsize_2x = cellfun (@times, {2}, fontsize, "uniformoutput", false); |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
205 set (h, {"fontsize"}, fontsize_2x); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
206 local_drawnow (["postscript eps " gp_opts], epsfile, opts); |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
207 unwind_protect_cleanup |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
208 set (h, {"fontsize"}, fontsize); |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
209 end_unwind_protect |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
210 endfunction |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
211 |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
212 function local_drawnow (term, file, opts) |
17146
bbda4d952eb5
Fix pop-up of invisible figures during printing.
Rik <rik@octave.org>
parents:
16801
diff
changeset
|
213 set (0, "currentfigure", opts.figure); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
214 if (isempty (opts.debug_file) || ! opts.debug) |
21699
21fdab18f857
Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21385
diff
changeset
|
215 drawnow (term, file); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
216 else |
21699
21fdab18f857
Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21385
diff
changeset
|
217 drawnow (term, file, opts.debug_file); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
218 endif |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
219 if (opts.debug) |
21385
89fa0694aa2e
Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents:
20969
diff
changeset
|
220 fprintf ("Expanded gnuplot terminal = '%s'\n", term); |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
221 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
222 endfunction |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
223 |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
224 function f = font_spec (opts, varargin) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14174
diff
changeset
|
225 for n = 1:2:numel (varargin) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
226 opts.(varargin{n}) = varargin{n+1}; |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
227 endfor |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
228 f = ""; |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
229 switch (opts.devopt) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
230 case "cgm" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
231 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
232 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
233 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
234 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
235 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
236 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
237 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
238 case {"eps", "eps2", "epsc", "epsc2"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
239 ## Gnuplot renders fonts as half their specification, which |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
240 ## results in a tight spacing for the axes-labels and tick-labels. |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21699
diff
changeset
|
241 ## Compensate for the half scale. This will produce the proper |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
242 ## spacing for the requested fontsize. |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
243 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
244 f = sprintf ('font "%s,%d"', opts.font, 2 * opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
245 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
246 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
247 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
248 f = sprintf ("%d", 2 * opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
249 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
250 case "svg" |
19725
5f2c0ca0ef51
Ensure that numbers passed to integer *printf format codes are integers (bug #44245).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
251 ## FIXME: Why does svg format use round on the fontsize while |
5f2c0ca0ef51
Ensure that numbers passed to integer *printf format codes are integers (bug #44245).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
252 ## other terminals don't? |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
253 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
254 fontsize = round (opts.fontsize * 0.75); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
255 f = sprintf ('fname "%s" fsize %d', opts.font, fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
256 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
257 f = sprintf ('fname "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
258 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
259 fontsize = round (opts.fontsize * 0.75); |
20951
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
260 f = sprintf ("fsize %d", fontsize); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
261 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
262 case "pdf" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
263 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
264 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
265 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
266 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
267 elseif (! isempty (opts.fontsize)) |
20951
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
268 f = sprintf ('font ",%d"', opts.fontsize); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
269 endif |
20964
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
270 case {"cairolatex", "epscairo", "epscairolatex", ... |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
271 "epscairolatexstandalone", "pdfcairo", "pdfcairolatex", ... |
6ac3d299c5ad
Add support for cairo based gnuplot terminals: "cairolatex", "epscairo",
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20951
diff
changeset
|
272 "pdfcairolatexstandalone", "pngcairo"} |
20951
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
273 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
274 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
275 elseif (! isempty (opts.font)) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
276 f = sprintf ('font "%s"', opts.font); |
20951
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
277 elseif (! isempty (opts.fontsize)) |
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
278 f = sprintf ('font ",%d"', opts.fontsize); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
279 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
280 case {"epslatex", "epslatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
281 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
282 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
283 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
284 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
285 elseif (! isempty (opts.fontsize)) |
20951
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
286 f = sprintf ('font ",%d"', opts.fontsize); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
287 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
288 case "pslatex" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
289 if (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
290 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
291 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
292 case {"gif", "jpeg", "png"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
293 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
294 f = sprintf ('font "%s ,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
295 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
296 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
297 elseif (! isempty (opts.fontsize)) |
20951
793886a00c3b
Font handling improvements for gnuplot (part of bug #44187)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20852
diff
changeset
|
298 f = sprintf ('font ",%d"', opts.fontsize); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
299 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
300 case "emf" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
301 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
302 f = sprintf ('"%s" %d', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
303 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
304 f = sprintf ('"%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
305 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
306 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
307 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
308 case "canvas" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
309 if (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
310 f = sprintf ("fsize %d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
311 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
312 case {"aifm", "corel"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
313 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
314 f = sprintf ("%s %d", opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
315 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
316 f = sprintf ("%s", opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
317 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
318 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
319 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
320 case "fig" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
321 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
322 f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
323 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
324 f = sprintf ("font %s", opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
325 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
326 f = sprintf ("fontsize %d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
327 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
328 endswitch |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
329 endfunction |
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
330 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
331 function [h, fontsize] = get_figure_text_objs (opts) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
332 h = findall (opts.figure, "-property", "fontsize"); |
16801
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
333 hp = get (h, "parent"); |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
334 if (iscell (hp)) |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
335 hp = cell2mat (hp); |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
336 endif |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
337 ## Do not change the text objects fontsizes for the children of a |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
338 ## legend axes. These will be handled by the fontsize listener. |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
339 is_legend_key_string = strcmp (get (hp, "tag"), "legend") ... |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
340 & isprop (hp, "string") ... |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
341 & isprop (hp, "location") ... |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
342 & strcmp (get (hp, "type"), "axes"); |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
343 h(is_legend_key_string) = []; |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
344 fontsize = get (h, "fontsize"); |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
345 switch (numel (fontsize)) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
346 case 0 |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
347 fontsize = {}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
348 case 1 |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
349 fontsize = {fontsize}; |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
350 endswitch |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
351 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17174
diff
changeset
|
352 |