blob: c75b9a11e2e0797b96b7c2e48386c3868357c7ec (
plain)
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
|
#ifndef __LIBJIN_FONTDATA_H
#define __LIBJIN_FONTDATA_H
#include "../3rdparty/stb/stb_truetype.h"
#include "Color.h"
#include <vector>
namespace jin
{
namespace graphics
{
class FontData
{
public:
static FontData* createFontData(const unsigned char* data, unsigned int size);
~FontData();
void pushFontsize(unsigned int fontsize);
void popFontsize();
Channel* getCodepointBitmapAlpha(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const;
Color* getCodepointBitmap(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const;
void getVMetrics(int* baseline, int* descent);
void getHMetrics(unsigned int codepoint, int* advanceWidth, int* leftSideBearing);
private:
static const unsigned int FONT_SIZE = 12;
FontData(const unsigned char* data, unsigned int size);
stbtt_fontinfo info;
struct
{
unsigned char* data;
unsigned int size;
} raw;
std::vector<float> scales;
};
}
}
#endif
|