Essentially just a wrapper for the SDL TTF_Font type. More...
#include <Font.hpp>
Collaboration diagram for BARE2D::Font:Public Member Functions | |
| Font () | |
| ~Font () | |
| void | init (const char *fontFile, int size) |
| Creates font resources. More... | |
| void | dispose () |
| Destroys font resources. More... | |
| unsigned int | getHeight () const |
| CharacterGlyph * | getGlyph (int &index) |
| Gets a character glyph. Does no checking to make sure it exists! More... | |
| GLuint | getTextureID () const |
| unsigned int | getCharacters () const |
| glm::vec2 | measure (const char *s) |
| Measures the dimensions of some given text. More... | |
Static Private Member Functions | |
| static std::vector< int > * | createRows (glm::ivec4 *rectangles, int rectanglesLength, int rows, int padding, int &width) |
Private Attributes | |
| GLuint | m_textureID = 0 |
| unsigned int | m_height |
| unsigned int | m_regStart |
| unsigned int | m_regLength |
| CharacterGlyph * | m_characterGlyphs = nullptr |
|
staticprivate |
| void BARE2D::Font::dispose | ( | ) |
Destroys font resources.
Definition at line 261 of file Font.cpp.
References m_characterGlyphs, and m_textureID.
|
inline |
Definition at line 74 of file Font.hpp.
References m_regLength.
Referenced by BARE2D::FontRenderer::draw().
Here is the caller graph for this function:
|
inline |
Gets a character glyph. Does no checking to make sure it exists!
| index | The index of the glyph |
Definition at line 58 of file Font.hpp.
References m_characterGlyphs.
Referenced by BARE2D::FontRenderer::draw().
Here is the caller graph for this function:
|
inline |
Definition at line 48 of file Font.hpp.
References m_height.
Referenced by BARE2D::FontRenderer::draw().
Here is the caller graph for this function:
|
inline |
Definition at line 66 of file Font.hpp.
References m_textureID.
Referenced by BARE2D::FontRenderer::draw().
Here is the caller graph for this function:| void BARE2D::Font::init | ( | const char * | fontFile, |
| int | size | ||
| ) |
Creates font resources.
| fontFile | The file to load the font from. Should be .ttf |
| size | The size of the font (in points). This is basically just the quality of the font loaded. Has nothing to do with rendered size. |
Definition at line 30 of file Font.cpp.
References BARE2D::GLContext::bindTexture(), BARE2D::CharacterGlyph::character, closestPow2(), createRows(), FIRST_PRINTABLE_CHAR, BARE2D::FONT_FAILURE, BARE2D::GLContextManager::getContext(), LAST_PRINTABLE_CHAR, m_characterGlyphs, m_height, m_regLength, m_regStart, m_textureID, MAX_TEXTURE_RES, BARE2D::CharacterGlyph::size, BARE2D::throwFatalError(), and BARE2D::CharacterGlyph::uvRect.
Referenced by BARE2D::ResourceManager::loadFont().
Here is the call graph for this function:
Here is the caller graph for this function:| glm::vec2 BARE2D::Font::measure | ( | const char * | s | ) |
Measures the dimensions of some given text.
| s | The text to be measured |
Definition at line 277 of file Font.cpp.
References m_characterGlyphs, m_height, m_regLength, m_regStart, and BARE2D::CharacterGlyph::size.
Referenced by BARE2D::FontRenderer::draw().
Here is the caller graph for this function:
|
private |
|
private |
Definition at line 97 of file Font.hpp.
Referenced by getHeight(), init(), and measure().
|
private |
Definition at line 100 of file Font.hpp.
Referenced by getCharacters(), init(), and measure().
|
private |
|
private |
Definition at line 94 of file Font.hpp.
Referenced by dispose(), getTextureID(), and init().