[cff] Add Multiple Masters service.
The code simply uses the MM functions from the `truetype' module. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * include/freetype/internal/tttypes.h (TT_Face): New field `mm'. * src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. (cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var, cff_set_var_design, cff_get_var_design): New functions. (cff_service_multi_masters): New service. (cff_services): Updated. * src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New functions. * src/cff/cffload.h: Updated. * src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro. * src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. (sfnt_init_face): Initialize `face->mm'.
This commit is contained in:
parent
a7dc0c3554
commit
c628a7dfba
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2016-12-14 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[cff] Add Multiple Masters service.
|
||||
|
||||
The code simply uses the MM functions from the `truetype' module.
|
||||
|
||||
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
|
||||
|
||||
* include/freetype/internal/tttypes.h (TT_Face): New field `mm'.
|
||||
|
||||
* src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
|
||||
(cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var,
|
||||
cff_set_var_design, cff_get_var_design): New functions.
|
||||
(cff_service_multi_masters): New service.
|
||||
(cff_services): Updated.
|
||||
|
||||
* src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New
|
||||
functions.
|
||||
* src/cff/cffload.h: Updated.
|
||||
|
||||
* src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro.
|
||||
|
||||
* src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
|
||||
(sfnt_init_face): Initialize `face->mm'.
|
||||
|
||||
2016-12-14 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Extend functionality of `ft_module_get_service'.
|
||||
|
@ -1161,6 +1161,8 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* psnames :: A pointer to the PostScript names service. */
|
||||
/* */
|
||||
/* mm :: A pointer to the Multiple Masters service. */
|
||||
/* */
|
||||
/* hdmx :: The face's horizontal device metrics */
|
||||
/* (`hdmx' table). This table is optional in */
|
||||
/* TrueType/OpenType fonts. */
|
||||
@ -1349,6 +1351,12 @@ FT_BEGIN_HEADER
|
||||
/* handle glyph names <-> unicode & Mac values */
|
||||
void* psnames;
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
/* a typeless pointer to the FT_Service_MultiMasters table used to */
|
||||
/* handle variation fonts */
|
||||
void* mm;
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include "cffcmap.h"
|
||||
#include "cffparse.h"
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||
#endif
|
||||
|
||||
#include "cfferrs.h"
|
||||
#include "cffpic.h"
|
||||
|
||||
@ -866,6 +870,89 @@
|
||||
(FT_Properties_GetFunc)cff_property_get ) /* get_property */
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
|
||||
/*
|
||||
* MULTIPLE MASTER SERVICE
|
||||
*
|
||||
*/
|
||||
|
||||
static FT_Error
|
||||
cff_set_mm_blend( CFF_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->set_mm_blend( FT_FACE( face ), num_coords, coords );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_get_mm_blend( CFF_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->get_mm_blend( FT_FACE( face ), num_coords, coords );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_get_mm_var( CFF_Face face,
|
||||
FT_MM_Var* *master )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->get_mm_var( FT_FACE( face ), master );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_set_var_design( CFF_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->set_var_design( FT_FACE( face ), num_coords, coords );
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_get_var_design( CFF_Face face,
|
||||
FT_UInt num_coords,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->get_var_design( FT_FACE( face ), num_coords, coords );
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
||||
cff_service_multi_masters,
|
||||
|
||||
(FT_Get_MM_Func) NULL, /* get_mm */
|
||||
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
||||
(FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
|
||||
(FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
|
||||
(FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
|
||||
(FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */
|
||||
(FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */
|
||||
|
||||
(FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) cff_done_blend /* done_blend */
|
||||
)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
@ -878,7 +965,21 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
|
||||
#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
|
||||
defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_DEFINE_SERVICEDESCREC8(
|
||||
cff_services,
|
||||
|
||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
||||
FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET,
|
||||
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_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
||||
)
|
||||
#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
|
||||
FT_DEFINE_SERVICEDESCREC7(
|
||||
cff_services,
|
||||
|
||||
@ -890,6 +991,18 @@
|
||||
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
||||
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
||||
)
|
||||
#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_DEFINE_SERVICEDESCREC7(
|
||||
cff_services,
|
||||
|
||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
||||
FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET,
|
||||
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_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
||||
)
|
||||
#else
|
||||
FT_DEFINE_SERVICEDESCREC6(
|
||||
cff_services,
|
||||
|
@ -1054,6 +1054,32 @@
|
||||
}
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
cff_get_var_blend( CFF_Face face,
|
||||
FT_UInt *num_coords,
|
||||
FT_Fixed* *coords )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->get_var_blend( FT_FACE( face ), num_coords, coords );
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
cff_done_blend( CFF_Face face )
|
||||
{
|
||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
mm->done_blend( FT_FACE( face ) );
|
||||
}
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
||||
|
||||
|
||||
static void
|
||||
cff_encoding_done( CFF_Encoding encoding )
|
||||
{
|
||||
|
@ -75,6 +75,17 @@ FT_BEGIN_HEADER
|
||||
FT_UInt glyph_index );
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_LOCAL( FT_Error )
|
||||
cff_get_var_blend( CFF_Face face,
|
||||
FT_UInt *num_coords,
|
||||
FT_Fixed* *coords );
|
||||
|
||||
FT_LOCAL( void )
|
||||
cff_done_blend( CFF_Face face );
|
||||
#endif
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* CFFLOAD_H_ */
|
||||
|
@ -32,6 +32,7 @@
|
||||
#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_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters
|
||||
#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
|
||||
#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
|
||||
#define CFF_FIELD_HANDLERS_GET cff_field_handlers
|
||||
|
@ -28,6 +28,11 @@
|
||||
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
||||
#include FT_SFNT_NAMES_H
|
||||
#include FT_GZIP_H
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||
#endif
|
||||
|
||||
#include "sferrors.h"
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
@ -872,6 +877,19 @@
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
if ( !face->mm )
|
||||
{
|
||||
/* we want the MM interface from the `truetype' module only */
|
||||
FT_Module tt_module = FT_Get_Module( library, "truetype" );
|
||||
|
||||
|
||||
face->mm = ft_module_get_service( tt_module,
|
||||
FT_SERVICE_ID_MULTI_MASTERS,
|
||||
0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
FT_TRACE2(( "SFNT driver\n" ));
|
||||
|
||||
error = sfnt_open_font( stream, face );
|
||||
|
Loading…
Reference in New Issue
Block a user