00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __FTDRIVER_H__
00020 #define __FTDRIVER_H__
00021
00022
00023 #include <ft2build.h>
00024 #include FT_MODULE_H
00025
00026
00027 FT_BEGIN_HEADER
00028
00029
00030 typedef FT_Error
00031 (*FT_Face_InitFunc)( FT_Stream stream,
00032 FT_Face face,
00033 FT_Int typeface_index,
00034 FT_Int num_params,
00035 FT_Parameter* parameters );
00036
00037 typedef void
00038 (*FT_Face_DoneFunc)( FT_Face face );
00039
00040
00041 typedef FT_Error
00042 (*FT_Size_InitFunc)( FT_Size size );
00043
00044 typedef void
00045 (*FT_Size_DoneFunc)( FT_Size size );
00046
00047
00048 typedef FT_Error
00049 (*FT_Slot_InitFunc)( FT_GlyphSlot slot );
00050
00051 typedef void
00052 (*FT_Slot_DoneFunc)( FT_GlyphSlot slot );
00053
00054
00055 typedef FT_Error
00056 (*FT_Size_RequestFunc)( FT_Size size,
00057 FT_Size_Request req );
00058
00059 typedef FT_Error
00060 (*FT_Size_SelectFunc)( FT_Size size,
00061 FT_ULong size_index );
00062
00063 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00064
00065 typedef FT_Error
00066 (*FT_Size_ResetPointsFunc)( FT_Size size,
00067 FT_F26Dot6 char_width,
00068 FT_F26Dot6 char_height,
00069 FT_UInt horz_resolution,
00070 FT_UInt vert_resolution );
00071
00072 typedef FT_Error
00073 (*FT_Size_ResetPixelsFunc)( FT_Size size,
00074 FT_UInt pixel_width,
00075 FT_UInt pixel_height );
00076
00077 #endif
00078
00079 typedef FT_Error
00080 (*FT_Slot_LoadFunc)( FT_GlyphSlot slot,
00081 FT_Size size,
00082 FT_UInt glyph_index,
00083 FT_Int32 load_flags );
00084
00085
00086 typedef FT_UInt
00087 (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap,
00088 FT_Long charcode );
00089
00090 typedef FT_Long
00091 (*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
00092 FT_Long charcode );
00093
00094
00095 typedef FT_Error
00096 (*FT_Face_GetKerningFunc)( FT_Face face,
00097 FT_UInt left_glyph,
00098 FT_UInt right_glyph,
00099 FT_Vector* kerning );
00100
00101
00102 typedef FT_Error
00103 (*FT_Face_AttachFunc)( FT_Face face,
00104 FT_Stream stream );
00105
00106
00107 typedef FT_Error
00108 (*FT_Face_GetAdvancesFunc)( FT_Face face,
00109 FT_UInt first,
00110 FT_UInt count,
00111 FT_Int32 flags,
00112 FT_Fixed* advances );
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 typedef struct FT_Driver_ClassRec_
00184 {
00185 FT_Module_Class root;
00186
00187 FT_Long face_object_size;
00188 FT_Long size_object_size;
00189 FT_Long slot_object_size;
00190
00191 FT_Face_InitFunc init_face;
00192 FT_Face_DoneFunc done_face;
00193
00194 FT_Size_InitFunc init_size;
00195 FT_Size_DoneFunc done_size;
00196
00197 FT_Slot_InitFunc init_slot;
00198 FT_Slot_DoneFunc done_slot;
00199
00200 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00201
00202 FT_Size_ResetPointsFunc set_char_sizes;
00203 FT_Size_ResetPixelsFunc set_pixel_sizes;
00204
00205 #endif
00206
00207 FT_Slot_LoadFunc load_glyph;
00208
00209 FT_Face_GetKerningFunc get_kerning;
00210 FT_Face_AttachFunc attach_file;
00211 FT_Face_GetAdvancesFunc get_advances;
00212
00213
00214 FT_Size_RequestFunc request_size;
00215 FT_Size_SelectFunc select_size;
00216
00217 } FT_Driver_ClassRec, *FT_Driver_Class;
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00228
00229 FT_BASE( FT_Error )
00230 ft_stub_set_char_sizes( FT_Size size,
00231 FT_F26Dot6 width,
00232 FT_F26Dot6 height,
00233 FT_UInt horz_res,
00234 FT_UInt vert_res );
00235
00236 FT_BASE( FT_Error )
00237 ft_stub_set_pixel_sizes( FT_Size size,
00238 FT_UInt width,
00239 FT_UInt height );
00240
00241 #endif
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 #ifndef FT_CONFIG_OPTION_PIC
00278
00279 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00280 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
00281 a_, b_,
00282 #else
00283 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
00284 #endif
00285
00286 #define FT_DECLARE_DRIVER(class_) \
00287 FT_CALLBACK_TABLE \
00288 const FT_Driver_ClassRec class_;
00289
00290 #define FT_DEFINE_DRIVER(class_, \
00291 flags_, size_, name_, version_, requires_, \
00292 interface_, init_, done_, get_interface_, \
00293 face_object_size_, size_object_size_, \
00294 slot_object_size_, init_face_, done_face_, \
00295 init_size_, done_size_, init_slot_, done_slot_, \
00296 old_set_char_sizes_, old_set_pixel_sizes_, \
00297 load_glyph_, get_kerning_, attach_file_, \
00298 get_advances_, request_size_, select_size_ ) \
00299 FT_CALLBACK_TABLE_DEF \
00300 const FT_Driver_ClassRec class_ = \
00301 { \
00302 FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \
00303 init_,done_,get_interface_) \
00304 \
00305 face_object_size_, \
00306 size_object_size_, \
00307 slot_object_size_, \
00308 \
00309 init_face_, \
00310 done_face_, \
00311 \
00312 init_size_, \
00313 done_size_, \
00314 \
00315 init_slot_, \
00316 done_slot_, \
00317 \
00318 FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \
00319 \
00320 load_glyph_, \
00321 \
00322 get_kerning_, \
00323 attach_file_, \
00324 get_advances_, \
00325 \
00326 request_size_, \
00327 select_size_ \
00328 };
00329
00330 #else
00331
00332 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00333 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
00334 clazz->set_char_sizes = a_; \
00335 clazz->set_pixel_sizes = b_;
00336 #else
00337 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
00338 #endif
00339
00340 #define FT_DECLARE_DRIVER(class_) FT_DECLARE_MODULE(class_)
00341
00342 #define FT_DEFINE_DRIVER(class_, \
00343 flags_, size_, name_, version_, requires_, \
00344 interface_, init_, done_, get_interface_, \
00345 face_object_size_, size_object_size_, \
00346 slot_object_size_, init_face_, done_face_, \
00347 init_size_, done_size_, init_slot_, done_slot_, \
00348 old_set_char_sizes_, old_set_pixel_sizes_, \
00349 load_glyph_, get_kerning_, attach_file_, \
00350 get_advances_, request_size_, select_size_ ) \
00351 void class_##_pic_free( FT_Library library ); \
00352 FT_Error class_##_pic_init( FT_Library library ); \
00353 \
00354 void \
00355 FT_Destroy_Class_##class_( FT_Library library, \
00356 FT_Module_Class* clazz ) \
00357 { \
00358 FT_Memory memory = library->memory; \
00359 FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \
00360 class_##_pic_free( library ); \
00361 if ( dclazz ) \
00362 FT_FREE( dclazz ); \
00363 } \
00364 \
00365 FT_Error \
00366 FT_Create_Class_##class_( FT_Library library, \
00367 FT_Module_Class** output_class ) \
00368 { \
00369 FT_Driver_Class clazz; \
00370 FT_Error error; \
00371 FT_Memory memory = library->memory; \
00372 \
00373 if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \
00374 return error; \
00375 \
00376 error = class_##_pic_init( library ); \
00377 if(error) \
00378 { \
00379 FT_FREE( clazz ); \
00380 return error; \
00381 } \
00382 \
00383 FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \
00384 init_,done_,get_interface_) \
00385 \
00386 clazz->face_object_size = face_object_size_; \
00387 clazz->size_object_size = size_object_size_; \
00388 clazz->slot_object_size = slot_object_size_; \
00389 \
00390 clazz->init_face = init_face_; \
00391 clazz->done_face = done_face_; \
00392 \
00393 clazz->init_size = init_size_; \
00394 clazz->done_size = done_size_; \
00395 \
00396 clazz->init_slot = init_slot_; \
00397 clazz->done_slot = done_slot_; \
00398 \
00399 FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \
00400 \
00401 clazz->load_glyph = load_glyph_; \
00402 \
00403 clazz->get_kerning = get_kerning_; \
00404 clazz->attach_file = attach_file_; \
00405 clazz->get_advances = get_advances_; \
00406 \
00407 clazz->request_size = request_size_; \
00408 clazz->select_size = select_size_; \
00409 \
00410 *output_class = (FT_Module_Class*)clazz; \
00411 return FT_Err_Ok; \
00412 }
00413
00414
00415 #endif
00416
00417 FT_END_HEADER
00418
00419 #endif
00420
00421
00422