|
Aether
SDL2 based UI Framework for NX
|
Caches SDL_ttf font objects + surfaces to reduce rendering. This class is not thread-safe, all operations should be protected from the outside by a mutex. More...
#include <FontCache.hpp>
Public Member Functions | |
| FontCache (Renderer *renderer) | |
| Pointer to main renderer in order to manipulate surfaces. More... | |
| void | empty () |
| Remove all cached data. | |
| void | setCustomFont (const std::string &path) |
| Set a custom font to use before checking built-in fonts. Pass an empty string to remove. More... | |
| SDL_Surface * | getGlyph (const uint16_t ch, const unsigned int fontSize) |
| Render the requested character. Searches a custom font first before in-built fonts. More... | |
| GlyphMetrics | getMetrics (const uint16_t ch, const unsigned int fontSize) |
| Get the GlyphMetrics for the character at the passed font size. More... | |
| ~FontCache () | |
| Cleans up all allocated resources. | |
Caches SDL_ttf font objects + surfaces to reduce rendering. This class is not thread-safe, all operations should be protected from the outside by a mutex.
| Aether::FontCache::FontCache | ( | Renderer * | renderer | ) |
Pointer to main renderer in order to manipulate surfaces.
Initialize the font cache object + rendering backend.
| renderer | Pointer to main renderer |
| SDL_Surface* Aether::FontCache::getGlyph | ( | const uint16_t | ch, |
| const unsigned int | fontSize | ||
| ) |
Render the requested character. Searches a custom font first before in-built fonts.
| ch | UTF-8 character code |
| fontSize | Font size to render character with |
| GlyphMetrics Aether::FontCache::getMetrics | ( | const uint16_t | ch, |
| const unsigned int | fontSize | ||
| ) |
Get the GlyphMetrics for the character at the passed font size.
| ch | UTf-8 character code |
| fontSize | Font size to get metrics for |
| void Aether::FontCache::setCustomFont | ( | const std::string & | path | ) |
Set a custom font to use before checking built-in fonts. Pass an empty string to remove.
| path | Path to TTF file. |
1.8.13