annotate libass/ass_cache.h @ 20469:54babf7ca302

If HAVE_FONTCONFIG is not defined, font_fontconfig might be declared both extern and static, causing compilation to fail
author reimar
date Sat, 28 Oct 2006 10:21:30 +0000
parents fa122b7c71c6
children 4e7a7dea3e1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
2 // vim:ts=8:sw=8:noet:ai:
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
3 /*
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
5
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
6 This program is free software; you can redistribute it and/or modify
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
7 it under the terms of the GNU General Public License as published by
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
8 the Free Software Foundation; either version 2 of the License, or
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
9 (at your option) any later version.
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
10
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
11 This program is distributed in the hope that it will be useful,
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
14 GNU General Public License for more details.
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
15
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
16 You should have received a copy of the GNU General Public License
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
17 along with this program; if not, write to the Free Software
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
19 */
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
20
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
21 #ifndef __ASS_CACHE_H__
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
22 #define __ASS_CACHE_H__
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
23
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
24 #include <ft2build.h>
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25 #include FT_FREETYPE_H
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
26 #include FT_STROKER_H
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
27 #include FT_GLYPH_H
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29 // font cache
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30 typedef struct face_desc_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
31 char* family;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
32 unsigned bold;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
33 unsigned italic;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
34 } face_desc_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
35
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36 void ass_face_cache_init(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
37 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
38 void ass_face_cache_done(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
39
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
40
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
41 // describes a glyph; glyphs with equivalents structs are considered identical
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
42 typedef struct glyph_hash_key_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
43 char bitmap; // bool : true = bitmap, false = outline
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
44 FT_Face face;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
45 int size; // font size
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
46 int index; // glyph index in the face
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
47 unsigned outline; // border width, 16.16 fixed point value
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
48 int bold, italic;
19848
07be98a5dd5f Add \be (blur edges) support to libass.
eugeni
parents: 19846
diff changeset
49 char be; // blur edges
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
50
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
51 // the following affects bitmap glyphs only
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
52 unsigned scale_x, scale_y; // 16.16
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
53 int angle; // signed 16.16
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
54
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
55 FT_Vector advance; // subpixel shift vector
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
56 } glyph_hash_key_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
57
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
58 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
59 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
60 bitmap_t* bm_o;
19965
70352570e9ae Shadow support in libass.
eugeni
parents: 19848
diff changeset
61 bitmap_t* bm_s;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
62 FT_BBox bbox_scaled; // bbox after scaling, but before rotation
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
63 FT_Vector advance; // 26.6, advance distance to the next glyph in line
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
64 } glyph_hash_val_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
65
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
66 void ass_glyph_cache_init(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
67 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
68 glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
19539
64009ae411fb Reset glyph cache on reconfigure.
eugeni
parents: 18937
diff changeset
69 void ass_glyph_cache_reset(void);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
70 void ass_glyph_cache_done(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
71
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
72 #endif
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
73