annotate libass/ass_cache.h @ 19846:bcc792bfa431

Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer. This is required for various bitmap modifications (like blur, outline and shadow).
author eugeni
date Sat, 16 Sep 2006 13:08:17 +0000
parents 64009ae411fb
children 07be98a5dd5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
1 #ifndef __ASS_CACHE_H__
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
2 #define __ASS_CACHE_H__
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
3
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
4 #include <ft2build.h>
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
5 #include FT_FREETYPE_H
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
6 #include FT_STROKER_H
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
7 #include FT_GLYPH_H
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
8
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
9 // font cache
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
10 typedef struct face_desc_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
11 char* family;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
12 unsigned bold;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
13 unsigned italic;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
14 } face_desc_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
15
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
16 void ass_face_cache_init(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
17 int ass_new_face(FT_Library library, void* fontconfig_priv, face_desc_t* desc, /*out*/ FT_Face* face);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
18 void ass_face_cache_done(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
19
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
20
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
21 // describes a glyph; glyphs with equivalents structs are considered identical
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
22 typedef struct glyph_hash_key_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
23 char bitmap; // bool : true = bitmap, false = outline
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
24 FT_Face face;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25 int size; // font size
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
26 int index; // glyph index in the face
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
27 unsigned outline; // border width, 16.16 fixed point value
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28 int bold, italic;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30 // the following affects bitmap glyphs only
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
31 unsigned scale_x, scale_y; // 16.16
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
32 int angle; // signed 16.16
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
33
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
34 FT_Vector advance; // subpixel shift vector
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
35 } glyph_hash_key_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
37 typedef struct glyph_hash_val_s {
19846
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents: 19539
diff changeset
38 bitmap_t* bm; // the actual glyph bitmaps
bcc792bfa431 Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents: 19539
diff changeset
39 bitmap_t* bm_o;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
40 FT_BBox bbox_scaled; // bbox after scaling, but before rotation
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
41 FT_Vector advance; // 26.6, advance distance to the next glyph in line
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
42 } glyph_hash_val_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
43
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
44 void ass_glyph_cache_init(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
45 void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
46 glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
19539
64009ae411fb Reset glyph cache on reconfigure.
eugeni
parents: 18937
diff changeset
47 void ass_glyph_cache_reset(void);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
48 void ass_glyph_cache_done(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
49
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
50 #endif
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
51