Commit 53078ee7502c4556a54aacf9ccd09906c623d173

David Turner 2000-06-22T00:26:54

removed obsolete headers, added new ones

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
diff --git a/include/freetype/ftgrays.h b/include/freetype/ftgrays.h
deleted file mode 100644
index feb7484..0000000
--- a/include/freetype/ftgrays.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftgrays.h                                                              */
-/*                                                                         */
-/*    FreeType smooth renderer declaration                                 */
-/*                                                                         */
-/*  Copyright 1996-2000 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used        */
-/*  modified and distributed under the terms of the FreeType project       */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-#ifndef FTGRAYS_H
-#define FTGRAYS_H
-
-#ifdef __cplusplus
-  extern "C" {
-#endif
-
-#ifdef _STANDALONE_
-#include "ftimage.h"
-#else
-#include <freetype/ftimage.h>
-#endif
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* To make ftgrays.h independent from configuration files we check       */
-  /* whether FT_EXPORT_DEF has been defined already.                          */
-  /*                                                                       */
-  /* On some systems and compilers (Win32 mostly), an extra keyword is     */
-  /* necessary to compile the library as a DLL.                            */
-  /*                                                                       */
-#ifndef FT_EXPORT_VAR
-#define FT_EXPORT_VAR(x)  extern  x
-#endif
-
-  FT_EXPORT_VAR(FT_Raster_Funcs)  ft_grays_raster;
-
-  #ifdef __cplusplus
-  }
-  #endif
-
-#endif
diff --git a/include/freetype/ftmodule.h b/include/freetype/ftmodule.h
new file mode 100644
index 0000000..bc8e961
--- /dev/null
+++ b/include/freetype/ftmodule.h
@@ -0,0 +1,194 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftmodule.h                                                             */
+/*                                                                         */
+/*  FreeType modules public interface.                                     */
+/*                                                                         */
+/*  Copyright 1996-2000 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used        */
+/*  modified and distributed under the terms of the FreeType project       */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+#ifndef FTMODULE_H
+#define FTMODULE_H
+
+#include <freetype/freetype.h>
+
+  /* module bit flags */
+  typedef enum FT_Module_Flags_
+  {
+    ft_module_font_driver         = 1, /* this module is a font driver */
+    ft_module_renderer            = 2, /* this module is a renderer    */
+
+    ft_module_driver_scalable     = 4, /* this driver supports scalable fonts          */
+    ft_module_driver_no_outlines  = 8  /* this driver does not support vector outlines */
+
+  } FT_Module_Flags;
+
+
+
+  typedef void  (*FT_Module_Interface)( void );
+
+
+  typedef FT_Error  (*FT_Module_Constructor)( FT_Module  module );
+
+  typedef void      (*FT_Module_Destructor)( FT_Module   module );
+
+  typedef FT_Module_Interface (*FT_Module_Requester)( FT_Module    module,
+                                                      const char*  name );
+
+
+ /*************************************************************************
+  *
+  *  <Struct>
+  *     FT_Module_Class
+  *
+  *  <Description>
+  *     The module class descriptor.
+  *
+  *  <Fields>
+  *     module_flags      :: bit flags describing the module
+  *     module_size       :: size of one module object/instance in bytes
+  *     module_name       :: name of the module
+  *     module_version    :: version, as a 16.16 fixed number (major.minor)
+  *     module_requires   :: the version of FreeType this module requires
+  *                          (starts at 2.0, a.k.a. 0x20000)
+  *
+  *     module_init       :: a function used to initialise (not create) a
+  *                          new module object
+  *
+  *     module_done       :: a function used to finalise (not destroy) a
+  *                          given module object
+  *
+  *     get_interface     :: queries a given module for a specific interface
+  *                          by name..
+  *
+  *************************************************************************/
+  
+  typedef struct  FT_Module_Class_
+  {
+    FT_ULong               module_flags;
+    FT_Int                 module_size;
+    const FT_String*       module_name;
+    FT_Fixed               module_version;
+    FT_Fixed               module_requires;
+
+    const void*            module_interface;
+
+    FT_Module_Constructor  module_init;
+    FT_Module_Destructor   module_done;
+    FT_Module_Requester    get_interface;
+    
+  } FT_Module_Class;
+
+
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Add_Module
+  *
+  *  <Description>
+  *     Add a new module to a given library instance.
+  *
+  *  <Input>
+  *     library  :: handle to library object
+  *     clazz    :: pointer to class descriptor for the module
+  *
+  *  <Return>
+  *     Error code. 0 means success
+  *
+  *  <Note>
+  *     An error will be returned if a module already exists by that
+  *     name, or if the module requires a version of freetype that is
+  *     too great
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Error)  FT_Add_Module( FT_Library              library,
+                                          const FT_Module_Class*  clazz );
+
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Get_Module
+  *
+  *  <Description>
+  *     Find a module by its name.
+  *
+  *  <Input>
+  *     library     :: handle to library object
+  *     module_name :: the module's ASCII name.
+  *
+  *  <Return>
+  *     Module handle, 0 if none was found.
+  *
+  *  <Note>
+  *     You'd better be familiar with FreeType internals to know which
+  *     module to look for :-)
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Module) FT_Get_Module( FT_Library   library,
+                                          const char*  module_name );
+
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Get_Module_Interface
+  *
+  *  <Description>
+  *     Find a module and returns it's specific interface as a void*
+  *
+  *  <Input>
+  *     library     :: handle to library object
+  *     module_name :: the module's ASCII name.
+  *
+  *  <Return>
+  *     Module specific interface, if any
+  *
+  *  <Note>
+  *     You'd better be familiar with FreeType internals to know which
+  *     module to look for, and what it's interface is :-)
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(const void*)  FT_Get_Module_Interface( FT_Library   library,
+                                                       const char*  mod_name );
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Remove_Module
+  *
+  *  <Description>
+  *     Removes a given module from a library instance.
+  *
+  *  <Input>
+  *     library  :: handle to library object
+  *     module   :: handle to module object
+  *
+  *  <Return>
+  *     Error code (module not listed)
+  *
+  *  <Note>
+  *     The module object is destroyed by the function in case of success
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Error)  FT_Remove_Module( FT_Library  library,
+                                             FT_Module   module );
+
+
+#endif /* FTMODULE_H */
+
+
+/* END */
diff --git a/include/freetype/ftraster.h b/include/freetype/ftraster.h
deleted file mode 100644
index 371ed27..0000000
--- a/include/freetype/ftraster.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftraster.h                                                             */
-/*                                                                         */
-/*    The FreeType glyph rasterizer (specification).                       */
-/*                                                                         */
-/*  Copyright 1996-2000 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used        */
-/*  modified and distributed under the terms of the FreeType project       */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef FTRASTER_H
-#define FTRASTER_H
-
-#ifdef __cplusplus
-  extern "C" {
-#endif
-
-#include <freetype/ftimage.h>
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* Uncomment the following line if you are using ftraster.c as a         */
-  /* standalone module, fully independent of FreeType.                     */
-  /*                                                                       */
-/* #define _STANDALONE_ */
-
-#ifndef FT_EXPORT_VAR
-#define FT_EXPORT_VAR(x)  extern x
-#endif
-
-  FT_EXPORT_VAR(FT_Raster_Funcs)  ft_standard_raster;
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif /* FTRASTER_H */
-
-
-/* END */
diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h
new file mode 100644
index 0000000..c0169f6
--- /dev/null
+++ b/include/freetype/ftrender.h
@@ -0,0 +1,152 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftrender.h                                                             */
+/*                                                                         */
+/*  FreeType renderer modules public interface                             */
+/*                                                                         */
+/*  Copyright 1996-2000 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used        */
+/*  modified and distributed under the terms of the FreeType project       */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+#ifndef FTRENDER_H
+#define FTRENDER_H
+
+#include <freetype/ftmodule.h>
+
+ /*************************************************************************
+  *
+  *  <Struct>
+  *     FT_Renderer_Class
+  *
+  *  <Description>
+  *     The renderer module class descriptor.
+  *
+  *  <Fields>
+  *     root          :: the root FT_Module_Class fields
+  *
+  *     glyph_format  :: the glyph image format this renderer handles
+  *
+  *     render_glyph  :: a method used to render the image that is in a
+  *                      given glyph slot into a bitmap.
+  *
+  *     set_mode      :: a method used to pass additional parameters
+  *
+  *     raster_class  :: for ft_glyph_format_outline renderers only, this
+  *                      is a pointer to its raster's class.
+  *
+  *     raster        :: for ft_glyph_format_outline renderers only. this
+  *                      is a pointer to the corresponding raster object,
+  *                      if any..
+  *
+  *************************************************************************/
+
+  typedef FT_Error  (*FTRenderer_render)( FT_Renderer   renderer,
+                                          FT_GlyphSlot  slot,
+                                          FT_UInt       mode );
+
+  typedef FT_Error  (*FTRenderer_transform)( FT_Renderer   renderer,
+                                             FT_GlyphSlot  slot,
+                                             FT_Matrix*    matrix,
+                                             FT_Vector*    delta );
+
+  typedef void      (*FTRenderer_getCBox)( FT_Renderer   renderer,
+                                           FT_GlyphSlot  slot,
+                                           FT_BBox      *cbox );
+
+  typedef FT_Error  (*FTRenderer_setMode)( FT_Renderer  renderer,
+                                           FT_ULong     mode_tag,
+                                           FT_Pointer   mode_ptr );
+
+  typedef struct  FT_Renderer_Class_
+  {
+    FT_Module_Class       root;
+    
+    FT_Glyph_Format       glyph_format;
+    
+    FTRenderer_render     render_glyph;
+    FTRenderer_transform  transform_glyph;
+    FTRenderer_getCBox    get_glyph_cbox;
+    FTRenderer_setMode    set_mode;
+
+    FT_Raster_Funcs*      raster_class;
+
+  } FT_Renderer_Class;
+
+
+  enum
+  {
+    ft_render_mode_antialias = 1
+  };
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Get_Renderer
+  *
+  *  <Description>
+  *     retrieves the current renderer for a given glyph format.
+  *
+  *  <Input>
+  *     library  :: handle to library object
+  *     format   :: glyph format
+  *
+  *  <Return>
+  *     renderer handle. 0 if none found.
+  *
+  *  <Note>
+  *     An error will be returned if a module already exists by that
+  *     name, or if the module requires a version of freetype that is
+  *     too great
+  *
+  *     To add a new renderer, simply use FT_Add_Module. To retrieve
+  *     a renderer by its name, use FT_Get_Module
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Renderer)  FT_Get_Renderer( FT_Library       library,
+                                               FT_Glyph_Format  format );
+
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Set_Renderer
+  *
+  *  <Description>
+  *     Sets the current renderer to use, and set additional mode
+  *
+  *  <Input>
+  *     library     :: handle to library object
+  *     renderer    :: handle to renderer object
+  *     num_params  :: number of additional parameters
+  *     params      :: additional parameters
+  *
+  *  <Return>
+  *     Error code. 0 means success.
+  *
+  *  <Note>
+  *     in case of success, the renderer will be used to convert glyph
+  *     images in the renderer's known format into bitmaps.
+  *
+  *     This doesn't change the current renderer for other formats..
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Error) FT_Set_Renderer( FT_Library     library,
+                                           FT_Renderer    renderer,
+                                           FT_UInt        num_params,
+                                           FT_Parameter*  parameters );
+
+
+
+#endif /* FTMODULE_H */
+
+
+/* END */