ref: 723aafb5e35f4cd2410064285cdc591bd62b7b04
parent: d718ac4ead0d711bd73d8103ba67cca10a55b3d9
author: Werner Lemberg <[email protected]>
date: Wed Jan 11 09:21:26 EST 2017
[truetype] Actually use metrics variation service. * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (ft_face_get_mvar_service): New auxiliary function to look up metrics variation service. (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call metrics variation service. * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for named instances.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2017-01-11 Werner Lemberg <[email protected]>
+ [truetype] Actually use metrics variation service.
+
+ * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
+ (ft_face_get_mvar_service): New auxiliary function to look up
+ metrics variation service.
+ (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
+ FT_Set_Var_Blend_Coordinates): Call metrics variation service.
+
+ * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for
+ named instances.
+
+2017-01-11 Werner Lemberg <[email protected]>
+
[truetype] Provide metrics variation service.
* include/freetype/internal/services/svmetric.h
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -22,6 +22,7 @@
#include FT_MULTIPLE_MASTERS_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include FT_SERVICE_METRICS_VARIATIONS_H
/*************************************************************************/
@@ -62,6 +63,34 @@
}
+ static FT_Error
+ ft_face_get_mvar_service( FT_Face face,
+ FT_Service_MetricsVariations *aservice )
+ {
+ FT_Error error;
+
+
+ *aservice = NULL;
+
+ if ( !face )
+ return FT_THROW( Invalid_Face_Handle );
+
+ error = FT_ERR( Invalid_Argument );
+
+ if ( FT_HAS_MULTIPLE_MASTERS( face ) )
+ {
+ FT_FACE_LOOKUP_SERVICE( face,
+ *aservice,
+ METRICS_VARIATIONS );
+
+ if ( *aservice )
+ error = FT_Err_Ok;
+ }
+
+ return error;
+ }
+
+
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
@@ -158,8 +187,9 @@
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Error error;
- FT_Service_MultiMasters service;
+ FT_Error error;
+ FT_Service_MultiMasters service_mm;
+ FT_Service_MetricsVariations service_mvar;
/* check of `face' delayed to `ft_face_get_mm_service' */
@@ -167,14 +197,21 @@
if ( !coords )
return FT_THROW( Invalid_Argument );
- error = ft_face_get_mm_service( face, &service );
+ error = ft_face_get_mm_service( face, &service_mm );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
- if ( service->set_var_design )
- error = service->set_var_design( face, num_coords, coords );
+ if ( service_mm->set_var_design )
+ error = service_mm->set_var_design( face, num_coords, coords );
}
+ error = ft_face_get_mvar_service( face, &service_mvar );
+ if ( !error )
+ {
+ if ( service_mvar->metrics_adjust )
+ service_mvar->metrics_adjust( face );
+ }
+
/* enforce recomputation of auto-hinting data */
if ( !error && face->autohint.finalizer )
{
@@ -221,8 +258,9 @@
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Error error;
- FT_Service_MultiMasters service;
+ FT_Error error;
+ FT_Service_MultiMasters service_mm;
+ FT_Service_MetricsVariations service_mvar;
/* check of `face' delayed to `ft_face_get_mm_service' */
@@ -230,14 +268,21 @@
if ( !coords )
return FT_THROW( Invalid_Argument );
- error = ft_face_get_mm_service( face, &service );
+ error = ft_face_get_mm_service( face, &service_mm );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
- if ( service->set_mm_blend )
- error = service->set_mm_blend( face, num_coords, coords );
+ if ( service_mm->set_mm_blend )
+ error = service_mm->set_mm_blend( face, num_coords, coords );
}
+ error = ft_face_get_mvar_service( face, &service_mvar );
+ if ( !error )
+ {
+ if ( service_mvar->metrics_adjust )
+ service_mvar->metrics_adjust( face );
+ }
+
/* enforce recomputation of auto-hinting data */
if ( !error && face->autohint.finalizer )
{
@@ -259,8 +304,9 @@
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Error error;
- FT_Service_MultiMasters service;
+ FT_Error error;
+ FT_Service_MultiMasters service_mm;
+ FT_Service_MetricsVariations service_mvar;
/* check of `face' delayed to `ft_face_get_mm_service' */
@@ -268,12 +314,19 @@
if ( !coords )
return FT_THROW( Invalid_Argument );
- error = ft_face_get_mm_service( face, &service );
+ error = ft_face_get_mm_service( face, &service_mm );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
- if ( service->set_mm_blend )
- error = service->set_mm_blend( face, num_coords, coords );
+ if ( service_mm->set_mm_blend )
+ error = service_mm->set_mm_blend( face, num_coords, coords );
+ }
+
+ error = ft_face_get_mvar_service( face, &service_mvar );
+ if ( !error )
+ {
+ if ( service_mvar->metrics_adjust )
+ service_mvar->metrics_adjust( face );
}
/* enforce recomputation of auto-hinting data */
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -664,6 +664,8 @@
named_style->coords );
if ( error )
goto Exit;
+
+ tt_apply_mvar( face );
}
}
}