6#include <unordered_map>
22 std::array<GLfloat, 12> texcoords;
28 CachedGlyph(
char c, std::array<GLfloat, 12> texcoords,
float x2o,
float y2o,
float w,
float h,
float advX,
float advY);
30 [[nodiscard]] std::array<GLfloat, 12>
getTexCoords()
const;
36 std::unordered_map<char, CachedGlyph*> glyphs;
38 GLsizei texture_width = 0, texture_height = 0;
39 unsigned int font_size = 0;
40 unsigned int font_index = 0;
47 std::unordered_map<char, CachedGlyph*>
getGlyphs();
52 CachedFont(GLuint texture_id, GLsizei texture_width, GLsizei texture_height,
unsigned int font_size,
unsigned int font_index);
58 std::vector<CachedFont*> cachedFonts{};
63 void newFont(GLuint texture_id, GLsizei texture_width, GLsizei texture_height,
unsigned int font_size,
unsigned int font_index);
Represents a Font object as it exists in the font-cache.
Definition: FontCache.h:34
~CachedFont()
Definition: FontCache.cpp:72
unsigned int getFontIndex() const
Definition: FontCache.cpp:32
GLsizei getTextureHeight() const
Definition: FontCache.cpp:63
std::unordered_map< char, CachedGlyph * > getGlyphs()
Definition: FontCache.cpp:51
unsigned int getFontSize() const
Definition: FontCache.cpp:28
const GLuint * getTextureHandle()
Definition: FontCache.cpp:55
CachedGlyph * getGlyph(char c)
Definition: FontCache.cpp:36
GLsizei getTextureWidth() const
Definition: FontCache.cpp:59
CachedFont(GLuint texture_id, GLsizei texture_width, GLsizei texture_height, unsigned int font_size, unsigned int font_index)
Definition: FontCache.cpp:43
void appendGlyph(CachedGlyph *glyph)
Definition: FontCache.cpp:24
Represents a single font-character "glyph", that has been cached in-memory for fast retrieval.
Definition: FontCache.h:19
int y2offset
Definition: FontCache.h:24
float advanceX
Definition: FontCache.h:25
CachedGlyph(char c, std::array< GLfloat, 12 > texcoords, float x2o, float y2o, float w, float h, float advX, float advY)
Definition: FontCache.cpp:13
std::array< GLfloat, 12 > getTexCoords() const
Definition: FontCache.cpp:9
int w
Definition: FontCache.h:24
float advanceY
Definition: FontCache.h:25
int x2offset
Definition: FontCache.h:24
int h
Definition: FontCache.h:24
char getCharacter() const
Definition: FontCache.cpp:5
Definition: FontCache.h:56
void purgeCache()
Definition: FontCache.cpp:94
void eraseFont(CachedFont *font)
Definition: FontCache.cpp:85
void appendFont(CachedFont *font)
Definition: FontCache.cpp:76
CachedFont * getFont(unsigned int font_size, unsigned int font_index)
Definition: FontCache.cpp:104
void newFont(GLuint texture_id, GLsizei texture_width, GLsizei texture_height, unsigned int font_size, unsigned int font_index)
Definition: FontCache.cpp:80
std::vector< CachedFont * > getFonts()
Definition: FontCache.cpp:100
OpenGL Wrapper for rendering 2D & 3D graphics in both a 2D and 3D context.
Definition: JGL.h:31
FontCache fontCache
Definition: FontCache.h:69