Mercurial > octave
annotate libinterp/corefcn/gl2ps-print.cc @ 25054:6652d3823428 stable
maint: Update copyright dates in all source files.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Mar 2018 09:19:05 -0400 |
parents | a802e644937a |
children | 078b795c5219 |
rev | line source |
---|---|
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
1 /* |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
2 |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24809
diff
changeset
|
3 Copyright (C) 2009-2018 Shai Ayal |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
4 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
5 This file is part of Octave. |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
6 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22753
diff
changeset
|
8 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:
24520
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22753
diff
changeset
|
10 (at your option) any later version. |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22753
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22753
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22753
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22753
diff
changeset
|
15 GNU General Public License for more details. |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
16 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
18 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:
24520
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
20 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
21 */ |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
22 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21539
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21230
diff
changeset
|
24 # include "config.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
25 #endif |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
26 |
21539
212bafe8413a
gl2ps-print.cc: Fix compiling whet --without-opengl used.
Rik <rik@octave.org>
parents:
21527
diff
changeset
|
27 // Both header files are required outside of HAVE_GLP2S_H |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
28 #include "errwarn.h" |
21539
212bafe8413a
gl2ps-print.cc: Fix compiling whet --without-opengl used.
Rik <rik@octave.org>
parents:
21527
diff
changeset
|
29 #include "gl2ps-print.h" |
19648
16f21db320b5
Fix compilation error when building without gl2ps
Mike Miller <mtmiller@ieee.org>
parents:
19639
diff
changeset
|
30 |
22750
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
31 #if defined (HAVE_GL2PS_H) && defined (HAVE_OPENGL) |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
32 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
33 #include <cstdio> |
21852
25493c55d976
don't include unistd.h unless it is needed
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
34 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
35 #include <limits> |
21852
25493c55d976
don't include unistd.h unless it is needed
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
36 |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
37 #include <gl2ps.h> |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
38 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
39 #include "lo-mappers.h" |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
40 #include "oct-locbuf.h" |
21991
80659e58609f
provide wrapper for tmpfile (bug #48337)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
41 #include "tmpfile-wrapper.h" |
21910
4d723ba06b4a
provide wrappers for some unistd.h functions
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
42 #include "unistd-wrappers.h" |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
43 #include "unwind-prot.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
44 |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
45 #include "gl-render.h" |
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
46 #include "oct-opengl.h" |
21527
ab8760b1245d
Raise an error if writes to pipe fail (bug #47381).
Rik <rik@octave.org>
parents:
21391
diff
changeset
|
47 #include "sighandlers.h" |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
48 #include "sysdep.h" |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21207
diff
changeset
|
49 #include "text-renderer.h" |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
50 |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
51 namespace octave |
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
52 { |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
53 static void |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
54 safe_pclose (FILE *f) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
55 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
56 if (f) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
57 octave_pclose (f); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
58 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
59 |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
60 static void |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
61 safe_fclose (FILE *f) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
62 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
63 if (f) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
64 std::fclose (f); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
65 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
66 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
67 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
68 OCTINTERP_API |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
69 gl2ps_renderer : public opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
70 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
71 public: |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
72 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
73 gl2ps_renderer (FILE *_fp, const std::string& _term) |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
74 : opengl_renderer () , fp (_fp), term (_term), fontsize (), |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
75 fontname (), buffer_overflow (false) |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
76 { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
77 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
78 ~gl2ps_renderer (void) = default; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
79 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
80 // FIXME: should we import the functions from the base class and |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
81 // overload them here, or should we use a different name so we don't |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
82 // have to do this? Without the using declaration or a name change, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
83 // the base class functions will be hidden. That may be OK, but it |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
84 // can also cause some confusion. |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
85 using opengl_renderer::draw; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
86 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
87 void draw (const graphics_object& go, const std::string& print_cmd); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
88 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
89 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
90 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
91 Matrix render_text (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
92 double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
93 int halign, int valign, double rotation = 0.0); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
94 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
95 void set_font (const base_properties& props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
96 |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
97 static bool has_alpha (const graphics_handle& h) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
98 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
99 bool retval = false; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
100 graphics_object go = gh_manager::get_object (h); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
101 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
102 if (! go.valid_object ()) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
103 return retval; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
104 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
105 if (go.isa ("axes") || go.isa ("hggroup")) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
106 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
107 Matrix children = go.get ("children").matrix_value (); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
108 for (octave_idx_type ii = 0; ii < children.numel (); ii++) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
109 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
110 retval = has_alpha (graphics_handle (children(ii))); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
111 if (retval) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
112 break; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
113 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
114 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
115 else if (go.isa ("patch") || go.isa ("surface")) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
116 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
117 octave_value fa = go.get ("facealpha"); |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
118 if (fa.is_scalar_type () && fa.is_double_type () |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
119 && fa.double_value () < 1) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
120 retval = true; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
121 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
122 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
123 return retval; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
124 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
125 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
126 void draw_axes (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
127 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
128 // Initialize a sorting tree (viewport) in gl2ps for each axes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
129 GLint vp[4]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
130 glGetIntegerv (GL_VIEWPORT, vp); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
131 gl2psBeginViewport (vp); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
132 |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
133 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
134 // Don't remove hidden primitives when some of them are transparent |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
135 GLint opts; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
136 gl2psGetOptions (&opts); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
137 if (has_alpha (props.get___myhandle__ ())) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
138 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
139 opts &= ~GL2PS_OCCLUSION_CULL; |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
140 // FIXME: currently the GL2PS_BLEND (which is more an equivalent of |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
141 // GL_ALPHA_TEST than GL_BLEND) is not working on a per primitive |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
142 // basis. We thus set it once per viewport. |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
143 gl2psEnable (GL2PS_BLEND); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
144 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
145 else |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
146 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
147 opts |= GL2PS_OCCLUSION_CULL; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
148 gl2psDisable (GL2PS_BLEND); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
149 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
150 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
151 gl2psSetOptions (opts); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
152 |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
153 // Draw and finish () or there may be primitives missing in the gl2ps |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
154 // output. |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
155 opengl_renderer::draw_axes (props); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
156 finish (); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
157 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
158 // Finalize viewport |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
159 GLint state = gl2psEndViewport (); |
23858
cb8251337689
Fix printing of plots with axes that are not visible (bug #51713).
Rik <rik@octave.org>
parents:
23848
diff
changeset
|
160 if (state == GL2PS_NO_FEEDBACK && props.is_visible ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
161 warning ("gl2ps_renderer::draw_axes: empty feedback buffer and/or nothing else to print"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
162 else if (state == GL2PS_ERROR) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
163 error ("gl2ps_renderer::draw_axes: gl2psEndPage returned GL2PS_ERROR"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
164 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
165 buffer_overflow |= (state == GL2PS_OVERFLOW); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
166 |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
167 // Don't draw background for subsequent viewports (legends, subplots, |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
168 // etc.) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
169 gl2psGetOptions (&opts); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
170 opts &= ~GL2PS_DRAW_BACKGROUND; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
171 gl2psSetOptions (opts); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
172 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
173 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
174 void draw_text (const text::properties& props); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
175 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
176 void draw_pixels (int w, int h, const float *data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
177 void draw_pixels (int w, int h, const uint8_t *data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
178 void draw_pixels (int w, int h, const uint16_t *data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
179 |
24689
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
180 void init_marker (const std::string& m, double size, float width) |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
181 { |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
182 opengl_renderer::init_marker (m, size, width); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
183 |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
184 // FIXME: gl2ps can't handle closed contours and we set linecap/linejoin |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
185 // round to obtain a better looking result for some markers. |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
186 if (m == "o" || m == "v" || m == "^" || m == ">" || m == "<" || m == "h" |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
187 || m == "hexagram" || m == "p" || m == "pentagram") |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
188 { |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
189 set_linejoin ("round"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
190 set_linecap ("round"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
191 } |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
192 else |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
193 { |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
194 set_linejoin ("miter"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
195 set_linecap ("square"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
196 } |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
197 } |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
198 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22392
diff
changeset
|
199 void set_linestyle (const std::string& s, bool use_stipple = false, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22392
diff
changeset
|
200 double linewidth = 0.5) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
201 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
202 opengl_renderer::set_linestyle (s, use_stipple, linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
203 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
204 if (s == "-" && ! use_stipple) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
205 gl2psDisable (GL2PS_LINE_STIPPLE); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
206 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
207 gl2psEnable (GL2PS_LINE_STIPPLE); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
208 } |
21333
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
209 |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
210 void set_linecap (const std::string& s) |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
211 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
212 opengl_renderer::set_linejoin (s); |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
213 |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
214 #if defined (HAVE_GL2PSLINEJOIN) |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
215 if (s == "butt") |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
216 gl2psLineCap (GL2PS_LINE_CAP_BUTT); |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
217 else if (s == "square") |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
218 gl2psLineCap (GL2PS_LINE_CAP_SQUARE); |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
219 else if (s == "round") |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
220 gl2psLineCap (GL2PS_LINE_CAP_ROUND); |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
221 #endif |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
222 } |
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
223 |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
224 void set_linejoin (const std::string& s) |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
225 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
226 opengl_renderer::set_linejoin (s); |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
227 |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
228 #if defined (HAVE_GL2PSLINEJOIN) |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
229 if (s == "round") |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
230 gl2psLineJoin (GL2PS_LINE_JOIN_ROUND); |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
231 else if (s == "miter") |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
232 gl2psLineJoin (GL2PS_LINE_JOIN_MITER); |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
233 else if (s == "chamfer") |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
234 gl2psLineJoin (GL2PS_LINE_JOIN_BEVEL); |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
235 #endif |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
236 } |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
237 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
238 void set_polygon_offset (bool on, float offset = 0.0f) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
239 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
240 if (on) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
241 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
242 opengl_renderer::set_polygon_offset (on, offset); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
243 gl2psEnable (GL2PS_POLYGON_OFFSET_FILL); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
244 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
245 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
246 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
247 gl2psDisable (GL2PS_POLYGON_OFFSET_FILL); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
248 opengl_renderer::set_polygon_offset (on, offset); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
249 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
250 } |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
251 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
252 void set_linewidth (float w) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
253 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
254 gl2psLineWidth (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
255 } |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
256 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
257 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
258 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
259 // Use xform to compute the coordinates of the string list |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
260 // that have been parsed by freetype. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
261 void fix_strlist_position (double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
262 Matrix box, double rotation, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
263 std::list<text_renderer::string>& lst); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
264 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
265 // Build an svg text element from a list of parsed strings. |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
266 std::string strlist_to_svg (double x, double y, double z, Matrix box, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
267 double rotation, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
268 std::list<octave::text_renderer::string>& lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
269 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
270 // Build a list of postscript commands from a list of parsed strings. |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
271 std::string strlist_to_ps (double x, double y, double z, Matrix box, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
272 double rotation, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
273 std::list<octave::text_renderer::string>& lst); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
274 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
275 int alignment_to_mode (int ha, int va) const; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
276 FILE *fp; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
277 caseless_str term; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
278 double fontsize; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
279 std::string fontname; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
280 bool buffer_overflow; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
281 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
282 |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
283 static bool |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
284 has_2D_axes (const graphics_handle& h) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
285 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
286 bool retval = true; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
287 graphics_object go = gh_manager::get_object (h); |
23863
56b7352fa456
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23859
diff
changeset
|
288 |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
289 if (! go.valid_object ()) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
290 return retval; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
291 |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
292 if (go.isa ("figure") || go.isa ("uipanel")) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
293 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
294 Matrix children = go.get ("children").matrix_value (); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
295 for (octave_idx_type ii = 0; ii < children.numel (); ii++) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
296 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
297 retval = has_2D_axes (graphics_handle (children(ii))); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
298 if (! retval) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
299 break; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
300 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
301 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
302 else if (go.isa ("axes")) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
303 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
304 axes::properties& ap |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
305 = reinterpret_cast<axes::properties&> (go.get_properties ()); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
306 retval = ap.get_is2D (true); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
307 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
308 |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
309 return retval; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
310 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
311 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
312 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
313 gl2ps_renderer::draw (const graphics_object& go, const std::string& print_cmd) |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
314 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
315 static bool in_draw = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
316 static std::string old_print_cmd; |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
317 static GLint buffsize; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
318 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
319 if (! in_draw) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
320 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
321 unwind_protect frame; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
322 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
323 frame.protect_var (in_draw); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
324 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
325 in_draw = true; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
326 |
22336
47629df12b79
Fix crash when choosing an inappropriate terminal in drawnow (bug #48782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22331
diff
changeset
|
327 GLint gl2ps_term = GL2PS_PS; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
328 if (term.find ("eps") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
329 gl2ps_term = GL2PS_EPS; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
330 else if (term.find ("pdf") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
331 gl2ps_term = GL2PS_PDF; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
332 else if (term.find ("ps") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
333 gl2ps_term = GL2PS_PS; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
334 else if (term.find ("svg") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
335 gl2ps_term = GL2PS_SVG; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
336 else if (term.find ("pgf") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
337 gl2ps_term = GL2PS_PGF; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
338 else if (term.find ("tex") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
339 gl2ps_term = GL2PS_TEX; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
340 else |
22336
47629df12b79
Fix crash when choosing an inappropriate terminal in drawnow (bug #48782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22331
diff
changeset
|
341 warning ("gl2ps_renderer::draw: Unknown terminal %s, using 'ps'", |
47629df12b79
Fix crash when choosing an inappropriate terminal in drawnow (bug #48782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22331
diff
changeset
|
342 term.c_str ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
343 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
344 GLint gl2ps_text = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
345 if (term.find ("notxt") != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
346 gl2ps_text = GL2PS_NO_TEXT; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
347 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
348 // Default sort order optimizes for 3D plots |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
349 GLint gl2ps_sort = GL2PS_BSP_SORT; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
350 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23457
diff
changeset
|
351 // FIXME: gl2ps does not provide a way to change the sorting algorythm |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23457
diff
changeset
|
352 // on a viewport basis, we thus disable sorting only if all axes are 2D |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
353 if (has_2D_axes (go.get ("__myhandle__"))) |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23457
diff
changeset
|
354 gl2ps_sort = GL2PS_NO_SORT; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
355 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
356 // Use a temporary file in case an overflow happens |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23305
diff
changeset
|
357 FILE *tmpf = octave_tmpfile_wrapper (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
358 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
359 if (! tmpf) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
360 error ("gl2ps_renderer::draw: couldn't open temporary file for printing"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
361 |
23740
38188d1aaf3f
ensure that temporary file used by gl2ps is closed (bug #50696)
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
362 frame.add_fcn (safe_fclose, tmpf); |
38188d1aaf3f
ensure that temporary file used by gl2ps is closed (bug #50696)
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
363 |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
364 // Reset buffsize, unless this is 2nd pass of a texstandalone print. |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
365 if (term.find ("tex") == std::string::npos) |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
366 buffsize = 2*1024*1024; |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
367 else |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
368 buffsize /= 2; |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
369 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
370 buffer_overflow = true; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
371 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
372 while (buffer_overflow) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
373 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
374 buffer_overflow = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
375 buffsize *= 2; |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
376 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
377 std::fseek (tmpf, 0, SEEK_SET); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
378 octave_ftruncate_wrapper (fileno (tmpf), 0); |
21391
13b6be3cb217
Correctly print figure background when multiple axes present (bug #47315).
Rik <rik@octave.org>
parents:
21353
diff
changeset
|
379 |
22704
b5407b1ab11a
Provide extra info message when gl2ps buffer overflows (bug #49482).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
380 // For LaTeX output the print process uses 2 drawnow() commands. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
381 // The first one is for the pdf/ps/eps graph to be included. The |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
382 // print_cmd is saved as old_print_cmd. Then the second drawnow() |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
383 // outputs the tex-file and the graphic filename to be included is |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
384 // extracted from old_print_cmd. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
385 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
386 std::string include_graph; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
387 |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23803
diff
changeset
|
388 size_t found_redirect = old_print_cmd.find ('>'); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
389 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
390 if (found_redirect != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
391 include_graph = old_print_cmd.substr (found_redirect + 1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
392 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
393 include_graph = old_print_cmd; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
394 |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23803
diff
changeset
|
395 size_t n_begin = include_graph.find_first_not_of (' '); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
396 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
397 if (n_begin != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
398 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23803
diff
changeset
|
399 size_t n_end = include_graph.find_last_not_of (' '); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
400 include_graph = include_graph.substr (n_begin, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
401 n_end - n_begin + 1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
402 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
403 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
404 include_graph = "foobar-inc"; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
405 |
24686
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
406 // FIXME: workaround gl2ps drawing 2 background planes, the first |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
407 // eventually being black and producing visual artifacts |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
408 const figure::properties& fprop |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
409 = dynamic_cast<const figure::properties&> (go.get_properties ()); |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
410 Matrix c = fprop.get_color_rgb (); |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
411 glClearColor (c(0), c(1), c(2), 1); |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
412 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
413 // GL2PS_SILENT was removed to allow gl2ps to print errors on stderr |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
414 GLint ret = gl2psBeginPage ("gl2ps_renderer figure", "Octave", |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
415 nullptr, gl2ps_term, gl2ps_sort, |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
416 (GL2PS_BEST_ROOT |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
417 | gl2ps_text |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
418 | GL2PS_DRAW_BACKGROUND |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
419 | GL2PS_NO_PS3_SHADING |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
420 | GL2PS_USE_CURRENT_VIEWPORT), |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23794
diff
changeset
|
421 GL_RGBA, 0, nullptr, 0, 0, 0, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
422 buffsize, tmpf, include_graph.c_str ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
423 if (ret == GL2PS_ERROR) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
424 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
425 old_print_cmd.clear (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
426 error ("gl2ps_renderer::draw: gl2psBeginPage returned GL2PS_ERROR"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
427 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
428 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
429 opengl_renderer::draw (go); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
430 |
22704
b5407b1ab11a
Provide extra info message when gl2ps buffer overflows (bug #49482).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
431 if (buffer_overflow) |
b5407b1ab11a
Provide extra info message when gl2ps buffer overflows (bug #49482).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
432 warning ("gl2ps_renderer::draw: retrying with buffer size: %.1E B\n", double (2*buffsize)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
433 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
434 if (! buffer_overflow) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
435 old_print_cmd = print_cmd; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
436 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
437 // Don't check return value of gl2psEndPage, it is not meaningful. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
438 // Errors and warnings are checked after gl2psEndViewport in |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
439 // gl2ps_renderer::draw_axes instead. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
440 gl2psEndPage (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
441 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
442 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
443 // Copy temporary file to pipe |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
444 std::fseek (tmpf, 0, SEEK_SET); |
23305
34c75889ed50
Possibly improve performance of OpenGL printing.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
445 char str[8192]; // 8 kB is a common kernel buffersize |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
446 size_t nread, nwrite; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
447 nread = 1; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
448 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
449 // In EPS terminal read the header line by line and insert a |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
450 // new procedure |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
451 const char* fcn = "/SRX { gsave FCT moveto rotate xshow grestore } BD\n"; |
24809
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
452 bool header_found = ! (term.find ("eps") != std::string::npos |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
453 || term.find ("svg") != std::string::npos); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
454 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
455 while (! feof (tmpf) && nread) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
456 { |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
457 if (! header_found && std::fgets (str, 8192, tmpf)) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
458 nread = strlen (str); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
459 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
460 nread = std::fread (str, 1, 8192, tmpf); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
461 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
462 if (nread) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
463 { |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
464 if (! header_found && std::strncmp (str, "/SBCR", 5) == 0) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
465 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
466 header_found = true; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
467 nwrite = std::fwrite (fcn, 1, strlen (fcn), fp); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
468 if (nwrite != strlen (fcn)) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
469 { |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
470 // FIXME: is this the best thing to do here? |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
471 respond_to_pending_signals (); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
472 error ("gl2ps_renderer::draw: internal pipe error"); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
473 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
474 } |
24809
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
475 else if (! header_found |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
476 && term.find ("svg") != std::string::npos) |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
477 { |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
478 // FIXME: gl2ps uses pixel units for SVG format. |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
479 // Modify resulting svg to use points instead. |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
480 // Remove this "else if" block, and |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
481 // make header_found true for SVG if gl2ps is fixed. |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
482 std::string srchstr (str); |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
483 size_t pos = srchstr.find ("px"); |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
484 if (pos != std::string::npos) |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
485 { |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
486 header_found = true; |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
487 srchstr[pos+1] = 't'; // "px" -> "pt" |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
488 // Assume the second occurrence is at the same line |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
489 pos = srchstr.find ("px", pos); |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
490 srchstr[pos+1] = 't'; // "px" -> "pt" |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
491 std::strcpy (str, srchstr.c_str ()); |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
492 } |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
493 } |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
494 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
495 nwrite = std::fwrite (str, 1, nread, fp); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
496 if (nwrite != nread) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
497 { |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
498 // FIXME: is this the best thing to do here? |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
499 respond_to_pending_signals (); // Clear SIGPIPE signal |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
500 error ("gl2ps_renderer::draw: internal pipe error"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
501 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
502 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
503 } |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
504 } |
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
505 else |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
506 opengl_renderer::draw (go); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
507 } |
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
508 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
509 int |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
510 gl2ps_renderer::alignment_to_mode (int ha, int va) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
511 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
512 int gl2psa = GL2PS_TEXT_BL; |
19890 | 513 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
514 if (ha == 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
515 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
516 if (va == 0 || va == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
517 gl2psa=GL2PS_TEXT_BL; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
518 else if (va == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
519 gl2psa=GL2PS_TEXT_TL; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
520 else if (va == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
521 gl2psa=GL2PS_TEXT_CL; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
522 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
523 else if (ha == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
524 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
525 if (va == 0 || va == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
526 gl2psa=GL2PS_TEXT_BR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
527 else if (va == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
528 gl2psa=GL2PS_TEXT_TR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
529 else if (va == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
530 gl2psa=GL2PS_TEXT_CR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
531 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
532 else if (ha == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
533 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
534 if (va == 0 || va == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
535 gl2psa=GL2PS_TEXT_B; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
536 else if (va == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
537 gl2psa=GL2PS_TEXT_T; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
538 else if (va == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
539 gl2psa=GL2PS_TEXT_C; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
540 } |
19890 | 541 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
542 return gl2psa; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
543 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
544 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
545 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
546 gl2ps_renderer::fix_strlist_position (double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
547 Matrix box, double rotation, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
548 std::list<text_renderer::string>& lst) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
549 { |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
550 for (auto& txtobj : lst) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
551 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
552 // Get pixel coordinates |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
553 ColumnVector coord_pix = get_transform ().transform (x, y, z, false); |
19890 | 554 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
555 // Translate and rotate |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
556 double rot = rotation * 4.0 * atan (1.0) / 180; |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
557 coord_pix(0) += (txtobj.get_x () + box(0))*cos (rot) |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
558 - (txtobj.get_y () + box(1))*sin (rot); |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
559 coord_pix(1) -= (txtobj.get_y () + box(1))*cos (rot) |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
560 + (txtobj.get_x () + box(0))*sin (rot); |
19890 | 561 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
562 GLint vp[4]; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
563 glGetIntegerv (GL_VIEWPORT, vp); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
564 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
565 txtobj.set_x (coord_pix(0)); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
566 txtobj.set_y (vp[3] - coord_pix(1)); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
567 txtobj.set_z (coord_pix(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
568 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
569 } |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
570 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
571 static std::string |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
572 code_to_symbol (uint32_t code) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
573 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
574 std::string retval; |
9834
92d8f35ff217
compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9798
diff
changeset
|
575 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
576 uint32_t idx = code - 945; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
577 if (idx < 25) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
578 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
579 std::string characters ("abgdezhqiklmnxoprVstufcyw"); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
580 retval = characters[idx]; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
581 return retval; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
582 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
583 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
584 idx = code - 913; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
585 if (idx < 25) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
586 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
587 std::string characters ("ABGDEZHQIKLMNXOPRVSTUFCYW"); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
588 retval = characters[idx]; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
589 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
590 else if (code == 978) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
591 retval = "U"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
592 else if (code == 215) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
593 retval = "\xb4"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
594 else if (code == 177) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
595 retval = "\xb1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
596 else if (code == 8501) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
597 retval = "\xc0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
598 else if (code == 8465) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
599 retval = "\xc1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
600 else if (code == 8242) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
601 retval = "\xa2"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
602 else if (code == 8736) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
603 retval = "\xd0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
604 else if (code == 172) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
605 retval = "\xd8"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
606 else if (code == 9829) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
607 retval = "\xa9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
608 else if (code == 8472) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
609 retval = "\xc3"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
610 else if (code == 8706) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
611 retval = "\xb6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
612 else if (code == 8704) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
613 retval = "\x22"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
614 else if (code == 9827) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
615 retval = "\xa7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
616 else if (code == 9824) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
617 retval = "\xaa"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
618 else if (code == 8476) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
619 retval = "\xc2"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
620 else if (code == 8734) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
621 retval = "\xa5"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
622 else if (code == 8730) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
623 retval = "\xd6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
624 else if (code == 8707) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
625 retval = "\x24"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
626 else if (code == 9830) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
627 retval = "\xa8"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
628 else if (code == 8747) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
629 retval = "\xf2"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
630 else if (code == 8727) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
631 retval = "\x2a"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
632 else if (code == 8744) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
633 retval = "\xda"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
634 else if (code == 8855) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
635 retval = "\xc4"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
636 else if (code == 8901) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
637 retval = "\xd7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
638 else if (code == 8728) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
639 retval = "\xb0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
640 else if (code == 8745) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
641 retval = "\xc7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
642 else if (code == 8743) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
643 retval = "\xd9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
644 else if (code == 8856) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
645 retval = "\xc6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
646 else if (code == 8729) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
647 retval = "\xb7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
648 else if (code == 8746) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
649 retval = "\xc8"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
650 else if (code == 8853) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
651 retval = "\xc5"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
652 else if (code == 8804) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
653 retval = "\xa3"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
654 else if (code == 8712) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
655 retval = "\xce"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
656 else if (code == 8839) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
657 retval = "\xca"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
658 else if (code == 8801) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
659 retval = "\xba"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
660 else if (code == 8773) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
661 retval = "\x40"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
662 else if (code == 8834) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
663 retval = "\xcc"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
664 else if (code == 8805) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
665 retval = "\xb3"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
666 else if (code == 8715) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
667 retval = "\x27"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
668 else if (code == 8764) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
669 retval = "\x7e"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
670 else if (code == 8733) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
671 retval = "\xb5"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
672 else if (code == 8838) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
673 retval = "\xcd"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
674 else if (code == 8835) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
675 retval = "\xc9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
676 else if (code == 8739) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
677 retval = "\xbd"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
678 else if (code == 8776) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
679 retval = "\xbb"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
680 else if (code == 8869) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
681 retval = "\x5e"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
682 else if (code == 8656) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
683 retval = "\xdc"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
684 else if (code == 8592) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
685 retval = "\xac"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
686 else if (code == 8658) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
687 retval = "\xde"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
688 else if (code == 8594) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
689 retval = "\xae"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
690 else if (code == 8596) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
691 retval = "\xab"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
692 else if (code == 8593) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
693 retval = "\xad"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
694 else if (code == 8595) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
695 retval = "\xaf"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
696 else if (code == 8970) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
697 retval = "\xeb"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
698 else if (code == 8971) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
699 retval = "\xfb"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
700 else if (code == 10216) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
701 retval = "\xe1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
702 else if (code == 10217) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
703 retval = "\xf1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
704 else if (code == 8968) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
705 retval = "\xe9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
706 else if (code == 8969) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
707 retval = "\xf9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
708 else if (code == 8800) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
709 retval = "\xb9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
710 else if (code == 8230) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
711 retval = "\xbc"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
712 else if (code == 176) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
713 retval = "\xb0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
714 else if (code == 8709) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
715 retval = "\xc6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
716 else if (code == 169) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
717 retval = "\xd3"; |
20020
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
718 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
719 if (retval.empty ()) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
720 warning ("print: unhandled symbol %d", code); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
721 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
722 return retval; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
723 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
724 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
725 static std::string |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
726 select_font (caseless_str fn, bool isbold, bool isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
727 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
728 std::transform (fn.begin (), fn.end (), fn.begin (), ::tolower); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
729 std::string fontname; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
730 if (fn == "times" || fn == "times-roman") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
731 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
732 if (isitalic && isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
733 fontname = "Times-BoldItalic"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
734 else if (isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
735 fontname = "Times-Italic"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
736 else if (isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
737 fontname = "Times-Bold"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
738 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
739 fontname = "Times-Roman"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
740 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
741 else if (fn == "courier") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
742 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
743 if (isitalic && isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
744 fontname = "Courier-BoldOblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
745 else if (isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
746 fontname = "Courier-Oblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
747 else if (isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
748 fontname = "Courier-Bold"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
749 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
750 fontname = "Courier"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
751 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
752 else if (fn == "symbol") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
753 fontname = "Symbol"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
754 else if (fn == "zapfdingbats") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
755 fontname = "ZapfDingbats"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
756 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
757 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
758 if (isitalic && isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
759 fontname = "Helvetica-BoldOblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
760 else if (isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
761 fontname = "Helvetica-Oblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
762 else if (isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
763 fontname = "Helvetica-Bold"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
764 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
765 fontname = "Helvetica"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
766 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
767 return fontname; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
768 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
769 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
770 static void |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
771 escape_character (const std::string chr, std::string& str) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
772 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
773 std::size_t idx = str.find (chr); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
774 while (idx != std::string::npos) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
775 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
776 str.insert (idx, 1, '\\'); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
777 idx = str.find (chr, idx + 2); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
778 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
779 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
780 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
781 std::string |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
782 gl2ps_renderer::strlist_to_svg (double x, double y, double z, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
783 Matrix box, double rotation, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
784 std::list<octave::text_renderer::string>& lst) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
785 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
786 if (lst.empty ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
787 return ""; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
788 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
789 //Use pixel coordinates to conform to gl2ps |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
790 ColumnVector coord_pix = get_transform ().transform (x, y, z, false); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
791 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
792 std::ostringstream os; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
793 os << "<text xml:space=\"preserve\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
794 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
795 // Rotation and translation are applied to the whole text element |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
796 os << "transform=\"" |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
797 << "translate(" << coord_pix(0) + box(0) << "," << coord_pix(1) - box(1) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
798 << ") rotate(" << -rotation << "," << -box(0) << "," << box(1) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
799 << ")\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
800 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
801 // Use the first entry for the base text font |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
802 auto p = lst.begin (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
803 std::string name = p->get_family (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
804 std::string weight = p->get_weight (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
805 std::string angle = p->get_angle (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
806 double size = p->get_size (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
807 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
808 os << "font-family=\"" << name << "\" " |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
809 << "font-weight=\"" << weight << "\" " |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
810 << "font-style=\"" << angle << "\" " |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
811 << "font-size=\"" << size << "\">"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
812 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
813 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
814 // build a tspan for each element in the strlist |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
815 for (p = lst.begin (); p != lst.end (); p++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
816 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
817 os << "<tspan "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
818 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
819 if (name.compare (p->get_family ())) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
820 os << "font-family=\"" << p->get_family () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
821 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
822 if (weight.compare (p->get_weight ())) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
823 os << "font-weight=\"" << p->get_weight () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
824 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
825 if (angle.compare (p->get_angle ())) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
826 os << "font-style=\"" << p->get_angle () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
827 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
828 if (size != p->get_size ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
829 os << "font-size=\"" << p->get_size () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
830 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
831 os << "y=\"" << - p->get_y () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
832 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
833 Matrix col = p->get_color (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
834 os << "fill=\"rgb(" << col(0)*255 << "," |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
835 << col(1)*255 << "," << col(2)*255 << ")\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
836 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
837 // provide an x coordinate for each character in the string |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
838 os << "x=\""; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
839 std::vector<double> xdata = p->get_xdata (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
840 for (auto q = xdata.begin (); q != xdata.end (); q++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
841 os << (*q) << " "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
842 os << "\""; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
843 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
844 os << ">"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
845 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
846 // translate unicode and special xml characters |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
847 if (p->get_code ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
848 os << "&#" << p->get_code () << ";"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
849 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
850 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
851 const std::string str = p->get_string (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
852 for (auto q = str.begin (); q != str.end (); q++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
853 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
854 std::stringstream chr; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
855 chr << *q; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
856 if (chr.str () == "\"") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
857 os << """; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
858 else if (chr.str () == "'") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
859 os << "'"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
860 else if (chr.str () == "&") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
861 os << "&"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
862 else if (chr.str () == "<") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
863 os << "<"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
864 else if (chr.str () == ">") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
865 os << ">"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
866 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
867 os << chr.str (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
868 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
869 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
870 os << "</tspan>"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
871 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
872 os << "</text>"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
873 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
874 return os.str (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
875 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
876 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
877 std::string |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
878 gl2ps_renderer::strlist_to_ps (double x, double y, double z, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
879 Matrix box, double rotation, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
880 std::list<octave::text_renderer::string>& lst) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
881 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
882 // Translate and rotate coordinates in order to use bottom-left alignment |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
883 fix_strlist_position (x, y, z, box, rotation, lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
884 Matrix prev_color (1, 3, -1); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
885 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
886 std::ostringstream ss; |
24084
71a449b29cc7
Save/Restore state of postscript program when dumping text (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24076
diff
changeset
|
887 ss << "gsave\n"; |
71a449b29cc7
Save/Restore state of postscript program when dumping text (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24076
diff
changeset
|
888 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
889 for (const auto& txtobj : lst) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
890 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
891 // Color |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
892 if (txtobj.get_color () != prev_color) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
893 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
894 prev_color = txtobj.get_color (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
895 for (int i = 0; i < 3; i++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
896 ss << prev_color(i) << " "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
897 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
898 ss << "C\n"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
899 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
900 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
901 // String |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
902 std::string str; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
903 if (txtobj.get_code ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
904 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
905 fontname = "Symbol"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
906 str = code_to_symbol (txtobj.get_code ()); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
907 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
908 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
909 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
910 fontname = select_font (txtobj.get_name (), |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
911 txtobj.get_weight () == "bold", |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
912 txtobj.get_angle () == "italic"); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
913 str = txtobj.get_string (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
914 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
915 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
916 escape_character ("(", str); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
917 escape_character (")", str); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
918 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
919 ss << "(" << str << ") ["; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
920 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
921 std::vector<double> xdata = txtobj.get_xdata (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
922 for (size_t i = 1; i < xdata.size (); i++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
923 ss << xdata[i] - xdata[i-1] << " "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
924 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
925 ss << "10] " << rotation << " " << txtobj.get_x () |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
926 << " " << txtobj.get_y () << " " << txtobj.get_size () |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
927 << " /" << fontname << " SRX\n"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
928 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
929 |
24084
71a449b29cc7
Save/Restore state of postscript program when dumping text (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24076
diff
changeset
|
930 ss << "grestore\n"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
931 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
932 return ss.str (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
933 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
934 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
935 Matrix |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
936 gl2ps_renderer::render_text (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
937 double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
938 int ha, int va, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
939 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
940 std::string saved_font = fontname; |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
941 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
942 if (txt.empty ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
943 return Matrix (1, 4, 0.0); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
944 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
945 Matrix bbox; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
946 std::string str = txt; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
947 std::list<text_renderer::string> lst; |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
948 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
949 text_to_strlist (str, lst, bbox, ha, va, rotation); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
950 glRasterPos3d (x, y, z); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
951 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
952 // For svg/eps directly dump a preformated text element into gl2ps output |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
953 if (term.find ("svg") != std::string::npos) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
954 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
955 std::string elt = strlist_to_svg (x, y, z, bbox, rotation, lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
956 if (! elt.empty ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
957 gl2psSpecial (GL2PS_SVG, elt.c_str ()); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
958 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
959 else if (term.find ("eps") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
960 { |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
961 std::string elt = strlist_to_ps (x, y, z, bbox, rotation, lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
962 if (! elt.empty ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
963 gl2psSpecial (GL2PS_EPS, elt.c_str ()); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
964 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
965 } |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
966 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
967 gl2psTextOpt (str.c_str (), fontname.c_str (), fontsize, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
968 alignment_to_mode (ha, va), rotation); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
969 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
970 fontname = saved_font; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
971 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
972 return bbox; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
973 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
974 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
975 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
976 gl2ps_renderer::set_font (const base_properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
977 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
978 opengl_renderer::set_font (props); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
979 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
980 // Set the interpreter so that text_to_pixels can parse strings properly |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
981 if (props.has_property ("interpreter")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
982 set_interpreter (props.get ("interpreter").string_value ()); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
983 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
984 fontsize = props.get ("__fontsize_points__").double_value (); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
985 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
986 caseless_str fn = props.get ("fontname").xtolower ().string_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
987 bool isbold = |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
988 (props.get ("fontweight").xtolower ().string_value () == "bold"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
989 bool isitalic = |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
990 (props.get ("fontangle").xtolower ().string_value () == "italic"); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
991 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
992 fontname = select_font (fn, isbold, isitalic); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
993 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
994 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
995 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
996 gl2ps_renderer::draw_pixels (int w, int h, const float *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
997 { |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
998 // Clip data between 0 and 1 for float values |
22392
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
999 OCTAVE_LOCAL_BUFFER (float, tmp_data, 3*w*h); |
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1000 |
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1001 for (int i = 0; i < 3*h*w; i++) |
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1002 tmp_data[i] = (data[i] < 0.0f ? 0.0f : (data[i] > 1.0f ? 1.0f : data[i])); |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
1003 |
22392
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1004 gl2psDrawPixels (w, h, 0, 0, GL_RGB, GL_FLOAT, tmp_data); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1005 } |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
1006 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1007 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1008 gl2ps_renderer::draw_pixels (int w, int h, const uint8_t *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1009 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1010 // gl2psDrawPixels only supports the GL_FLOAT type. |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1011 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1012 OCTAVE_LOCAL_BUFFER (float, tmp_data, 3*w*h); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1013 |
24284
1ad2297f8ece
Fix printing integer type images (bug #51558)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23219
diff
changeset
|
1014 static const float maxval = std::numeric_limits<uint8_t>::max (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1015 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1016 for (int i = 0; i < 3*w*h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1017 tmp_data[i] = data[i] / maxval; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1018 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1019 draw_pixels (w, h, tmp_data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1020 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1021 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1022 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1023 gl2ps_renderer::draw_pixels (int w, int h, const uint16_t *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1024 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1025 // gl2psDrawPixels only supports the GL_FLOAT type. |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1026 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1027 OCTAVE_LOCAL_BUFFER (float, tmp_data, 3*w*h); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1028 |
24284
1ad2297f8ece
Fix printing integer type images (bug #51558)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23219
diff
changeset
|
1029 static const float maxval = std::numeric_limits<uint16_t>::max (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1030 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1031 for (int i = 0; i < 3*w*h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1032 tmp_data[i] = data[i] / maxval; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1033 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1034 draw_pixels (w, h, tmp_data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1035 } |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
1036 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1037 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1038 gl2ps_renderer::draw_text (const text::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1039 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23546
diff
changeset
|
1040 if (props.get_string ().isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1041 return; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1042 |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24084
diff
changeset
|
1043 draw_text_background (props, true); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24084
diff
changeset
|
1044 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1045 // First set font properties: freetype will use them to compute |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1046 // coordinates and gl2ps will retrieve the color directly from the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1047 // feedback buffer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1048 set_font (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1049 set_color (props.get_color_rgb ()); |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1050 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1051 std::string saved_font = fontname; |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1052 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1053 // Alignment |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1054 int halign = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1055 int valign = 0; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1056 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1057 if (props.horizontalalignment_is ("center")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1058 halign = 1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1059 else if (props.horizontalalignment_is ("right")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1060 halign = 2; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1061 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1062 if (props.verticalalignment_is ("top")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1063 valign = 2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1064 else if (props.verticalalignment_is ("baseline")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1065 valign = 3; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1066 else if (props.verticalalignment_is ("middle")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1067 valign = 1; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1068 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1069 // FIXME: handle margin and surrounding box |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1070 // Matrix bbox; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1071 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1072 const Matrix pos = get_transform ().scale (props.get_data_position ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1073 std::string str = props.get_string ().string_vector_value ().join ("\n"); |
12965
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12322
diff
changeset
|
1074 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1075 render_text (str, pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1076 halign, valign, props.get_rotation ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1077 } |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1078 } |
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1079 |
21207
945695cafd2b
allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
1080 #endif |
945695cafd2b
allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
1081 |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1082 namespace octave |
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1083 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1084 // If the name of the stream begins with '|', open a pipe to the command |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1085 // named by the rest of the string. Otherwise, write to the named file. |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1086 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1087 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1088 gl2ps_print (const graphics_object& fig, const std::string& stream, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1089 const std::string& term) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1090 { |
22750
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1091 #if defined (HAVE_GL2PS_H) && defined (HAVE_OPENGL) |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1092 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1093 // FIXME: should we have a way to create a file that begins with the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1094 // character '|'? |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1095 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1096 bool have_cmd = stream.length () > 1 && stream[0] == '|'; |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1097 |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
1098 FILE *fp = nullptr; |
19709
5cfb3ccbf24a
style fixes for resource management
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
1099 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1100 unwind_protect frame; |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1101 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1102 if (have_cmd) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1103 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1104 // Create process and pipe gl2ps output to it. |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1105 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1106 std::string cmd = stream.substr (1); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1107 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1108 fp = octave_popen (cmd.c_str (), "w"); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1109 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1110 if (! fp) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1111 error (R"(print: failed to open pipe "%s")", stream.c_str ()); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1112 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1113 frame.add_fcn (safe_pclose, fp); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1114 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1115 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1116 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1117 // Write gl2ps output directly to file. |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1118 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1119 fp = std::fopen (stream.c_str (), "w"); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1120 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1121 if (! fp) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1122 error (R"(gl2ps_print: failed to create file "%s")", stream.c_str ()); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1123 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1124 frame.add_fcn (safe_fclose, fp); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1125 } |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1126 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1127 gl2ps_renderer rend (fp, term); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
1128 |
24638
a3031d4967ce
Supply the OpenGL viewport setting for gl2ps_print context (bug #52940).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24534
diff
changeset
|
1129 Matrix pos = fig.get ("position").matrix_value (); |
a3031d4967ce
Supply the OpenGL viewport setting for gl2ps_print context (bug #52940).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24534
diff
changeset
|
1130 rend.set_viewport (pos(2), pos(3)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1131 rend.draw (fig, stream); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1132 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1133 // Make sure buffered commands are finished!!! |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1134 rend.finish (); |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1135 |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1136 #else |
22750
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1137 octave_unused_parameter (fig); |
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1138 octave_unused_parameter (stream); |
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1139 octave_unused_parameter (term); |
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1140 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1141 err_disabled_feature ("gl2ps_print", "gl2ps"); |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1142 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1143 } |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1144 } |