forked from minhngoc25a/freetype2
[sfnt, truetype] Add framework for Metrics Variations service.
No effect yet; service functions will be implemented later on. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * include/freetype/internal/services/svmetric.h: New file. * include/freetype/internal/ftserv.h (FT_SERVICE_METRICS_VARIATIONS_H): New macro. * include/freetype/internal/tttypes.h (TT_Face): New field `var'. * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (sfnt_init_face): Initialize `face->var'. * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (tt_service_metrics_variations): New service. (tt_services): Updated. * src/truetype/ttpic.h: Updated.
This commit is contained in:
parent
c628a7dfba
commit
0918325e3f
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2016-12-14 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[sfnt, truetype] Add framework for Metrics Variations service.
|
||||
|
||||
No effect yet; service functions will be implemented later on.
|
||||
|
||||
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
|
||||
|
||||
* include/freetype/internal/services/svmetric.h: New file.
|
||||
|
||||
* include/freetype/internal/ftserv.h
|
||||
(FT_SERVICE_METRICS_VARIATIONS_H): New macro.
|
||||
|
||||
* include/freetype/internal/tttypes.h (TT_Face): New field `var'.
|
||||
|
||||
* src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
|
||||
(sfnt_init_face): Initialize `face->var'.
|
||||
|
||||
* src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
|
||||
(tt_service_metrics_variations): New service.
|
||||
(tt_services): Updated.
|
||||
|
||||
* src/truetype/ttpic.h: Updated.
|
||||
|
||||
2016-12-14 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[cff] Add Multiple Masters service.
|
||||
|
|
|
@ -818,6 +818,7 @@ FT_BEGIN_HEADER
|
|||
#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
|
||||
#define FT_SERVICE_GX_VALIDATE_H <freetype/internal/services/svgxval.h>
|
||||
#define FT_SERVICE_KERNING_H <freetype/internal/services/svkern.h>
|
||||
#define FT_SERVICE_METRICS_VARIATIONS_H <freetype/internal/services/svmetric.h>
|
||||
#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h>
|
||||
#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h>
|
||||
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* svmetric.h */
|
||||
/* */
|
||||
/* The FreeType services for metrics variations (specification). */
|
||||
/* */
|
||||
/* Copyright 2016 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SVMETRIC_H_
|
||||
#define SVMETRIC_H_
|
||||
|
||||
#include FT_INTERNAL_SERVICE_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/*
|
||||
* A service to manage the `HVAR, `MVAR', and `VVAR' OpenType tables.
|
||||
*
|
||||
*/
|
||||
|
||||
#define FT_SERVICE_ID_METRICS_VARIATIONS "metrics-variations"
|
||||
|
||||
|
||||
/* HVAR */
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_HAdvance_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_LSB_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_RSB_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
/* VVAR */
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_VAdvance_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_TSB_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_BSB_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_VOrg_Adjust_Func)( FT_Face face,
|
||||
FT_UInt gindex,
|
||||
FT_Int *avalue );
|
||||
|
||||
/* MVAR */
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_Metrics_Adjust_Func)( FT_Face face,
|
||||
FT_ULong tag,
|
||||
FT_Int *avalue );
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE( MetricsVariations )
|
||||
{
|
||||
FT_HAdvance_Adjust_Func hadvance_adjust;
|
||||
FT_LSB_Adjust_Func lsb_adjust;
|
||||
FT_RSB_Adjust_Func rsb_adjust;
|
||||
|
||||
FT_VAdvance_Adjust_Func vadvance_adjust;
|
||||
FT_TSB_Adjust_Func tsb_adjust;
|
||||
FT_BSB_Adjust_Func bsb_adjust;
|
||||
FT_VOrg_Adjust_Func vorg_adjust;
|
||||
|
||||
FT_Metrics_Adjust_Func metrics_adjust;
|
||||
};
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_, \
|
||||
hadvance_adjust_, \
|
||||
lsb_adjust_, \
|
||||
rsb_adjust_, \
|
||||
vadvance_adjust_, \
|
||||
tsb_adjust_, \
|
||||
bsb_adjust_, \
|
||||
vorg_adjust_, \
|
||||
metrics_adjust_ ) \
|
||||
static const FT_Service_MetricsVariationsRec class_ = \
|
||||
{ \
|
||||
hadvance_adjust_, \
|
||||
lsb_adjust_, \
|
||||
rsb_adjust_, \
|
||||
vadvance_adjust_, \
|
||||
tsb_adjust_, \
|
||||
bsb_adjust_, \
|
||||
vorg_adjust_, \
|
||||
metrics_adjust_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_, \
|
||||
hadvance_adjust_, \
|
||||
lsb_adjust_, \
|
||||
rsb_adjust_, \
|
||||
vadvance_adjust_, \
|
||||
tsb_adjust_, \
|
||||
bsb_adjust_, \
|
||||
vorg_adjust_, \
|
||||
metrics_adjust_ ) \
|
||||
void \
|
||||
FT_Init_Class_ ## class_( FT_Service_MetricsVariationsRec* clazz ) \
|
||||
{ \
|
||||
clazz->hadvance_adjust = hadvance_adjust_; \
|
||||
clazz->lsb_adjust = lsb_adjust_; \
|
||||
clazz->rsb_adjust = rsb_adjust_; \
|
||||
clazz->vadvance_adjust = vadvance_adjust_; \
|
||||
clazz->tsb_adjust = tsb_adjust_; \
|
||||
clazz->bsb_adjust = bsb_adjust_; \
|
||||
clazz->vorg_adjust = vorg_adjust_; \
|
||||
clazz->metrics_adjust = metrics_adjust_; \
|
||||
};
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* SVMETRIC_H_ */
|
||||
|
||||
|
||||
/* END */
|
|
@ -1355,6 +1355,10 @@ FT_BEGIN_HEADER
|
|||
/* a typeless pointer to the FT_Service_MultiMasters table used to */
|
||||
/* handle variation fonts */
|
||||
void* mm;
|
||||
|
||||
/* a typeless pointer to the FT_Service_MetricsVariationsRec table */
|
||||
/* used to handle the HVAR, VVAR, and MVAR OpenType tables */
|
||||
void* var;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||
#include FT_SERVICE_METRICS_VARIATIONS_H
|
||||
#endif
|
||||
|
||||
#include "sferrors.h"
|
||||
|
@ -888,6 +889,8 @@
|
|||
FT_SERVICE_ID_MULTI_MASTERS,
|
||||
0 );
|
||||
}
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face, face->var, METRICS_VARIATIONS );
|
||||
#endif
|
||||
|
||||
FT_TRACE2(( "SFNT driver\n" ));
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
#include FT_MULTIPLE_MASTERS_H
|
||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||
#include FT_SERVICE_METRICS_VARIATIONS_H
|
||||
#endif
|
||||
|
||||
#include FT_SERVICE_TRUETYPE_ENGINE_H
|
||||
|
@ -464,6 +465,7 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
|
||||
FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
||||
tt_service_gx_multi_masters,
|
||||
|
||||
|
@ -478,7 +480,23 @@
|
|||
(FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
|
||||
(FT_Done_Blend_Func) tt_done_blend /* done_blend */
|
||||
)
|
||||
#endif
|
||||
|
||||
FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
|
||||
tt_service_metrics_variations,
|
||||
|
||||
(FT_HAdvance_Adjust_Func)NULL, /* hadvance_adjust */
|
||||
(FT_LSB_Adjust_Func) NULL, /* lsb_adjust */
|
||||
(FT_RSB_Adjust_Func) NULL, /* rsb_adjust */
|
||||
|
||||
(FT_VAdvance_Adjust_Func)NULL, /* vadvance_adjust */
|
||||
(FT_TSB_Adjust_Func) NULL, /* tsb_adjust */
|
||||
(FT_BSB_Adjust_Func) NULL, /* bsb_adjust */
|
||||
(FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */
|
||||
|
||||
(FT_Metrics_Adjust_Func) NULL /* metrics_adjust */
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
||||
|
||||
|
||||
static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine =
|
||||
|
@ -503,14 +521,15 @@
|
|||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_DEFINE_SERVICEDESCREC5(
|
||||
FT_DEFINE_SERVICEDESCREC6(
|
||||
tt_services,
|
||||
|
||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE,
|
||||
FT_SERVICE_ID_MULTI_MASTERS, &TT_SERVICE_GX_MULTI_MASTERS_GET,
|
||||
FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
|
||||
FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET,
|
||||
FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET )
|
||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE,
|
||||
FT_SERVICE_ID_MULTI_MASTERS, &TT_SERVICE_GX_MULTI_MASTERS_GET,
|
||||
FT_SERVICE_ID_METRICS_VARIATIONS, &TT_SERVICE_METRICS_VARIATIONS_GET,
|
||||
FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
|
||||
FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET,
|
||||
FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET )
|
||||
#else
|
||||
FT_DEFINE_SERVICEDESCREC4(
|
||||
tt_services,
|
||||
|
|
|
@ -25,15 +25,17 @@
|
|||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define TT_SERVICES_GET tt_services
|
||||
#define TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters
|
||||
#define TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf
|
||||
#define TT_SERVICE_PROPERTIES_GET tt_service_properties
|
||||
#define TT_SERVICES_GET tt_services
|
||||
#define TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters
|
||||
#define TT_SERVICE_METRICS_VARIATIONS_GET tt_service_metrics_variations
|
||||
#define TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf
|
||||
#define TT_SERVICE_PROPERTIES_GET tt_service_properties
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#include FT_MULTIPLE_MASTERS_H
|
||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||
#include FT_SERVICE_METRICS_VARIATIONS_H
|
||||
#include FT_SERVICE_TRUETYPE_GLYF_H
|
||||
#include FT_SERVICE_PROPERTIES_H
|
||||
|
||||
|
@ -42,12 +44,13 @@ FT_BEGIN_HEADER
|
|||
|
||||
typedef struct TTModulePIC_
|
||||
{
|
||||
FT_ServiceDescRec* tt_services;
|
||||
FT_ServiceDescRec* tt_services;
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_Service_MultiMastersRec tt_service_gx_multi_masters;
|
||||
FT_Service_MultiMastersRec tt_service_gx_multi_masters;
|
||||
FT_Service_MetricsVariationsRec tt_service_metrics_variations;
|
||||
#endif
|
||||
FT_Service_TTGlyfRec tt_service_truetype_glyf;
|
||||
FT_Service_PropertiesRec tt_service_properties;
|
||||
FT_Service_TTGlyfRec tt_service_truetype_glyf;
|
||||
FT_Service_PropertiesRec tt_service_properties;
|
||||
|
||||
} TTModulePIC;
|
||||
|
||||
|
@ -56,6 +59,8 @@ FT_BEGIN_HEADER
|
|||
( (TTModulePIC*)((lib)->pic_container.truetype) )
|
||||
#define TT_SERVICES_GET \
|
||||
( GET_PIC( library )->tt_services )
|
||||
#define TT_SERVICE_METRICS_VARIATIONS_GET \
|
||||
( GET_PIC( library )->tt_service_metrics_variations )
|
||||
#define TT_SERVICE_GX_MULTI_MASTERS_GET \
|
||||
( GET_PIC( library )->tt_service_gx_multi_masters )
|
||||
#define TT_SERVICE_TRUETYPE_GLYF_GET \
|
||||
|
|
Loading…
Reference in New Issue