~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/include/freetype/internal/ftobjs.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************/
 
2
/*                                                                         */
 
3
/*  ftobjs.h                                                               */
 
4
/*                                                                         */
 
5
/*    The FreeType private base classes (specification).                   */
 
6
/*                                                                         */
 
7
/*  Copyright 1996-2001, 2002, 2003, 2004 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
  /*************************************************************************/
 
20
  /*                                                                       */
 
21
  /*  This file contains the definition of all internal FreeType classes.  */
 
22
  /*                                                                       */
 
23
  /*************************************************************************/
 
24
 
 
25
 
 
26
#ifndef __FTOBJS_H__
 
27
#define __FTOBJS_H__
 
28
 
 
29
#include <ft2build.h>
 
30
#include FT_CONFIG_STANDARD_LIBRARY_H   /* for ft_setjmp and ft_longjmp */
 
31
#include FT_RENDER_H
 
32
#include FT_SIZES_H
 
33
#include FT_INTERNAL_MEMORY_H
 
34
#include FT_INTERNAL_GLYPH_LOADER_H
 
35
#include FT_INTERNAL_DRIVER_H
 
36
#include FT_INTERNAL_AUTOHINT_H
 
37
#include FT_INTERNAL_SERVICE_H
 
38
 
 
39
#ifdef FT_CONFIG_OPTION_INCREMENTAL
 
40
#include FT_INCREMENTAL_H
 
41
#endif
 
42
 
 
43
 
 
44
FT_BEGIN_HEADER
 
45
 
 
46
 
 
47
  /*************************************************************************/
 
48
  /*                                                                       */
 
49
  /* Some generic definitions.                                             */
 
50
  /*                                                                       */
 
51
#ifndef TRUE
 
52
#define TRUE  1
 
53
#endif
 
54
 
 
55
#ifndef FALSE
 
56
#define FALSE  0
 
57
#endif
 
58
 
 
59
#ifndef NULL
 
60
#define NULL  (void*)0
 
61
#endif
 
62
 
 
63
 
 
64
  /*************************************************************************/
 
65
  /*                                                                       */
 
66
  /* The min and max functions missing in C.  As usual, be careful not to  */
 
67
  /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */
 
68
  /*                                                                       */
 
69
#define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )
 
70
#define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )
 
71
 
 
72
#define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )
 
73
 
 
74
 
 
75
#define FT_PAD_FLOOR( x, n )  ( (x) & ~((n)-1) )
 
76
#define FT_PAD_ROUND( x, n )  FT_PAD_FLOOR( (x) + ((n)/2), n )
 
77
#define FT_PAD_CEIL( x, n )   FT_PAD_FLOOR( (x) + ((n)-1), n )
 
78
 
 
79
#define FT_PIX_FLOOR( x )     ( (x) & ~63 )
 
80
#define FT_PIX_ROUND( x )     FT_PIX_FLOOR( (x) + 32 )
 
81
#define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )
 
82
 
 
83
 
 
84
  /*************************************************************************/
 
85
  /*************************************************************************/
 
86
  /*************************************************************************/
 
87
  /****                                                                 ****/
 
88
  /****                                                                 ****/
 
89
  /****                    V A L I D A T I O N                          ****/
 
90
  /****                                                                 ****/
 
91
  /****                                                                 ****/
 
92
  /*************************************************************************/
 
93
  /*************************************************************************/
 
94
  /*************************************************************************/
 
95
 
 
96
  /* handle to a validation object */
 
97
  typedef struct FT_ValidatorRec_*  FT_Validator;
 
98
 
 
99
 
 
100
  /*************************************************************************/
 
101
  /*                                                                       */
 
102
  /* There are three distinct validation levels defined here:              */
 
103
  /*                                                                       */
 
104
  /* FT_VALIDATE_DEFAULT ::                                                */
 
105
  /*   A table that passes this validation level can be used reliably by   */
 
106
  /*   FreeType.  It generally means that all offsets have been checked to */
 
107
  /*   prevent out-of-bound reads, array counts are correct, etc.          */
 
108
  /*                                                                       */
 
109
  /* FT_VALIDATE_TIGHT ::                                                  */
 
110
  /*   A table that passes this validation level can be used reliably and  */
 
111
  /*   doesn't contain invalid data.  For example, a charmap table that    */
 
112
  /*   returns invalid glyph indices will not pass, even though it can     */
 
113
  /*   be used with FreeType in default mode (the library will simply      */
 
114
  /*   return an error later when trying to load the glyph).               */
 
115
  /*                                                                       */
 
116
  /*   It also check that fields that must be a multiple of 2, 4, or 8     */
 
117
  /*   don't have incorrect values, etc.                                   */
 
118
  /*                                                                       */
 
119
  /* FT_VALIDATE_PARANOID ::                                               */
 
120
  /*   Only for font debugging.  Checks that a table follows the           */
 
121
  /*   specification by 100%.  Very few fonts will be able to pass this    */
 
122
  /*   level anyway but it can be useful for certain tools like font       */
 
123
  /*   editors/converters.                                                 */
 
124
  /*                                                                       */
 
125
  typedef enum  FT_ValidationLevel_
 
126
  {
 
127
    FT_VALIDATE_DEFAULT = 0,
 
128
    FT_VALIDATE_TIGHT,
 
129
    FT_VALIDATE_PARANOID
 
130
 
 
131
  } FT_ValidationLevel;
 
132
 
 
133
 
 
134
  /* validator structure */
 
135
  typedef struct  FT_ValidatorRec_
 
136
  {
 
137
    const FT_Byte*      base;        /* address of table in memory       */
 
138
    const FT_Byte*      limit;       /* `base' + sizeof(table) in memory */
 
139
    FT_ValidationLevel  level;       /* validation level                 */
 
140
    FT_Error            error;       /* error returned. 0 means success  */
 
141
 
 
142
    ft_jmp_buf          jump_buffer; /* used for exception handling      */
 
143
 
 
144
  } FT_ValidatorRec;
 
145
 
 
146
 
 
147
#define FT_VALIDATOR( x )  ((FT_Validator)( x ))
 
148
 
 
149
 
 
150
  FT_BASE( void )
 
151
  ft_validator_init( FT_Validator        valid,
 
152
                     const FT_Byte*      base,
 
153
                     const FT_Byte*      limit,
 
154
                     FT_ValidationLevel  level );
 
155
 
 
156
  FT_BASE( FT_Int )
 
157
  ft_validator_run( FT_Validator  valid );
 
158
 
 
159
  /* Sets the error field in a validator, then calls `longjmp' to return */
 
160
  /* to high-level caller.  Using `setjmp/longjmp' avoids many stupid    */
 
161
  /* error checks within the validation routines.                        */
 
162
  /*                                                                     */
 
163
  FT_BASE( void )
 
164
  ft_validator_error( FT_Validator  valid,
 
165
                      FT_Error      error );
 
166
 
 
167
 
 
168
  /* Calls ft_validate_error.  Assumes that the `valid' local variable */
 
169
  /* holds a pointer to the current validator object.                  */
 
170
  /*                                                                   */
 
171
#define FT_INVALID( _error )  ft_validator_error( valid, _error )
 
172
 
 
173
  /* called when a broken table is detected */
 
174
#define FT_INVALID_TOO_SHORT  FT_INVALID( FT_Err_Invalid_Table )
 
175
 
 
176
  /* called when an invalid offset is detected */
 
177
#define FT_INVALID_OFFSET     FT_INVALID( FT_Err_Invalid_Offset )
 
178
 
 
179
  /* called when an invalid format/value is detected */
 
180
#define FT_INVALID_FORMAT     FT_INVALID( FT_Err_Invalid_Table )
 
181
 
 
182
  /* called when an invalid glyph index is detected */
 
183
#define FT_INVALID_GLYPH_ID   FT_INVALID( FT_Err_Invalid_Glyph_Index )
 
184
 
 
185
  /* called when an invalid field value is detected */
 
186
#define FT_INVALID_DATA       FT_INVALID( FT_Err_Invalid_Table )
 
187
 
 
188
 
 
189
  /*************************************************************************/
 
190
  /*************************************************************************/
 
191
  /*************************************************************************/
 
192
  /****                                                                 ****/
 
193
  /****                                                                 ****/
 
194
  /****                       C H A R M A P S                           ****/
 
195
  /****                                                                 ****/
 
196
  /****                                                                 ****/
 
197
  /*************************************************************************/
 
198
  /*************************************************************************/
 
199
  /*************************************************************************/
 
200
 
 
201
  /* handle to internal charmap object */
 
202
  typedef struct FT_CMapRec_*              FT_CMap;
 
203
 
 
204
  /* handle to charmap class structure */
 
205
  typedef const struct FT_CMap_ClassRec_*  FT_CMap_Class;
 
206
 
 
207
  /* internal charmap object structure */
 
208
  typedef struct  FT_CMapRec_
 
209
  {
 
210
    FT_CharMapRec  charmap;
 
211
    FT_CMap_Class  clazz;
 
212
 
 
213
  } FT_CMapRec;
 
214
 
 
215
  /* typecase any pointer to a charmap handle */
 
216
#define FT_CMAP( x )              ((FT_CMap)( x ))
 
217
 
 
218
  /* obvious macros */
 
219
#define FT_CMAP_PLATFORM_ID( x )  FT_CMAP( x )->charmap.platform_id
 
220
#define FT_CMAP_ENCODING_ID( x )  FT_CMAP( x )->charmap.encoding_id
 
221
#define FT_CMAP_ENCODING( x )     FT_CMAP( x )->charmap.encoding
 
222
#define FT_CMAP_FACE( x )         FT_CMAP( x )->charmap.face
 
223
 
 
224
 
 
225
  /* class method definitions */
 
226
  typedef FT_Error
 
227
  (*FT_CMap_InitFunc)( FT_CMap     cmap,
 
228
                       FT_Pointer  init_data );
 
229
 
 
230
  typedef void
 
231
  (*FT_CMap_DoneFunc)( FT_CMap  cmap );
 
232
 
 
233
  typedef FT_UInt
 
234
  (*FT_CMap_CharIndexFunc)( FT_CMap    cmap,
 
235
                            FT_UInt32  char_code );
 
236
 
 
237
  typedef FT_UInt
 
238
  (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
 
239
                           FT_UInt32  *achar_code );
 
240
 
 
241
 
 
242
  typedef struct  FT_CMap_ClassRec_
 
243
  {
 
244
    FT_ULong               size;
 
245
    FT_CMap_InitFunc       init;
 
246
    FT_CMap_DoneFunc       done;
 
247
    FT_CMap_CharIndexFunc  char_index;
 
248
    FT_CMap_CharNextFunc   char_next;
 
249
 
 
250
  } FT_CMap_ClassRec;
 
251
 
 
252
 
 
253
  /* create a new charmap and add it to charmap->face */
 
254
  FT_BASE( FT_Error )
 
255
  FT_CMap_New( FT_CMap_Class  clazz,
 
256
               FT_Pointer     init_data,
 
257
               FT_CharMap     charmap,
 
258
               FT_CMap       *acmap );
 
259
 
 
260
  /* destroy a charmap (don't remove it from face's list though) */
 
261
  FT_BASE( void )
 
262
  FT_CMap_Done( FT_CMap  cmap );
 
263
 
 
264
 
 
265
  /*************************************************************************/
 
266
  /*                                                                       */
 
267
  /* <Struct>                                                              */
 
268
  /*    FT_Face_InternalRec                                                */
 
269
  /*                                                                       */
 
270
  /* <Description>                                                         */
 
271
  /*    This structure contains the internal fields of each FT_Face        */
 
272
  /*    object.  These fields may change between different releases of     */
 
273
  /*    FreeType.                                                          */
 
274
  /*                                                                       */
 
275
  /* <Fields>                                                              */
 
276
  /*    max_points ::                                                      */
 
277
  /*      The maximal number of points used to store the vectorial outline */
 
278
  /*      of any glyph in this face.  If this value cannot be known in     */
 
279
  /*      advance, or if the face isn't scalable, this should be set to 0. */
 
280
  /*      Only relevant for scalable formats.                              */
 
281
  /*                                                                       */
 
282
  /*    max_contours ::                                                    */
 
283
  /*      The maximal number of contours used to store the vectorial       */
 
284
  /*      outline of any glyph in this face.  If this value cannot be      */
 
285
  /*      known in advance, or if the face isn't scalable, this should be  */
 
286
  /*      set to 0.  Only relevant for scalable formats.                   */
 
287
  /*                                                                       */
 
288
  /*    transform_matrix ::                                                */
 
289
  /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */
 
290
  /*      outlines after they are loaded from the font.  Only used by the  */
 
291
  /*      convenience functions.                                           */
 
292
  /*                                                                       */
 
293
  /*    transform_delta ::                                                 */
 
294
  /*      A translation vector used to transform glyph outlines after they */
 
295
  /*      are loaded from the font.  Only used by the convenience          */
 
296
  /*      functions.                                                       */
 
297
  /*                                                                       */
 
298
  /*    transform_flags ::                                                 */
 
299
  /*      Some flags used to classify the transform.  Only used by the     */
 
300
  /*      convenience functions.                                           */
 
301
  /*                                                                       */
 
302
  /*    services ::                                                        */
 
303
  /*      A cache for frequently used services.  It should be only         */
 
304
  /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */
 
305
  /*                                                                       */
 
306
  /*    incremental_interface ::                                           */
 
307
  /*      If non-null, the interface through which glyph data and metrics  */
 
308
  /*      are loaded incrementally for faces that do not provide all of    */
 
309
  /*      this data when first opened.  This field exists only if          */
 
310
  /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
 
311
  /*                                                                       */
 
312
  typedef struct  FT_Face_InternalRec_
 
313
  {
 
314
    FT_UShort           max_points;
 
315
    FT_Short            max_contours;
 
316
 
 
317
    FT_Matrix           transform_matrix;
 
318
    FT_Vector           transform_delta;
 
319
    FT_Int              transform_flags;
 
320
 
 
321
    FT_ServiceCacheRec  services;
 
322
 
 
323
#ifdef FT_CONFIG_OPTION_INCREMENTAL
 
324
    FT_Incremental_InterfaceRec*  incremental_interface;
 
325
#endif
 
326
 
 
327
  } FT_Face_InternalRec;
 
328
 
 
329
 
 
330
  /*************************************************************************/
 
331
  /*                                                                       */
 
332
  /* <Struct>                                                              */
 
333
  /*    FT_Slot_InternalRec                                                */
 
334
  /*                                                                       */
 
335
  /* <Description>                                                         */
 
336
  /*    This structure contains the internal fields of each FT_GlyphSlot   */
 
337
  /*    object.  These fields may change between different releases of     */
 
338
  /*    FreeType.                                                          */
 
339
  /*                                                                       */
 
340
  /* <Fields>                                                              */
 
341
  /*    loader            :: The glyph loader object used to load outlines */
 
342
  /*                         into the glyph slot.                          */
 
343
  /*                                                                       */
 
344
  /*    flags             :: Possible values are zero or                   */
 
345
  /*                         FT_GLYPH_OWN_BITMAP.  The latter indicates    */
 
346
  /*                         that the FT_GlyphSlot structure owns the      */
 
347
  /*                         bitmap buffer.                                */
 
348
  /*                                                                       */
 
349
  /*    glyph_transformed :: Boolean.  Set to TRUE when the loaded glyph   */
 
350
  /*                         must be transformed through a specific        */
 
351
  /*                         font transformation.  This is _not_ the same  */
 
352
  /*                         as the face transform set through             */
 
353
  /*                         FT_Set_Transform().                           */
 
354
  /*                                                                       */
 
355
  /*    glyph_matrix      :: The 2x2 matrix corresponding to the glyph     */
 
356
  /*                         transformation, if necessary.                 */
 
357
  /*                                                                       */
 
358
  /*    glyph_delta       :: The 2d translation vector corresponding to    */
 
359
  /*                         the glyph transformation, if necessary.       */
 
360
  /*                                                                       */
 
361
  /*    glyph_hints       :: Format-specific glyph hints management.       */
 
362
  /*                                                                       */
 
363
 
 
364
#define FT_GLYPH_OWN_BITMAP  0x1
 
365
 
 
366
  typedef struct  FT_Slot_InternalRec_
 
367
  {
 
368
    FT_GlyphLoader  loader;
 
369
    FT_UInt         flags;
 
370
    FT_Bool         glyph_transformed;
 
371
    FT_Matrix       glyph_matrix;
 
372
    FT_Vector       glyph_delta;
 
373
    void*           glyph_hints;
 
374
 
 
375
  } FT_GlyphSlot_InternalRec;
 
376
 
 
377
 
 
378
  /*************************************************************************/
 
379
  /*************************************************************************/
 
380
  /*************************************************************************/
 
381
  /****                                                                 ****/
 
382
  /****                                                                 ****/
 
383
  /****                         M O D U L E S                           ****/
 
384
  /****                                                                 ****/
 
385
  /****                                                                 ****/
 
386
  /*************************************************************************/
 
387
  /*************************************************************************/
 
388
  /*************************************************************************/
 
389
 
 
390
 
 
391
  /*************************************************************************/
 
392
  /*                                                                       */
 
393
  /* <Struct>                                                              */
 
394
  /*    FT_ModuleRec                                                       */
 
395
  /*                                                                       */
 
396
  /* <Description>                                                         */
 
397
  /*    A module object instance.                                          */
 
398
  /*                                                                       */
 
399
  /* <Fields>                                                              */
 
400
  /*    clazz   :: A pointer to the module's class.                        */
 
401
  /*                                                                       */
 
402
  /*    library :: A handle to the parent library object.                  */
 
403
  /*                                                                       */
 
404
  /*    memory  :: A handle to the memory manager.                         */
 
405
  /*                                                                       */
 
406
  /*    generic :: A generic structure for user-level extensibility (?).   */
 
407
  /*                                                                       */
 
408
  typedef struct  FT_ModuleRec_
 
409
  {
 
410
    FT_Module_Class*  clazz;
 
411
    FT_Library        library;
 
412
    FT_Memory         memory;
 
413
    FT_Generic        generic;
 
414
 
 
415
  } FT_ModuleRec;
 
416
 
 
417
 
 
418
  /* typecast an object to a FT_Module */
 
419
#define FT_MODULE( x )          ((FT_Module)( x ))
 
420
#define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz
 
421
#define FT_MODULE_LIBRARY( x )  FT_MODULE( x )->library
 
422
#define FT_MODULE_MEMORY( x )   FT_MODULE( x )->memory
 
423
 
 
424
 
 
425
#define FT_MODULE_IS_DRIVER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
 
426
                                    FT_MODULE_FONT_DRIVER )
 
427
 
 
428
#define FT_MODULE_IS_RENDERER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
 
429
                                      FT_MODULE_RENDERER )
 
430
 
 
431
#define FT_MODULE_IS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
 
432
                                    FT_MODULE_HINTER )
 
433
 
 
434
#define FT_MODULE_IS_STYLER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
 
435
                                    FT_MODULE_STYLER )
 
436
 
 
437
#define FT_DRIVER_IS_SCALABLE( x )  ( FT_MODULE_CLASS( x )->module_flags & \
 
438
                                      FT_MODULE_DRIVER_SCALABLE )
 
439
 
 
440
#define FT_DRIVER_USES_OUTLINES( x )  !( FT_MODULE_CLASS( x )->module_flags & \
 
441
                                         FT_MODULE_DRIVER_NO_OUTLINES )
 
442
 
 
443
#define FT_DRIVER_HAS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
 
444
                                     FT_MODULE_DRIVER_HAS_HINTER )
 
445
 
 
446
 
 
447
  /*************************************************************************/
 
448
  /*                                                                       */
 
449
  /* <Function>                                                            */
 
450
  /*    FT_Get_Module_Interface                                            */
 
451
  /*                                                                       */
 
452
  /* <Description>                                                         */
 
453
  /*    Finds a module and returns its specific interface as a typeless    */
 
454
  /*    pointer.                                                           */
 
455
  /*                                                                       */
 
456
  /* <Input>                                                               */
 
457
  /*    library     :: A handle to the library object.                     */
 
458
  /*                                                                       */
 
459
  /*    module_name :: The module's name (as an ASCII string).             */
 
460
  /*                                                                       */
 
461
  /* <Return>                                                              */
 
462
  /*    A module-specific interface if available, 0 otherwise.             */
 
463
  /*                                                                       */
 
464
  /* <Note>                                                                */
 
465
  /*    You should better be familiar with FreeType internals to know      */
 
466
  /*    which module to look for, and what its interface is :-)            */
 
467
  /*                                                                       */
 
468
  FT_BASE( const void* )
 
469
  FT_Get_Module_Interface( FT_Library   library,
 
470
                           const char*  mod_name );
 
471
 
 
472
  FT_BASE( FT_Pointer )
 
473
  ft_module_get_service( FT_Module    module,
 
474
                         const char*  service_id );
 
475
 
 
476
 /* */
 
477
 
 
478
 
 
479
  /*************************************************************************/
 
480
  /*************************************************************************/
 
481
  /*************************************************************************/
 
482
  /****                                                                 ****/
 
483
  /****                                                                 ****/
 
484
  /****               FACE, SIZE & GLYPH SLOT OBJECTS                   ****/
 
485
  /****                                                                 ****/
 
486
  /****                                                                 ****/
 
487
  /*************************************************************************/
 
488
  /*************************************************************************/
 
489
  /*************************************************************************/
 
490
 
 
491
  /* a few macros used to perform easy typecasts with minimal brain damage */
 
492
 
 
493
#define FT_FACE( x )          ((FT_Face)(x))
 
494
#define FT_SIZE( x )          ((FT_Size)(x))
 
495
#define FT_SLOT( x )          ((FT_GlyphSlot)(x))
 
496
 
 
497
#define FT_FACE_DRIVER( x )   FT_FACE( x )->driver
 
498
#define FT_FACE_LIBRARY( x )  FT_FACE_DRIVER( x )->root.library
 
499
#define FT_FACE_MEMORY( x )   FT_FACE( x )->memory
 
500
#define FT_FACE_STREAM( x )   FT_FACE( x )->stream
 
501
 
 
502
#define FT_SIZE_FACE( x )     FT_SIZE( x )->face
 
503
#define FT_SLOT_FACE( x )     FT_SLOT( x )->face
 
504
 
 
505
#define FT_FACE_SLOT( x )     FT_FACE( x )->glyph
 
506
#define FT_FACE_SIZE( x )     FT_FACE( x )->size
 
507
 
 
508
 
 
509
  /*************************************************************************/
 
510
  /*                                                                       */
 
511
  /* <Function>                                                            */
 
512
  /*    FT_New_GlyphSlot                                                   */
 
513
  /*                                                                       */
 
514
  /* <Description>                                                         */
 
515
  /*    It is sometimes useful to have more than one glyph slot for a      */
 
516
  /*    given face object.  This function is used to create additional     */
 
517
  /*    slots.  All of them are automatically discarded when the face is   */
 
518
  /*    destroyed.                                                         */
 
519
  /*                                                                       */
 
520
  /* <Input>                                                               */
 
521
  /*    face  :: A handle to a parent face object.                         */
 
522
  /*                                                                       */
 
523
  /* <Output>                                                              */
 
524
  /*    aslot :: A handle to a new glyph slot object.                      */
 
525
  /*                                                                       */
 
526
  /* <Return>                                                              */
 
527
  /*    FreeType error code.  0 means success.                             */
 
528
  /*                                                                       */
 
529
  FT_BASE( FT_Error )
 
530
  FT_New_GlyphSlot( FT_Face        face,
 
531
                    FT_GlyphSlot  *aslot );
 
532
 
 
533
 
 
534
  /*************************************************************************/
 
535
  /*                                                                       */
 
536
  /* <Function>                                                            */
 
537
  /*    FT_Done_GlyphSlot                                                  */
 
538
  /*                                                                       */
 
539
  /* <Description>                                                         */
 
540
  /*    Destroys a given glyph slot.  Remember however that all slots are  */
 
541
  /*    automatically destroyed with its parent.  Using this function is   */
 
542
  /*    not always mandatory.                                              */
 
543
  /*                                                                       */
 
544
  /* <Input>                                                               */
 
545
  /*    slot :: A handle to a target glyph slot.                           */
 
546
  /*                                                                       */
 
547
  FT_BASE( void )
 
548
  FT_Done_GlyphSlot( FT_GlyphSlot  slot );
 
549
 
 
550
 /* */
 
551
 
 
552
 /*
 
553
  * Free the bitmap of a given glyphslot when needed
 
554
  * (i.e., only when it was allocated with ft_glyphslot_alloc_bitmap).
 
555
  */
 
556
  FT_BASE( void )
 
557
  ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
 
558
 
 
559
 
 
560
 /*
 
561
  * Allocate a new bitmap buffer in a glyph slot.
 
562
  */
 
563
  FT_BASE( FT_Error )
 
564
  ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,
 
565
                             FT_ULong      size );
 
566
 
 
567
 
 
568
 /*
 
569
  * Set the bitmap buffer in a glyph slot to a given pointer.
 
570
  * The buffer will not be freed by a later call to ft_glyphslot_free_bitmap.
 
571
  */
 
572
  FT_BASE( void )
 
573
  ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,
 
574
                           FT_Byte*      buffer );
 
575
 
 
576
 
 
577
  /*************************************************************************/
 
578
  /*************************************************************************/
 
579
  /*************************************************************************/
 
580
  /****                                                                 ****/
 
581
  /****                                                                 ****/
 
582
  /****                        R E N D E R E R S                        ****/
 
583
  /****                                                                 ****/
 
584
  /****                                                                 ****/
 
585
  /*************************************************************************/
 
586
  /*************************************************************************/
 
587
  /*************************************************************************/
 
588
 
 
589
 
 
590
#define FT_RENDERER( x )      ((FT_Renderer)( x ))
 
591
#define FT_GLYPH( x )         ((FT_Glyph)( x ))
 
592
#define FT_BITMAP_GLYPH( x )  ((FT_BitmapGlyph)( x ))
 
593
#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
 
594
 
 
595
 
 
596
  typedef struct  FT_RendererRec_
 
597
  {
 
598
    FT_ModuleRec            root;
 
599
    FT_Renderer_Class*      clazz;
 
600
    FT_Glyph_Format         glyph_format;
 
601
    FT_Glyph_Class          glyph_class;
 
602
 
 
603
    FT_Raster               raster;
 
604
    FT_Raster_Render_Func   raster_render;
 
605
    FT_Renderer_RenderFunc  render;
 
606
 
 
607
  } FT_RendererRec;
 
608
 
 
609
 
 
610
  /*************************************************************************/
 
611
  /*************************************************************************/
 
612
  /*************************************************************************/
 
613
  /****                                                                 ****/
 
614
  /****                                                                 ****/
 
615
  /****                    F O N T   D R I V E R S                      ****/
 
616
  /****                                                                 ****/
 
617
  /****                                                                 ****/
 
618
  /*************************************************************************/
 
619
  /*************************************************************************/
 
620
  /*************************************************************************/
 
621
 
 
622
 
 
623
  /* typecast a module into a driver easily */
 
624
#define FT_DRIVER( x )        ((FT_Driver)(x))
 
625
 
 
626
  /* typecast a module as a driver, and get its driver class */
 
627
#define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz
 
628
 
 
629
 
 
630
  /*************************************************************************/
 
631
  /*                                                                       */
 
632
  /* <Struct>                                                              */
 
633
  /*    FT_DriverRec                                                       */
 
634
  /*                                                                       */
 
635
  /* <Description>                                                         */
 
636
  /*    The root font driver class.  A font driver is responsible for      */
 
637
  /*    managing and loading font files of a given format.                 */
 
638
  /*                                                                       */
 
639
  /*  <Fields>                                                             */
 
640
  /*     root         :: Contains the fields of the root module class.     */
 
641
  /*                                                                       */
 
642
  /*     clazz        :: A pointer to the font driver's class.  Note that  */
 
643
  /*                     this is NOT root.clazz.  `class' wasn't used      */
 
644
  /*                     as it is a reserved word in C++.                  */
 
645
  /*                                                                       */
 
646
  /*     faces_list   :: The list of faces currently opened by this        */
 
647
  /*                     driver.                                           */
 
648
  /*                                                                       */
 
649
  /*     extensions   :: A typeless pointer to the driver's extensions     */
 
650
  /*                     registry, if they are supported through the       */
 
651
  /*                     configuration macro FT_CONFIG_OPTION_EXTENSIONS.  */
 
652
  /*                                                                       */
 
653
  /*     glyph_loader :: The glyph loader for all faces managed by this    */
 
654
  /*                     driver.  This object isn't defined for unscalable */
 
655
  /*                     formats.                                          */
 
656
  /*                                                                       */
 
657
  typedef struct  FT_DriverRec_
 
658
  {
 
659
    FT_ModuleRec     root;
 
660
    FT_Driver_Class  clazz;
 
661
 
 
662
    FT_ListRec       faces_list;
 
663
    void*            extensions;
 
664
 
 
665
    FT_GlyphLoader   glyph_loader;
 
666
 
 
667
  } FT_DriverRec;
 
668
 
 
669
 
 
670
  /*************************************************************************/
 
671
  /*************************************************************************/
 
672
  /*************************************************************************/
 
673
  /****                                                                 ****/
 
674
  /****                                                                 ****/
 
675
  /****                       L I B R A R I E S                         ****/
 
676
  /****                                                                 ****/
 
677
  /****                                                                 ****/
 
678
  /*************************************************************************/
 
679
  /*************************************************************************/
 
680
  /*************************************************************************/
 
681
 
 
682
 
 
683
/* this hook is used by the TrueType debugger. It must be set to an alternate
 
684
 * truetype bytecode interpreter function
 
685
 */
 
686
#define FT_DEBUG_HOOK_TRUETYPE            0
 
687
 
 
688
 
 
689
/* set this debug hook to a non-null pointer to force unpatented hinting
 
690
 * for all faces when both TT_CONFIG_OPTION_BYTECODE_INTERPRETER and
 
691
 * TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used
 
692
 * during debugging
 
693
 */
 
694
#define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
 
695
 
 
696
 
 
697
  /*************************************************************************/
 
698
  /*                                                                       */
 
699
  /* <Struct>                                                              */
 
700
  /*    FT_LibraryRec                                                      */
 
701
  /*                                                                       */
 
702
  /* <Description>                                                         */
 
703
  /*    The FreeType library class.  This is the root of all FreeType      */
 
704
  /*    data.  Use FT_New_Library() to create a library object, and        */
 
705
  /*    FT_Done_Library() to discard it and all child objects.             */
 
706
  /*                                                                       */
 
707
  /* <Fields>                                                              */
 
708
  /*    memory           :: The library's memory object.  Manages memory   */
 
709
  /*                        allocation.                                    */
 
710
  /*                                                                       */
 
711
  /*    generic          :: Client data variable.  Used to extend the      */
 
712
  /*                        Library class by higher levels and clients.    */
 
713
  /*                                                                       */
 
714
  /*    version_major    :: The major version number of the library.       */
 
715
  /*                                                                       */
 
716
  /*    version_minor    :: The minor version number of the library.       */
 
717
  /*                                                                       */
 
718
  /*    version_patch    :: The current patch level of the library.        */
 
719
  /*                                                                       */
 
720
  /*    num_modules      :: The number of modules currently registered     */
 
721
  /*                        within this library.  This is set to 0 for new */
 
722
  /*                        libraries.  New modules are added through the  */
 
723
  /*                        FT_Add_Module() API function.                  */
 
724
  /*                                                                       */
 
725
  /*    modules          :: A table used to store handles to the currently */
 
726
  /*                        registered modules. Note that each font driver */
 
727
  /*                        contains a list of its opened faces.           */
 
728
  /*                                                                       */
 
729
  /*    renderers        :: The list of renderers currently registered     */
 
730
  /*                        within the library.                            */
 
731
  /*                                                                       */
 
732
  /*    cur_renderer     :: The current outline renderer.  This is a       */
 
733
  /*                        shortcut used to avoid parsing the list on     */
 
734
  /*                        each call to FT_Outline_Render().  It is a     */
 
735
  /*                        handle to the current renderer for the         */
 
736
  /*                        FT_GLYPH_FORMAT_OUTLINE format.                */
 
737
  /*                                                                       */
 
738
  /*    auto_hinter      :: XXX                                            */
 
739
  /*                                                                       */
 
740
  /*    raster_pool      :: The raster object's render pool.  This can     */
 
741
  /*                        ideally be changed dynamically at run-time.    */
 
742
  /*                                                                       */
 
743
  /*    raster_pool_size :: The size of the render pool in bytes.          */
 
744
  /*                                                                       */
 
745
  /*    debug_hooks      :: XXX                                            */
 
746
  /*                                                                       */
 
747
  typedef struct  FT_LibraryRec_
 
748
  {
 
749
    FT_Memory          memory;           /* library's memory manager */
 
750
 
 
751
    FT_Generic         generic;
 
752
 
 
753
    FT_Int             version_major;
 
754
    FT_Int             version_minor;
 
755
    FT_Int             version_patch;
 
756
 
 
757
    FT_UInt            num_modules;
 
758
    FT_Module          modules[FT_MAX_MODULES];  /* module objects  */
 
759
 
 
760
    FT_ListRec         renderers;        /* list of renderers        */
 
761
    FT_Renderer        cur_renderer;     /* current outline renderer */
 
762
    FT_Module          auto_hinter;
 
763
 
 
764
    FT_Byte*           raster_pool;      /* scan-line conversion */
 
765
                                         /* render pool          */
 
766
    FT_ULong           raster_pool_size; /* size of render pool in bytes */
 
767
 
 
768
    FT_DebugHook_Func  debug_hooks[4];
 
769
 
 
770
  } FT_LibraryRec;
 
771
 
 
772
 
 
773
  FT_BASE( FT_Renderer )
 
774
  FT_Lookup_Renderer( FT_Library       library,
 
775
                      FT_Glyph_Format  format,
 
776
                      FT_ListNode*     node );
 
777
 
 
778
  FT_BASE( FT_Error )
 
779
  FT_Render_Glyph_Internal( FT_Library      library,
 
780
                            FT_GlyphSlot    slot,
 
781
                            FT_Render_Mode  render_mode );
 
782
 
 
783
  typedef const char*
 
784
  (*FT_Face_GetPostscriptNameFunc)( FT_Face  face );
 
785
 
 
786
  typedef FT_Error
 
787
  (*FT_Face_GetGlyphNameFunc)( FT_Face     face,
 
788
                               FT_UInt     glyph_index,
 
789
                               FT_Pointer  buffer,
 
790
                               FT_UInt     buffer_max );
 
791
 
 
792
  typedef FT_UInt
 
793
  (*FT_Face_GetGlyphNameIndexFunc)( FT_Face     face,
 
794
                                    FT_String*  glyph_name );
 
795
 
 
796
 
 
797
#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
 
798
 
 
799
  /*************************************************************************/
 
800
  /*                                                                       */
 
801
  /* <Function>                                                            */
 
802
  /*    FT_New_Memory                                                      */
 
803
  /*                                                                       */
 
804
  /* <Description>                                                         */
 
805
  /*    Creates a new memory object.                                       */
 
806
  /*                                                                       */
 
807
  /* <Return>                                                              */
 
808
  /*    A pointer to the new memory object.  0 in case of error.           */
 
809
  /*                                                                       */
 
810
  FT_EXPORT( FT_Memory )
 
811
  FT_New_Memory( void );
 
812
 
 
813
 
 
814
  /*************************************************************************/
 
815
  /*                                                                       */
 
816
  /* <Function>                                                            */
 
817
  /*    FT_Done_Memory                                                     */
 
818
  /*                                                                       */
 
819
  /* <Description>                                                         */
 
820
  /*    Discards memory manager.                                           */
 
821
  /*                                                                       */
 
822
  /* <Input>                                                               */
 
823
  /*    memory :: A handle to the memory manager.                          */
 
824
  /*                                                                       */
 
825
  FT_EXPORT( void )
 
826
  FT_Done_Memory( FT_Memory  memory );
 
827
 
 
828
#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
 
829
 
 
830
 
 
831
  /* Define default raster's interface.  The default raster is located in  */
 
832
  /* `src/base/ftraster.c'.                                                */
 
833
  /*                                                                       */
 
834
  /* Client applications can register new rasters through the              */
 
835
  /* FT_Set_Raster() API.                                                  */
 
836
 
 
837
#ifndef FT_NO_DEFAULT_RASTER
 
838
  FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
 
839
#endif
 
840
 
 
841
 
 
842
FT_END_HEADER
 
843
 
 
844
#endif /* __FTOBJS_H__ */
 
845
 
 
846
 
 
847
/* END */