annotate libinterp/corefcn/text-renderer.h @ 27923:bd51beb6205e

update formatting of copyright notices * Use <https://octave.org/copyright/> instead of <https://octave.org/COPYRIGHT.html/>. * For consistency with other comments in the Octave sources, use C++-style comments for copyright blocks in C and C++ files. * Use delimiters above and below copyright blocks that are appropriate for the language used in the file. * Eliminate extra spacing inside copyright blocks. * lex.ll (looks_like_copyright): Also allow newlines and carriage returns before the word "Copyright". * scripts/mk-doc.pl (gethelp): Also skip empty comment lines. * bp-table.cc, type.m: Adjust tests.
author John W. Eaton <jwe@octave.org>
date Wed, 08 Jan 2020 11:59:41 -0500
parents 1891570abac8
children 0a5b15007766
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 // Copyright (C) 2009-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_text_renderer_h)
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_text_renderer_h 1
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21209
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21209
diff changeset
30
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <list>
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include <string>
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
33 #include <vector>
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "caseless-str.h"
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 #include "dMatrix.h"
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 #include "uint8NDArray.h"
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38
22326
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
39 namespace octave
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
40 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
41 class base_text_renderer;
25643
afb5288a25ad move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
42 class text_element;
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
44 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
45 OCTINTERP_API
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
46 text_renderer
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 {
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 public:
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
50 text_renderer (void);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
51
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
52 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
53
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
54 text_renderer (const text_renderer&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
55
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
56 text_renderer& operator = (const text_renderer&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
57
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
58 ~text_renderer (void);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
59
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
60 bool ok (void) const;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
61
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
62 Matrix get_extent (text_element *elt, double rotation = 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
63
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
64 Matrix get_extent (const std::string& txt, double rotation = 0.0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
65 const caseless_str& interpreter = "tex");
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26443
diff changeset
67 void set_anti_aliasing (bool val);
26995
ab5bfee22d18 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 26858
diff changeset
68
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
69 void set_font (const std::string& name, const std::string& weight,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
70 const std::string& angle, double size);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
71
27623
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26995
diff changeset
72 octave_map get_system_fonts (void);
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26995
diff changeset
73
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
74 void set_color (const Matrix& c);
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
76 void text_to_pixels (const std::string& txt,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
77 uint8NDArray& pxls, Matrix& bbox,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
78 int halign, int valign, double rotation = 0.0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
79 const caseless_str& interpreter = "tex",
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
80 bool handle_rotation = true);
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
82 class font
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
84 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
85
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
86 font (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
87 : name (), weight (), angle (), size (0)
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
90 font (const std::string& nm, const std::string& wt,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
91 const std::string& ang, double sz)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
92 : name (nm), weight (wt), angle (ang), size (sz)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
93 { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
94
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
95 font (const font& ft)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
96 : name (ft.name), weight (ft.weight), angle (ft.angle),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
97 size (ft.size)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
98 { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
99
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
100 ~font (void) = default;
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
102 font& operator = (const font& ft)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
103 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
104 if (&ft != this)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
105 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
106 name = ft.name;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
107 weight = ft.weight;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
108 angle = ft.angle;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
109 size = ft.size;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
110 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
111
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
112 return *this;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
113 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
114
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
115 std::string get_name (void) const { return name; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
116
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
117 std::string get_weight (void) const { return weight; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
119 std::string get_angle (void) const { return angle; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
120
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
121 double get_size (void) const { return size; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
122
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
123 protected:
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
125 std::string name;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
126 std::string weight;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
127 std::string angle;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
128 double size;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
129 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
130
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
131 // Container for substrings after parsing.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
132
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
133 class string
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
134 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
135 public:
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
137 string (const std::string& s, font& f, const double x0, const double y0)
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
138 : str (s), family (f.get_name ()), fnt (f), x (x0), y (y0), z (0.0),
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
139 xdata (), code (0), color (Matrix (1,3,0.0))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
140 { }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
142 string (const string& s)
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
143 : str (s.str), family (s.family), fnt (s.fnt), x (s.x), y (s.y),
26443
6dfb842362dd text-renderer.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
144 z (s.z), xdata (s.xdata), code (s.code), color (s.color)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
145 { }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
147 ~string (void) = default;
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
149 string& operator = (const string& s)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
150 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
151 if (&s != this)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
152 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
153 str = s.str;
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
154 family = s.family;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
155 fnt = s.fnt;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
156 x = s.x;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
157 y = s.y;
26443
6dfb842362dd text-renderer.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
158 z = s.z;
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
159 xdata = s.xdata;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
160 code = s.code;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
161 color = s.color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
162 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
164 return *this;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
165 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
166
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
167 void set_string (const std::string& s) { str = s; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
168
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
169 std::string get_string (void) const { return str; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
171 std::string get_name (void) const { return fnt.get_name (); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
172
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
173 std::string get_family (void) const { return family; }
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
174
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
175 void set_family (const std::string& nm) { family = nm; }
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
176
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
177 std::string get_weight (void) const { return fnt.get_weight (); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
178
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
179 std::string get_angle (void) const { return fnt.get_angle (); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
180
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
181 double get_size (void) const { return fnt.get_size (); }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
183 void set_x (const double x0) { x = x0; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
184
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
185 double get_x (void) const { return x; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
187 void set_xdata (const std::vector<double>& x0) { xdata = x0; }
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
188
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
189 std::vector<double> get_xdata (void) const { return xdata; }
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
190
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
191 void set_y (const double y0) { y = y0; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
192
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
193 double get_y (void) const { return y; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
195 void set_z (const double z0) { z = z0; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
196
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
197 double get_z (void) const { return z; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
199 void set_code (const uint32_t c) { code = c; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
200
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
201 uint32_t get_code (void) const { return code; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
203 void set_color (const uint8NDArray& c)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
204 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
205 color(0) = static_cast<double> (c(0)) / 255;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
206 color(1) = static_cast<double> (c(1)) / 255;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
207 color(2) = static_cast<double> (c(2)) / 255;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
208 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
209
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
210 Matrix get_color (void) const { return color; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
211
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
212 private:
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
213
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
214 std::string str;
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
215 std::string family;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
216 font fnt;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
217 double x, y, z;
24076
1b7e49a72c62 improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23220
diff changeset
218 std::vector<double> xdata;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
219 uint32_t code;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
220 Matrix color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
221 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
222
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
223 void text_to_strlist (const std::string& txt,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
224 std::list<string>& lst, Matrix& box,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
225 int halign, int valign, double rotation = 0.0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
226 const caseless_str& interpreter = "tex");
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 private:
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
230 base_text_renderer *rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
231 };
22326
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
232 }
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
233
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 #endif