annotate libass/ass_font.h @ 28998:a445ca582c0a

Synced with r28991.
author bircoph
date Sun, 22 Mar 2009 12:38:52 +0000
parents 7fcc0bf5b27a
children 48d020c5ceca
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 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
2 // vim:ts=8:sw=8:noet:ai:
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
3 /*
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
4 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
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 * This file is part of libass.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
7 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
8 * libass is free software; you can redistribute it and/or modify
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
9 * it under the terms of the GNU General Public License as published by
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
11 * (at your option) any later version.
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
12 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
13 * libass is distributed in the hope that it will be useful,
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
16 * GNU General Public License for more details.
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
17 *
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
18 * 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
19 * with libass; if not, write to the Free Software Foundation, Inc.,
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
21 */
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
22
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
23 #ifndef LIBASS_FONT_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
24 #define LIBASS_FONT_H
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
25
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
26 #include <stdint.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
27 #include <ft2build.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
28 #include FT_GLYPH_H
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
29 #include "ass.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
30 #include "ass_types.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
31
21321
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
32 typedef struct ass_font_desc_s {
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
33 char* family;
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
34 unsigned bold;
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
35 unsigned italic;
28860
7fcc0bf5b27a Treat -font/-subfont as Fontconfig pattern in libass.
eugeni
parents: 26738
diff changeset
36 int treat_family_as_pattern;
21321
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
37 } ass_font_desc_t;
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
38
21619
b4b51eb2904f Keep reselected fonts in an array, adding new ones to the end. Glyph
eugeni
parents: 21618
diff changeset
39 #define ASS_FONT_MAX_FACES 10
b4b51eb2904f Keep reselected fonts in an array, adding new ones to the end. Glyph
eugeni
parents: 21618
diff changeset
40
21321
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
41 typedef struct ass_font_s {
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
42 ass_font_desc_t desc;
23981
705628816d98 Factor out common code from ass_font_new and ass_font_reselect.
eugeni
parents: 23980
diff changeset
43 ass_library_t* library;
21349
11679d93c7d8 Add FT_Library to ass_font_t.
eugeni
parents: 21323
diff changeset
44 FT_Library ftlibrary;
21619
b4b51eb2904f Keep reselected fonts in an array, adding new ones to the end. Glyph
eugeni
parents: 21618
diff changeset
45 FT_Face faces[ASS_FONT_MAX_FACES];
b4b51eb2904f Keep reselected fonts in an array, adding new ones to the end. Glyph
eugeni
parents: 21618
diff changeset
46 int n_faces;
23299
0ee56ec36a40 Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents: 23134
diff changeset
47 double scale_x, scale_y; // current transform
21321
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
48 FT_Vector v; // current shift
23300
04dbd42b3962 Support fractional font sizes.
eugeni
parents: 23299
diff changeset
49 double size;
21321
7b7627ff1937 Move ass_font_desc_t and ass_font_t declarations to ass_font.h.
eugeni
parents: 21317
diff changeset
50 } ass_font_t;
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
51
21460
62bd8e0d3a0f Open embedded fonts directly from memory.
eugeni
parents: 21351
diff changeset
52 ass_font_t* ass_font_new(ass_library_t* library, FT_Library ftlibrary, void* fc_priv, ass_font_desc_t* desc);
23299
0ee56ec36a40 Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents: 23134
diff changeset
53 void ass_font_set_transform(ass_font_t* font, double scale_x, double scale_y, FT_Vector* v);
23300
04dbd42b3962 Support fractional font sizes.
eugeni
parents: 23299
diff changeset
54 void ass_font_set_size(ass_font_t* font, double size);
21614
5d2ca7ca18b5 Move ascender, descender, and kerning computation to ass_font.c.
eugeni
parents: 21460
diff changeset
55 void ass_font_get_asc_desc(ass_font_t* font, uint32_t ch, int* asc, int* desc);
23134
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21619
diff changeset
56 FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch, ass_hinting_t hinting);
21614
5d2ca7ca18b5 Move ascender, descender, and kerning computation to ass_font.c.
eugeni
parents: 21460
diff changeset
57 FT_Vector ass_font_get_kerning(ass_font_t* font, uint32_t c1, uint32_t c2);
21277
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
58 void ass_font_free(ass_font_t* font);
0603972f083c Move fonts-related code to a separate file.
eugeni
parents:
diff changeset
59
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
60 #endif /* LIBASS_FONT_H */