metaforce/specter/include/Specter/FontCache.hpp

57 lines
1.1 KiB
C++
Raw Normal View History

2015-11-21 23:45:02 +00:00
#ifndef SPECTER_FONTCACHE_HPP
#define SPECTER_FONTCACHE_HPP
#include <ft2build.h>
#include FT_FREETYPE_H
2015-11-22 04:32:12 +00:00
#include <boo/boo.hpp>
#include <HECL/Runtime.hpp>
2015-11-21 23:45:02 +00:00
namespace Specter
{
2015-11-22 22:30:42 +00:00
class FreeTypeGZipMemFace
{
FT_StreamRec m_comp = {};
FT_StreamRec m_decomp = {};
FT_Face m_face;
public:
FreeTypeGZipMemFace(FT_Library lib, const uint8_t* data, size_t sz);
~FreeTypeGZipMemFace();
operator FT_Face() {return m_face;}
};
2015-11-22 04:32:12 +00:00
class FontHandle
{
};
class FontAtlas
{
FT_Face m_face;
std::vector<boo::ITextureS*> m_texs;
};
2015-11-21 23:45:02 +00:00
class FontCache
{
2015-11-22 04:32:12 +00:00
const HECL::Runtime::FileStoreManager& m_fileMgr;
2015-11-22 23:51:44 +00:00
struct Library
{
FT_Library m_lib;
Library();
~Library();
operator FT_Library() {return m_lib;}
} m_fontLib;
2015-11-22 22:30:42 +00:00
FreeTypeGZipMemFace m_regFace;
FreeTypeGZipMemFace m_monoFace;
2015-11-22 04:32:12 +00:00
public:
FontCache(const HECL::Runtime::FileStoreManager& fileMgr);
FontHandle prepMainFont(float points=10.0);
FontHandle prepMonoFont(float points=10.0);
FontHandle prepCustomFont(FT_Face face, float points=10.0);
2015-11-21 23:45:02 +00:00
};
}
#endif // SPECTER_FONTCACHE_HPP