diff --git a/src/gui/Font.cc b/src/gui/Font.cc index 3c0491d..8ce4a1a 100644 --- a/src/gui/Font.cc +++ b/src/gui/Font.cc @@ -3,6 +3,19 @@ namespace jes { + Font::Font() + { + m_loaded = false; + } + + Font::~Font() + { + if (m_loaded) + { + FT_Done_Face(m_face); + } + } + bool Font::load(FT_Library ft, const char * fname, size_t size) { if (FT_New_Face(ft, fname, 0, &m_face) != 0) @@ -13,6 +26,7 @@ namespace jes FT_Set_Pixel_Sizes(m_face, 0, size); + m_loaded = true; return true; } } diff --git a/src/gui/Font.h b/src/gui/Font.h index 3dfffa6..a824920 100644 --- a/src/gui/Font.h +++ b/src/gui/Font.h @@ -10,9 +10,12 @@ namespace jes class Font { public: + Font(); + ~Font(); bool load(FT_Library ft, const char * fname, size_t size); protected: FT_Face m_face; + bool m_loaded; }; typedef Ref FontRef;