|
1 /***************************************************************************/ |
|
2 /* */ |
|
3 /* ftdriver.h */ |
|
4 /* */ |
|
5 /* FreeType font driver interface (specification). */ |
|
6 /* */ |
|
7 /* Copyright 1996-2001, 2002, 2003, 2006 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, FTL.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_char_index :: A function handle to return the glyph index of */ |
|
149 /* a given character for a given charmap. This */ |
|
150 /* field is mandatory! */ |
|
151 /* */ |
|
152 /* get_kerning :: A function handle to return the unscaled */ |
|
153 /* kerning for a given pair of glyphs. Can be */ |
|
154 /* set to 0 if the format doesn't support */ |
|
155 /* kerning. */ |
|
156 /* */ |
|
157 /* attach_file :: This function handle is used to read */ |
|
158 /* additional data for a face from another */ |
|
159 /* file/stream. For example, this can be used to */ |
|
160 /* add data from AFM or PFM files on a Type 1 */ |
|
161 /* face, or a CIDMap on a CID-keyed face. */ |
|
162 /* */ |
|
163 /* get_advances :: A function handle used to return advance */ |
|
164 /* widths of `count' glyphs (in font units), */ |
|
165 /* starting at `first'. The `vertical' flag must */ |
|
166 /* be set to get vertical advance heights. The */ |
|
167 /* `advances' buffer is caller-allocated. */ |
|
168 /* Currently not implemented. The idea of this */ |
|
169 /* function is to be able to perform */ |
|
170 /* device-independent text layout without loading */ |
|
171 /* a single glyph image. */ |
|
172 /* */ |
|
173 /* request_size :: A handle to a function used to request the new */ |
|
174 /* character size. Can be set to 0 if the */ |
|
175 /* scaling done in the base layer suffices. */ |
|
176 /* */ |
|
177 /* select_size :: A handle to a function used to select a new */ |
|
178 /* fixed size. It is used only if */ |
|
179 /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ |
|
180 /* to 0 if the scaling done in the base layer */ |
|
181 /* suffices. */ |
|
182 /* <Note> */ |
|
183 /* Most function pointers, with the exception of `load_glyph' and */ |
|
184 /* `get_char_index' can be set to 0 to indicate a default behaviour. */ |
|
185 /* */ |
|
186 typedef struct FT_Driver_ClassRec_ |
|
187 { |
|
188 FT_Module_Class root; |
|
189 |
|
190 FT_Long face_object_size; |
|
191 FT_Long size_object_size; |
|
192 FT_Long slot_object_size; |
|
193 |
|
194 FT_Face_InitFunc init_face; |
|
195 FT_Face_DoneFunc done_face; |
|
196 |
|
197 FT_Size_InitFunc init_size; |
|
198 FT_Size_DoneFunc done_size; |
|
199 |
|
200 FT_Slot_InitFunc init_slot; |
|
201 FT_Slot_DoneFunc done_slot; |
|
202 |
|
203 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
|
204 |
|
205 FT_Size_ResetPointsFunc set_char_sizes; |
|
206 FT_Size_ResetPixelsFunc set_pixel_sizes; |
|
207 |
|
208 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ |
|
209 |
|
210 FT_Slot_LoadFunc load_glyph; |
|
211 |
|
212 FT_Face_GetKerningFunc get_kerning; |
|
213 FT_Face_AttachFunc attach_file; |
|
214 FT_Face_GetAdvancesFunc get_advances; |
|
215 |
|
216 /* since version 2.2 */ |
|
217 FT_Size_RequestFunc request_size; |
|
218 FT_Size_SelectFunc select_size; |
|
219 |
|
220 } FT_Driver_ClassRec, *FT_Driver_Class; |
|
221 |
|
222 |
|
223 /* |
|
224 * The following functions are used as stubs for `set_char_sizes' and |
|
225 * `set_pixel_sizes'; the code uses `request_size' and `select_size' |
|
226 * functions instead. |
|
227 * |
|
228 * Implementation is in `src/base/ftobjs.c'. |
|
229 */ |
|
230 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
|
231 |
|
232 FT_BASE( FT_Error ) |
|
233 ft_stub_set_char_sizes( FT_Size size, |
|
234 FT_F26Dot6 width, |
|
235 FT_F26Dot6 height, |
|
236 FT_UInt horz_res, |
|
237 FT_UInt vert_res ); |
|
238 |
|
239 FT_BASE( FT_Error ) |
|
240 ft_stub_set_pixel_sizes( FT_Size size, |
|
241 FT_UInt width, |
|
242 FT_UInt height ); |
|
243 |
|
244 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ |
|
245 |
|
246 |
|
247 FT_END_HEADER |
|
248 |
|
249 #endif /* __FTDRIVER_H__ */ |
|
250 |
|
251 |
|
252 /* END */ |