Add framework for CFF properties.

* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC7):
New macro.

* src/cff/cffdrivr.c: Include FT_SERVICE_PROPERTIES_H.
(cff_property_set, cff_property_get): New function, still empty.
Define `cff_service_properties' service.
Update `cff_services'.

* src/cff/cffpic.h: Include FT_SERVICE_PROPERTIES_H.
(CFF_SERVICE_PROPERTIES_GET): New macro.
CffModulePIC: Add `cff_service_properties'.
This commit is contained in:
Werner Lemberg 2013-04-12 19:48:06 +02:00
parent 04e547bd2c
commit fc185ef41a
4 changed files with 148 additions and 12 deletions

View File

@ -1,3 +1,19 @@
2013-04-12 Werner Lemberg <wl@gnu.org>
Add framework for CFF properties.
* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC7):
New macro.
* src/cff/cffdrivr.c: Include FT_SERVICE_PROPERTIES_H.
(cff_property_set, cff_property_get): New function, still empty.
Define `cff_service_properties' service.
Update `cff_services'.
* src/cff/cffpic.h: Include FT_SERVICE_PROPERTIES_H.
(CFF_SERVICE_PROPERTIES_GET): New macro.
CffModulePIC: Add `cff_service_properties'.
2013-04-03 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #38589.

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType services (specification only). */
/* */
/* Copyright 2003-2007, 2009, 2012 by */
/* Copyright 2003-2007, 2009, 2012, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -174,6 +174,7 @@ FT_BEGIN_HEADER
/* FT_DEFINE_SERVICEDESCREC4 */
/* FT_DEFINE_SERVICEDESCREC5 */
/* FT_DEFINE_SERVICEDESCREC6 */
/* FT_DEFINE_SERVICEDESCREC7 */
/* */
/* <Description> */
/* Used to initialize an array of FT_ServiceDescRec structures. */
@ -270,6 +271,26 @@ FT_BEGIN_HEADER
{ NULL, NULL } \
};
#define FT_DEFINE_SERVICEDESCREC7( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6, \
serv_id_7, serv_data_7 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ serv_id_3, serv_data_3 }, \
{ serv_id_4, serv_data_4 }, \
{ serv_id_5, serv_data_5 }, \
{ serv_id_6, serv_data_6 }, \
{ serv_id_7, serv_data_7 }, \
{ NULL, NULL } \
};
#else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICEDESCREC1( class_, \
@ -527,6 +548,59 @@ FT_BEGIN_HEADER
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC7( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6, \
serv_id_7, serv_data_7 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = serv_id_6; \
clazz[5].serv_data = serv_data_6; \
clazz[6].serv_id = serv_id_7; \
clazz[6].serv_data = serv_data_7; \
clazz[7].serv_id = NULL; \
clazz[7].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#endif /* FT_CONFIG_OPTION_PIC */

View File

@ -37,6 +37,7 @@
#include FT_SERVICE_XFREE86_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_PROPERTIES_H
/*************************************************************************/
@ -298,7 +299,8 @@
}
FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,
FT_DEFINE_SERVICE_GLYPHDICTREC(
cff_service_glyph_dict,
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
(FT_GlyphDict_NameIndexFunc)cff_get_name_index
)
@ -360,7 +362,8 @@
}
FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info,
FT_DEFINE_SERVICE_PSINFOREC(
cff_service_ps_info,
(PS_GetFontInfoFunc) cff_ps_get_font_info,
(PS_GetFontExtraFunc) NULL,
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
@ -384,7 +387,8 @@
}
FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name,
FT_DEFINE_SERVICE_PSFONTNAMEREC(
cff_service_ps_name,
(FT_PsName_GetFunc)cff_get_ps_name
)
@ -430,7 +434,8 @@
}
FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,
FT_DEFINE_SERVICE_TTCMAPSREC(
cff_service_get_cmap_info,
(TT_CMap_Info_GetFunc)cff_get_cmap_info
)
@ -559,13 +564,42 @@
}
FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info,
FT_DEFINE_SERVICE_CIDREC(
cff_service_cid_info,
(FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
(FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
(FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
)
/*
* PROPERTY SERVICE
*
*/
static FT_Error
cff_property_set( FT_Module ft_module,
const char* property_name,
const void* value )
{
return FT_Err_Ok;
}
static FT_Error
cff_property_get( FT_Module ft_module,
const char* property_name,
const void* value )
{
return FT_Err_Ok;
}
FT_DEFINE_SERVICE_PROPERTIESREC(
cff_service_properties,
(FT_Properties_SetFunc)cff_property_set,
(FT_Properties_GetFunc)cff_property_get )
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -577,25 +611,31 @@
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
FT_DEFINE_SERVICEDESCREC6(cff_services,
FT_DEFINE_SERVICEDESCREC7(
cff_services,
FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
)
#else
FT_DEFINE_SERVICEDESCREC5(cff_services,
FT_DEFINE_SERVICEDESCREC6(
cff_services,
FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
)
#endif
FT_CALLBACK_DEF( FT_Module_Interface )
cff_get_interface( FT_Module driver, /* CFF_Driver */
const char* module_interface )
@ -642,7 +682,8 @@
#define CFF_SIZE_SELECT 0
#endif
FT_DEFINE_DRIVER( cff_driver_class,
FT_DEFINE_DRIVER(
cff_driver_class,
FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_SCALABLE |

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for cff module. */
/* */
/* Copyright 2009, 2012 by */
/* Copyright 2009, 2012, 2013 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -32,6 +32,7 @@ FT_BEGIN_HEADER
#define CFF_SERVICE_PS_NAME_GET cff_service_ps_name
#define CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info
#define CFF_SERVICE_CID_INFO_GET cff_service_cid_info
#define CFF_SERVICE_PROPERTIES_GET cff_service_properties
#define CFF_SERVICES_GET cff_services
#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
@ -45,6 +46,7 @@ FT_BEGIN_HEADER
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_TT_CMAP_H
#include FT_SERVICE_CID_H
#include FT_SERVICE_PROPERTIES_H
typedef struct CffModulePIC_
@ -56,6 +58,7 @@ FT_BEGIN_HEADER
FT_Service_PsFontNameRec cff_service_ps_name;
FT_Service_TTCMapsRec cff_service_get_cmap_info;
FT_Service_CIDRec cff_service_cid_info;
FT_Service_PropertiesRec cff_service_properties;
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
@ -75,6 +78,8 @@ FT_BEGIN_HEADER
( GET_PIC( library )->cff_service_get_cmap_info )
#define CFF_SERVICE_CID_INFO_GET \
( GET_PIC( library )->cff_service_cid_info )
#define CFF_SERVICE_PROPERTIES_GET \
( GET_PIC( library )->cff_service_properties )
#define CFF_SERVICES_GET \
( GET_PIC( library )->cff_services )
#define CFF_CMAP_ENCODING_CLASS_REC_GET \