[truetype] Updates for the forthcoming OpenType 1.9 standard (2/2).
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store): s/shortDeltaCount/wordDeltaCount/ (as done in the specification, too). Recognize new format and reject it for now.
This commit is contained in:
parent
93e6b3e8e9
commit
e4f7673e46
|
@ -457,7 +457,8 @@
|
||||||
FT_UShort format;
|
FT_UShort format;
|
||||||
FT_ULong region_offset;
|
FT_ULong region_offset;
|
||||||
FT_UInt i, j, k;
|
FT_UInt i, j, k;
|
||||||
FT_UInt shortDeltaCount;
|
FT_UInt wordDeltaCount;
|
||||||
|
FT_Bool long_words;
|
||||||
|
|
||||||
GX_Blend blend = face->blend;
|
GX_Blend blend = face->blend;
|
||||||
GX_ItemVarData varData;
|
GX_ItemVarData varData;
|
||||||
|
@ -572,15 +573,18 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
if ( FT_READ_USHORT( varData->itemCount ) ||
|
if ( FT_READ_USHORT( varData->itemCount ) ||
|
||||||
FT_READ_USHORT( shortDeltaCount ) ||
|
FT_READ_USHORT( wordDeltaCount ) ||
|
||||||
FT_READ_USHORT( varData->regionIdxCount ) )
|
FT_READ_USHORT( varData->regionIdxCount ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
long_words = !!( wordDeltaCount & 0x8000 );
|
||||||
|
wordDeltaCount &= 0x7FFF;
|
||||||
|
|
||||||
/* check some data consistency */
|
/* check some data consistency */
|
||||||
if ( shortDeltaCount > varData->regionIdxCount )
|
if ( wordDeltaCount > varData->regionIdxCount )
|
||||||
{
|
{
|
||||||
FT_TRACE2(( "bad short count %d or region count %d\n",
|
FT_TRACE2(( "bad short count %d or region count %d\n",
|
||||||
shortDeltaCount,
|
wordDeltaCount,
|
||||||
varData->regionIdxCount ));
|
varData->regionIdxCount ));
|
||||||
error = FT_THROW( Invalid_Table );
|
error = FT_THROW( Invalid_Table );
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
@ -616,18 +620,30 @@
|
||||||
|
|
||||||
/* Parse delta set. */
|
/* Parse delta set. */
|
||||||
/* */
|
/* */
|
||||||
/* On input, deltas are (shortDeltaCount + regionIdxCount) bytes */
|
/* On input, deltas are (wordDeltaCount + regionIdxCount) bytes */
|
||||||
/* each; on output, deltas are expanded to `regionIdxCount' shorts */
|
/* each if `long_words` isn't set, and twice as much otherwise. */
|
||||||
/* each. */
|
/* */
|
||||||
|
/* On output, deltas are expanded to `regionIdxCount` shorts each. */
|
||||||
if ( FT_NEW_ARRAY( varData->deltaSet,
|
if ( FT_NEW_ARRAY( varData->deltaSet,
|
||||||
varData->regionIdxCount * varData->itemCount ) )
|
varData->regionIdxCount * varData->itemCount ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
/* the delta set is stored as a 2-dimensional array of shorts; */
|
/* the delta set is stored as a 2-dimensional array of shorts */
|
||||||
/* sign-extend signed bytes to signed shorts */
|
if ( long_words )
|
||||||
|
{
|
||||||
|
/* new in OpenType 1.9, currently for 'COLR' table only; */
|
||||||
|
/* the deltas are interpreted as 16.16 fixed-point scaling values */
|
||||||
|
|
||||||
|
/* not supported yet */
|
||||||
|
|
||||||
|
error = FT_THROW( Invalid_Table );
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for ( j = 0; j < varData->itemCount * varData->regionIdxCount; )
|
for ( j = 0; j < varData->itemCount * varData->regionIdxCount; )
|
||||||
{
|
{
|
||||||
for ( k = 0; k < shortDeltaCount; k++, j++ )
|
for ( k = 0; k < wordDeltaCount; k++, j++ )
|
||||||
{
|
{
|
||||||
/* read the short deltas */
|
/* read the short deltas */
|
||||||
FT_Short delta;
|
FT_Short delta;
|
||||||
|
@ -652,6 +668,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
FT_FREE( dataOffsetArray );
|
FT_FREE( dataOffsetArray );
|
||||||
|
|
Loading…
Reference in New Issue