00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __FTOBJS_H__
00027 #define __FTOBJS_H__
00028
00029 #include <ft2build.h>
00030 #include FT_RENDER_H
00031 #include FT_SIZES_H
00032 #include FT_LCD_FILTER_H
00033 #include FT_INTERNAL_MEMORY_H
00034 #include FT_INTERNAL_GLYPH_LOADER_H
00035 #include FT_INTERNAL_DRIVER_H
00036 #include FT_INTERNAL_AUTOHINT_H
00037 #include FT_INTERNAL_SERVICE_H
00038 #include FT_INTERNAL_PIC_H
00039
00040 #ifdef FT_CONFIG_OPTION_INCREMENTAL
00041 #include FT_INCREMENTAL_H
00042 #endif
00043
00044
00045 FT_BEGIN_HEADER
00046
00047
00048
00049
00050
00051
00052 #ifndef TRUE
00053 #define TRUE 1
00054 #endif
00055
00056 #ifndef FALSE
00057 #define FALSE 0
00058 #endif
00059
00060 #ifndef NULL
00061 #define NULL (void*)0
00062 #endif
00063
00064
00065
00066
00067
00068
00069
00070 #define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
00071 #define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
00072
00073 #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
00074
00075
00076 #define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) )
00077 #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
00078 #define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
00079
00080 #define FT_PIX_FLOOR( x ) ( (x) & ~63 )
00081 #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
00082 #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
00083
00084
00085
00086
00087
00088
00089 FT_BASE( FT_UInt32 )
00090 ft_highpow2( FT_UInt32 value );
00091
00092
00093
00094
00095
00096
00097
00098 #define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )
00099
00100 #define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \
00101 ( (unsigned)(x) - 'a' ) < 6U || \
00102 ( (unsigned)(x) - 'A' ) < 6U )
00103
00104
00105 #define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )
00106 #define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )
00107
00108 #define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )
00109 #define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 typedef struct FT_CMapRec_* FT_CMap;
00126
00127
00128 typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
00129
00130
00131 typedef struct FT_CMapRec_
00132 {
00133 FT_CharMapRec charmap;
00134 FT_CMap_Class clazz;
00135
00136 } FT_CMapRec;
00137
00138
00139 #define FT_CMAP( x ) ((FT_CMap)( x ))
00140
00141
00142 #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
00143 #define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
00144 #define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
00145 #define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
00146
00147
00148
00149 typedef FT_Error
00150 (*FT_CMap_InitFunc)( FT_CMap cmap,
00151 FT_Pointer init_data );
00152
00153 typedef void
00154 (*FT_CMap_DoneFunc)( FT_CMap cmap );
00155
00156 typedef FT_UInt
00157 (*FT_CMap_CharIndexFunc)( FT_CMap cmap,
00158 FT_UInt32 char_code );
00159
00160 typedef FT_UInt
00161 (*FT_CMap_CharNextFunc)( FT_CMap cmap,
00162 FT_UInt32 *achar_code );
00163
00164 typedef FT_UInt
00165 (*FT_CMap_CharVarIndexFunc)( FT_CMap cmap,
00166 FT_CMap unicode_cmap,
00167 FT_UInt32 char_code,
00168 FT_UInt32 variant_selector );
00169
00170 typedef FT_Bool
00171 (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap,
00172 FT_UInt32 char_code,
00173 FT_UInt32 variant_selector );
00174
00175 typedef FT_UInt32 *
00176 (*FT_CMap_VariantListFunc)( FT_CMap cmap,
00177 FT_Memory mem );
00178
00179 typedef FT_UInt32 *
00180 (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,
00181 FT_Memory mem,
00182 FT_UInt32 char_code );
00183
00184 typedef FT_UInt32 *
00185 (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,
00186 FT_Memory mem,
00187 FT_UInt32 variant_selector );
00188
00189
00190 typedef struct FT_CMap_ClassRec_
00191 {
00192 FT_ULong size;
00193 FT_CMap_InitFunc init;
00194 FT_CMap_DoneFunc done;
00195 FT_CMap_CharIndexFunc char_index;
00196 FT_CMap_CharNextFunc char_next;
00197
00198
00199
00200
00201 FT_CMap_CharVarIndexFunc char_var_index;
00202 FT_CMap_CharVarIsDefaultFunc char_var_default;
00203 FT_CMap_VariantListFunc variant_list;
00204 FT_CMap_CharVariantListFunc charvariant_list;
00205 FT_CMap_VariantCharListFunc variantchar_list;
00206
00207 } FT_CMap_ClassRec;
00208
00209 #ifndef FT_CONFIG_OPTION_PIC
00210
00211 #define FT_DECLARE_CMAP_CLASS(class_) \
00212 FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
00213
00214 #define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \
00215 char_next_, char_var_index_, char_var_default_, variant_list_, \
00216 charvariant_list_, variantchar_list_) \
00217 FT_CALLBACK_TABLE_DEF \
00218 const FT_CMap_ClassRec class_ = \
00219 { \
00220 size_, init_, done_, char_index_, char_next_, char_var_index_, \
00221 char_var_default_, variant_list_, charvariant_list_, variantchar_list_ \
00222 };
00223 #else
00224
00225 #define FT_DECLARE_CMAP_CLASS(class_) \
00226 void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec* clazz);
00227
00228 #define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \
00229 char_next_, char_var_index_, char_var_default_, variant_list_, \
00230 charvariant_list_, variantchar_list_) \
00231 void \
00232 FT_Init_Class_##class_( FT_Library library, \
00233 FT_CMap_ClassRec* clazz) \
00234 { \
00235 FT_UNUSED(library); \
00236 clazz->size = size_; \
00237 clazz->init = init_; \
00238 clazz->done = done_; \
00239 clazz->char_index = char_index_; \
00240 clazz->char_next = char_next_; \
00241 clazz->char_var_index = char_var_index_; \
00242 clazz->char_var_default = char_var_default_; \
00243 clazz->variant_list = variant_list_; \
00244 clazz->charvariant_list = charvariant_list_; \
00245 clazz->variantchar_list = variantchar_list_; \
00246 }
00247 #endif
00248
00249
00250 FT_BASE( FT_Error )
00251 FT_CMap_New( FT_CMap_Class clazz,
00252 FT_Pointer init_data,
00253 FT_CharMap charmap,
00254 FT_CMap *acmap );
00255
00256
00257 FT_BASE( void )
00258 FT_CMap_Done( FT_CMap cmap );
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314 typedef struct FT_Face_InternalRec_
00315 {
00316 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00317 FT_UShort reserved1;
00318 FT_Short reserved2;
00319 #endif
00320 FT_Matrix transform_matrix;
00321 FT_Vector transform_delta;
00322 FT_Int transform_flags;
00323
00324 FT_ServiceCacheRec services;
00325
00326 #ifdef FT_CONFIG_OPTION_INCREMENTAL
00327 FT_Incremental_InterfaceRec* incremental_interface;
00328 #endif
00329
00330 FT_Bool ignore_unpatented_hinter;
00331
00332 } FT_Face_InternalRec;
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369 #define FT_GLYPH_OWN_BITMAP 0x1
00370
00371 typedef struct FT_Slot_InternalRec_
00372 {
00373 FT_GlyphLoader loader;
00374 FT_UInt flags;
00375 FT_Bool glyph_transformed;
00376 FT_Matrix glyph_matrix;
00377 FT_Vector glyph_delta;
00378 void* glyph_hints;
00379
00380 } FT_GlyphSlot_InternalRec;
00381
00382
00383 #if 0
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396 typedef struct FT_Size_InternalRec_
00397 {
00398
00399
00400 } FT_Size_InternalRec;
00401
00402 #endif
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434 typedef struct FT_ModuleRec_
00435 {
00436 FT_Module_Class* clazz;
00437 FT_Library library;
00438 FT_Memory memory;
00439 FT_Generic generic;
00440
00441 } FT_ModuleRec;
00442
00443
00444
00445 #define FT_MODULE( x ) ((FT_Module)( x ))
00446 #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
00447 #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
00448 #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
00449
00450
00451 #define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
00452 FT_MODULE_FONT_DRIVER )
00453
00454 #define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
00455 FT_MODULE_RENDERER )
00456
00457 #define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
00458 FT_MODULE_HINTER )
00459
00460 #define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
00461 FT_MODULE_STYLER )
00462
00463 #define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
00464 FT_MODULE_DRIVER_SCALABLE )
00465
00466 #define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
00467 FT_MODULE_DRIVER_NO_OUTLINES )
00468
00469 #define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
00470 FT_MODULE_DRIVER_HAS_HINTER )
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494 FT_BASE( const void* )
00495 FT_Get_Module_Interface( FT_Library library,
00496 const char* mod_name );
00497
00498 FT_BASE( FT_Pointer )
00499 ft_module_get_service( FT_Module module,
00500 const char* service_id );
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519 #define FT_FACE( x ) ((FT_Face)(x))
00520 #define FT_SIZE( x ) ((FT_Size)(x))
00521 #define FT_SLOT( x ) ((FT_GlyphSlot)(x))
00522
00523 #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
00524 #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
00525 #define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
00526 #define FT_FACE_STREAM( x ) FT_FACE( x )->stream
00527
00528 #define FT_SIZE_FACE( x ) FT_SIZE( x )->face
00529 #define FT_SLOT_FACE( x ) FT_SLOT( x )->face
00530
00531 #define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
00532 #define FT_FACE_SIZE( x ) FT_FACE( x )->size
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555 FT_BASE( FT_Error )
00556 FT_New_GlyphSlot( FT_Face face,
00557 FT_GlyphSlot *aslot );
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573 FT_BASE( void )
00574 FT_Done_GlyphSlot( FT_GlyphSlot slot );
00575
00576
00577
00578 #define FT_REQUEST_WIDTH( req ) \
00579 ( (req)->horiResolution \
00580 ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \
00581 : (req)->width )
00582
00583 #define FT_REQUEST_HEIGHT( req ) \
00584 ( (req)->vertResolution \
00585 ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \
00586 : (req)->height )
00587
00588
00589
00590 FT_BASE( void )
00591 FT_Select_Metrics( FT_Face face,
00592 FT_ULong strike_index );
00593
00594
00595
00596 FT_BASE( void )
00597 FT_Request_Metrics( FT_Face face,
00598 FT_Size_Request req );
00599
00600
00601
00602 FT_BASE( FT_Error )
00603 FT_Match_Size( FT_Face face,
00604 FT_Size_Request req,
00605 FT_Bool ignore_width,
00606 FT_ULong* size_index );
00607
00608
00609
00610
00611 FT_BASE( void )
00612 ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
00613 FT_Pos advance );
00614
00615
00616
00617
00618 FT_BASE( void )
00619 ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
00620
00621
00622
00623 FT_BASE( FT_Error )
00624 ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
00625 FT_ULong size );
00626
00627
00628
00629
00630 FT_BASE( void )
00631 ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
00632 FT_Byte* buffer );
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648 #define FT_RENDERER( x ) ((FT_Renderer)( x ))
00649 #define FT_GLYPH( x ) ((FT_Glyph)( x ))
00650 #define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x ))
00651 #define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
00652
00653
00654 typedef struct FT_RendererRec_
00655 {
00656 FT_ModuleRec root;
00657 FT_Renderer_Class* clazz;
00658 FT_Glyph_Format glyph_format;
00659 FT_Glyph_Class glyph_class;
00660
00661 FT_Raster raster;
00662 FT_Raster_Render_Func raster_render;
00663 FT_Renderer_RenderFunc render;
00664
00665 } FT_RendererRec;
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682 #define FT_DRIVER( x ) ((FT_Driver)(x))
00683
00684
00685 #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715 typedef struct FT_DriverRec_
00716 {
00717 FT_ModuleRec root;
00718 FT_Driver_Class clazz;
00719
00720 FT_ListRec faces_list;
00721 void* extensions;
00722
00723 FT_GlyphLoader glyph_loader;
00724
00725 } FT_DriverRec;
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743 #define FT_DEBUG_HOOK_TRUETYPE 0
00744
00745
00746
00747
00748
00749
00750 #define FT_DEBUG_HOOK_UNPATENTED_HINTING 1
00751
00752
00753 typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
00754 FT_Render_Mode render_mode,
00755 FT_Library library );
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812 typedef struct FT_LibraryRec_
00813 {
00814 FT_Memory memory;
00815
00816 FT_Generic generic;
00817
00818 FT_Int version_major;
00819 FT_Int version_minor;
00820 FT_Int version_patch;
00821
00822 FT_UInt num_modules;
00823 FT_Module modules[FT_MAX_MODULES];
00824
00825 FT_ListRec renderers;
00826 FT_Renderer cur_renderer;
00827 FT_Module auto_hinter;
00828
00829 FT_Byte* raster_pool;
00830
00831 FT_ULong raster_pool_size;
00832
00833 FT_DebugHook_Func debug_hooks[4];
00834
00835 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
00836 FT_LcdFilter lcd_filter;
00837 FT_Int lcd_extra;
00838 FT_Byte lcd_weights[7];
00839 FT_Bitmap_LcdFilterFunc lcd_filter_func;
00840 #endif
00841
00842 #ifdef FT_CONFIG_OPTION_PIC
00843 FT_PIC_Container pic_container;
00844 #endif
00845
00846 } FT_LibraryRec;
00847
00848
00849 FT_BASE( FT_Renderer )
00850 FT_Lookup_Renderer( FT_Library library,
00851 FT_Glyph_Format format,
00852 FT_ListNode* node );
00853
00854 FT_BASE( FT_Error )
00855 FT_Render_Glyph_Internal( FT_Library library,
00856 FT_GlyphSlot slot,
00857 FT_Render_Mode render_mode );
00858
00859 typedef const char*
00860 (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
00861
00862 typedef FT_Error
00863 (*FT_Face_GetGlyphNameFunc)( FT_Face face,
00864 FT_UInt glyph_index,
00865 FT_Pointer buffer,
00866 FT_UInt buffer_max );
00867
00868 typedef FT_UInt
00869 (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,
00870 FT_String* glyph_name );
00871
00872
00873 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886 FT_BASE( FT_Memory )
00887 FT_New_Memory( void );
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901 FT_BASE( void )
00902 FT_Done_Memory( FT_Memory memory );
00903
00904 #endif
00905
00906
00907
00908
00909
00910
00911
00912
00913 #ifndef FT_NO_DEFAULT_RASTER
00914 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
00915 #endif
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943 #ifndef FT_CONFIG_OPTION_PIC
00944
00945 #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \
00946 cubic_to_, shift_, delta_) \
00947 static const FT_Outline_Funcs class_ = \
00948 { \
00949 move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \
00950 };
00951
00952 #else
00953
00954 #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \
00955 cubic_to_, shift_, delta_) \
00956 static FT_Error \
00957 Init_Class_##class_( FT_Outline_Funcs* clazz ) \
00958 { \
00959 clazz->move_to = move_to_; \
00960 clazz->line_to = line_to_; \
00961 clazz->conic_to = conic_to_; \
00962 clazz->cubic_to = cubic_to_; \
00963 clazz->shift = shift_; \
00964 clazz->delta = delta_; \
00965 return FT_Err_Ok; \
00966 }
00967
00968 #endif
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983 #ifndef FT_CONFIG_OPTION_PIC
00984
00985 #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \
00986 raster_reset_, raster_set_mode_, \
00987 raster_render_, raster_done_) \
00988 const FT_Raster_Funcs class_ = \
00989 { \
00990 glyph_format_, raster_new_, raster_reset_, \
00991 raster_set_mode_, raster_render_, raster_done_ \
00992 };
00993
00994 #else
00995
00996 #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \
00997 raster_reset_, raster_set_mode_, raster_render_, raster_done_) \
00998 void \
00999 FT_Init_Class_##class_( FT_Raster_Funcs* clazz ) \
01000 { \
01001 clazz->glyph_format = glyph_format_; \
01002 clazz->raster_new = raster_new_; \
01003 clazz->raster_reset = raster_reset_; \
01004 clazz->raster_set_mode = raster_set_mode_; \
01005 clazz->raster_render = raster_render_; \
01006 clazz->raster_done = raster_done_; \
01007 }
01008
01009 #endif
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038 #ifndef FT_CONFIG_OPTION_PIC
01039
01040 #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \
01041 transform_, bbox_, prepare_) \
01042 FT_CALLBACK_TABLE_DEF \
01043 const FT_Glyph_Class class_ = \
01044 { \
01045 size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \
01046 };
01047
01048 #else
01049
01050 #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \
01051 transform_, bbox_, prepare_) \
01052 void \
01053 FT_Init_Class_##class_( FT_Glyph_Class* clazz ) \
01054 { \
01055 clazz->glyph_size = size_; \
01056 clazz->glyph_format = format_; \
01057 clazz->glyph_init = init_; \
01058 clazz->glyph_done = done_; \
01059 clazz->glyph_copy = copy_; \
01060 clazz->glyph_transform = transform_; \
01061 clazz->glyph_bbox = bbox_; \
01062 clazz->glyph_prepare = prepare_; \
01063 }
01064
01065 #endif
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101 #ifndef FT_CONFIG_OPTION_PIC
01102
01103 #define FT_DECLARE_RENDERER(class_) \
01104 FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
01105
01106 #define FT_DEFINE_RENDERER(class_, \
01107 flags_, size_, name_, version_, requires_, \
01108 interface_, init_, done_, get_interface_, \
01109 glyph_format_, render_glyph_, transform_glyph_, \
01110 get_glyph_cbox_, set_mode_, raster_class_ ) \
01111 FT_CALLBACK_TABLE_DEF \
01112 const FT_Renderer_Class class_ = \
01113 { \
01114 FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \
01115 interface_,init_,done_,get_interface_) \
01116 glyph_format_, \
01117 \
01118 render_glyph_, \
01119 transform_glyph_, \
01120 get_glyph_cbox_, \
01121 set_mode_, \
01122 \
01123 raster_class_ \
01124 };
01125
01126 #else
01127
01128 #define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_)
01129
01130 #define FT_DEFINE_RENDERER(class_, \
01131 flags_, size_, name_, version_, requires_, \
01132 interface_, init_, done_, get_interface_, \
01133 glyph_format_, render_glyph_, transform_glyph_, \
01134 get_glyph_cbox_, set_mode_, raster_class_ ) \
01135 void class_##_pic_free( FT_Library library ); \
01136 FT_Error class_##_pic_init( FT_Library library ); \
01137 \
01138 void \
01139 FT_Destroy_Class_##class_( FT_Library library, \
01140 FT_Module_Class* clazz ) \
01141 { \
01142 FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \
01143 FT_Memory memory = library->memory; \
01144 class_##_pic_free( library ); \
01145 if ( rclazz ) \
01146 FT_FREE( rclazz ); \
01147 } \
01148 \
01149 FT_Error \
01150 FT_Create_Class_##class_( FT_Library library, \
01151 FT_Module_Class** output_class ) \
01152 { \
01153 FT_Renderer_Class* clazz; \
01154 FT_Error error; \
01155 FT_Memory memory = library->memory; \
01156 \
01157 if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \
01158 return error; \
01159 \
01160 error = class_##_pic_init( library ); \
01161 if(error) \
01162 { \
01163 FT_FREE( clazz ); \
01164 return error; \
01165 } \
01166 \
01167 FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \
01168 interface_,init_,done_,get_interface_) \
01169 \
01170 clazz->glyph_format = glyph_format_; \
01171 \
01172 clazz->render_glyph = render_glyph_; \
01173 clazz->transform_glyph = transform_glyph_; \
01174 clazz->get_glyph_cbox = get_glyph_cbox_; \
01175 clazz->set_mode = set_mode_; \
01176 \
01177 clazz->raster_class = raster_class_; \
01178 \
01179 *output_class = (FT_Module_Class*)clazz; \
01180 return FT_Err_Ok; \
01181 }
01182
01183
01184
01185 #endif
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200 #ifdef FT_CONFIG_OPTION_PIC
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216 typedef FT_Error
01217 (*FT_Module_Creator)( FT_Memory memory,
01218 FT_Module_Class** output_class );
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232 typedef void
01233 (*FT_Module_Destroyer)( FT_Memory memory,
01234 FT_Module_Class* clazz );
01235
01236 #endif
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280 #ifndef FT_CONFIG_OPTION_PIC
01281
01282 #define FT_DECLARE_MODULE(class_) \
01283 FT_CALLBACK_TABLE \
01284 const FT_Module_Class class_; \
01285
01286 #define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \
01287 interface_, init_, done_, get_interface_) \
01288 { \
01289 flags_, \
01290 size_, \
01291 \
01292 name_, \
01293 version_, \
01294 requires_, \
01295 \
01296 interface_, \
01297 \
01298 init_, \
01299 done_, \
01300 get_interface_, \
01301 },
01302
01303 #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \
01304 interface_, init_, done_, get_interface_) \
01305 FT_CALLBACK_TABLE_DEF \
01306 const FT_Module_Class class_ = \
01307 { \
01308 flags_, \
01309 size_, \
01310 \
01311 name_, \
01312 version_, \
01313 requires_, \
01314 \
01315 interface_, \
01316 \
01317 init_, \
01318 done_, \
01319 get_interface_, \
01320 };
01321
01322
01323 #else
01324
01325 #define FT_DECLARE_MODULE(class_) \
01326 FT_Error FT_Create_Class_##class_( FT_Library library, \
01327 FT_Module_Class** output_class ); \
01328 void FT_Destroy_Class_##class_( FT_Library library, \
01329 FT_Module_Class* clazz );
01330
01331 #define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \
01332 interface_, init_, done_, get_interface_) \
01333 clazz->root.module_flags = flags_; \
01334 clazz->root.module_size = size_; \
01335 clazz->root.module_name = name_; \
01336 clazz->root.module_version = version_; \
01337 clazz->root.module_requires = requires_; \
01338 \
01339 clazz->root.module_interface = interface_; \
01340 \
01341 clazz->root.module_init = init_; \
01342 clazz->root.module_done = done_; \
01343 clazz->root.get_interface = get_interface_;
01344
01345 #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \
01346 interface_, init_, done_, get_interface_) \
01347 void class_##_pic_free( FT_Library library ); \
01348 FT_Error class_##_pic_init( FT_Library library ); \
01349 \
01350 void \
01351 FT_Destroy_Class_##class_( FT_Library library, \
01352 FT_Module_Class* clazz ) \
01353 { \
01354 FT_Memory memory = library->memory; \
01355 class_##_pic_free( library ); \
01356 if ( clazz ) \
01357 FT_FREE( clazz ); \
01358 } \
01359 \
01360 FT_Error \
01361 FT_Create_Class_##class_( FT_Library library, \
01362 FT_Module_Class** output_class ) \
01363 { \
01364 FT_Memory memory = library->memory; \
01365 FT_Module_Class* clazz; \
01366 FT_Error error; \
01367 \
01368 if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \
01369 return error; \
01370 error = class_##_pic_init( library ); \
01371 if(error) \
01372 { \
01373 FT_FREE( clazz ); \
01374 return error; \
01375 } \
01376 \
01377 clazz->module_flags = flags_; \
01378 clazz->module_size = size_; \
01379 clazz->module_name = name_; \
01380 clazz->module_version = version_; \
01381 clazz->module_requires = requires_; \
01382 \
01383 clazz->module_interface = interface_; \
01384 \
01385 clazz->module_init = init_; \
01386 clazz->module_done = done_; \
01387 clazz->get_interface = get_interface_; \
01388 \
01389 *output_class = clazz; \
01390 return FT_Err_Ok; \
01391 }
01392
01393 #endif
01394
01395
01396 FT_END_HEADER
01397
01398 #endif
01399
01400
01401