MyGL
Loading...
Searching...
No Matches
Font.hpp
1#ifndef MYGL_FONT
2#define MYGL_FONT
3
4#include "../mygl_export.h"
5
6#include <ft2build.h>
7#include <glad/gl.h>
8#include FT_FREETYPE_H
9
10#include "../Texture.hpp"
11
12#include <string>
13#include <vector>
14
15namespace my
16{
20 class Font
21 {
22 private:
23 static FT_Library ftLib;
24 static unsigned int instancesCount;
25 FT_Face m_face;
26
36 static void addGlyph(FT_GlyphSlot& glyph, std::vector<uint8_t>& texture, FT_Pos x, FT_Pos y, FT_Pos width);
37
44 Texture getStringTexture(const std::string& text, unsigned int size);
45
46 public:
50 MYGL_EXPORT Font();
51
60 MYGL_EXPORT Font(const std::string& fontFilename);
61
67 MYGL_EXPORT bool load(const std::string& fontFilename);
68
69 MYGL_EXPORT ~Font();
70
71 friend class Text;
72 };
73
74} // namespace my
75
76#endif // MYGL_FONT
Class for storing a font.
Definition Font.hpp:21
MYGL_EXPORT bool load(const std::string &fontFilename)
Loads a font.
MYGL_EXPORT Font()
Default constructor, doesn't produce a usable font.
MYGL_EXPORT Font(const std::string &fontFilename)
Creates a font from a font file.
Class for drawing strings of text.
Definition Text.hpp:46
Class for storing textures.
Definition Texture.hpp:21
Namespace containing every class, function and enum of the library.
Definition Camera.hpp:10