#ifndef SPECTRE_GRAPHICS_FONT_H #define SPECTRE_GRAPHICS_FONT_H #include #include #include #include #include #include namespace sp { class FontEngine; // TODO: Fixup this api :) class Font { public : struct Info { std::string name; }; Font(); ~Font(); bool loadFromFile(const std::string& filename); bool loadFromMemory(const void *data); Glyph getGlyph(unsigned int code) const; const Texture* getTexture() const; protected : bool loadData(); void loadChar(unsigned char code) const; void createTexture(); void resizeTexture() const; Vector2u findTextureRegion(const Image& img) const; protected : struct CacheTexture { vec2u texpos; unsigned shelf; Texture texture; }; FontEngine *m_engine; mutable std::map m_charset; // Alpha Cache texture. mutable CacheTexture m_cacheTextureA; std::vector m_rawData; }; } #endif /* SPECTRE_GRAPHICS_FONT_H */