A font is a MSDF atlas of glyphs.
More...
#include <Font.hpp>
|
| | Font () |
| | Constructor.
|
| |
| | Font (Font &&) |
| | Move constructor.
|
| |
| Font & | operator= (Font &&) |
| | Move assignment operator.
|
| |
| | ~Font () |
| | Destructor.
|
| |
| bool | load (const std::string &file) |
| | Loads the font and sets up characters.
|
| |
| bool | load (unsigned char *buffer, const unsigned int size) |
| | Loads the font and sets up characters.
|
| |
| void | build () |
| | Build the font atlas.
|
| |
| float | vertical_advance (const float size) const |
| | Get vertical advance for drawing multiline text.
|
| |
| glm::vec2 | get_text_size (const std::string &text, const float size) |
| | Query text size with font.
|
| |
| msdfgl_font_t | handle () |
| | Get handle to internal font object.
|
| |
A font is a MSDF atlas of glyphs.
Definition at line 24 of file Font.hpp.
◆ Font() [1/2]
| galaxy::graphics::Font::Font |
( |
| ) |
|
Constructor.
Definition at line 18 of file Font.cpp.
◆ Font() [2/2]
| galaxy::graphics::Font::Font |
( |
Font && | f | ) |
|
Move constructor.
Definition at line 24 of file Font.cpp.
◆ ~Font()
| galaxy::graphics::Font::~Font |
( |
| ) |
|
Destructor.
Definition at line 57 of file Font.cpp.
◆ operator=()
| Font & galaxy::graphics::Font::operator= |
( |
Font && | f | ) |
|
Move assignment operator.
Definition at line 38 of file Font.cpp.
◆ load() [1/2]
| bool galaxy::graphics::Font::load |
( |
const std::string & | file | ) |
|
|
nodiscard |
Loads the font and sets up characters.
- Parameters
-
| file | Path to the font file. |
- Returns
- True if successful.
Definition at line 67 of file Font.cpp.
◆ load() [2/2]
| bool galaxy::graphics::Font::load |
( |
unsigned char * | buffer, |
|
|
const unsigned int | size ) |
|
nodiscard |
Loads the font and sets up characters.
- Parameters
-
| buffer | Array of data. |
| size | Size of buffer. |
- Returns
- True if successful.
Definition at line 88 of file Font.cpp.
◆ build()
| void galaxy::graphics::Font::build |
( |
| ) |
|
Build the font atlas.
Not thread safe, calls OpenGL code.
Definition at line 107 of file Font.cpp.
◆ vertical_advance()
| float galaxy::graphics::Font::vertical_advance |
( |
const float | size | ) |
const |
|
nodiscard |
Get vertical advance for drawing multiline text.
- Parameters
-
- Returns
- Float.
Definition at line 125 of file Font.cpp.
◆ get_text_size()
| glm::vec2 galaxy::graphics::Font::get_text_size |
( |
const std::string & | text, |
|
|
const float | size ) |
|
nodiscard |
Query text size with font.
Doesnt support vertical text. You also need to pre-process tab symbols.
- Parameters
-
- Returns
- Vector 2 of dimensions of text.
Definition at line 130 of file Font.cpp.
◆ handle()
| msdfgl_font_t galaxy::graphics::Font::handle |
( |
| ) |
|
|
nodiscard |
Get handle to internal font object.
- Returns
- msdfgl_font_t pointer.
Definition at line 170 of file Font.cpp.
◆ m_font
| msdfgl_font_t galaxy::graphics::Font::m_font |
|
private |
◆ m_face
| FT_Face galaxy::graphics::Font::m_face |
|
private |
Freetype face.
Owned by MSDFGL.
Definition at line 117 of file Font.hpp.
The documentation for this class was generated from the following files:
- galaxy/src/galaxy/graphics/text/Font.hpp
- galaxy/src/galaxy/graphics/text/Font.cpp