MCPcopy Create free account
hub / github.com/arrayfire/forge / font_impl

Class font_impl

src/backend/opengl/font_impl.hpp:26–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24typedef std::vector<Glyph*> GlyphList;
25
26class font_impl {
27 private:
28 /* VAO map to store a vertex array object
29 * for each valid window context */
30 std::map<int, gl::GLuint> mVAOMap;
31
32 /* attributes */
33 std::string mTTFfile;
34 bool mIsFontLoaded;
35 FontAtlas* mAtlas;
36 gl::GLuint mVBO;
37 ShaderProgram mProgram;
38 int mOrthoW;
39 int mOrthoH;
40
41 std::vector<GlyphList> mGlyphLists;
42
43 /* OpenGL Data */
44 glm::mat4 mProjMat;
45 gl::GLuint mPMatIndex;
46 gl::GLuint mMMatIndex;
47 gl::GLuint mTexIndex;
48 gl::GLuint mClrIndex;
49
50 /* load all glyphs and create character atlas */
51 void loadAtlasWithGlyphs(const size_t pFontSize);
52
53 /* helper functions to bind and unbind
54 * rendering resources */
55 void bindResources(int pWindowId);
56 void unbindResources() const;
57
58 /* helper to destroy GL objects created for
59 * given font face and size if required */
60 void destroyGLResources();
61
62 public:
63 font_impl();
64 ~font_impl();
65
66 void setOthro2D(int pWidth, int pHeight);
67 void loadFont(const char* const pFile);
68 void loadSystemFont(const char* const pName);
69
70 void render(int pWindowId,
71 const float pPos[2], const float pColor[4], const char* pText,
72 size_t pFontSize, bool pIsVertical = false);
73};
74
75}
76}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected