OSDN Git Service

stop using trunk directory in rectool
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / modules / font.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005\r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / modules interfaces\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 \r
26 #ifndef _GF_MODULE_FONT_H_\r
27 #define _GF_MODULE_FONT_H_\r
28 \r
29 #ifdef __cplusplus\r
30 extern "C" {\r
31 #endif\r
32 \r
33 #include <gpac/path2d.h>\r
34 #include <gpac/module.h>\r
35 #include <gpac/user.h>\r
36 \r
37 \r
38 typedef struct _gf_glyph\r
39 {\r
40         /*glyphs are stored as linked lists*/\r
41         struct _gf_glyph *next;\r
42         /*glyph ID as used in *_get_glyphs - this may not match the UTF name*/\r
43         u32 ID;\r
44         /*UTF-name of the glyph if any*/\r
45         u32 utf_name;\r
46         GF_Path *path;\r
47         /*width of the glyph - !! this can be more than the horizontal advance !! */\r
48         u32 width;\r
49         /*glyph horizontal advance in font EM size*/\r
50         s32 horiz_advance;\r
51         /*height of the glyph - !! this can be more than the vertical advance !! */\r
52         u32 height;\r
53         /*glyph vertical advance in font EM size*/\r
54         s32 vert_advance;\r
55 } GF_Glyph;\r
56 \r
57 enum\r
58 {\r
59         /*font styles*/\r
60         GF_FONT_ITALIC = 1,\r
61         GF_FONT_OBLIQUE = 1<<1,\r
62         /*font variant (smallcaps)*/\r
63         GF_FONT_SMALLCAPS = 1<<2,\r
64         /*font decoration*/\r
65         GF_FONT_UNDERLINED = 1<<3,\r
66         GF_FONT_STRIKEOUT = 1<<4,\r
67 \r
68         /*all font weight modification are placed AFTER 1<<9*/\r
69         GF_FONT_WEIGHT_100 = 1<<10,\r
70         GF_FONT_WEIGHT_LIGHTER = 1<<11,\r
71         GF_FONT_WEIGHT_200 = 1<<12,\r
72         GF_FONT_WEIGHT_300 = 1<<13,\r
73         GF_FONT_WEIGHT_400 = 1<<14,\r
74         GF_FONT_WEIGHT_NORMAL = 1<<15,\r
75         GF_FONT_WEIGHT_500 = 1<<16,\r
76         GF_FONT_WEIGHT_600 = 1<<17,\r
77         GF_FONT_WEIGHT_700 = 1<<18,\r
78         GF_FONT_WEIGHT_BOLD = 1<<19,\r
79         GF_FONT_WEIGHT_800 = 1<<20,\r
80         GF_FONT_WEIGHT_900 = 1<<21,\r
81         GF_FONT_WEIGHT_BOLDER = 1<<22\r
82 };\r
83 /*mask for font styles used for CSS2 selection*/\r
84 #define GF_FONT_STYLE_MASK      0x00000007\r
85 /*mask for all font weight*/\r
86 #define GF_FONT_WEIGHT_MASK     0xFFFFFC00\r
87 \r
88 /*interface name and version for font engine*/\r
89 #define GF_FONT_READER_INTERFACE                GF_4CC('G','F','T', 0x01)\r
90 \r
91 \r
92 typedef struct _font_reader\r
93 {\r
94         /* interface declaration*/\r
95         GF_DECL_MODULE_INTERFACE\r
96 \r
97         /*inits font engine.*/\r
98         GF_Err (*init_font_engine)(struct _font_reader *dr);\r
99         /*shutdown font engine*/\r
100         GF_Err (*shutdown_font_engine)(struct _font_reader *dr);\r
101 \r
102         /*set active font . @styles indicates font styles (PLAIN, BOLD, ITALIC, \r
103         BOLDITALIC and UNDERLINED, STRIKEOUT)*/\r
104         GF_Err (*set_font)(struct _font_reader *dr, const char *fontName, u32 styles);\r
105         /*gets font info*/\r
106         GF_Err (*get_font_info)(struct _font_reader *dr, char **font_name, s32 *em_size, s32 *ascent, s32 *descent, s32 *underline, s32 *line_spacing, s32 *max_advance_h, s32 *max_advance_v);\r
107 \r
108         /*translate string to glyph sequence*/\r
109         GF_Err (*get_glyphs)(struct _font_reader *dr, const char *utf_string, u32 *glyph_id_buffer, u32 *io_glyph_id_buffer_size, const char *xml_lang, Bool *rev_layout);\r
110 \r
111         /*loads glyph by name - returns NULL if glyph cannot be found*/\r
112         GF_Glyph *(*load_glyph)(struct _font_reader *dr, u32 glyph_name);\r
113 \r
114 /*module private*/\r
115         void *udta;\r
116 } GF_FontReader;\r
117 \r
118 \r
119 \r
120 #ifdef __cplusplus\r
121 }\r
122 #endif\r
123 \r
124 \r
125 #endif  /*_GF_MODULE_FONT_H_*/\r
126 \r