New function `FT_Set_Named_Instance'.
No effect yet. * src/base/ftmm.c (FT_Set_Named_Instance): New function. * include/freetype/ftmm.h: Updated.
This commit is contained in:
parent
b3f9c4f2f6
commit
dd8539ef82
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2017-10-07 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
New function `FT_Set_Named_Instance'.
|
||||||
|
|
||||||
|
No effect yet.
|
||||||
|
|
||||||
|
* src/base/ftmm.c (FT_Set_Named_Instance): New function.
|
||||||
|
|
||||||
|
* include/freetype/ftmm.h: Updated.
|
||||||
|
|
||||||
2017-10-07 Werner Lemberg <wl@gnu.org>
|
2017-10-07 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
Add macros for checking whether a font variation is active.
|
Add macros for checking whether a font variation is active.
|
||||||
|
|
|
@ -551,6 +551,43 @@ FT_BEGIN_HEADER
|
||||||
FT_UInt axis_index,
|
FT_UInt axis_index,
|
||||||
FT_UInt* flags );
|
FT_UInt* flags );
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* FT_Set_Named_Instance */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Set or change the current named instance. */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* face :: A handle to the source face. */
|
||||||
|
/* */
|
||||||
|
/* instance_index :: The index of the requested instance, starting */
|
||||||
|
/* with value 1. If set to value 0, FreeType */
|
||||||
|
/* switches to font access without a named */
|
||||||
|
/* instance. */
|
||||||
|
/* */
|
||||||
|
/* <Return> */
|
||||||
|
/* FreeType error code. 0~means success. */
|
||||||
|
/* */
|
||||||
|
/* <Note> */
|
||||||
|
/* The function uses the value of `instance_index' to set bits 16-30 */
|
||||||
|
/* of the face's `face_index' field. It also resets any variation */
|
||||||
|
/* applied to the font, and the @FT_FACE_FLAG_VARIATION bit of the */
|
||||||
|
/* face's `face_flags' field gets reset to zero (i.e., */
|
||||||
|
/* @FT_IS_VARIATION will return false). */
|
||||||
|
/* */
|
||||||
|
/* For Adobe MM fonts (which don't have named instances) this */
|
||||||
|
/* function simply resets the current face to the default instance. */
|
||||||
|
/* */
|
||||||
|
/* <Since> */
|
||||||
|
/* 2.8.2 */
|
||||||
|
/* */
|
||||||
|
FT_EXPORT( FT_Error )
|
||||||
|
FT_Set_Named_Instance( FT_Face face,
|
||||||
|
FT_UInt instance_index );
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -426,4 +426,52 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* documentation is in ftmm.h */
|
||||||
|
|
||||||
|
FT_EXPORT_DEF( FT_Error )
|
||||||
|
FT_Set_Named_Instance( FT_Face face,
|
||||||
|
FT_UInt instance_index )
|
||||||
|
{
|
||||||
|
FT_Error error;
|
||||||
|
|
||||||
|
FT_Service_MultiMasters service_mm = NULL;
|
||||||
|
FT_Service_MetricsVariations service_mvar = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/* check of `face' delayed to `ft_face_get_mm_service' */
|
||||||
|
|
||||||
|
error = ft_face_get_mm_service( face, &service_mm );
|
||||||
|
if ( !error )
|
||||||
|
{
|
||||||
|
error = FT_ERR( Invalid_Argument );
|
||||||
|
if ( service_mm->set_instance )
|
||||||
|
error = service_mm->set_instance( face, instance_index );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !error )
|
||||||
|
{
|
||||||
|
(void)ft_face_get_mvar_service( face, &service_mvar );
|
||||||
|
|
||||||
|
if ( service_mvar && service_mvar->metrics_adjust )
|
||||||
|
service_mvar->metrics_adjust( face );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* enforce recomputation of auto-hinting data */
|
||||||
|
if ( !error && face->autohint.finalizer )
|
||||||
|
{
|
||||||
|
face->autohint.finalizer( face->autohint.data );
|
||||||
|
face->autohint.data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !error )
|
||||||
|
{
|
||||||
|
face->face_index = ( instance_index << 16 ) |
|
||||||
|
( face->face_index & 0xFFFFL );
|
||||||
|
face->face_flags &= ~FT_FACE_FLAG_VARIATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
Loading…
Reference in New Issue