forked from minhngoc25a/freetype2
Proposal: Feature control for variable COLRv1
* include/freetype/ftdriver.h (variable-color-v1 property): Add documentation for variable-colr-v1 property. * src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property when called, set to enable_variable_colrv1 driver flag. * src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag.
This commit is contained in:
parent
b861b24157
commit
4b6f92e6b3
|
@ -214,9 +214,9 @@ FT_BEGIN_HEADER
|
||||||
* itself, it is possible to control its behaviour with @FT_Property_Set
|
* itself, it is possible to control its behaviour with @FT_Property_Set
|
||||||
* and @FT_Property_Get.
|
* and @FT_Property_Get.
|
||||||
*
|
*
|
||||||
* The TrueType driver's module name is 'truetype'; a single property
|
* The TrueType driver's module name is 'truetype'; two properties are
|
||||||
* @interpreter-version is available, as documented in the @properties
|
* available, @interpreter-version and @TEMPORARY-enable-variable-colrv1, as
|
||||||
* section.
|
* documented in the @properties section.
|
||||||
*
|
*
|
||||||
* To help understand the differences between interpreter versions, we
|
* To help understand the differences between interpreter versions, we
|
||||||
* introduce a list of definitions, kindly provided by Greg Hitchcock.
|
* introduce a list of definitions, kindly provided by Greg Hitchcock.
|
||||||
|
@ -820,6 +820,48 @@ FT_BEGIN_HEADER
|
||||||
* 2.5
|
* 2.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* @property:
|
||||||
|
* TEMPORARY-enable-variable-colrv1
|
||||||
|
*
|
||||||
|
* @description:
|
||||||
|
* Controls experimental support of variable COLRv1 and whether the COLRv1
|
||||||
|
* implementation should take into account variation deltas. This tells the
|
||||||
|
* COLRv1 API methods whether they should read from the font and apply
|
||||||
|
* variable deltas to COLRv1 properties. The feature is default off. When
|
||||||
|
* on, variable COLRv1 deltas are applied for COLRv1 features for which they
|
||||||
|
* are already implemented. When off, variable deltas are ignored even if
|
||||||
|
* the respective PaintVar* table may already be understood.
|
||||||
|
*
|
||||||
|
* WARNING: Temporary flag during development of variable COLRv1. This flag
|
||||||
|
* will be removed, do not rely on it. Full variable COLRv1 support will be
|
||||||
|
* announced separately.
|
||||||
|
*
|
||||||
|
* @note:
|
||||||
|
* This property cannot be set via the `FREETYPE_PROPERTIES` environment
|
||||||
|
* variable.
|
||||||
|
*
|
||||||
|
* @example:
|
||||||
|
* The following example code demonstrates how to enable variable
|
||||||
|
* COLRv1.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* FT_Library library;
|
||||||
|
* FT_Face face;
|
||||||
|
* FT_Bool variable_colrv1 = TRUE;
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* FT_Init_FreeType( &library );
|
||||||
|
*
|
||||||
|
* FT_Property_Set( library, "truetype",
|
||||||
|
* "TEMPORARY-enable-variable-colrv1",
|
||||||
|
* &variable_colr_v1 );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since:
|
||||||
|
* 2.12.2
|
||||||
|
*/
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
|
|
|
@ -108,6 +108,23 @@
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !ft_strcmp( property_name, "TEMPORARY-enable-variable-colrv1" ) )
|
||||||
|
{
|
||||||
|
/* This flag is temporary and can't be set with environment variables. */
|
||||||
|
if ( !value_is_string )
|
||||||
|
{
|
||||||
|
FT_Bool* bv = (FT_Bool*)value;
|
||||||
|
|
||||||
|
if ( *bv == TRUE || *bv == FALSE)
|
||||||
|
driver->enable_variable_colrv1 = *bv;
|
||||||
|
else
|
||||||
|
error = FT_ERR( Unimplemented_Feature );
|
||||||
|
} else
|
||||||
|
error = FT_ERR( Invalid_Argument );
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
FT_TRACE2(( "tt_property_set: missing property `%s'\n",
|
FT_TRACE2(( "tt_property_set: missing property `%s'\n",
|
||||||
property_name ));
|
property_name ));
|
||||||
return FT_THROW( Missing_Property );
|
return FT_THROW( Missing_Property );
|
||||||
|
|
|
@ -337,6 +337,8 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
FT_UInt interpreter_version;
|
FT_UInt interpreter_version;
|
||||||
|
|
||||||
|
FT_Bool enable_variable_colrv1;
|
||||||
|
|
||||||
} TT_DriverRec;
|
} TT_DriverRec;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue