shaper: fix run-specific font size
[libass.git] / libass / ass_font.h
blob725a7c148be8e0ecaa59e80880bfec79a4ea2eaa
1 /*
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
4 * This file is part of libass.
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.
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.
19 #ifndef LIBASS_FONT_H
20 #define LIBASS_FONT_H
22 #include <stdint.h>
23 #include <ft2build.h>
24 #include FT_GLYPH_H
25 #include FT_OUTLINE_H
27 #include "ass.h"
28 #include "ass_types.h"
30 #define ASS_FONT_MAX_FACES 10
31 #define DECO_UNDERLINE 1
32 #define DECO_STRIKETHROUGH 2
34 typedef struct ass_shaper_font_data ASS_ShaperFontData;
36 typedef struct {
37 char *family;
38 unsigned bold;
39 unsigned italic;
40 int treat_family_as_pattern;
41 int vertical; // @font vertical layout
42 } ASS_FontDesc;
44 typedef struct {
45 ASS_FontDesc desc;
46 ASS_Library *library;
47 FT_Library ftlibrary;
48 FT_Face faces[ASS_FONT_MAX_FACES];
49 ASS_ShaperFontData *shaper_priv;
50 int n_faces;
51 double scale_x, scale_y; // current transform
52 FT_Vector v; // current shift
53 double size;
54 } ASS_Font;
56 #include "ass_cache.h"
58 ASS_Font *ass_font_new(Cache *font_cache, ASS_Library *library,
59 FT_Library ftlibrary, void *fc_priv,
60 ASS_FontDesc *desc);
61 void ass_font_set_transform(ASS_Font *font, double scale_x,
62 double scale_y, FT_Vector *v);
63 void ass_face_set_size(FT_Face face, double size);
64 void ass_font_set_size(ASS_Font *font, double size);
65 void ass_font_get_asc_desc(ASS_Font *font, uint32_t ch, int *asc,
66 int *desc);
67 int ass_font_get_index(void *fcpriv, ASS_Font *font, uint32_t symbol,
68 int *face_index, int *glyph_index);
69 FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font,
70 uint32_t ch, int face_index, int index,
71 ASS_Hinting hinting, int deco);
72 FT_Vector ass_font_get_kerning(ASS_Font *font, uint32_t c1, uint32_t c2);
73 void ass_font_free(ASS_Font *font);
74 void fix_freetype_stroker(FT_Outline *outline, int border_x, int border_y);
75 void outline_copy(FT_Library lib, FT_Outline *source, FT_Outline **dest);
76 void outline_free(FT_Library lib, FT_Outline *outline);
78 #endif /* LIBASS_FONT_H */