MRPT  2.0.4
opengl_fonts.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/core/common.h> // disable warnings
13 #include <mrpt/img/TColor.h>
14 #include <string>
15 
16 namespace mrpt::opengl
17 {
18 /** Different style for vectorized font rendering \sa T2DTextData */
20 {
21  FILL = 0, ///< renders glyphs as filled polygons
22  OUTLINE = 1, ///< renders glyphs as outlines with GL_LINES
23 
24  /** This was "renders glyphs filled with antialiased outlines", but since
25  antialiased is not properly implemented in mrtp2 since the port to
26  OpenGL3, NICE is for now an alias for FILL. */
27  NICE = 2
28 };
29 
30 /** A description of a bitmapped or vectorized text font.
31  * (Vectorized fonts are recommended for new code).
32  *
33  * \sa mrpt::opengl::gl_utils::glSetFont(),
34  * mrpt::opengl::gl_utils::glDrawText()
35  */
37 {
38  TFontParams() = default;
39 
40  /** Vectorized font name ("sans","mono","serif") */
41  std::string vfont_name = "mono";
42 
43  /** Size of characters [pixels] */
44  float vfont_scale = 10.0f;
45 
46  mrpt::img::TColorf color = {1.0f, 1.0f, 1.0f, 1.0f};
47 
48  bool draw_shadow = false;
49  mrpt::img::TColorf shadow_color = {0.0f, 0.0f, 0.0f, 1.0f};
50 
51  /** (default: FILL) See TOpenGLFontStyle. */
53 
54  /** (default: 1.5) Refer to mrpt::opengl::gl_utils::glDrawText */
55  double vfont_spacing = 1.5;
56 
57  /** (default: 0.1) Refer to mrpt::opengl::gl_utils::glDrawText */
58  double vfont_kerning = 0.1;
59 };
60 
61 /** An auxiliary struct for holding a list of text messages in some mrpt::opengl
62  * & mrpt::gui classes
63  * The font can be either a bitmapped or a vectorized font.
64  * \sa mrpt::opengl::CTextMessageCapable
65  * \ingroup mrpt_opengl_grp
66  */
67 struct T2DTextData : public TFontParams
68 {
69  T2DTextData() = default;
70  std::string text;
71  double x{0}, y{0};
72 };
73 } // namespace mrpt::opengl
mrpt::opengl::TFontParams
A description of a bitmapped or vectorized text font.
Definition: opengl_fonts.h:36
mrpt::opengl::T2DTextData::x
double x
Definition: opengl_fonts.h:71
mrpt::opengl::T2DTextData::T2DTextData
T2DTextData()=default
mrpt::opengl::TOpenGLFontStyle
TOpenGLFontStyle
Different style for vectorized font rendering.
Definition: opengl_fonts.h:19
mrpt::opengl::NICE
@ NICE
This was "renders glyphs filled with antialiased outlines", but since antialiased is not properly imp...
Definition: opengl_fonts.h:27
mrpt::opengl::OUTLINE
@ OUTLINE
renders glyphs as outlines with GL_LINES
Definition: opengl_fonts.h:22
mrpt::opengl::TFontParams::color
mrpt::img::TColorf color
Definition: opengl_fonts.h:46
mrpt::opengl::TFontParams::vfont_style
TOpenGLFontStyle vfont_style
(default: FILL) See TOpenGLFontStyle.
Definition: opengl_fonts.h:52
mrpt::opengl::T2DTextData::text
std::string text
Definition: opengl_fonts.h:70
mrpt::opengl::TFontParams::shadow_color
mrpt::img::TColorf shadow_color
Definition: opengl_fonts.h:49
mrpt::opengl::TFontParams::vfont_scale
float vfont_scale
Size of characters [pixels].
Definition: opengl_fonts.h:44
mrpt::opengl::T2DTextData
An auxiliary struct for holding a list of text messages in some mrpt::opengl & mrpt::gui classes The ...
Definition: opengl_fonts.h:67
mrpt::img::TColorf
An RGBA color - floats in the range [0,1].
Definition: TColor.h:88
mrpt::opengl::TFontParams::vfont_spacing
double vfont_spacing
(default: 1.5) Refer to mrpt::opengl::gl_utils::glDrawText
Definition: opengl_fonts.h:55
mrpt::opengl::TFontParams::vfont_kerning
double vfont_kerning
(default: 0.1) Refer to mrpt::opengl::gl_utils::glDrawText
Definition: opengl_fonts.h:58
mrpt::opengl::FILL
@ FILL
renders glyphs as filled polygons
Definition: opengl_fonts.h:21
common.h
mrpt::opengl::T2DTextData::y
double y
Definition: opengl_fonts.h:71
mrpt::opengl::TFontParams::draw_shadow
bool draw_shadow
Definition: opengl_fonts.h:48
mrpt::opengl::TFontParams::vfont_name
std::string vfont_name
Vectorized font name ("sans","mono","serif")
Definition: opengl_fonts.h:41
mrpt::opengl::TFontParams::TFontParams
TFontParams()=default
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
TColor.h



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Fri Jul 17 08:43:33 UTC 2020