annotate libass/ass_font.h @ 33263:5f527a9a9521

Add an exit function. This function will allow performing clean-up operations. (MPlayer calls guiDone() before exiting, but only if the GUI has been initialized, i.e. if guiInit() has been called successfully. Any exit_player()/exit_player_with_rc() after GUI's cfg_read() until guiInit(), or any exit_player() during guiInit() itself will end the GUI without calling guiDone(). This exit function will at least handle abortions during guiInit() itself. It will be called twice in case of an guiExit() after GUI initialization - first directly, next by guiDone() via MPlayer's exit_player_with_rc().)
author ib
date Tue, 03 May 2011 12:19:22 +0000
parents e64df5862cea
children 88eebbbbd6a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
1 /*
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
3 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
4 * This file is part of libass.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
5 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
6 * libass is free software; you can redistribute it and/or modify
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
7 * it under the terms of the GNU General Public License as published by
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
9 * (at your option) any later version.
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
10 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
11 * libass is distributed in the hope that it will be useful,
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
14 * GNU General Public License for more details.
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
15 *
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
16 * You should have received a copy of the GNU General Public License along
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
17 * with libass; if not, write to the Free Software Foundation, Inc.,
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
19 */
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
20
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
21 #ifndef LIBASS_FONT_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
22 #define LIBASS_FONT_H
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
23
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
24 #include <stdint.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
25 #include <ft2build.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
26 #include FT_GLYPH_H
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
27 #include "ass.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
28 #include "ass_types.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
29
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
30 #define ASS_FONT_MAX_FACES 10
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
31 #define DECO_UNDERLINE 1
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
32 #define DECO_STRIKETHROUGH 2
21321
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
33
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
34 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
35 char *family;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
36 unsigned bold;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
37 unsigned italic;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
38 int treat_family_as_pattern;
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
39 int vertical; // @font vertical layout
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
40 } ASS_FontDesc;
21619
b4b51eb2904f Keep reselected fonts in an array, adding new ones to the end. Glyph
eugeni
parents: 21618
diff changeset
41
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
42 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
43 ASS_FontDesc desc;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
44 ASS_Library *library;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
45 FT_Library ftlibrary;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
46 FT_Face faces[ASS_FONT_MAX_FACES];
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
47 int n_faces;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
48 double scale_x, scale_y; // current transform
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
49 FT_Vector v; // current shift
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
50 double size;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
51 } ASS_Font;
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
52
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
53 // FIXME: passing the hashmap via a void pointer is very ugly.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
54 ASS_Font *ass_font_new(void *font_cache, ASS_Library *library,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
55 FT_Library ftlibrary, void *fc_priv,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
56 ASS_FontDesc *desc);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
57 void ass_font_set_transform(ASS_Font *font, double scale_x,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
58 double scale_y, FT_Vector *v);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
59 void ass_font_set_size(ASS_Font *font, double size);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
60 void ass_font_get_asc_desc(ASS_Font *font, uint32_t ch, int *asc,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
61 int *desc);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
62 FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
63 uint32_t ch, ASS_Hinting hinting, int flags);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
64 FT_Vector ass_font_get_kerning(ASS_Font *font, uint32_t c1, uint32_t c2);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
65 void ass_font_free(ASS_Font *font);
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
66 void fix_freetype_stroker(FT_OutlineGlyph glyph, int border_x, int border_y);
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
67
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
68 #endif /* LIBASS_FONT_H */