[sfnt] Remove temporary runtime flag for variable 'COLR' v1.
Fixes #1187. * src/sfnt/ttcolr.c (top level, read_paint, tt_face_load_colr, tt_face_free_colr, get_deltas_for_var_index_base, tt_face_get_color_glyph_clipbox, tt_face_get_colorline_stops): Remove macro definition `VARIABLE_COLRV1_ENABLED` and its usage. * src/truetype/ttdriver.c (tt_property_set): Remove parsing of 'TEMPORARY-enable-variable-colrv1' property name. * src/truetype/ttobjs.h (TT_DriverRec): Remove `enable_variable_colrv1` flag.
This commit is contained in:
parent
b1c90733ee
commit
2692b3215b
|
@ -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'; two properties are
|
* The TrueType driver's module name is 'truetype'; a single property
|
||||||
* available, @interpreter-version and @TEMPORARY-enable-variable-colrv1, as
|
* @interpreter-version is available, as documented in the @properties
|
||||||
* documented in the @properties section.
|
* 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,49 +820,6 @@ 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* @property:
|
* @property:
|
||||||
|
|
|
@ -38,13 +38,6 @@
|
||||||
#include <freetype/internal/services/svmm.h>
|
#include <freetype/internal/services/svmm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* the next two code lines are a temporary hack, to be removed together */
|
|
||||||
/* with `VARIABLE_COLRV1_ENABLED` and related code as soon as variable */
|
|
||||||
/* 'COLR' support is complete and tested */
|
|
||||||
#include "../truetype/ttobjs.h"
|
|
||||||
#include "../truetype/ttdriver.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
|
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
|
||||||
|
|
||||||
#include "ttcolr.h"
|
#include "ttcolr.h"
|
||||||
|
@ -65,11 +58,6 @@
|
||||||
#define COLRV1_HEADER_SIZE 34U
|
#define COLRV1_HEADER_SIZE 34U
|
||||||
|
|
||||||
|
|
||||||
#define VARIABLE_COLRV1_ENABLED \
|
|
||||||
( ((TT_Driver)FT_FACE_DRIVER( face ))->root.clazz == \
|
|
||||||
&tt_driver_class && \
|
|
||||||
((TT_Driver)FT_FACE_DRIVER( face ))->enable_variable_colrv1 )
|
|
||||||
|
|
||||||
#define ENSURE_READ_BYTES( byte_size ) \
|
#define ENSURE_READ_BYTES( byte_size ) \
|
||||||
if ( p < colr->paints_start_v1 || \
|
if ( p < colr->paints_start_v1 || \
|
||||||
p > (FT_Byte*)colr->table + colr->table_size - byte_size ) \
|
p > (FT_Byte*)colr->table + colr->table_size - byte_size ) \
|
||||||
|
@ -309,8 +297,7 @@
|
||||||
colr->delta_set_idx_map.outerIndex = NULL;
|
colr->delta_set_idx_map.outerIndex = NULL;
|
||||||
colr->delta_set_idx_map.innerIndex = NULL;
|
colr->delta_set_idx_map.innerIndex = NULL;
|
||||||
|
|
||||||
if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR &&
|
if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
FT_ULong var_idx_map_offset, var_store_offset;
|
FT_ULong var_idx_map_offset, var_store_offset;
|
||||||
|
|
||||||
|
@ -370,7 +357,6 @@
|
||||||
|
|
||||||
InvalidTable:
|
InvalidTable:
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||||
|
|
||||||
|
@ -404,7 +390,6 @@
|
||||||
if ( colr )
|
if ( colr )
|
||||||
{
|
{
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
||||||
|
|
||||||
|
@ -600,12 +585,6 @@
|
||||||
FT_UInt i = 0;
|
FT_UInt i = 0;
|
||||||
|
|
||||||
|
|
||||||
if ( !VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
|
||||||
FT_ASSERT( 0 );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( var_index_base == 0xFFFFFFFF )
|
if ( var_index_base == 0xFFFFFFFF )
|
||||||
{
|
{
|
||||||
for ( i = 0; i < num_deltas; ++i )
|
for ( i = 0; i < num_deltas; ++i )
|
||||||
|
@ -710,8 +689,7 @@
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( (FT_PaintFormat_Internal)apaint->format ==
|
if ( (FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID &&
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG( p );
|
var_index_base = FT_NEXT_ULONG( p );
|
||||||
|
@ -772,7 +750,7 @@
|
||||||
apaint->u.linear_gradient.p2.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
|
apaint->u.linear_gradient.p2.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( do_read_var && VARIABLE_COLRV1_ENABLED )
|
if ( do_read_var )
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG ( p );
|
var_index_base = FT_NEXT_ULONG ( p );
|
||||||
|
@ -830,7 +808,7 @@
|
||||||
apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp;
|
apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp;
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( do_read_var && VARIABLE_COLRV1_ENABLED )
|
if ( do_read_var )
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG ( p );
|
var_index_base = FT_NEXT_ULONG ( p );
|
||||||
|
@ -881,7 +859,7 @@
|
||||||
F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
|
F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( do_read_var && VARIABLE_COLRV1_ENABLED )
|
if ( do_read_var )
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG ( p );
|
var_index_base = FT_NEXT_ULONG ( p );
|
||||||
|
@ -941,8 +919,7 @@
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( (FT_PaintFormat_Internal)apaint->format ==
|
if ( (FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM &&
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG( p );
|
var_index_base = FT_NEXT_ULONG( p );
|
||||||
|
@ -978,8 +955,7 @@
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( (FT_PaintFormat_Internal)apaint->format ==
|
if ( (FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE &&
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG( p );
|
var_index_base = FT_NEXT_ULONG( p );
|
||||||
|
@ -1055,8 +1031,7 @@
|
||||||
(FT_PaintFormat_Internal)apaint->format ==
|
(FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM ||
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM ||
|
||||||
(FT_PaintFormat_Internal)apaint->format ==
|
(FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) &&
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG( p );
|
var_index_base = FT_NEXT_ULONG( p );
|
||||||
|
@ -1151,8 +1126,7 @@
|
||||||
if ( ( (FT_PaintFormat_Internal)apaint->format ==
|
if ( ( (FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE ||
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE ||
|
||||||
(FT_PaintFormat_Internal)apaint->format ==
|
(FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) &&
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
FT_UInt num_deltas = 0;
|
FT_UInt num_deltas = 0;
|
||||||
|
|
||||||
|
@ -1225,8 +1199,7 @@
|
||||||
if ( ( (FT_PaintFormat_Internal)apaint->format ==
|
if ( ( (FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW ||
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW ||
|
||||||
(FT_PaintFormat_Internal)apaint->format ==
|
(FT_PaintFormat_Internal)apaint->format ==
|
||||||
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) &&
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) )
|
||||||
VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
ENSURE_READ_BYTES( 4 );
|
ENSURE_READ_BYTES( 4 );
|
||||||
var_index_base = FT_NEXT_ULONG( p );
|
var_index_base = FT_NEXT_ULONG( p );
|
||||||
|
@ -1471,7 +1444,7 @@
|
||||||
face->root.size->metrics.y_scale );
|
face->root.size->metrics.y_scale );
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( VARIABLE_COLRV1_ENABLED && format == 2 )
|
if ( format == 2 )
|
||||||
{
|
{
|
||||||
FT_ULong var_index_base = 0;
|
FT_ULong var_index_base = 0;
|
||||||
/* varIndexBase offset for clipbox is 3 at most. */
|
/* varIndexBase offset for clipbox is 3 at most. */
|
||||||
|
@ -1661,7 +1634,6 @@
|
||||||
var_index_base = FT_NEXT_ULONG( p );
|
var_index_base = FT_NEXT_ULONG( p );
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
if ( VARIABLE_COLRV1_ENABLED )
|
|
||||||
{
|
{
|
||||||
FT_Int item_deltas[2];
|
FT_Int item_deltas[2];
|
||||||
|
|
||||||
|
|
|
@ -108,23 +108,6 @@
|
||||||
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,8 +337,6 @@ 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