GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
base-text-renderer.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2009-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_base_text_renderer_h)
27 #define octave_base_text_renderer_h 1
28 
29 #include "octave-config.h"
30 
31 #include <list>
32 #include <string>
33 
34 #include "dMatrix.h"
35 #include "oct-map.h"
36 #include "uint8NDArray.h"
37 
38 #include "text-engine.h"
39 #include "text-renderer.h"
40 
42 
43 class
45 {
46 public:
47 
48  enum
49  {
50  ROTATION_0 = 0,
51  ROTATION_90 = 1,
52  ROTATION_180 = 2,
53  ROTATION_270 = 3
54  };
55 
57 
58  OCTAVE_DISABLE_COPY_MOVE (base_text_renderer)
59 
60  virtual ~base_text_renderer () = default;
61 
62  virtual void
63  set_anti_aliasing (bool val) = 0;
64 
65  virtual Matrix
66  get_extent (text_element *elt, double rotation) = 0;
67 
68  virtual Matrix
69  get_extent (const std::string& txt, double rotation,
70  const caseless_str& interpreter) = 0;
71 
72  virtual void
73  set_font (const std::string& name, const std::string& weight,
74  const std::string& angle, double size) = 0;
75 
76  virtual bool
77  ok () { return true; };
78 
79  virtual octave_map
81 
82  virtual void set_color (const Matrix& c) = 0;
83 
84  virtual void
85  text_to_pixels (const std::string& txt, uint8NDArray& pxls,
86  Matrix& bbox, int halign, int valign, double rotation,
88  bool handle_rotation) = 0;
89 
90  virtual void
91  text_to_strlist (const std::string& txt,
92  std::list<text_renderer::string>& lst,
93  Matrix& box, int halign, int valign, double rotation,
94  const caseless_str& interpreter = "tex") = 0;
95 
96  void rotate_pixels (uint8NDArray& pixels, int rot_mode) const;
97 
98  int rotation_to_mode (double rotation) const;
99 
100  void fix_bbox_anchor (Matrix& bbox, int halign,
101  int valign, int rot_mode,
102  bool handle_rotation) const;
103 
104 };
105 
106 OCTAVE_END_NAMESPACE(octave)
107 
108 #endif
Definition: dMatrix.h:42
virtual void text_to_pixels(const std::string &txt, uint8NDArray &pxls, Matrix &bbox, int halign, int valign, double rotation, const caseless_str &interpreter, bool handle_rotation)=0
virtual void text_to_strlist(const std::string &txt, std::list< text_renderer::string > &lst, Matrix &box, int halign, int valign, double rotation, const caseless_str &interpreter="tex")=0
virtual void set_color(const Matrix &c)=0
virtual octave_map get_system_fonts()=0
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn