DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
ft2_fontdefs.h
Go to the documentation of this file.
1#ifndef FT2_PRIVATE_H__
2#define FT2_PRIVATE_H__
3
4// anything should work, but I recommend multiples of 8
5// since the texture size should be a power of 2
6#define FONT_CHARS_PER_LINE 16
7#define FONT_CHAR_LINES 16
8#define FONT_CHARS_PER_MAP (FONT_CHARS_PER_LINE * FONT_CHAR_LINES)
9
10// map.start value for incremental maps to hold a place
11#define INCMAP_START 0x110000
12
13typedef struct glyph_slot_s
14{
16 // we keep the quad coords here only currently
17 // if you need other info, make Font_LoadMapForIndex fill it into this slot
18 float txmin; // texture coordinate in [0,1]
19 float txmax;
20 float tymin;
21 float tymax;
22 float vxmin;
23 float vxmax;
24 float vymin;
25 float vymax;
26 float advance_x;
27 float advance_y;
29
31{
33 float size;
34
35 // the actual size used in the freetype code
36 // by convention, the requested size is the height of the font's bounding box.
37 float intSize;
39
40 ft2_font_map_t *next;
41 cachepic_t *pic;
45
46 // saves us the trouble of calculating these over and over again
47 double sfx, sfy;
48
49 // note: float width_of[256] was moved to `struct dp_font_s` as width_of_ft2
50
51 // these may only present in a startmap
52 // contains the kerning information for the first 256 characters
53 // for the other characters, we will lookup the kerning information
55 // for accessing incremental maps for bigblock glyphs
56 font_incmap_t *incmap;
57};
58
60{
61 // associated fontmap; startmap of incmaps
65
66 // two rounds of merge will take place, keep those data until then
68 unsigned char *data_tier2[FONT_CHAR_LINES];
69
70 // count of merged maps
72};
73
75{
76 const unsigned char *data;
78};
79
80//qbool Font_LoadMapForIndex(ft2_font_t *font, Uchar _ch, ft2_font_map_t **outmap);
81qbool Font_LoadMapForIndex(ft2_font_t *font, int map_index, Uchar _ch, ft2_font_map_t **outmap);
82
83void font_start(void);
84void font_shutdown(void);
85void font_newmap(void);
86
87#endif // FT2_PRIVATE_H__
int64_t fs_offset_t
Definition fs.h:37
void font_newmap(void)
Definition ft2.c:439
#define FONT_CHARS_PER_MAP
Definition ft2_fontdefs.h:8
void font_start(void)
Definition ft2.c:404
#define FONT_CHARS_PER_LINE
Definition ft2_fontdefs.h:6
void font_shutdown(void)
Definition ft2.c:425
#define FONT_CHAR_LINES
Definition ft2_fontdefs.h:7
qbool Font_LoadMapForIndex(ft2_font_t *font, int map_index, Uchar _ch, ft2_font_map_t **outmap)
Definition ft2.c:1899
bool qbool
Definition qtypes.h:9
unsigned char * data_tier2[FONT_CHAR_LINES]
unsigned char * data_tier1[FONT_CHARS_PER_LINE]
struct ft2_font_map_s * fontmap
fs_offset_t size
const unsigned char * data
ft2_font_map_t * next
glyph_slot_t glyphs[FONT_CHARS_PER_MAP]
font_incmap_t * incmap
ft2_kerning_t * kerning
cachepic_t * pic
Uchar glyphchars[FONT_CHARS_PER_MAP]
int32_t Uchar
Definition utf8lib.h:35