#include "../../include/mglpp/graphics/Font.hpp" #include "../../include/mglpp/graphics/Texture.hpp" #include namespace mgl { Font::Font() { memset(&font, 0, sizeof(font)); } Font::~Font() { mgl_font_unload(&font); } bool Font::load_from_file(const char *filepath, unsigned int character_size) { if(font.texture.id) return false; return mgl_font_load_from_file(&font, filepath, character_size) == 0; } unsigned int Font::get_character_size() const { return font.character_size; } FontGlyph Font::get_glyph(uint32_t codepoint) const { FontGlyph font_glyph; if(font.texture.id == 0) return font_glyph; mgl_font_get_glyph(&font, codepoint, (mgl_font_glyph*)&font_glyph); return font_glyph; } Texture Font::get_texture() const { if(font.texture.id == 0) return Texture(); return Texture::reference(font.texture); } mgl_font* Font::internal_font() { return &font; } }