annotate libass/ass_font.h @ 34373:7a4dbec9415b

Flush cache and sync stream position/eof after seeking STREAM_CTRLs. This avoid some strange differences in behaviour between -cache and -nocache.
author reimar
date Fri, 23 Dec 2011 21:50:32 +0000
parents 6e7f60f6f9d4
children
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 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
6 * Permission to use, copy, modify, and distribute this software for any
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
7 * purpose with or without fee is hereby granted, provided that the above
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
8 * copyright notice and this permission notice appear in all copies.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
9 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
17 */
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
18
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
19 #ifndef LIBASS_FONT_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
20 #define LIBASS_FONT_H
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
21
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
22 #include <stdint.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
23 #include <ft2build.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
24 #include FT_GLYPH_H
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
25 #include FT_OUTLINE_H
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
26
26138
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
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
30 #define VERTICAL_LOWER_BOUND 0x02f1
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
31
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
32 #define ASS_FONT_MAX_FACES 10
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
33 #define DECO_UNDERLINE 1
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
34 #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
35
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
36 typedef struct ass_shaper_font_data ASS_ShaperFontData;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
37
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
38 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
39 char *family;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
40 unsigned bold;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
41 unsigned italic;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
42 int treat_family_as_pattern;
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
43 int vertical; // @font vertical layout
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
44 } ASS_FontDesc;
21619
b4b51eb2904f Keep reselected fonts in an array, adding new ones to the end. Glyph
eugeni
parents: 21618
diff changeset
45
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
46 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
47 ASS_FontDesc desc;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
48 ASS_Library *library;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
49 FT_Library ftlibrary;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
50 FT_Face faces[ASS_FONT_MAX_FACES];
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
51 ASS_ShaperFontData *shaper_priv;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
52 int n_faces;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
53 double scale_x, scale_y; // current transform
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
54 FT_Vector v; // current shift
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
55 double size;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
56 } ASS_Font;
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
57
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
58 #include "ass_cache.h"
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
59
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
60 ASS_Font *ass_font_new(Cache *font_cache, ASS_Library *library,
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
61 FT_Library ftlibrary, void *fc_priv,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
62 ASS_FontDesc *desc);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
63 void ass_font_set_transform(ASS_Font *font, double scale_x,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
64 double scale_y, FT_Vector *v);
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
65 void ass_face_set_size(FT_Face face, double size);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
66 void ass_font_set_size(ASS_Font *font, double size);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
67 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
68 int *desc);
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
69 int ass_font_get_index(void *fcpriv, ASS_Font *font, uint32_t symbol,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
70 int *face_index, int *glyph_index);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
71 FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font,
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
72 uint32_t ch, int face_index, int index,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
73 ASS_Hinting hinting, int deco);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
74 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
75 void ass_font_free(ASS_Font *font);
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
76 void fix_freetype_stroker(FT_Outline *outline, int border_x, int border_y);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
77 void outline_copy(FT_Library lib, FT_Outline *source, FT_Outline **dest);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
78 void outline_free(FT_Library lib, FT_Outline *outline);
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
79
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 28860
diff changeset
80 #endif /* LIBASS_FONT_H */