Font: add constructor/destructor

This commit is contained in:
josh committed 2014-06-15 20:37:31 -04:00
1 parent 07662e0abc
commit 27a167e97d
2 files changed
+17

No files matched your search

+14
View File
@@ -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;
}
}
+3
View File
@@ -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<Font> FontRef;