]> granicus.if.org Git - libass/blob - libass/ass_font.h
renderer: eliminate use of bitmap pointers as mode flags
[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  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18
19 #ifndef LIBASS_FONT_H
20 #define LIBASS_FONT_H
21
22 #include <stdint.h>
23 #include <ft2build.h>
24 #include FT_GLYPH_H
25 #include FT_OUTLINE_H
26
27 typedef struct ass_font ASS_Font;
28 typedef struct ass_font_desc ASS_FontDesc;
29
30 #include "ass.h"
31 #include "ass_types.h"
32 #include "ass_fontselect.h"
33 #include "ass_cache.h"
34
35 #define VERTICAL_LOWER_BOUND 0x02f1
36
37 #define ASS_FONT_MAX_FACES 10
38 #define DECO_UNDERLINE     1
39 #define DECO_STRIKETHROUGH 2
40 #define DECO_ROTATE        4
41
42 struct ass_font_desc {
43     char *family;
44     unsigned bold;
45     unsigned italic;
46     int vertical;               // @font vertical layout
47 };
48
49 struct ass_font {
50     ASS_FontDesc desc;
51     ASS_Library *library;
52     FT_Library ftlibrary;
53     int faces_uid[ASS_FONT_MAX_FACES];
54     FT_Face faces[ASS_FONT_MAX_FACES];
55     ASS_ShaperFontData *shaper_priv;
56     int n_faces;
57     double size;
58 };
59
60 void charmap_magic(ASS_Library *library, FT_Face face);
61 ASS_Font *ass_font_new(ASS_Renderer *render_priv, ASS_FontDesc *desc);
62 void ass_face_set_size(FT_Face face, double size);
63 void ass_font_set_size(ASS_Font *font, double size);
64 void ass_font_get_asc_desc(ASS_Font *font, int face_index,
65                            int *asc, int *desc);
66 int ass_font_get_index(ASS_FontSelector *fontsel, ASS_Font *font,
67                        uint32_t symbol, int *face_index, int *glyph_index);
68 uint32_t ass_font_index_magic(FT_Face face, uint32_t symbol);
69 FT_Glyph ass_font_get_glyph(ASS_Font *font, int face_index, int index,
70                             ASS_Hinting hinting, int deco);
71 void ass_font_clear(ASS_Font *font);
72
73 #endif                          /* LIBASS_FONT_H */