1 #ifndef AETHER_FONTCACHE_HPP 2 #define AETHER_FONTCACHE_HPP 4 #include "Aether/types/GlyphMetrics.hpp" 5 #include "Aether/types/LRUCache.hpp" 20 typedef struct _TTF_Font TTF_Font;
24 typedef std::tuple<size_t, unsigned int, uint16_t> SurfaceKey;
30 struct hash<SurfaceKey> {
31 size_t operator() (
const SurfaceKey & k)
const {
37 hash |= std::get<0>(k);
39 hash |= std::get<1>(k);
41 hash |= std::get<2>(k);
57 std::string customFontPath;
59 PlFontData_ * ninFontData;
62 std::vector< LRUCache<unsigned int, TTF_Font *> * > fontCache;
87 void setCustomFont(
const std::string & path);
101 SDL_Surface * getGlyph(
const uint16_t ch,
const unsigned int fontSize);
110 GlyphMetrics getMetrics(
const uint16_t ch,
const unsigned int fontSize);
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.
Definition: FontCache.hpp:55
Definition: FontCache.hpp:28
Aether's main renderer instance. It provides all methods relating to drawing directly to the screen...
Definition: Renderer.hpp:30
A basic LRU (least recently used) cache implementation. Also supports a custom callback for when an i...
Definition: LRUCache.hpp:14
Base namespace for all Aether related classes and functions.
Class storing metrics for a font's character. Designed to be read-only as it is only able to return v...
Definition: GlyphMetrics.hpp:11