MRPT
1.9.9
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-2019, 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
/** Existing fonts for 2D texts in mrpt::opengl methods.
19
* \sa mrpt::opengl::CWxGLCanvasBase::renderTextBitmap
20
* \ingroup mrpt_opengl_grp
21
*/
22
enum
TOpenGLFont
23
{
24
MRPT_GLUT_BITMAP_NONE
= -1,
25
MRPT_GLUT_BITMAP_TIMES_ROMAN_10
= 0,
26
MRPT_GLUT_BITMAP_TIMES_ROMAN_24
= 1,
27
MRPT_GLUT_BITMAP_HELVETICA_10
= 2,
28
MRPT_GLUT_BITMAP_HELVETICA_12
= 3,
29
MRPT_GLUT_BITMAP_HELVETICA_18
= 4
30
};
31
32
/** Different style for vectorized font rendering \sa T2DTextData */
33
enum
TOpenGLFontStyle
34
{
35
FILL
= 0,
///< renders glyphs as filled polygons
36
OUTLINE
= 1,
///< renders glyphs as outlines with GL_LINES
37
NICE
= 2
///< renders glyphs filled with antialiased outlines
38
};
39
40
/** A description of a bitmapped or vectorized text font.
41
* (Vectorized fonts are recommended for new code).
42
*
43
* \sa mrpt::opengl::gl_utils::glSetFont(),
44
* mrpt::opengl::gl_utils::glDrawText()
45
*/
46
struct
TFontParams
47
{
48
TFontParams
() :
vfont_name
(
"sans"
) {}
49
mrpt::img::TColorf
color
;
50
51
bool
draw_shadow
{
false
};
52
mrpt::img::TColorf
shadow_color
;
53
54
/** @name Bitmapped font params
55
@{ */
56
mrpt::opengl::TOpenGLFont
font
{
MRPT_GLUT_BITMAP_NONE
};
57
/** @} */
58
59
/** @name Vectorized font params - Applicable only if
60
font==MRPT_GLUT_BITMAP_NONE
61
@{ */
62
/** Vectorized font name ("sans","mono","serif") */
63
std::string
vfont_name
;
64
/** Size of characters */
65
double
vfont_scale
{10};
66
/** (default: NICE) See TOpenGLFontStyle. */
67
TOpenGLFontStyle
vfont_style
{};
68
/** (default: 1.5) Refer to mrpt::opengl::gl_utils::glDrawText */
69
double
vfont_spacing
{1.5};
70
/** (default: 0.1) Refer to mrpt::opengl::gl_utils::glDrawText */
71
double
vfont_kerning
{0.1};
72
/** @} */
73
};
74
75
/** An auxiliary struct for holding a list of text messages in some mrpt::opengl
76
* & mrpt::gui classes
77
* The font can be either a bitmapped or a vectorized font.
78
* \sa mrpt::opengl::CTextMessageCapable
79
* \ingroup mrpt_opengl_grp
80
*/
81
struct
T2DTextData
:
public
TFontParams
82
{
83
T2DTextData
() =
default
;
84
std::string
text
;
85
double
x
{0},
y
{0};
86
};
87
}
// namespace mrpt::opengl
mrpt::opengl::TFontParams::TFontParams
TFontParams()
Definition:
opengl_fonts.h:48
mrpt::opengl::TFontParams::font
mrpt::opengl::TOpenGLFont font
Definition:
opengl_fonts.h:56
mrpt::opengl::T2DTextData::text
std::string text
Definition:
opengl_fonts.h:84
mrpt::opengl::TFontParams
A description of a bitmapped or vectorized text font.
Definition:
opengl_fonts.h:46
mrpt::opengl::T2DTextData::T2DTextData
T2DTextData()=default
mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_10
Definition:
opengl_fonts.h:25
mrpt::opengl::OUTLINE
renders glyphs as outlines with GL_LINES
Definition:
opengl_fonts.h:36
mrpt::opengl::TFontParams::vfont_name
std::string vfont_name
Vectorized font name ("sans","mono","serif")
Definition:
opengl_fonts.h:63
mrpt::opengl::TOpenGLFont
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
Definition:
opengl_fonts.h:22
mrpt::opengl::TOpenGLFontStyle
TOpenGLFontStyle
Different style for vectorized font rendering.
Definition:
opengl_fonts.h:33
mrpt::opengl::TFontParams::vfont_kerning
double vfont_kerning
(default: 0.1) Refer to mrpt::opengl::gl_utils::glDrawText
Definition:
opengl_fonts.h:71
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:81
string
GLsizei const GLchar ** string
Definition:
glext.h:4116
mrpt::opengl::TFontParams::draw_shadow
bool draw_shadow
Definition:
opengl_fonts.h:51
mrpt::opengl::TFontParams::vfont_spacing
double vfont_spacing
(default: 1.5) Refer to mrpt::opengl::gl_utils::glDrawText
Definition:
opengl_fonts.h:69
mrpt::opengl::MRPT_GLUT_BITMAP_NONE
Definition:
opengl_fonts.h:24
mrpt::img::TColorf
A RGB color - floats in the range [0,1].
Definition:
TColor.h:77
mrpt::opengl::NICE
renders glyphs filled with antialiased outlines
Definition:
opengl_fonts.h:37
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition:
CGlCanvasBase.h:15
y
GLenum GLint GLint y
Definition:
glext.h:3542
mrpt::opengl::TFontParams::color
mrpt::img::TColorf color
Definition:
opengl_fonts.h:49
common.h
mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24
Definition:
opengl_fonts.h:26
mrpt::opengl::MRPT_GLUT_BITMAP_HELVETICA_12
Definition:
opengl_fonts.h:28
x
GLenum GLint x
Definition:
glext.h:3542
TColor.h
mrpt::opengl::FILL
renders glyphs as filled polygons
Definition:
opengl_fonts.h:35
mrpt::opengl::MRPT_GLUT_BITMAP_HELVETICA_10
Definition:
opengl_fonts.h:27
mrpt::opengl::TFontParams::shadow_color
mrpt::img::TColorf shadow_color
Definition:
opengl_fonts.h:52
mrpt::opengl::TFontParams::vfont_scale
double vfont_scale
Size of characters.
Definition:
opengl_fonts.h:65
mrpt::opengl::TFontParams::vfont_style
TOpenGLFontStyle vfont_style
(default: NICE) See TOpenGLFontStyle.
Definition:
opengl_fonts.h:67
mrpt::opengl::MRPT_GLUT_BITMAP_HELVETICA_18
Definition:
opengl_fonts.h:29
Page generated by
Doxygen 1.8.14
for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019