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