Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File: font.hpp, created on Aug 20, 2011 by WeltEnSTurm
- #ifndef FONT_HPP_
- #define FONT_HPP_
- #include <ft2build.h>
- #include <freetype/freetype.h>
- #include <freetype/ftglyph.h>
- #include <freetype/ftoutln.h>
- #include <freetype/fttrigon.h>
- #include <vector>
- #include <string>
- #include "tools/base.hpp"
- #include "GLTools.h"
- #include "GLBatch.h"
- class fm {
- public:
- class font {
- protected:
- struct Glyph {
- GLuint Map;
- GLBatch Vertices;
- long Width;
- long Height;
- };
- FT_Face Face;
- bool Invalid;
- std::string Path;
- long Index;
- public:
- std::vector<Glyph*> Data;
- font(bool ninv = true){
- Invalid = !ninv;
- }
- void init();
- bool operator ! (){
- return Invalid;
- }
- friend class fm;
- };
- protected:
- fm(){
- }
- ~fm();
- FT_Library mLib;
- std::vector<font*> Fonts;
- public:
- static fm& Get(){
- static fm Manager;
- return Manager;
- }
- static font* LoadFont(std::string path, long size = 12, long index = 0);
- void DrawText(const std::string& text);
- };
- #endif /* FONT_HPP_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement