Font: add constructor/destructor
This commit is contained in:
parent
07662e0abc
commit
27a167e97d
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user