1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* ftdriver.h */ |
---|
4 | /* */ |
---|
5 | /* FreeType font driver interface (specification). */ |
---|
6 | /* */ |
---|
7 | /* Copyright 1996-2001, 2002, 2003, 2006, 2008 by */ |
---|
8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
---|
9 | /* */ |
---|
10 | /* This file is part of the FreeType project, and may only be used, */ |
---|
11 | /* modified, and distributed under the terms of the FreeType project */ |
---|
12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
---|
13 | /* this file you indicate that you have read the license and */ |
---|
14 | /* understand and accept it fully. */ |
---|
15 | /* */ |
---|
16 | /***************************************************************************/ |
---|
17 | |
---|
18 | |
---|
19 | #ifndef __FTDRIVER_H__ |
---|
20 | #define __FTDRIVER_H__ |
---|
21 | |
---|
22 | |
---|
23 | #include <ft2build.h> |
---|
24 | #include FT_MODULE_H |
---|
25 | |
---|
26 | |
---|
27 | FT_BEGIN_HEADER |
---|
28 | |
---|
29 | |
---|
30 | typedef FT_Error |
---|
31 | (*FT_Face_InitFunc)( FT_Stream stream, |
---|
32 | FT_Face face, |
---|
33 | FT_Int typeface_index, |
---|
34 | FT_Int num_params, |
---|
35 | FT_Parameter* parameters ); |
---|
36 | |
---|
37 | typedef void |
---|
38 | (*FT_Face_DoneFunc)( FT_Face face ); |
---|
39 | |
---|
40 | |
---|
41 | typedef FT_Error |
---|
42 | (*FT_Size_InitFunc)( FT_Size size ); |
---|
43 | |
---|
44 | typedef void |
---|
45 | (*FT_Size_DoneFunc)( FT_Size size ); |
---|
46 | |
---|
47 | |
---|
48 | typedef FT_Error |
---|
49 | (*FT_Slot_InitFunc)( FT_GlyphSlot slot ); |
---|
50 | |
---|
51 | typedef void |
---|
52 | (*FT_Slot_DoneFunc)( FT_GlyphSlot slot ); |
---|
53 | |
---|
54 | |
---|
55 | typedef FT_Error |
---|
56 | (*FT_Size_RequestFunc)( FT_Size size, |
---|
57 | FT_Size_Request req ); |
---|
58 | |
---|
59 | typedef FT_Error |
---|
60 | (*FT_Size_SelectFunc)( FT_Size size, |
---|
61 | FT_ULong size_index ); |
---|
62 | |
---|
63 | #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
---|
64 | |
---|
65 | typedef FT_Error |
---|
66 | (*FT_Size_ResetPointsFunc)( FT_Size size, |
---|
67 | FT_F26Dot6 char_width, |
---|
68 | FT_F26Dot6 char_height, |
---|
69 | FT_UInt horz_resolution, |
---|
70 | FT_UInt vert_resolution ); |
---|
71 | |
---|
72 | typedef FT_Error |
---|
73 | (*FT_Size_ResetPixelsFunc)( FT_Size size, |
---|
74 | FT_UInt pixel_width, |
---|
75 | FT_UInt pixel_height ); |
---|
76 | |
---|
77 | #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ |
---|
78 | |
---|
79 | typedef FT_Error |
---|
80 | (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, |
---|
81 | FT_Size size, |
---|
82 | FT_UInt glyph_index, |
---|
83 | FT_Int32 load_flags ); |
---|
84 | |
---|
85 | |
---|
86 | typedef FT_UInt |
---|
87 | (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap, |
---|
88 | FT_Long charcode ); |
---|
89 | |
---|
90 | typedef FT_Long |
---|
91 | (*FT_CharMap_CharNextFunc)( FT_CharMap charmap, |
---|
92 | FT_Long charcode ); |
---|
93 | |
---|
94 | typedef FT_Error |
---|
95 | (*FT_Face_GetKerningFunc)( FT_Face face, |
---|
96 | FT_UInt left_glyph, |
---|
97 | FT_UInt right_glyph, |
---|
98 | FT_Vector* kerning ); |
---|
99 | |
---|
100 | |
---|
101 | typedef FT_Error |
---|
102 | (*FT_Face_AttachFunc)( FT_Face face, |
---|
103 | FT_Stream stream ); |
---|
104 | |
---|
105 | |
---|
106 | typedef FT_Error |
---|
107 | (*FT_Face_GetAdvancesFunc)( FT_Face face, |
---|
108 | FT_UInt first, |
---|
109 | FT_UInt count, |
---|
110 | FT_Bool vertical, |
---|
111 | FT_UShort* advances ); |
---|
112 | |
---|
113 | |
---|
114 | /*************************************************************************/ |
---|
115 | /* */ |
---|
116 | /* <Struct> */ |
---|
117 | /* FT_Driver_ClassRec */ |
---|
118 | /* */ |
---|
119 | /* <Description> */ |
---|
120 | /* The font driver class. This structure mostly contains pointers to */ |
---|
121 | /* driver methods. */ |
---|
122 | /* */ |
---|
123 | /* <Fields> */ |
---|
124 | /* root :: The parent module. */ |
---|
125 | /* */ |
---|
126 | /* face_object_size :: The size of a face object in bytes. */ |
---|
127 | /* */ |
---|
128 | /* size_object_size :: The size of a size object in bytes. */ |
---|
129 | /* */ |
---|
130 | /* slot_object_size :: The size of a glyph object in bytes. */ |
---|
131 | /* */ |
---|
132 | /* init_face :: The format-specific face constructor. */ |
---|
133 | /* */ |
---|
134 | /* done_face :: The format-specific face destructor. */ |
---|
135 | /* */ |
---|
136 | /* init_size :: The format-specific size constructor. */ |
---|
137 | /* */ |
---|
138 | /* done_size :: The format-specific size destructor. */ |
---|
139 | /* */ |
---|
140 | /* init_slot :: The format-specific slot constructor. */ |
---|
141 | /* */ |
---|
142 | /* done_slot :: The format-specific slot destructor. */ |
---|
143 | /* */ |
---|
144 | /* */ |
---|
145 | /* load_glyph :: A function handle to load a glyph to a slot. */ |
---|
146 | /* This field is mandatory! */ |
---|
147 | /* */ |
---|
148 | /* get_kerning :: A function handle to return the unscaled */ |
---|
149 | /* kerning for a given pair of glyphs. Can be */ |
---|
150 | /* set to 0 if the format doesn't support */ |
---|
151 | /* kerning. */ |
---|
152 | /* */ |
---|
153 | /* attach_file :: This function handle is used to read */ |
---|
154 | /* additional data for a face from another */ |
---|
155 | /* file/stream. For example, this can be used to */ |
---|
156 | /* add data from AFM or PFM files on a Type 1 */ |
---|
157 | /* face, or a CIDMap on a CID-keyed face. */ |
---|
158 | /* */ |
---|
159 | /* get_advances :: A function handle used to return advance */ |
---|
160 | /* widths of `count' glyphs (in font units), */ |
---|
161 | /* starting at `first'. The `vertical' flag must */ |
---|
162 | /* be set to get vertical advance heights. The */ |
---|
163 | /* `advances' buffer is caller-allocated. */ |
---|
164 | /* Currently not implemented. The idea of this */ |
---|
165 | /* function is to be able to perform */ |
---|
166 | /* device-independent text layout without loading */ |
---|
167 | /* a single glyph image. */ |
---|
168 | /* */ |
---|
169 | /* request_size :: A handle to a function used to request the new */ |
---|
170 | /* character size. Can be set to 0 if the */ |
---|
171 | /* scaling done in the base layer suffices. */ |
---|
172 | /* */ |
---|
173 | /* select_size :: A handle to a function used to select a new */ |
---|
174 | /* fixed size. It is used only if */ |
---|
175 | /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ |
---|
176 | /* to 0 if the scaling done in the base layer */ |
---|
177 | /* suffices. */ |
---|
178 | /* <Note> */ |
---|
179 | /* Most function pointers, with the exception of `load_glyph', can be */ |
---|
180 | /* set to 0 to indicate a default behaviour. */ |
---|
181 | /* */ |
---|
182 | typedef struct FT_Driver_ClassRec_ |
---|
183 | { |
---|
184 | FT_Module_Class root; |
---|
185 | |
---|
186 | FT_Long face_object_size; |
---|
187 | FT_Long size_object_size; |
---|
188 | FT_Long slot_object_size; |
---|
189 | |
---|
190 | FT_Face_InitFunc init_face; |
---|
191 | FT_Face_DoneFunc done_face; |
---|
192 | |
---|
193 | FT_Size_InitFunc init_size; |
---|
194 | FT_Size_DoneFunc done_size; |
---|
195 | |
---|
196 | FT_Slot_InitFunc init_slot; |
---|
197 | FT_Slot_DoneFunc done_slot; |
---|
198 | |
---|
199 | #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
---|
200 | |
---|
201 | FT_Size_ResetPointsFunc set_char_sizes; |
---|
202 | FT_Size_ResetPixelsFunc set_pixel_sizes; |
---|
203 | |
---|
204 | #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ |
---|
205 | |
---|
206 | FT_Slot_LoadFunc load_glyph; |
---|
207 | |
---|
208 | FT_Face_GetKerningFunc get_kerning; |
---|
209 | FT_Face_AttachFunc attach_file; |
---|
210 | FT_Face_GetAdvancesFunc get_advances; |
---|
211 | |
---|
212 | /* since version 2.2 */ |
---|
213 | FT_Size_RequestFunc request_size; |
---|
214 | FT_Size_SelectFunc select_size; |
---|
215 | |
---|
216 | } FT_Driver_ClassRec, *FT_Driver_Class; |
---|
217 | |
---|
218 | |
---|
219 | /* |
---|
220 | * The following functions are used as stubs for `set_char_sizes' and |
---|
221 | * `set_pixel_sizes'; the code uses `request_size' and `select_size' |
---|
222 | * functions instead. |
---|
223 | * |
---|
224 | * Implementation is in `src/base/ftobjs.c'. |
---|
225 | */ |
---|
226 | #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
---|
227 | |
---|
228 | FT_BASE( FT_Error ) |
---|
229 | ft_stub_set_char_sizes( FT_Size size, |
---|
230 | FT_F26Dot6 width, |
---|
231 | FT_F26Dot6 height, |
---|
232 | FT_UInt horz_res, |
---|
233 | FT_UInt vert_res ); |
---|
234 | |
---|
235 | FT_BASE( FT_Error ) |
---|
236 | ft_stub_set_pixel_sizes( FT_Size size, |
---|
237 | FT_UInt width, |
---|
238 | FT_UInt height ); |
---|
239 | |
---|
240 | #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ |
---|
241 | |
---|
242 | |
---|
243 | FT_END_HEADER |
---|
244 | |
---|
245 | #endif /* __FTDRIVER_H__ */ |
---|
246 | |
---|
247 | |
---|
248 | /* END */ |
---|