convert cff module to FT_PicData
This commit is contained in:
parent
5982d4debc
commit
51ad1c7089
4 changed files with 61 additions and 68 deletions
|
@ -95,13 +95,13 @@ FT_BEGIN_HEADER
|
|||
#define FT_PIC_ENTRY_LIST \
|
||||
_FT_PICDATA( base ) \
|
||||
_FT_PICDATA( autofit ) \
|
||||
_FT_PICDATA( cff ) \
|
||||
|
||||
/* now define the entries in the PIC table itself */
|
||||
#define _FT_PICDATA(name) FT_PicDataRec name [1];
|
||||
FT_PIC_ENTRY_LIST
|
||||
#undef _FT_PICDATA
|
||||
|
||||
void* cff;
|
||||
void* pshinter;
|
||||
void* psnames;
|
||||
void* raster;
|
||||
|
|
|
@ -623,15 +623,14 @@
|
|||
void ft_library_pic_free_cff_field_handlers(FT_Library library, CFF_Field_Handler* clazz)
|
||||
{
|
||||
FT_Memory memory = library->memory;
|
||||
if ( clazz )
|
||||
FT_FREE( clazz );
|
||||
FT_FREE( clazz );
|
||||
}
|
||||
|
||||
FT_Error ft_library_pic_alloc_cff_field_handlers(FT_Library library, CFF_Field_Handler** output_class)
|
||||
{
|
||||
CFF_Field_Handler* clazz;
|
||||
FT_Error error;
|
||||
FT_Memory memory = library->memory;
|
||||
FT_Error error;
|
||||
FT_Memory memory = library->memory;
|
||||
int i=0;
|
||||
|
||||
#undef CFF_FIELD
|
||||
|
@ -644,7 +643,7 @@
|
|||
#include "cfftoken.h"
|
||||
i++;/*{ 0, 0, 0, 0, 0, 0, 0 }*/
|
||||
|
||||
if ( FT_ALLOC( clazz, sizeof(CFF_Field_Handler)*i ) )
|
||||
if ( FT_NEW_ARRAY( clazz, i ) )
|
||||
return error;
|
||||
|
||||
i=0;
|
||||
|
@ -653,10 +652,10 @@
|
|||
#undef CFF_FIELD_CALLBACK
|
||||
|
||||
#define CFF_FIELD_CALLBACK( code_, name_ ) \
|
||||
clazz[i].kind = cff_kind_callback; \
|
||||
clazz[i].code = code_ | CFFCODE; \
|
||||
clazz[i].kind = cff_kind_callback; \
|
||||
clazz[i].code = code_ | CFFCODE; \
|
||||
clazz[i].offset = 0; \
|
||||
clazz[i].size = 0; \
|
||||
clazz[i].size = 0; \
|
||||
clazz[i].reader = cff_parse_ ## name_; \
|
||||
clazz[i].array_max = 0; \
|
||||
clazz[i].count_offset = 0; \
|
||||
|
|
|
@ -36,48 +36,38 @@
|
|||
FT_Error ft_library_pic_alloc_cff_field_handlers( FT_Library, CFF_Field_Handler**);
|
||||
void ft_library_pic_free_cff_field_handlers( FT_Library, CFF_Field_Handler*);
|
||||
|
||||
#if 0 /* defined by cffcmap.h */
|
||||
/* forward declaration of PIC init functions from cffcmap.c */
|
||||
void ft_pic_init_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
|
||||
void ft_pic_init_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
|
||||
#endif
|
||||
|
||||
void
|
||||
cff_driver_class_pic_free( FT_Library library )
|
||||
static void
|
||||
pic_cff_done( void* _cff, FT_PicTable pic )
|
||||
{
|
||||
FT_PicTable pic_table = &library->pic_table;
|
||||
FT_Memory memory = library->memory;
|
||||
CffModulePIC* container = (CffModulePIC*) _cff;
|
||||
|
||||
if ( pic_table->cff )
|
||||
|
||||
if (container->cff_services)
|
||||
{
|
||||
CffModulePIC* container = (CffModulePIC*)pic_table->cff;
|
||||
|
||||
|
||||
if(container->cff_services)
|
||||
ft_library_pic_free_cff_services(library, container->cff_services);
|
||||
|
||||
ft_library_pic_free_cff_services(pic->library, container->cff_services);
|
||||
container->cff_services = NULL;
|
||||
if(container->cff_field_handlers)
|
||||
{
|
||||
ft_library_pic_free_cff_field_handlers(library, container->cff_field_handlers);
|
||||
container->cff_field_handlers = NULL;
|
||||
}
|
||||
FT_FREE( container );
|
||||
pic_table->cff = NULL;
|
||||
}
|
||||
|
||||
if(container->cff_field_handlers)
|
||||
{
|
||||
ft_library_pic_free_cff_field_handlers(pic->library, container->cff_field_handlers);
|
||||
container->cff_field_handlers = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FT_Error
|
||||
cff_driver_class_pic_init( FT_Library library )
|
||||
|
||||
static FT_Error
|
||||
pic_cff_init( void* _cff, FT_PicTable pic )
|
||||
{
|
||||
FT_PicTable pic_table = &library->pic_table;
|
||||
FT_Memory memory = library->memory;
|
||||
FT_Library library = pic->library;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
CffModulePIC* container;
|
||||
|
||||
/* allocate pointer, clear and set global container pointer */
|
||||
if ( FT_NEW ( container ) )
|
||||
return error;
|
||||
|
||||
pic_table->cff = container;
|
||||
CffModulePIC* container = (CffModulePIC*) _cff;
|
||||
|
||||
/* initialize pointer table - this is how the module usually expects this data */
|
||||
error = ft_library_pic_alloc_cff_services(library, &container->cff_services);
|
||||
|
@ -100,12 +90,21 @@
|
|||
ft_pic_init_cff_cmap_unicode_class_rec (library,
|
||||
&container->cff_cmap_unicode_class_rec);
|
||||
Exit:
|
||||
if(error)
|
||||
cff_driver_class_pic_free(library);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
cff_driver_class_pic_init( FT_Library library )
|
||||
{
|
||||
FT_PicTable pic = &library->pic_table;
|
||||
|
||||
return ft_pic_table_init_data( pic, pic->cff,
|
||||
sizeof(CffModulePIC),
|
||||
pic_cff_init,
|
||||
pic_cff_done );
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
|
|
|
@ -25,15 +25,7 @@ FT_BEGIN_HEADER
|
|||
#include FT_INTERNAL_PIC_H
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
#define FT_CFF_SERVICE_PS_INFO_GET cff_service_ps_info
|
||||
#define FT_CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict
|
||||
#define FT_CFF_SERVICE_PS_NAME_GET cff_service_ps_name
|
||||
#define FT_CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info
|
||||
#define FT_CFF_SERVICE_CID_INFO_GET cff_service_cid_info
|
||||
#define FT_CFF_SERVICES_GET cff_services
|
||||
#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
|
||||
#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
|
||||
#define FT_CFF_FIELD_HANDLERS_GET cff_field_handlers
|
||||
#define FT_CFF_CONST_(name_) cff_##name_
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
@ -46,30 +38,33 @@ FT_BEGIN_HEADER
|
|||
|
||||
typedef struct CffModulePIC_
|
||||
{
|
||||
FT_ServiceDescRec* cff_services;
|
||||
CFF_Field_Handler* cff_field_handlers;
|
||||
FT_Service_PsInfoRec cff_service_ps_info;
|
||||
FT_Service_GlyphDictRec cff_service_glyph_dict;
|
||||
FT_ServiceDescRec* cff_services;
|
||||
FT_Service_PsInfoRec cff_service_ps_info;
|
||||
FT_Service_GlyphDictRec cff_service_glyph_dict;
|
||||
FT_Service_PsFontNameRec cff_service_ps_name;
|
||||
FT_Service_TTCMapsRec cff_service_get_cmap_info;
|
||||
FT_Service_CIDRec cff_service_cid_info;
|
||||
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
|
||||
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
|
||||
FT_Service_TTCMapsRec cff_service_get_cmap_info;
|
||||
FT_Service_CIDRec cff_service_cid_info;
|
||||
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
|
||||
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
|
||||
CFF_Field_Handler* cff_field_handlers;
|
||||
} CffModulePIC;
|
||||
|
||||
#define GET_PIC(lib) ((CffModulePIC*)((lib)->pic_table.cff))
|
||||
#define FT_CFF_SERVICE_PS_INFO_GET (GET_PIC(library)->cff_service_ps_info)
|
||||
#define FT_CFF_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->cff_service_glyph_dict)
|
||||
#define FT_CFF_SERVICE_PS_NAME_GET (GET_PIC(library)->cff_service_ps_name)
|
||||
#define FT_CFF_SERVICE_GET_CMAP_INFO_GET (GET_PIC(library)->cff_service_get_cmap_info)
|
||||
#define FT_CFF_SERVICE_CID_INFO_GET (GET_PIC(library)->cff_service_cid_info)
|
||||
#define FT_CFF_SERVICES_GET (GET_PIC(library)->cff_services)
|
||||
#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET (GET_PIC(library)->cff_cmap_encoding_class_rec)
|
||||
#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET (GET_PIC(library)->cff_cmap_unicode_class_rec)
|
||||
#define FT_CFF_FIELD_HANDLERS_GET (GET_PIC(library)->cff_field_handlers)
|
||||
#define CFF_GET_PIC(lib) ((CffModulePIC*)((lib)->pic_table.cff))
|
||||
#define FT_CFF_CONST_(name_) (CFF_GET_PIC(library)->cff_##name_)
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_CFF_SERVICE_PS_INFO_GET FT_CFF_CONST_(service_ps_info)
|
||||
#define FT_CFF_SERVICE_GLYPH_DICT_GET FT_CFF_CONST_(service_glyph_dict)
|
||||
#define FT_CFF_SERVICE_PS_NAME_GET FT_CFF_CONST_(service_ps_name)
|
||||
#define FT_CFF_SERVICE_GET_CMAP_INFO_GET FT_CFF_CONST_(service_get_cmap_info)
|
||||
#define FT_CFF_SERVICE_CID_INFO_GET FT_CFF_CONST_(service_cid_info)
|
||||
#define FT_CFF_SERVICES_GET FT_CFF_CONST_(services)
|
||||
#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET FT_CFF_CONST_(cmap_encoding_class_rec)
|
||||
#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET FT_CFF_CONST_(cmap_unicode_class_rec)
|
||||
#define FT_CFF_FIELD_HANDLERS_GET FT_CFF_CONST_(field_handlers)
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
Loading…
Add table
Reference in a new issue