Add framework to support services with 8 functions.

We will need this for CFF variation font support.

* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8):
New macro.
This commit is contained in:
Werner Lemberg 2016-12-08 22:33:46 +01:00
parent 29aa957767
commit 4191b7761b
2 changed files with 88 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2016-12-08 Werner Lemberg <wl@gnu.org>
Add framework to support services with 8 functions.
We will need this for CFF variation font support.
* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8):
New macro.
2016-12-08 Werner Lemberg <wl@gnu.org>
[sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface.

View File

@ -167,6 +167,7 @@ FT_BEGIN_HEADER
/* FT_DEFINE_SERVICEDESCREC5 */
/* FT_DEFINE_SERVICEDESCREC6 */
/* FT_DEFINE_SERVICEDESCREC7 */
/* FT_DEFINE_SERVICEDESCREC8 */
/* */
/* <Description> */
/* Used to initialize an array of FT_ServiceDescRec structures. */
@ -283,6 +284,28 @@ FT_BEGIN_HEADER
{ NULL, NULL } \
};
#define FT_DEFINE_SERVICEDESCREC8( 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, \
serv_id_8, serv_data_8 ) \
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 }, \
{ serv_id_8, serv_data_8 }, \
{ NULL, NULL } \
};
#else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICEDESCREC1( class_, \
@ -593,6 +616,62 @@ FT_BEGIN_HEADER
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC8( 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, \
serv_id_8, serv_data_8 ) \
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 ) * 9 ) ) \
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 = serv_id_8; \
clazz[7].serv_data = serv_data_8; \
clazz[8].serv_id = NULL; \
clazz[8].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#endif /* FT_CONFIG_OPTION_PIC */