Rendu
A lightweight rendering engine for experimentations
Main Page
Modules
Namespaces
Classes
Files
Related Pages
File List
Loading...
Searching...
No Matches
src
engine
resources
Font.hpp
1
#pragma once
2
3
#include "resources/Texture.hpp"
4
#include "resources/Mesh.hpp"
5
#include "Common.hpp"
6
12
class
Font
{
13
public
:
15
enum class
Alignment
{
16
LEFT,
17
CENTER,
18
RIGHT
19
};
20
24
explicit
Font
(std::istream & in);
25
32
void
generateLabel
(
const
std::string & text,
float
scale,
Mesh
& mesh,
Alignment
align = Alignment::LEFT)
const
;
33
37
Font
&
operator=
(
const
Font
&) =
delete
;
38
40
Font
(
const
Font
&) =
delete
;
41
45
Font
&
operator=
(
Font
&&) =
default
;
46
48
Font
(
Font
&&) =
default
;
49
53
const
Texture
*
atlas
()
const
{
return
_atlas
; }
54
55
private
:
56
60
struct
Glyph
{
61
glm::vec2
min
;
62
glm::vec2
max
;
63
};
64
65
const
Texture
*
_atlas
;
66
int
_firstCodepoint
;
67
int
_lastCodepoint
;
68
glm::vec2
_margins
;
69
70
std::vector<Glyph>
_glyphs
;
71
};
Font
Font loading and storage: texture atlas, codepoints supported, dimensions of each glyph.
Definition:
Font.hpp:12
Font::operator=
Font & operator=(const Font &)=delete
Font::operator=
Font & operator=(Font &&)=default
Font::generateLabel
void generateLabel(const std::string &text, float scale, Mesh &mesh, Alignment align=Alignment::LEFT) const
Definition:
Font.cpp:53
Font::Alignment
Alignment
Text alignment.
Definition:
Font.hpp:15
Font::_lastCodepoint
int _lastCodepoint
The integer value of the last supported character.
Definition:
Font.hpp:67
Font::Font
Font(Font &&)=default
Font::_atlas
const Texture * _atlas
The font texture atlas.
Definition:
Font.hpp:65
Font::_glyphs
std::vector< Glyph > _glyphs
The glyphs informations.
Definition:
Font.hpp:70
Font::Font
Font(const Font &)=delete
Font::atlas
const Texture * atlas() const
Definition:
Font.hpp:53
Font::_margins
glm::vec2 _margins
Margin to apply around each characters when generating the geometry.
Definition:
Font.hpp:68
Font::_firstCodepoint
int _firstCodepoint
The integer value of the first supported character.
Definition:
Font.hpp:66
Mesh
Represents a geometric mesh composed of vertices, other attributes and triangles.
Definition:
Mesh.hpp:15
Texture
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition:
Texture.hpp:12
Font::Glyph
A font glyph bounding box, in UV space.
Definition:
Font.hpp:60
Font::Glyph::max
glm::vec2 max
Top right corner.
Definition:
Font.hpp:62
Font::Glyph::min
glm::vec2 min
Bottom left corner.
Definition:
Font.hpp:61
Generated by
Doxygen
1.9.5 - Theme by
Simon Rodriguez