ReactOS  0.4.14-dev-384-g5b37caa
ftdrv.h
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ftdrv.h */
4 /* */
5 /* FreeType internal font driver interface (specification). */
6 /* */
7 /* Copyright 1996-2018 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 FTDRV_H_
20 #define FTDRV_H_
21 
22 
23 #include <ft2build.h>
24 #include FT_MODULE_H
25 
26 
28 
29 
30  typedef FT_Error
32  FT_Face face,
33  FT_Int typeface_index,
34  FT_Int num_params,
35  FT_Parameter* parameters );
36 
37  typedef void
39 
40 
41  typedef FT_Error
43 
44  typedef void
46 
47 
48  typedef FT_Error
50 
51  typedef void
53 
54 
55  typedef FT_Error
57  FT_Size_Request req );
58 
59  typedef FT_Error
61  FT_ULong size_index );
62 
63  typedef FT_Error
65  FT_Size size,
66  FT_UInt glyph_index,
67  FT_Int32 load_flags );
68 
69 
70  typedef FT_Error
74  FT_Vector* kerning );
75 
76 
77  typedef FT_Error
79  FT_Stream stream );
80 
81 
82  typedef FT_Error
84  FT_UInt first,
85  FT_UInt count,
86  FT_Int32 flags,
87  FT_Fixed* advances );
88 
89 
90  /*************************************************************************/
91  /* */
92  /* <Struct> */
93  /* FT_Driver_ClassRec */
94  /* */
95  /* <Description> */
96  /* The font driver class. This structure mostly contains pointers to */
97  /* driver methods. */
98  /* */
99  /* <Fields> */
100  /* root :: The parent module. */
101  /* */
102  /* face_object_size :: The size of a face object in bytes. */
103  /* */
104  /* size_object_size :: The size of a size object in bytes. */
105  /* */
106  /* slot_object_size :: The size of a glyph object in bytes. */
107  /* */
108  /* init_face :: The format-specific face constructor. */
109  /* */
110  /* done_face :: The format-specific face destructor. */
111  /* */
112  /* init_size :: The format-specific size constructor. */
113  /* */
114  /* done_size :: The format-specific size destructor. */
115  /* */
116  /* init_slot :: The format-specific slot constructor. */
117  /* */
118  /* done_slot :: The format-specific slot destructor. */
119  /* */
120  /* */
121  /* load_glyph :: A function handle to load a glyph to a slot. */
122  /* This field is mandatory! */
123  /* */
124  /* get_kerning :: A function handle to return the unscaled */
125  /* kerning for a given pair of glyphs. Can be */
126  /* set to 0 if the format doesn't support */
127  /* kerning. */
128  /* */
129  /* attach_file :: This function handle is used to read */
130  /* additional data for a face from another */
131  /* file/stream. For example, this can be used to */
132  /* add data from AFM or PFM files on a Type 1 */
133  /* face, or a CIDMap on a CID-keyed face. */
134  /* */
135  /* get_advances :: A function handle used to return advance */
136  /* widths of `count' glyphs (in font units), */
137  /* starting at `first'. The `vertical' flag must */
138  /* be set to get vertical advance heights. The */
139  /* `advances' buffer is caller-allocated. */
140  /* The idea of this function is to be able to */
141  /* perform device-independent text layout without */
142  /* loading a single glyph image. */
143  /* */
144  /* request_size :: A handle to a function used to request the new */
145  /* character size. Can be set to 0 if the */
146  /* scaling done in the base layer suffices. */
147  /* */
148  /* select_size :: A handle to a function used to select a new */
149  /* fixed size. It is used only if */
150  /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */
151  /* to 0 if the scaling done in the base layer */
152  /* suffices. */
153  /* <Note> */
154  /* Most function pointers, with the exception of `load_glyph', can be */
155  /* set to 0 to indicate a default behaviour. */
156  /* */
157  typedef struct FT_Driver_ClassRec_
158  {
160 
164 
167 
170 
173 
175 
179 
180  /* since version 2.2 */
183 
185 
186 
187  /*************************************************************************/
188  /* */
189  /* <Macro> */
190  /* FT_DECLARE_DRIVER */
191  /* */
192  /* <Description> */
193  /* Used to create a forward declaration of an FT_Driver_ClassRec */
194  /* struct instance. */
195  /* */
196  /* <Macro> */
197  /* FT_DEFINE_DRIVER */
198  /* */
199  /* <Description> */
200  /* Used to initialize an instance of FT_Driver_ClassRec struct. */
201  /* */
202  /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
203  /* called with a pointer where the allocated structure is returned. */
204  /* And when it is no longer needed a `destroy' function needs to be */
205  /* called to release that allocation. */
206  /* */
207  /* `ftinit.c' (ft_create_default_module_classes) already contains a */
208  /* mechanism to call these functions for the default modules */
209  /* described in `ftmodule.h'. */
210  /* */
211  /* Notice that the created `create' and `destroy' functions call */
212  /* `pic_init' and `pic_free' to allow you to manually allocate and */
213  /* initialize any additional global data, like a module specific */
214  /* interface, and put them in the global pic container defined in */
215  /* `ftpic.h'. If you don't need them just implement the functions as */
216  /* empty to resolve the link error. Also the `pic_init' and */
217  /* `pic_free' functions should be declared in `pic.h', to be referred */
218  /* by driver definition calling `FT_DEFINE_DRIVER' in following. */
219  /* */
220  /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
221  /* allocated in the global scope (or the scope where the macro is */
222  /* used). */
223  /* */
224 #ifndef FT_CONFIG_OPTION_PIC
225 
226 #define FT_DECLARE_DRIVER( class_ ) \
227  FT_CALLBACK_TABLE \
228  const FT_Driver_ClassRec class_;
229 
230 #define FT_DEFINE_DRIVER( \
231  class_, \
232  flags_, \
233  size_, \
234  name_, \
235  version_, \
236  requires_, \
237  interface_, \
238  init_, \
239  done_, \
240  get_interface_, \
241  face_object_size_, \
242  size_object_size_, \
243  slot_object_size_, \
244  init_face_, \
245  done_face_, \
246  init_size_, \
247  done_size_, \
248  init_slot_, \
249  done_slot_, \
250  load_glyph_, \
251  get_kerning_, \
252  attach_file_, \
253  get_advances_, \
254  request_size_, \
255  select_size_ ) \
256  FT_CALLBACK_TABLE_DEF \
257  const FT_Driver_ClassRec class_ = \
258  { \
259  FT_DEFINE_ROOT_MODULE( flags_, \
260  size_, \
261  name_, \
262  version_, \
263  requires_, \
264  interface_, \
265  init_, \
266  done_, \
267  get_interface_ ) \
268  \
269  face_object_size_, \
270  size_object_size_, \
271  slot_object_size_, \
272  \
273  init_face_, \
274  done_face_, \
275  \
276  init_size_, \
277  done_size_, \
278  \
279  init_slot_, \
280  done_slot_, \
281  \
282  load_glyph_, \
283  \
284  get_kerning_, \
285  attach_file_, \
286  get_advances_, \
287  \
288  request_size_, \
289  select_size_ \
290  };
291 
292 #else /* FT_CONFIG_OPTION_PIC */
293 
294 #define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ )
295 
296 #define FT_DEFINE_DRIVER( \
297  class_, \
298  flags_, \
299  size_, \
300  name_, \
301  version_, \
302  requires_, \
303  interface_, \
304  init_, \
305  done_, \
306  get_interface_, \
307  face_object_size_, \
308  size_object_size_, \
309  slot_object_size_, \
310  init_face_, \
311  done_face_, \
312  init_size_, \
313  done_size_, \
314  init_slot_, \
315  done_slot_, \
316  load_glyph_, \
317  get_kerning_, \
318  attach_file_, \
319  get_advances_, \
320  request_size_, \
321  select_size_ ) \
322  void \
323  FT_Destroy_Class_ ## class_( FT_Library library, \
324  FT_Module_Class* clazz ) \
325  { \
326  FT_Memory memory = library->memory; \
327  FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \
328  \
329  \
330  class_ ## _pic_free( library ); \
331  if ( dclazz ) \
332  FT_FREE( dclazz ); \
333  } \
334  \
335  \
336  FT_Error \
337  FT_Create_Class_ ## class_( FT_Library library, \
338  FT_Module_Class** output_class ) \
339  { \
340  FT_Driver_Class clazz = NULL; \
341  FT_Error error; \
342  FT_Memory memory = library->memory; \
343  \
344  \
345  if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
346  return error; \
347  \
348  error = class_ ## _pic_init( library ); \
349  if ( error ) \
350  { \
351  FT_FREE( clazz ); \
352  return error; \
353  } \
354  \
355  FT_DEFINE_ROOT_MODULE( flags_, \
356  size_, \
357  name_, \
358  version_, \
359  requires_, \
360  interface_, \
361  init_, \
362  done_, \
363  get_interface_ ) \
364  \
365  clazz->face_object_size = face_object_size_; \
366  clazz->size_object_size = size_object_size_; \
367  clazz->slot_object_size = slot_object_size_; \
368  \
369  clazz->init_face = init_face_; \
370  clazz->done_face = done_face_; \
371  \
372  clazz->init_size = init_size_; \
373  clazz->done_size = done_size_; \
374  \
375  clazz->init_slot = init_slot_; \
376  clazz->done_slot = done_slot_; \
377  \
378  clazz->load_glyph = load_glyph_; \
379  \
380  clazz->get_kerning = get_kerning_; \
381  clazz->attach_file = attach_file_; \
382  clazz->get_advances = get_advances_; \
383  \
384  clazz->request_size = request_size_; \
385  clazz->select_size = select_size_; \
386  \
387  *output_class = (FT_Module_Class*)clazz; \
388  \
389  return FT_Err_Ok; \
390  }
391 
392 
393 #endif /* FT_CONFIG_OPTION_PIC */
394 
396 
397 #endif /* FTDRV_H_ */
398 
399 
400 /* END */
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
FT_Slot_InitFunc init_slot
Definition: ftdrv.h:171
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Error(* FT_Slot_InitFunc)(FT_GlyphSlot slot)
Definition: ftdrv.h:49
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
FT_UInt FT_UInt right_glyph
Definition: ttdriver.c:201
FT_Face_GetAdvancesFunc get_advances
Definition: ftdrv.h:178
#define FT_END_HEADER
Definition: ftheader.h:54
struct _slot slot
Definition: vfat.h:196
void(* FT_Slot_DoneFunc)(FT_GlyphSlot slot)
Definition: ftdrv.h:52
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint GLsizei count
Definition: gl.h:1545
FT_Long slot_object_size
Definition: ftdrv.h:163
const GLint * first
Definition: glext.h:5794
FT_Slot_LoadFunc load_glyph
Definition: ftdrv.h:174
FT_Module_Class root
Definition: ftdrv.h:159
struct FT_Driver_ClassRec_ * FT_Driver_Class
WORD face[3]
Definition: mesh.c:4747
FT_Error(* FT_Size_RequestFunc)(FT_Size size, FT_Size_Request req)
Definition: ftdrv.h:56
FT_Face_InitFunc init_face
Definition: ftdrv.h:165
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
FT_Error(* FT_Slot_LoadFunc)(FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftdrv.h:64
FT_Long size_object_size
Definition: ftdrv.h:162
FT_Size_SelectFunc select_size
Definition: ftdrv.h:182
FT_Error(* FT_Size_SelectFunc)(FT_Size size, FT_ULong size_index)
Definition: ftdrv.h:60
FT_Size_RequestFunc request_size
Definition: ftdrv.h:181
GLsizeiptr size
Definition: glext.h:5919
FT_Error(* FT_Size_InitFunc)(FT_Size size)
Definition: ftdrv.h:42
GLbitfield flags
Definition: glext.h:7161
FT_Face_AttachFunc attach_file
Definition: ftdrv.h:177
void(* FT_Face_DoneFunc)(FT_Face face)
Definition: ftdrv.h:38
FT_BEGIN_HEADER typedef FT_Error(* FT_Face_InitFunc)(FT_Stream stream, FT_Face face, FT_Int typeface_index, FT_Int num_params, FT_Parameter *parameters)
Definition: ftdrv.h:31
GLuint GLuint stream
Definition: glext.h:7522
FT_Size_DoneFunc done_size
Definition: ftdrv.h:169
FT_UInt left_glyph
Definition: ttdriver.c:201
FT_Long face_object_size
Definition: ftdrv.h:161
FT_Error(* FT_Face_AttachFunc)(FT_Face face, FT_Stream stream)
Definition: ftdrv.h:78
signed long FT_Fixed
Definition: fttypes.h:288
FT_Slot_DoneFunc done_slot
Definition: ftdrv.h:172
unsigned int FT_UInt
Definition: fttypes.h:231
void(* FT_Size_DoneFunc)(FT_Size size)
Definition: ftdrv.h:45
FT_Error(* FT_Face_GetKerningFunc)(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector *kerning)
Definition: ftdrv.h:71
FT_Size_InitFunc init_size
Definition: ftdrv.h:168
FT_UInt FT_UInt FT_Vector * kerning
Definition: ttdriver.c:204
FT_Face_DoneFunc done_face
Definition: ftdrv.h:166
FT_Error(* FT_Face_GetAdvancesFunc)(FT_Face face, FT_UInt first, FT_UInt count, FT_Int32 flags, FT_Fixed *advances)
Definition: ftdrv.h:83
struct FT_Driver_ClassRec_ FT_Driver_ClassRec
FT_Face_GetKerningFunc get_kerning
Definition: ftdrv.h:176