add FontManager, Font classes

This commit is contained in:
josh committed 2014-06-10 21:23:58 -04:00
1 parent 3c348fe893
commit 7eba046aa4
5 files changed
+77 -3

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#include "Font.h"
#include <iostream>
namespace jes
{
bool Font::load(FT_Library ft, const char * fname, size_t size)
{
if (FT_New_Face(ft, fname, 0, &m_face) != 0)
{
std::cerr << "Could not load font " << fname << std::endl;
return false;
}
FT_Set_Pixel_Sizes(m_face, 0, size);
return true;
}
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef JES_FONT_H
#define JES_FONT_H
#include "jes/Ref.h"
#include <ft2build.h>
#include FT_FREETYPE_H
namespace jes
{
class Font
{
public:
bool load(FT_Library ft, const char * fname, size_t size);
protected:
FT_Face m_face;
};
typedef Ref<Font> FontRef;
}
#endif
+14
View File
@@ -0,0 +1,14 @@
#include "FontManager.h"
#include <iostream>
namespace jes
{
FontManager::FontManager()
{
if (FT_Init_FreeType(&m_ft) != 0)
{
std::cerr << "Error initializing FreeType" << std::endl;
return;
}
}
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef JES_FONTMANAGER_H
#define JES_FONTMANAGER_H
#include "jes/Ref.h"
#include <ft2build.h>
#include FT_FREETYPE_H
namespace jes
{
class FontManager
{
public:
FontManager();
protected:
FT_Library m_ft;
};
typedef Ref<FontManager> FontManagerRef;
}
#endif