-
Notifications
You must be signed in to change notification settings - Fork 0
/
wft.hpp
74 lines (54 loc) · 1.28 KB
/
wft.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef WFT2_HPP
#define WFT2_HPP
#include <iostream>
#include <vector>
extern "C" typedef struct FT_FaceRec_* FT_Face;
extern "C" typedef struct FT_LibraryRec_* FT_Library;
namespace wft {
struct mask_bits
{
mask_bits(void) {};
mask_bits(const FT_Face& F);
std::vector<unsigned char> Bits {};
uint32_t symbol_uncode = 0;
int top = 0;
int left = 0;
int width = 0;
int height = 0;
};
///
/// \brief The wft_lib class
///
class lib
{
private:
lib(const lib &) = delete;
lib &operator =(const lib &) = delete;
FT_Library FtLib {};
public:
lib(void);
~lib(void);
operator FT_Library() const { return FtLib; }
};
///
/// \brief The wft_face class
///
class font
{
private:
font(const font &) = delete;
font &operator =(const font &) = delete;
lib wFtLib {};
FT_Face FtFace {};
int get_kerning(unsigned int char_first, unsigned int char_second, unsigned int kern_mode = 0);
void get_bbox(mask_bits& Image);
public:
font(const char *filename, int face_index = 0);
~font(void);
operator FT_Face() const { return FtFace; }
void set_size(unsigned int w, unsigned int h);
mask_bits get_symbol(uint32_t symbol_code);
mask_bits make_bitmap_text(const std::string& Text);
};
} // namespace tr
#endif // WFT2_HPP