This class stores all font files required in STK.
More...
#include <font_manager.hpp>
|
| FontManager () |
| Constructor. More...
|
|
| ~FontManager () |
| Destructor. More...
|
|
template<typename T > |
T * | getFont () |
| Return a specfic type of FontWithFace found in m_fonts. More...
|
|
void | checkFTError (FT_Error err, const std::string &desc) const |
| Check for any error discovered in a freetype function that will return a FT_Error value, and log into the terminal. More...
|
|
bool | hasColorEmoji () const |
|
FT_Library | getFTLibrary () const |
| Return the m_ft_library. More...
|
|
FT_Face | loadColorEmoji () |
|
unsigned | getShapingDPI () const |
|
void | shape (const std::u32string &text, std::vector< irr::gui::GlyphLayout > &gls, irr::u32 shape_flag=0) |
|
std::vector< irr::gui::GlyphLayout > & | getCachedLayouts (const irr::core::stringw &str) |
|
void | clearCachedLayouts () |
|
void | initGlyphLayouts (const irr::core::stringw &text, std::vector< irr::gui::GlyphLayout > &gls, irr::u32 shape_flag=0) |
| Convert text to glyph layouts for fast rendering with (optional) caching enabled.
|
|
void | loadFonts () |
| Initialize all FaceTTF and FontWithFace members.
|
|
void | unitTesting () |
| Unit testing that will try to load all translations in STK, and discover if there is any characters required by it are not supported in m_normal_ttf.
|
|
|
std::vector< FT_Face > | loadTTF (const std::vector< std::string > &ttf_list) |
| Load all TTFs from a list to m_faces. More...
|
|
This class stores all font files required in STK.
◆ FontManager()
FontManager::FontManager |
( |
| ) |
|
◆ ~FontManager()
FontManager::~FontManager |
( |
| ) |
|
Destructor.
Clears all fonts and related stuff.
◆ checkFTError()
void FontManager::checkFTError |
( |
FT_Error |
err, |
|
|
const std::string & |
desc |
|
) |
| const |
|
inline |
Check for any error discovered in a freetype function that will return a FT_Error value, and log into the terminal.
- Parameters
-
err | The Freetype function. |
desc | The description of what is the function doing. |
◆ getFont()
template<typename T >
T* FontManager::getFont |
( |
| ) |
|
|
inline |
◆ getFTLibrary()
FT_Library FontManager::getFTLibrary |
( |
| ) |
const |
|
inline |
◆ loadTTF()
std::vector< FT_Face > FontManager::loadTTF |
( |
const std::vector< std::string > & |
ttf_list | ) |
|
|
private |
Load all TTFs from a list to m_faces.
- Parameters
-
ttf_list | List of TTFs to be loaded. |
◆ m_cached_gls
std::map<irr::core::stringw, std::vector<irr::gui::GlyphLayout> > FontManager::m_cached_gls |
|
private |
Text drawn to glyph layouts cache.
◆ m_digit_face
FT_Face FontManager::m_digit_face |
|
private |
TTF file for digit font in STK.
◆ m_faces
std::vector<FT_Face> FontManager::m_faces |
|
private |
List of TTF files for complex text shaping.
◆ m_font_type_map
std::unordered_map<std::type_index, int> FontManager::m_font_type_map |
|
private |
◆ m_fonts
◆ m_ft_faces_to_index
std::map<FT_Face, uint16_t> FontManager::m_ft_faces_to_index |
|
private |
Map FT_Face to index for quicker layout.
◆ m_ft_library
FT_Library FontManager::m_ft_library |
|
private |
A FreeType library, it holds the FT_Face internally inside freetype.
◆ m_shaping_dpi
unsigned FontManager::m_shaping_dpi |
|
private |
DPI used when shaping, each face will apply an inverse of this and the dpi of itself when rendering, so all faces can share the same glyph layout cache.
The documentation for this class was generated from the following files: