Mercurial > octave
annotate libinterp/corefcn/text-engine.h @ 29359:7854d5752dd2
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 10:10:40 -0500 |
parents | 376ca9022b7e 0a5b15007766 |
children | 2ae4764180c6 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3 // Copyright (C) 2009-2021 The Octave Project Developers |
27923
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 //////////////////////////////////////////////////////////////////////// |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
25 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
26 #if ! defined (octave_text_engine_h) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
27 #define octave_text_engine_h 1 |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21213
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21213
diff
changeset
|
30 |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
31 #include <memory> |
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
32 #include <string> |
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
33 |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
34 #include "base-list.h" |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
35 #include "caseless-str.h" |
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
36 #include "dMatrix.h" |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
37 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
38 namespace octave |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
39 { |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
40 class text_element; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
41 class text_element_string; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
42 class text_element_symbol; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
43 class text_element_list; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
44 class text_element_subscript; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
45 class text_element_superscript; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
46 class text_element_combined; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
47 class text_element_fontname; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
48 class text_element_fontsize; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
49 class text_element_fontstyle; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
50 class text_element_color; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
51 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
52 class text_processor; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
53 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
54 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
55 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
56 text_element |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
57 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
58 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
59 text_element (void) { } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
60 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
61 virtual ~text_element (void) = default; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
62 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
63 virtual void accept (text_processor& p) = 0; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
64 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
65 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
66 text_element (const text_element&); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
67 }; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
68 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
69 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
70 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
71 text_element_string : public text_element |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
72 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
73 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
74 text_element_string (const std::string& s = "") |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
75 : text_element (), str (s) { } |
17272
8ce6cdd272eb
Support TeX elements in FreeType renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17269
diff
changeset
|
76 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
77 ~text_element_string (void) = default; |
17327
fe6518a1d87c
Move TeX symbol decoding into the lexer (bug #39831).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17274
diff
changeset
|
78 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
79 std::string string_value (void) const { return str; } |
17272
8ce6cdd272eb
Support TeX elements in FreeType renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17269
diff
changeset
|
80 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
81 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
82 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
83 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
84 std::string str; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
85 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
86 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
87 text_element_string (const text_element_string &); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
88 }; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
89 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
90 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
91 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
92 text_element_symbol : public text_element |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 { |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
94 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
95 enum { invalid_code = 0xFFFFFFFFU }; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
96 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
97 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
98 text_element_symbol (int sym) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
99 : text_element (), symbol (sym) { } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
100 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
101 ~text_element_symbol (void) = default; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
102 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
103 int get_symbol (void) const { return symbol; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
104 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
105 uint32_t get_symbol_code (void) const; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
106 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
107 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
108 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
109 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
110 int symbol; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
111 }; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
112 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
113 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
114 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
115 text_element_list |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
116 : public text_element, public base_list<text_element *> |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
117 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
118 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
119 text_element_list (void) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
120 : text_element (), base_list<text_element*> () { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
121 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
122 text_element_list (text_element *e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
123 : text_element (), base_list<text_element*> () |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
124 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
125 push_back (e); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
126 } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
127 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
128 ~text_element_list (void) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
129 { |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
130 while (! empty ()) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
131 { |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
132 auto it = begin (); |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
133 delete (*it); |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
134 erase (it); |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
135 } |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
136 } |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
137 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
138 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
139 }; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
140 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
141 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
142 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
143 text_element_subscript : public text_element |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
144 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
145 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
146 text_element_subscript (text_element *e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
147 : text_element (), elem (e) { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
148 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
149 text_element_subscript (char c) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
150 : text_element () |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
151 { elem = new text_element_string (std::string (1, c)); } |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
152 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
153 ~text_element_subscript (void) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
154 { delete elem; } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
155 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
156 void accept (text_processor& p); |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
157 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
158 text_element * get_element (void) { return elem; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
159 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
160 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
161 text_element *elem; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
162 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
163 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
164 text_element_subscript (void); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
165 }; |
17274
0a09d4b40767
Combine successive TeX super- and subscript elements.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17272
diff
changeset
|
166 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
167 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
168 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
169 text_element_superscript : public text_element |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
170 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
171 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
172 text_element_superscript (text_element *e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
173 : text_element (), elem (e) { } |
17274
0a09d4b40767
Combine successive TeX super- and subscript elements.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17272
diff
changeset
|
174 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
175 text_element_superscript (char c) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
176 : text_element () |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
177 { elem = new text_element_string (std::string (1, c)); } |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
178 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
179 ~text_element_superscript (void) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
180 { delete elem; } |
17274
0a09d4b40767
Combine successive TeX super- and subscript elements.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17272
diff
changeset
|
181 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
182 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
183 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
184 text_element * get_element (void) { return elem; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
185 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
186 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
187 text_element *elem; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
188 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
189 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
190 text_element_superscript (void); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
191 }; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
192 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
193 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
194 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
195 text_element_combined : public text_element_list |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
196 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
197 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
198 text_element_combined (text_element *e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
199 : text_element_list (e) { } |
17272
8ce6cdd272eb
Support TeX elements in FreeType renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17269
diff
changeset
|
200 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
201 text_element_combined (text_element *e1, text_element *e2) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
202 : text_element_list(e1) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
203 { push_back (e2); } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
204 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
205 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
206 }; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
207 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
208 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
209 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
210 text_element_fontstyle : public text_element |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
211 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
212 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
213 enum fontstyle |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
214 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
215 normal, |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
216 bold, |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
217 italic, |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
218 oblique |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
219 }; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
220 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
221 text_element_fontstyle (fontstyle st) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
222 : text_element (), style (st) { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
223 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
224 ~text_element_fontstyle (void) = default; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
225 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
226 fontstyle get_fontstyle (void) const { return style; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
227 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
228 void accept (text_processor& p); |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
229 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
230 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
231 fontstyle style; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
232 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
233 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
234 text_element_fontstyle (void); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
235 }; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
236 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
237 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
238 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
239 text_element_fontname : public text_element |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
240 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
241 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
242 text_element_fontname (const std::string& fname) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
243 : text_element (), name (fname) { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
244 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
245 ~text_element_fontname (void) = default; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
246 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
247 const std::string& get_fontname (void) const { return name; } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
248 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
249 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
250 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
251 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
252 std::string name; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
253 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
254 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
255 text_element_fontname (void); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
256 }; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
257 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
258 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
259 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
260 text_element_fontsize : public text_element |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
261 { |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
262 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
263 text_element_fontsize (double fsize) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
264 : text_element (), size (fsize) { } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
265 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
266 ~text_element_fontsize (void) = default; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
267 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
268 double get_fontsize (void) const { return size; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
269 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
270 void accept (text_processor& p); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
271 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
272 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
273 double size; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
274 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
275 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
276 text_element_fontsize (void); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
277 }; |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
278 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
279 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
280 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
281 text_element_color : public text_element |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
282 { |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
283 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
284 text_element_color (double r, double g, double b) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
285 : text_element (), rgb (1, 3, 0.0) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
286 { |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
287 rgb(0) = r; |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
288 rgb(1) = g; |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
289 rgb(2) = b; |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
290 } |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
291 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
292 text_element_color (const std::string& cname) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
293 : text_element (), rgb (1, 3, 0.0) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
294 { |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
295 #define ASSIGN_COLOR(r,g,b) { rgb(0) = r; rgb(1) = g; rgb(2) = b; } |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
296 if (cname == "red") ASSIGN_COLOR(1, 0, 0) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
297 else if (cname == "green") ASSIGN_COLOR(0, 1, 0) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
298 else if (cname == "yellow") ASSIGN_COLOR(1, 1, 0) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
299 else if (cname == "magenta") ASSIGN_COLOR(1, 0, 1) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
300 else if (cname == "blue") ASSIGN_COLOR(0, 0, 1) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
301 else if (cname == "black") ASSIGN_COLOR(0, 0, 0) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
302 else if (cname == "white") ASSIGN_COLOR(1, 1, 1) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
303 else if (cname == "gray") ASSIGN_COLOR(.5, .5, .5) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
304 else if (cname == "darkGreen") ASSIGN_COLOR(0, .5, 0) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
305 else if (cname == "orange") ASSIGN_COLOR(1, .65, 0) |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
306 else if (cname == "lightBlue") ASSIGN_COLOR(0.68, .85, .9) |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
307 #undef ASSIGN_COLOR |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
308 } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
309 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
310 ~text_element_color (void) = default; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
311 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
312 Matrix get_color (void) { return rgb; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
313 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
314 void accept (text_processor& p); |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
315 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
316 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
317 Matrix rgb; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
318 }; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
319 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
320 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
321 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
322 text_processor |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
323 { |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
324 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
325 virtual void visit (text_element_string& e) = 0; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
326 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
327 virtual void visit (text_element_symbol&) { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
328 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
329 virtual void visit (text_element_list& e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
330 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
331 for (auto& el_p : e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
332 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
333 el_p->accept (*this); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
334 } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
335 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
336 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
337 virtual void visit (text_element_subscript& e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
338 { e.get_element ()->accept (*this); } |
17274
0a09d4b40767
Combine successive TeX super- and subscript elements.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17272
diff
changeset
|
339 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
340 virtual void visit (text_element_superscript& e) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
341 { e.get_element ()->accept (*this); } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
342 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
343 virtual void visit (text_element_combined&) { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
344 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
345 virtual void visit (text_element_fontstyle&) { } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
346 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
347 virtual void visit (text_element_fontname&) { } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
348 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
349 virtual void visit (text_element_fontsize&) { } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
350 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
351 virtual void visit (text_element_color&) { } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
352 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
353 virtual void reset (void) { } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
354 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
355 protected: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
356 text_processor (void) { } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
357 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
358 virtual ~text_processor (void) = default; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
359 }; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
360 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21307
diff
changeset
|
361 #define TEXT_ELEMENT_ACCEPT(cls) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21307
diff
changeset
|
362 inline void \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21307
diff
changeset
|
363 cls::accept (text_processor& p) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21307
diff
changeset
|
364 { \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21307
diff
changeset
|
365 p.visit (*this); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21307
diff
changeset
|
366 } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
367 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
368 TEXT_ELEMENT_ACCEPT(text_element_string) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
369 TEXT_ELEMENT_ACCEPT(text_element_symbol) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
370 TEXT_ELEMENT_ACCEPT(text_element_list) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
371 TEXT_ELEMENT_ACCEPT(text_element_subscript) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
372 TEXT_ELEMENT_ACCEPT(text_element_superscript) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
373 TEXT_ELEMENT_ACCEPT(text_element_combined) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
374 TEXT_ELEMENT_ACCEPT(text_element_fontstyle) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
375 TEXT_ELEMENT_ACCEPT(text_element_fontname) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
376 TEXT_ELEMENT_ACCEPT(text_element_fontsize) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
377 TEXT_ELEMENT_ACCEPT(text_element_color) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
378 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
379 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
380 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
381 text_parser |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
382 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
383 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
384 text_parser (void) { } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
385 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
386 virtual ~text_parser (void) = default; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
387 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
388 virtual text_element * parse (const std::string& s) = 0; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
389 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
390 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
391 static text_element * parse (const std::string& s, |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
392 const caseless_str& interpreter); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
393 }; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
394 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
395 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
396 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
397 text_parser_none : public text_parser |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
398 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
399 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
400 text_parser_none (void) : text_parser () { } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
401 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
402 ~text_parser_none (void) = default; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
403 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
404 // FIXME: is it possible to use reference counting to manage the |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
405 // memory for the object returned by the text parser? That would be |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
406 // preferable to having to know when and where to delete the object it |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
407 // creates... |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
408 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
409 text_element * parse (const std::string& s) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
410 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
411 return new text_element_string (s); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
412 } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
413 }; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
414 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
415 class |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
416 OCTINTERP_API |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
417 text_parser_tex : public text_parser |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
418 { |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
419 public: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
420 text_parser_tex (void) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
421 : text_parser (), scanner (nullptr), buffer_state (nullptr), result (nullptr) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
422 { } |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
423 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
424 ~text_parser_tex (void) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
425 { destroy_lexer (); } |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
426 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
427 text_element * parse (const std::string& s); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
428 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
429 void * get_scanner (void) { return scanner; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
430 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
431 void set_parse_result (text_element *e) { result = e; } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
432 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
433 text_element * get_parse_result (void) { return result; } |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
434 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
435 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
436 bool init_lexer (const std::string& s); |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
437 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
438 void destroy_lexer (void); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
439 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
440 private: |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
441 void *scanner; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
442 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
443 void *buffer_state; |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
444 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
445 text_element *result; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
446 }; |
11259
fe11e2b9d48a
eliminate text engine memory leak
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
447 |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
448 inline text_element* |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
449 text_parser::parse (const std::string& s, const caseless_str& interpreter) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
450 { |
25643
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
451 std::unique_ptr<text_parser> parser; |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
452 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
453 if (interpreter.compare ("tex")) |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
454 parser.reset (new text_parser_tex ()); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
455 else |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
456 parser.reset (new text_parser_none ()); |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
457 |
afb5288a25ad
move text engine classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
458 return parser->parse (s); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
459 } |
17269
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
460 } |
5b088598df1d
Add simple TeX parser based on flex/bison.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16892
diff
changeset
|
461 |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
462 #endif |