18937
|
1 #ifndef __ASS_CACHE_H__
|
|
2 #define __ASS_CACHE_H__
|
|
3
|
|
4 #include <ft2build.h>
|
|
5 #include FT_FREETYPE_H
|
|
6 #include FT_STROKER_H
|
|
7 #include FT_GLYPH_H
|
|
8
|
|
9 // font cache
|
|
10 typedef struct face_desc_s {
|
|
11 char* family;
|
|
12 unsigned bold;
|
|
13 unsigned italic;
|
|
14 } face_desc_t;
|
|
15
|
|
16 void ass_face_cache_init(void);
|
|
17 int ass_new_face(FT_Library library, void* fontconfig_priv, face_desc_t* desc, /*out*/ FT_Face* face);
|
|
18 void ass_face_cache_done(void);
|
|
19
|
|
20
|
|
21 // describes a glyph; glyphs with equivalents structs are considered identical
|
|
22 typedef struct glyph_hash_key_s {
|
|
23 char bitmap; // bool : true = bitmap, false = outline
|
|
24 FT_Face face;
|
|
25 int size; // font size
|
|
26 int index; // glyph index in the face
|
|
27 unsigned outline; // border width, 16.16 fixed point value
|
|
28 int bold, italic;
|
|
29
|
|
30 // the following affects bitmap glyphs only
|
|
31 unsigned scale_x, scale_y; // 16.16
|
|
32 int angle; // signed 16.16
|
|
33
|
|
34 FT_Vector advance; // subpixel shift vector
|
|
35 } glyph_hash_key_t;
|
|
36
|
|
37 typedef struct glyph_hash_val_s {
|
|
38 FT_Glyph glyph; // the actual glyphs
|
|
39 FT_Glyph outline_glyph;
|
|
40 FT_BBox bbox_scaled; // bbox after scaling, but before rotation
|
|
41 FT_Vector advance; // 26.6, advance distance to the next glyph in line
|
|
42 } glyph_hash_val_t;
|
|
43
|
|
44 void ass_glyph_cache_init(void);
|
|
45 void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val);
|
|
46 glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
|
|
47 void ass_glyph_cache_done(void);
|
|
48
|
|
49 #endif
|
|
50
|