ReactOS 0.4.16-dev-979-g79f281e
ftobjs.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftobjs.h
4 *
5 * The FreeType private base classes (specification).
6 *
7 * Copyright (C) 1996-2019 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_LCD_FILTER_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#include FT_INTERNAL_CALC_H
39
40#ifdef FT_CONFIG_OPTION_INCREMENTAL
41#include FT_INCREMENTAL_H
42#endif
43
44
46
47
48 /**************************************************************************
49 *
50 * Some generic definitions.
51 */
52#ifndef TRUE
53#define TRUE 1
54#endif
55
56#ifndef FALSE
57#define FALSE 0
58#endif
59
60#ifndef NULL
61#define NULL (void*)0
62#endif
63
64
65 /**************************************************************************
66 *
67 * The min and max functions missing in C. As usual, be careful not to
68 * write things like FT_MIN( a++, b++ ) to avoid side effects.
69 */
70#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
71#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
72
73#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
74
75 /*
76 * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' algorithm.
77 * We use alpha = 1, beta = 3/8, giving us results with a largest error
78 * less than 7% compared to the exact value.
79 */
80#define FT_HYPOT( x, y ) \
81 ( x = FT_ABS( x ), \
82 y = FT_ABS( y ), \
83 x > y ? x + ( 3 * y >> 3 ) \
84 : y + ( 3 * x >> 3 ) )
85
86 /* we use FT_TYPEOF to suppress signedness compilation warnings */
87#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )
88#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n )
89#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n )
90
91#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
92#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
93#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
94
95 /* specialized versions (for signed values) */
96 /* that don't produce run-time errors due to integer overflow */
97#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \
98 n )
99#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \
100 n )
101#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) )
102#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) )
103
104#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \
105 n )
106#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \
107 n )
108#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )
109#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )
110
111
112 /*
113 * character classification functions -- since these are used to parse font
114 * files, we must not use those in <ctypes.h> which are locale-dependent
115 */
116#define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )
117
118#define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \
119 ( (unsigned)(x) - 'a' ) < 6U || \
120 ( (unsigned)(x) - 'A' ) < 6U )
121
122 /* the next two macros assume ASCII representation */
123#define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )
124#define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )
125
126#define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )
127#define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )
128
129
130 /*************************************************************************/
131 /*************************************************************************/
132 /*************************************************************************/
133 /**** ****/
134 /**** ****/
135 /**** C H A R M A P S ****/
136 /**** ****/
137 /**** ****/
138 /*************************************************************************/
139 /*************************************************************************/
140 /*************************************************************************/
141
142 /* handle to internal charmap object */
143 typedef struct FT_CMapRec_* FT_CMap;
144
145 /* handle to charmap class structure */
146 typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
147
148 /* internal charmap object structure */
149 typedef struct FT_CMapRec_
150 {
153
155
156 /* typecast any pointer to a charmap handle */
157#define FT_CMAP( x ) ( (FT_CMap)( x ) )
158
159 /* obvious macros */
160#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
161#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
162#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
163#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
164
165
166 /* class method definitions */
167 typedef FT_Error
168 (*FT_CMap_InitFunc)( FT_CMap cmap,
169 FT_Pointer init_data );
170
171 typedef void
172 (*FT_CMap_DoneFunc)( FT_CMap cmap );
173
174 typedef FT_UInt
176 FT_UInt32 char_code );
177
178 typedef FT_UInt
180 FT_UInt32 *achar_code );
181
182 typedef FT_UInt
184 FT_CMap unicode_cmap,
185 FT_UInt32 char_code,
186 FT_UInt32 variant_selector );
187
188 typedef FT_Int
190 FT_UInt32 char_code,
191 FT_UInt32 variant_selector );
192
193 typedef FT_UInt32 *
194 (*FT_CMap_VariantListFunc)( FT_CMap cmap,
195 FT_Memory mem );
196
197 typedef FT_UInt32 *
198 (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,
200 FT_UInt32 char_code );
201
202 typedef FT_UInt32 *
203 (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,
205 FT_UInt32 variant_selector );
206
207
208 typedef struct FT_CMap_ClassRec_
209 {
211
216
217 /* Subsequent entries are special ones for format 14 -- the variant */
218 /* selector subtable which behaves like no other */
219
225
227
228
229#define FT_DECLARE_CMAP_CLASS( class_ ) \
230 FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
231
232#define FT_DEFINE_CMAP_CLASS( \
233 class_, \
234 size_, \
235 init_, \
236 done_, \
237 char_index_, \
238 char_next_, \
239 char_var_index_, \
240 char_var_default_, \
241 variant_list_, \
242 charvariant_list_, \
243 variantchar_list_ ) \
244 FT_CALLBACK_TABLE_DEF \
245 const FT_CMap_ClassRec class_ = \
246 { \
247 size_, \
248 init_, \
249 done_, \
250 char_index_, \
251 char_next_, \
252 char_var_index_, \
253 char_var_default_, \
254 variant_list_, \
255 charvariant_list_, \
256 variantchar_list_ \
257 };
258
259
260 /* create a new charmap and add it to charmap->face */
263 FT_Pointer init_data,
264 FT_CharMap charmap,
265 FT_CMap *acmap );
266
267 /* destroy a charmap and remove it from face's list */
268 FT_BASE( void )
269 FT_CMap_Done( FT_CMap cmap );
270
271
272 /* add LCD padding to CBox */
273 FT_BASE( void )
274 ft_lcd_padding( FT_BBox* cbox,
277
278#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
279
280 typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
281 FT_Render_Mode render_mode,
282 FT_Byte* weights );
283
284
285 /* This is the default LCD filter, an in-place, 5-tap FIR filter. */
286 FT_BASE( void )
287 ft_lcd_filter_fir( FT_Bitmap* bitmap,
290
291#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
292
293 /**************************************************************************
294 *
295 * @struct:
296 * FT_Face_InternalRec
297 *
298 * @description:
299 * This structure contains the internal fields of each FT_Face object.
300 * These fields may change between different releases of FreeType.
301 *
302 * @fields:
303 * max_points ::
304 * The maximum number of points used to store the vectorial outline of
305 * any glyph in this face. If this value cannot be known in advance,
306 * or if the face isn't scalable, this should be set to 0. Only
307 * relevant for scalable formats.
308 *
309 * max_contours ::
310 * The maximum number of contours used to store the vectorial outline
311 * of any glyph in this face. If this value cannot be known in
312 * advance, or if the face isn't scalable, this should be set to 0.
313 * Only relevant for scalable formats.
314 *
315 * transform_matrix ::
316 * A 2x2 matrix of 16.16 coefficients used to transform glyph outlines
317 * after they are loaded from the font. Only used by the convenience
318 * functions.
319 *
320 * transform_delta ::
321 * A translation vector used to transform glyph outlines after they are
322 * loaded from the font. Only used by the convenience functions.
323 *
324 * transform_flags ::
325 * Some flags used to classify the transform. Only used by the
326 * convenience functions.
327 *
328 * services ::
329 * A cache for frequently used services. It should be only accessed
330 * with the macro `FT_FACE_LOOKUP_SERVICE`.
331 *
332 * incremental_interface ::
333 * If non-null, the interface through which glyph data and metrics are
334 * loaded incrementally for faces that do not provide all of this data
335 * when first opened. This field exists only if
336 * @FT_CONFIG_OPTION_INCREMENTAL is defined.
337 *
338 * no_stem_darkening ::
339 * Overrides the module-level default, see @stem-darkening[cff], for
340 * example. FALSE and TRUE toggle stem darkening on and off,
341 * respectively, value~-1 means to use the module/driver default.
342 *
343 * random_seed ::
344 * If positive, override the seed value for the CFF 'random' operator.
345 * Value~0 means to use the font's value. Value~-1 means to use the
346 * CFF driver's default.
347 *
348 * lcd_weights ::
349 * lcd_filter_func ::
350 * These fields specify the LCD filtering weights and callback function
351 * for ClearType-style subpixel rendering.
352 *
353 * refcount ::
354 * A counter initialized to~1 at the time an @FT_Face structure is
355 * created. @FT_Reference_Face increments this counter, and
356 * @FT_Done_Face only destroys a face if the counter is~1, otherwise it
357 * simply decrements it.
358 */
359 typedef struct FT_Face_InternalRec_
360 {
364
366
367#ifdef FT_CONFIG_OPTION_INCREMENTAL
368 FT_Incremental_InterfaceRec* incremental_interface;
369#endif
370
372 FT_Int32 random_seed;
373
374#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
375 FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
376 FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
377#endif
378
380
382
383
384 /**************************************************************************
385 *
386 * @struct:
387 * FT_Slot_InternalRec
388 *
389 * @description:
390 * This structure contains the internal fields of each FT_GlyphSlot
391 * object. These fields may change between different releases of
392 * FreeType.
393 *
394 * @fields:
395 * loader ::
396 * The glyph loader object used to load outlines into the glyph slot.
397 *
398 * flags ::
399 * Possible values are zero or FT_GLYPH_OWN_BITMAP. The latter
400 * indicates that the FT_GlyphSlot structure owns the bitmap buffer.
401 *
402 * glyph_transformed ::
403 * Boolean. Set to TRUE when the loaded glyph must be transformed
404 * through a specific font transformation. This is _not_ the same as
405 * the face transform set through FT_Set_Transform().
406 *
407 * glyph_matrix ::
408 * The 2x2 matrix corresponding to the glyph transformation, if
409 * necessary.
410 *
411 * glyph_delta ::
412 * The 2d translation vector corresponding to the glyph transformation,
413 * if necessary.
414 *
415 * glyph_hints ::
416 * Format-specific glyph hints management.
417 *
418 * load_flags ::
419 * The load flags passed as an argument to @FT_Load_Glyph while
420 * initializing the glyph slot.
421 */
422
423#define FT_GLYPH_OWN_BITMAP 0x1U
424
425 typedef struct FT_Slot_InternalRec_
426 {
433
434 FT_Int32 load_flags;
435
437
438
439 /**************************************************************************
440 *
441 * @struct:
442 * FT_Size_InternalRec
443 *
444 * @description:
445 * This structure contains the internal fields of each FT_Size object.
446 *
447 * @fields:
448 * module_data ::
449 * Data specific to a driver module.
450 *
451 * autohint_mode ::
452 * The used auto-hinting mode.
453 *
454 * autohint_metrics ::
455 * Metrics used by the auto-hinter.
456 *
457 */
458
459 typedef struct FT_Size_InternalRec_
460 {
462
465
467
468
469 /*************************************************************************/
470 /*************************************************************************/
471 /*************************************************************************/
472 /**** ****/
473 /**** ****/
474 /**** M O D U L E S ****/
475 /**** ****/
476 /**** ****/
477 /*************************************************************************/
478 /*************************************************************************/
479 /*************************************************************************/
480
481
482 /**************************************************************************
483 *
484 * @struct:
485 * FT_ModuleRec
486 *
487 * @description:
488 * A module object instance.
489 *
490 * @fields:
491 * clazz ::
492 * A pointer to the module's class.
493 *
494 * library ::
495 * A handle to the parent library object.
496 *
497 * memory ::
498 * A handle to the memory manager.
499 */
500 typedef struct FT_ModuleRec_
501 {
505
507
508
509 /* typecast an object to an FT_Module */
510#define FT_MODULE( x ) ( (FT_Module)(x) )
511
512#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
513#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
514#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
515
516
517#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
518 FT_MODULE_FONT_DRIVER )
519
520#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
521 FT_MODULE_RENDERER )
522
523#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
524 FT_MODULE_HINTER )
525
526#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
527 FT_MODULE_STYLER )
528
529#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
530 FT_MODULE_DRIVER_SCALABLE )
531
532#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
533 FT_MODULE_DRIVER_NO_OUTLINES )
534
535#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
536 FT_MODULE_DRIVER_HAS_HINTER )
537
538#define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \
539 FT_MODULE_DRIVER_HINTS_LIGHTLY )
540
541
542 /**************************************************************************
543 *
544 * @function:
545 * FT_Get_Module_Interface
546 *
547 * @description:
548 * Finds a module and returns its specific interface as a typeless
549 * pointer.
550 *
551 * @input:
552 * library ::
553 * A handle to the library object.
554 *
555 * module_name ::
556 * The module's name (as an ASCII string).
557 *
558 * @return:
559 * A module-specific interface if available, 0 otherwise.
560 *
561 * @note:
562 * You should better be familiar with FreeType internals to know which
563 * module to look for, and what its interface is :-)
564 */
565 FT_BASE( const void* )
567 const char* mod_name );
568
571 const char* service_id,
572 FT_Bool global );
573
574#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
576 ft_property_string_set( FT_Library library,
577 const FT_String* module_name,
578 const FT_String* property_name,
579 FT_String* value );
580#endif
581
582 /* */
583
584
585 /*************************************************************************/
586 /*************************************************************************/
587 /*************************************************************************/
588 /**** ****/
589 /**** ****/
590 /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/
591 /**** ****/
592 /**** ****/
593 /*************************************************************************/
594 /*************************************************************************/
595 /*************************************************************************/
596
597 /* a few macros used to perform easy typecasts with minimal brain damage */
598
599#define FT_FACE( x ) ( (FT_Face)(x) )
600#define FT_SIZE( x ) ( (FT_Size)(x) )
601#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )
602
603#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
604#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
605#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
606#define FT_FACE_STREAM( x ) FT_FACE( x )->stream
607
608#define FT_SIZE_FACE( x ) FT_SIZE( x )->face
609#define FT_SLOT_FACE( x ) FT_SLOT( x )->face
610
611#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
612#define FT_FACE_SIZE( x ) FT_FACE( x )->size
613
614
615 /**************************************************************************
616 *
617 * @function:
618 * FT_New_GlyphSlot
619 *
620 * @description:
621 * It is sometimes useful to have more than one glyph slot for a given
622 * face object. This function is used to create additional slots. All
623 * of them are automatically discarded when the face is destroyed.
624 *
625 * @input:
626 * face ::
627 * A handle to a parent face object.
628 *
629 * @output:
630 * aslot ::
631 * A handle to a new glyph slot object.
632 *
633 * @return:
634 * FreeType error code. 0 means success.
635 */
638 FT_GlyphSlot *aslot );
639
640
641 /**************************************************************************
642 *
643 * @function:
644 * FT_Done_GlyphSlot
645 *
646 * @description:
647 * Destroys a given glyph slot. Remember however that all slots are
648 * automatically destroyed with its parent. Using this function is not
649 * always mandatory.
650 *
651 * @input:
652 * slot ::
653 * A handle to a target glyph slot.
654 */
655 FT_BASE( void )
657
658 /* */
659
660#define FT_REQUEST_WIDTH( req ) \
661 ( (req)->horiResolution \
662 ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \
663 : (req)->width )
664
665#define FT_REQUEST_HEIGHT( req ) \
666 ( (req)->vertResolution \
667 ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \
668 : (req)->height )
669
670
671 /* Set the metrics according to a bitmap strike. */
672 FT_BASE( void )
674 FT_ULong strike_index );
675
676
677 /* Set the metrics according to a size request. */
678 FT_BASE( void )
680 FT_Size_Request req );
681
682
683 /* Match a size request against `available_sizes'. */
686 FT_Size_Request req,
687 FT_Bool ignore_width,
688 FT_ULong* size_index );
689
690
691 /* Use the horizontal metrics to synthesize the vertical metrics. */
692 /* If `advance' is zero, it is also synthesized. */
693 FT_BASE( void )
695 FT_Pos advance );
696
697
698 /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
699 /* was allocated with ft_glyphslot_alloc_bitmap). */
700 FT_BASE( void )
702
703
704 /* Preset bitmap metrics of an outline glyphslot prior to rendering */
705 /* and check whether the truncated bbox is too large for rendering. */
709 const FT_Vector* origin );
710
711 /* Allocate a new bitmap buffer in a glyph slot. */
714 FT_ULong size );
715
716
717 /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */
718 /* will not be freed by a later call to ft_glyphslot_free_bitmap. */
719 FT_BASE( void )
721 FT_Byte* buffer );
722
723
724 /*************************************************************************/
725 /*************************************************************************/
726 /*************************************************************************/
727 /**** ****/
728 /**** ****/
729 /**** R E N D E R E R S ****/
730 /**** ****/
731 /**** ****/
732 /*************************************************************************/
733 /*************************************************************************/
734 /*************************************************************************/
735
736
737#define FT_RENDERER( x ) ( (FT_Renderer)(x) )
738#define FT_GLYPH( x ) ( (FT_Glyph)(x) )
739#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) )
740#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) )
741
742
743 typedef struct FT_RendererRec_
744 {
749
753
755
756
757 /*************************************************************************/
758 /*************************************************************************/
759 /*************************************************************************/
760 /**** ****/
761 /**** ****/
762 /**** F O N T D R I V E R S ****/
763 /**** ****/
764 /**** ****/
765 /*************************************************************************/
766 /*************************************************************************/
767 /*************************************************************************/
768
769
770 /* typecast a module into a driver easily */
771#define FT_DRIVER( x ) ( (FT_Driver)(x) )
772
773 /* typecast a module as a driver, and get its driver class */
774#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
775
776
777 /**************************************************************************
778 *
779 * @struct:
780 * FT_DriverRec
781 *
782 * @description:
783 * The root font driver class. A font driver is responsible for managing
784 * and loading font files of a given format.
785 *
786 * @fields:
787 * root ::
788 * Contains the fields of the root module class.
789 *
790 * clazz ::
791 * A pointer to the font driver's class. Note that this is NOT
792 * root.clazz. 'class' wasn't used as it is a reserved word in C++.
793 *
794 * faces_list ::
795 * The list of faces currently opened by this driver.
796 *
797 * glyph_loader ::
798 * Unused. Used to be glyph loader for all faces managed by this
799 * driver.
800 */
801 typedef struct FT_DriverRec_
802 {
807
809
810
811 /*************************************************************************/
812 /*************************************************************************/
813 /*************************************************************************/
814 /**** ****/
815 /**** ****/
816 /**** L I B R A R I E S ****/
817 /**** ****/
818 /**** ****/
819 /*************************************************************************/
820 /*************************************************************************/
821 /*************************************************************************/
822
823
824 /**************************************************************************
825 *
826 * @struct:
827 * FT_LibraryRec
828 *
829 * @description:
830 * The FreeType library class. This is the root of all FreeType data.
831 * Use FT_New_Library() to create a library object, and FT_Done_Library()
832 * to discard it and all child objects.
833 *
834 * @fields:
835 * memory ::
836 * The library's memory object. Manages memory allocation.
837 *
838 * version_major ::
839 * The major version number of the library.
840 *
841 * version_minor ::
842 * The minor version number of the library.
843 *
844 * version_patch ::
845 * The current patch level of the library.
846 *
847 * num_modules ::
848 * The number of modules currently registered within this library.
849 * This is set to 0 for new libraries. New modules are added through
850 * the FT_Add_Module() API function.
851 *
852 * modules ::
853 * A table used to store handles to the currently registered
854 * modules. Note that each font driver contains a list of its opened
855 * faces.
856 *
857 * renderers ::
858 * The list of renderers currently registered within the library.
859 *
860 * cur_renderer ::
861 * The current outline renderer. This is a shortcut used to avoid
862 * parsing the list on each call to FT_Outline_Render(). It is a
863 * handle to the current renderer for the FT_GLYPH_FORMAT_OUTLINE
864 * format.
865 *
866 * auto_hinter ::
867 * The auto-hinter module interface.
868 *
869 * debug_hooks ::
870 * An array of four function pointers that allow debuggers to hook into
871 * a font format's interpreter. Currently, only the TrueType bytecode
872 * debugger uses this.
873 *
874 * lcd_weights ::
875 * The LCD filter weights for ClearType-style subpixel rendering.
876 *
877 * lcd_filter_func ::
878 * The LCD filtering callback function for for ClearType-style subpixel
879 * rendering.
880 *
881 * lcd_geometry ::
882 * This array specifies LCD subpixel geometry and controls Harmony LCD
883 * rendering technique, alternative to ClearType.
884 *
885 * pic_container ::
886 * Contains global structs and tables, instead of defining them
887 * globally.
888 *
889 * refcount ::
890 * A counter initialized to~1 at the time an @FT_Library structure is
891 * created. @FT_Reference_Library increments this counter, and
892 * @FT_Done_Library only destroys a library if the counter is~1,
893 * otherwise it simply decrements it.
894 */
895 typedef struct FT_LibraryRec_
896 {
897 FT_Memory memory; /* library's memory manager */
898
902
904 FT_Module modules[FT_MAX_MODULES]; /* module objects */
905
906 FT_ListRec renderers; /* list of renderers */
907 FT_Renderer cur_renderer; /* current outline renderer */
909
911
912#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
913 FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
914 FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
915#else
916 FT_Vector lcd_geometry[3]; /* RGB subpixel positions */
917#endif
918
920
922
923
927 FT_ListNode* node );
928
932 FT_Render_Mode render_mode );
933
934 typedef const char*
935 (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
936
937 typedef FT_Error
939 FT_UInt glyph_index,
941 FT_UInt buffer_max );
942
943 typedef FT_UInt
945 FT_String* glyph_name );
946
947
948#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
949
950 /**************************************************************************
951 *
952 * @function:
953 * FT_New_Memory
954 *
955 * @description:
956 * Creates a new memory object.
957 *
958 * @return:
959 * A pointer to the new memory object. 0 in case of error.
960 */
962 FT_New_Memory( void );
963
964
965 /**************************************************************************
966 *
967 * @function:
968 * FT_Done_Memory
969 *
970 * @description:
971 * Discards memory manager.
972 *
973 * @input:
974 * memory ::
975 * A handle to the memory manager.
976 */
977 FT_BASE( void )
979
980#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
981
982
983 /* Define default raster's interface. The default raster is located in */
984 /* `src/base/ftraster.c'. */
985 /* */
986 /* Client applications can register new rasters through the */
987 /* FT_Set_Raster() API. */
988
989#ifndef FT_NO_DEFAULT_RASTER
990 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
991#endif
992
993
994 /**************************************************************************
995 *
996 * @macro:
997 * FT_DEFINE_OUTLINE_FUNCS
998 *
999 * @description:
1000 * Used to initialize an instance of FT_Outline_Funcs struct. The struct
1001 * will be allocated in the global scope (or the scope where the macro is
1002 * used).
1003 */
1004#define FT_DEFINE_OUTLINE_FUNCS( \
1005 class_, \
1006 move_to_, \
1007 line_to_, \
1008 conic_to_, \
1009 cubic_to_, \
1010 shift_, \
1011 delta_ ) \
1012 static const FT_Outline_Funcs class_ = \
1013 { \
1014 move_to_, \
1015 line_to_, \
1016 conic_to_, \
1017 cubic_to_, \
1018 shift_, \
1019 delta_ \
1020 };
1021
1022
1023 /**************************************************************************
1024 *
1025 * @macro:
1026 * FT_DEFINE_RASTER_FUNCS
1027 *
1028 * @description:
1029 * Used to initialize an instance of FT_Raster_Funcs struct. The struct
1030 * will be allocated in the global scope (or the scope where the macro is
1031 * used).
1032 */
1033#define FT_DEFINE_RASTER_FUNCS( \
1034 class_, \
1035 glyph_format_, \
1036 raster_new_, \
1037 raster_reset_, \
1038 raster_set_mode_, \
1039 raster_render_, \
1040 raster_done_ ) \
1041 const FT_Raster_Funcs class_ = \
1042 { \
1043 glyph_format_, \
1044 raster_new_, \
1045 raster_reset_, \
1046 raster_set_mode_, \
1047 raster_render_, \
1048 raster_done_ \
1049 };
1050
1051
1052
1053 /**************************************************************************
1054 *
1055 * @macro:
1056 * FT_DEFINE_GLYPH
1057 *
1058 * @description:
1059 * The struct will be allocated in the global scope (or the scope where
1060 * the macro is used).
1061 */
1062#define FT_DEFINE_GLYPH( \
1063 class_, \
1064 size_, \
1065 format_, \
1066 init_, \
1067 done_, \
1068 copy_, \
1069 transform_, \
1070 bbox_, \
1071 prepare_ ) \
1072 FT_CALLBACK_TABLE_DEF \
1073 const FT_Glyph_Class class_ = \
1074 { \
1075 size_, \
1076 format_, \
1077 init_, \
1078 done_, \
1079 copy_, \
1080 transform_, \
1081 bbox_, \
1082 prepare_ \
1083 };
1084
1085
1086 /**************************************************************************
1087 *
1088 * @macro:
1089 * FT_DECLARE_RENDERER
1090 *
1091 * @description:
1092 * Used to create a forward declaration of a FT_Renderer_Class struct
1093 * instance.
1094 *
1095 * @macro:
1096 * FT_DEFINE_RENDERER
1097 *
1098 * @description:
1099 * Used to initialize an instance of FT_Renderer_Class struct.
1100 *
1101 * The struct will be allocated in the global scope (or the scope where
1102 * the macro is used).
1103 */
1104#define FT_DECLARE_RENDERER( class_ ) \
1105 FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
1106
1107#define FT_DEFINE_RENDERER( \
1108 class_, \
1109 flags_, \
1110 size_, \
1111 name_, \
1112 version_, \
1113 requires_, \
1114 interface_, \
1115 init_, \
1116 done_, \
1117 get_interface_, \
1118 glyph_format_, \
1119 render_glyph_, \
1120 transform_glyph_, \
1121 get_glyph_cbox_, \
1122 set_mode_, \
1123 raster_class_ ) \
1124 FT_CALLBACK_TABLE_DEF \
1125 const FT_Renderer_Class class_ = \
1126 { \
1127 FT_DEFINE_ROOT_MODULE( flags_, \
1128 size_, \
1129 name_, \
1130 version_, \
1131 requires_, \
1132 interface_, \
1133 init_, \
1134 done_, \
1135 get_interface_ ) \
1136 glyph_format_, \
1137 \
1138 render_glyph_, \
1139 transform_glyph_, \
1140 get_glyph_cbox_, \
1141 set_mode_, \
1142 \
1143 raster_class_ \
1144 };
1145
1146
1147 /**************************************************************************
1148 *
1149 * @macro:
1150 * FT_DECLARE_MODULE
1151 *
1152 * @description:
1153 * Used to create a forward declaration of a FT_Module_Class struct
1154 * instance.
1155 *
1156 * @macro:
1157 * FT_DEFINE_MODULE
1158 *
1159 * @description:
1160 * Used to initialize an instance of an FT_Module_Class struct.
1161 *
1162 * The struct will be allocated in the global scope (or the scope where
1163 * the macro is used).
1164 *
1165 * @macro:
1166 * FT_DEFINE_ROOT_MODULE
1167 *
1168 * @description:
1169 * Used to initialize an instance of an FT_Module_Class struct inside
1170 * another struct that contains it or in a function that initializes that
1171 * containing struct.
1172 */
1173#define FT_DECLARE_MODULE( class_ ) \
1174 FT_CALLBACK_TABLE \
1175 const FT_Module_Class class_;
1176
1177#define FT_DEFINE_ROOT_MODULE( \
1178 flags_, \
1179 size_, \
1180 name_, \
1181 version_, \
1182 requires_, \
1183 interface_, \
1184 init_, \
1185 done_, \
1186 get_interface_ ) \
1187 { \
1188 flags_, \
1189 size_, \
1190 \
1191 name_, \
1192 version_, \
1193 requires_, \
1194 \
1195 interface_, \
1196 \
1197 init_, \
1198 done_, \
1199 get_interface_, \
1200 },
1201
1202#define FT_DEFINE_MODULE( \
1203 class_, \
1204 flags_, \
1205 size_, \
1206 name_, \
1207 version_, \
1208 requires_, \
1209 interface_, \
1210 init_, \
1211 done_, \
1212 get_interface_ ) \
1213 FT_CALLBACK_TABLE_DEF \
1214 const FT_Module_Class class_ = \
1215 { \
1216 flags_, \
1217 size_, \
1218 \
1219 name_, \
1220 version_, \
1221 requires_, \
1222 \
1223 interface_, \
1224 \
1225 init_, \
1226 done_, \
1227 get_interface_, \
1228 };
1229
1230
1232
1233#endif /* FTOBJS_H_ */
1234
1235
1236/* END */
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
FT_Library library
Definition: cffdrivr.c:661
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:170
WORD face[3]
Definition: mesh.c:4747
int global
Definition: ehframes.cpp:22
FT_BEGIN_HEADER struct FT_Glyph_Metrics_ FT_Glyph_Metrics
enum FT_Render_Mode_ FT_Render_Mode
#define FT_EXPORT_VAR(x)
Definition: ftconfig.h:505
#define FT_BASE(x)
Definition: ftconfig.h:407
typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
Definition: ftglyph.h:70
#define FT_END_HEADER
Definition: ftheader.h:54
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
#define FT_Raster_Render_Func
Definition: ftimage.h:1188
struct FT_RasterRec_ * FT_Raster
Definition: ftimage.h:821
enum FT_Glyph_Format_ FT_Glyph_Format
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]
Definition: ftlcdfil.h:270
void(* FT_DebugHook_Func)(void *arg)
Definition: ftmodapi.h:627
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:179
struct FT_ModuleRec_ FT_ModuleRec
struct FT_Slot_InternalRec_ FT_GlyphSlot_InternalRec
FT_Match_Size(FT_Face face, FT_Size_Request req, FT_Bool ignore_width, FT_ULong *size_index)
Definition: ftobjs.c:2919
struct FT_LibraryRec_ FT_LibraryRec
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
Definition: ftobjs.c:2977
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
Definition: ftobjs.c:3037
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:183
FT_New_Memory(void)
Definition: ftsystem.c:300
ft_glyphslot_preset_bitmap(FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
Definition: ftobjs.c:348
ft_glyphslot_free_bitmap(FT_GlyphSlot slot)
Definition: ftobjs.c:326
struct FT_DriverRec_ FT_DriverRec
struct FT_Size_InternalRec_ FT_Size_InternalRec
FT_CMap_Done(FT_CMap cmap)
Definition: ftobjs.c:3611
FT_New_GlyphSlot(FT_Face face, FT_GlyphSlot *aslot)
Definition: ftobjs.c:596
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:198
FT_Request_Metrics(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3072
FT_Int(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:189
struct FT_CMap_ClassRec_ FT_CMap_ClassRec
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5007
FT_UInt(* FT_Face_GetGlyphNameIndexFunc)(FT_Face face, FT_String *glyph_name)
Definition: ftobjs.h:944
struct FT_CMapRec_ FT_CMapRec
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3657
FT_Render_Glyph_Internal(FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4528
ft_lcd_padding(FT_BBox *cbox, FT_GlyphSlot slot, FT_Render_Mode mode)
Definition: ftlcdfil.c:373
struct FT_CMapRec_ * FT_CMap
Definition: ftobjs.h:143
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:4992
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:203
FT_Done_Memory(FT_Memory memory)
Definition: ftsystem.c:324
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:194
struct FT_Face_InternalRec_ FT_Face_InternalRec
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:168
FT_Done_GlyphSlot(FT_GlyphSlot slot)
Definition: ftobjs.c:649
struct FT_RendererRec_ FT_RendererRec
FT_Lookup_Renderer(FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
Definition: ftobjs.c:4307
ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
Definition: ftobjs.c:515
ft_glyphslot_set_bitmap(FT_GlyphSlot slot, FT_Byte *buffer)
Definition: ftobjs.c:503
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:172
const struct FT_CMap_ClassRec_ * FT_CMap_Class
Definition: ftobjs.h:146
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:175
FT_Error(* FT_Face_GetGlyphNameFunc)(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: ftobjs.h:938
#define FT_MAX_MODULES
Definition: ftoption.h:403
FT_Error(* FT_Renderer_RenderFunc)(FT_Renderer renderer, FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
Definition: ftrender.h:89
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
signed char FT_Char
Definition: fttypes.h:143
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
int FT_Error
Definition: fttypes.h:299
char FT_String
Definition: fttypes.h:187
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
GLenum mode
Definition: glext.h:6217
const GLbyte * weights
Definition: glext.h:6523
voidpf uLong int origin
Definition: ioapi.h:144
static char memory[1024 *256]
Definition: process.c:116
FT_CharMapRec charmap
Definition: ftobjs.h:151
FT_CMap_Class clazz
Definition: ftobjs.h:152
FT_CMap_DoneFunc done
Definition: ftobjs.h:213
FT_CMap_CharNextFunc char_next
Definition: ftobjs.h:215
FT_CMap_CharVariantListFunc charvariant_list
Definition: ftobjs.h:223
FT_CMap_CharVarIndexFunc char_var_index
Definition: ftobjs.h:220
FT_ULong size
Definition: ftobjs.h:210
FT_CMap_VariantCharListFunc variantchar_list
Definition: ftobjs.h:224
FT_CMap_CharVarIsDefaultFunc char_var_default
Definition: ftobjs.h:221
FT_CMap_CharIndexFunc char_index
Definition: ftobjs.h:214
FT_CMap_VariantListFunc variant_list
Definition: ftobjs.h:222
FT_CMap_InitFunc init
Definition: ftobjs.h:212
FT_ListRec faces_list
Definition: ftobjs.h:805
FT_Driver_Class clazz
Definition: ftobjs.h:804
FT_ModuleRec root
Definition: ftobjs.h:803
FT_GlyphLoader glyph_loader
Definition: ftobjs.h:806
FT_Int transform_flags
Definition: ftobjs.h:363
FT_Char no_stem_darkening
Definition: ftobjs.h:371
FT_Int32 random_seed
Definition: ftobjs.h:372
FT_Matrix transform_matrix
Definition: ftobjs.h:361
FT_Vector transform_delta
Definition: ftobjs.h:362
FT_ServiceCacheRec services
Definition: ftobjs.h:365
FT_Vector lcd_geometry[3]
Definition: ftobjs.h:916
FT_DebugHook_Func debug_hooks[4]
Definition: ftobjs.h:910
FT_Int version_minor
Definition: ftobjs.h:900
FT_Int version_major
Definition: ftobjs.h:899
FT_Int version_patch
Definition: ftobjs.h:901
FT_Renderer cur_renderer
Definition: ftobjs.h:907
FT_Int refcount
Definition: ftobjs.h:919
FT_ListRec renderers
Definition: ftobjs.h:906
FT_Module auto_hinter
Definition: ftobjs.h:908
FT_Module modules[FT_MAX_MODULES]
Definition: ftobjs.h:904
FT_UInt num_modules
Definition: ftobjs.h:903
FT_Memory memory
Definition: ftobjs.h:897
FT_Memory memory
Definition: ftobjs.h:504
FT_Library library
Definition: ftobjs.h:503
FT_Module_Class * clazz
Definition: ftobjs.h:502
FT_Renderer_RenderFunc render
Definition: ftobjs.h:752
FT_Renderer_Class * clazz
Definition: ftobjs.h:746
FT_Glyph_Class glyph_class
Definition: ftobjs.h:748
FT_Glyph_Format glyph_format
Definition: ftobjs.h:747
FT_Raster_Render_Func raster_render
Definition: ftobjs.h:751
FT_ModuleRec root
Definition: ftobjs.h:745
FT_Raster raster
Definition: ftobjs.h:750
FT_Size_Metrics autohint_metrics
Definition: ftobjs.h:464
void * module_data
Definition: ftobjs.h:461
FT_Render_Mode autohint_mode
Definition: ftobjs.h:463
void * glyph_hints
Definition: ftobjs.h:432
FT_Vector glyph_delta
Definition: ftobjs.h:431
FT_Matrix glyph_matrix
Definition: ftobjs.h:430
FT_Bool glyph_transformed
Definition: ftobjs.h:429
FT_GlyphLoader loader
Definition: ftobjs.h:427
FT_Int32 load_flags
Definition: ftobjs.h:434
Definition: vfat.h:185
Definition: uimain.c:89
Definition: format.c:58
Definition: mem.c:349
Definition: dlist.c:348
Definition: pdh_main.c:96