]> granicus.if.org Git - libass/blob - libass/ass_font.h
Add standard GPL header to mputils.c
[libass] / libass / ass_font.h
1 /*
2  * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
3  *
4  * This file is part of libass.
5  *
6  * libass is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * libass is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with libass; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef LIBASS_FONT_H
22 #define LIBASS_FONT_H
23
24 #include <stdint.h>
25 #include <ft2build.h>
26 #include FT_GLYPH_H
27 #include "ass.h"
28 #include "ass_types.h"
29
30 typedef struct ass_font_desc_s {
31     char *family;
32     unsigned bold;
33     unsigned italic;
34     int treat_family_as_pattern;
35 } ass_font_desc_t;
36
37 #define ASS_FONT_MAX_FACES 10
38
39 typedef struct ass_font_s {
40     ass_font_desc_t desc;
41     ass_library_t *library;
42     FT_Library ftlibrary;
43     FT_Face faces[ASS_FONT_MAX_FACES];
44     int n_faces;
45     double scale_x, scale_y;    // current transform
46     FT_Vector v;                // current shift
47     double size;
48 } ass_font_t;
49
50 // FIXME: passing the hashmap via a void pointer is very ugly.
51 ass_font_t *ass_font_new(void *font_cache, ass_library_t *library,
52                          FT_Library ftlibrary, void *fc_priv,
53                          ass_font_desc_t *desc);
54 void ass_font_set_transform(ass_font_t *font, double scale_x,
55                             double scale_y, FT_Vector * v);
56 void ass_font_set_size(ass_font_t *font, double size);
57 void ass_font_get_asc_desc(ass_font_t *font, uint32_t ch, int *asc,
58                            int *desc);
59 FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ass_font_t *font,
60                             uint32_t ch, ass_hinting_t hinting);
61 FT_Vector ass_font_get_kerning(ass_font_t *font, uint32_t c1, uint32_t c2);
62 void ass_font_free(ass_font_t *font);
63
64 #endif                          /* LIBASS_FONT_H */