annotate libinterp/corefcn/text-renderer.cc @ 31231:a026fb2be108

sparse-xpow.cc: Return empty matrix for empty input (bug #63080)
author Arun Giridhar <arungiridhar@gmail.com>
date Mon, 19 Sep 2022 07:05:31 -0400
parents 796f54d4ddbf
children e88a07dec498
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 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30041
diff changeset
3 // Copyright (C) 2009-2022 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 ////////////////////////////////////////////////////////////////////////
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
26 #if defined (HAVE_CONFIG_H)
22003
2d3972b802ff use consistent style for including config.h in source files
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
27 # include "config.h"
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #endif
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include "base-text-renderer.h"
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
31 #include "error.h"
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include "errwarn.h"
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "ft-text-renderer.h"
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
34 #include "latex-text-renderer.h"
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "text-renderer.h"
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36
22326
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
37 namespace octave
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
38 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
39 text_renderer::text_renderer (void)
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
40 : m_rep (make_ft_text_renderer ()),
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
41 m_latex_rep (make_latex_text_renderer ())
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
42 { }
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 text_renderer::~text_renderer (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
45 {
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
46 delete m_rep;
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
47 delete m_latex_rep;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
48 }
21209
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 bool
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
51 text_renderer::ok (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
52 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
53 static bool warned = false;
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
55 if (! m_rep)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
56 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
57 if (! warned)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
58 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
59 warn_disabled_feature ("opengl_renderer::render_text",
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
60 "rendering text (FreeType)");
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
62 warned = true;
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 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
66 return m_rep != nullptr;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
67 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
69 Matrix
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
70 text_renderer::get_extent (text_element *elt, double rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
71 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
72 static Matrix empty_extent (1, 4, 0.0);
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
74 return ok () ? m_rep->get_extent (elt, rotation) : empty_extent;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
75 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
77 Matrix
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
78 text_renderer::get_extent (const std::string& txt, double rotation,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
79 const caseless_str& interpreter)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
80 {
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
81 static Matrix retval (1, 4, 0.0);
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
83 if (interpreter == "latex" && m_latex_rep->ok ())
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
84 retval = m_latex_rep->get_extent (txt, rotation, interpreter);
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
85 else if (ok ())
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
86 retval = m_rep->get_extent (txt, rotation, interpreter);
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
87
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
88 return retval;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
89 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
91 void
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26376
diff changeset
92 text_renderer::set_anti_aliasing (bool val)
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26376
diff changeset
93 {
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26376
diff changeset
94 if (ok ())
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
95 m_rep->set_anti_aliasing (val);
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26376
diff changeset
96 }
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26376
diff changeset
97
27623
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
98 octave_map
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
99 text_renderer::get_system_fonts (void)
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
100 {
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
101 octave_map retval;
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
102
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
103 if (ok ())
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
104 retval = m_rep->get_system_fonts ();
27623
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
105
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
106 return retval;
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
107 }
698c8b08fe8c New function uisetfont (bug #57130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
108
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26376
diff changeset
109 void
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
110 text_renderer::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
111 const std::string& angle, double size)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
112 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
113 if (ok ())
29483
af41ebf3d1b3 Differ latex test until actually needed (bug #59546)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29470
diff changeset
114 {
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
115 m_rep->set_font (name, weight, angle, size);
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
116 m_latex_rep->set_font (name, weight, angle, size);
29483
af41ebf3d1b3 Differ latex test until actually needed (bug #59546)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29470
diff changeset
117 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
118 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
120 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
121 text_renderer::set_color (const Matrix& c)
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 if (ok ())
29483
af41ebf3d1b3 Differ latex test until actually needed (bug #59546)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29470
diff changeset
124 {
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
125 m_rep->set_color (c);
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
126 m_latex_rep->set_color (c);
29483
af41ebf3d1b3 Differ latex test until actually needed (bug #59546)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29470
diff changeset
127 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
128 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
130 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
131 text_renderer::text_to_pixels (const std::string& txt,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
132 uint8NDArray& pxls, Matrix& bbox,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
133 int halign, int valign, double rotation,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
134 const caseless_str& interpreter,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
135 bool handle_rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
136 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
137 static Matrix empty_bbox (1, 4, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
138 static uint8NDArray empty_pxls;
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
140 if (interpreter == "latex" && m_latex_rep->ok ())
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
141 m_latex_rep->text_to_pixels (txt, pxls, bbox, halign, valign, rotation,
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
142 interpreter, handle_rotation);
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
143 else if (ok ())
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
144 m_rep->text_to_pixels (txt, pxls, bbox, halign, valign, rotation,
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
145 interpreter, handle_rotation);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
146 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
147 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
148 bbox = empty_bbox;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
149 pxls = empty_pxls;
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 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
153 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
154 text_renderer::text_to_strlist (const std::string& txt,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
155 std::list<text_renderer::string>& lst,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
156 Matrix& bbox, int halign, int valign,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
157 double rotation,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
158 const caseless_str& interpreter)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
159 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
160 static Matrix empty_bbox (1, 4, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
161 static std::list<text_renderer::string> empty_lst;
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
163 if (interpreter == "latex" && m_latex_rep->ok ())
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
164 m_latex_rep->text_to_strlist (txt, lst, bbox, halign, valign, rotation,
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
165 interpreter);
29470
2ae4764180c6 Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 29358
diff changeset
166 else if (ok ())
30041
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
167 m_rep->text_to_strlist (txt, lst, bbox, halign, valign, rotation,
f148aff802b6 maint: use "m_" prefix for member variables of text_renderer objects.
Rik <rik@octave.org>
parents: 29483
diff changeset
168 interpreter);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
169 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
170 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
171 bbox = empty_bbox;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
172 lst = empty_lst;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
173 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
174 }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175 }