diff options
author | Dominik Röttsches <drott@chromium.org> | 2022-05-20 17:22:25 +0300 |
---|---|---|
committer | Dominik Röttsches <drott@chromium.org> | 2022-05-23 16:18:28 +0300 |
commit | 7838c78f53f206ac5b8e9cefde548aa81cb00cf4 (patch) | |
tree | d53d42803fcc160326a69aae0abae85ab8f2bfeb /src | |
parent | 9aa99f226279f6fae80565d346ba9f81d396bd02 (diff) | |
download | freetype2-7838c78f53f206ac5b8e9cefde548aa81cb00cf4.tar.gz |
[truetype] Support reading 32bit/16bit VarStore deltas
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Define type
to be used for delta arrays, upgrade to FT_long.
* src/truetype/ttgxvar.c: Adhere to long_words bit and read either
Short/Byte pairs or Long/Short pairs, as defined by spec. For better
readability, define macro for repetitive read code.
Diffstat (limited to 'src')
-rw-r--r-- | src/truetype/ttgxvar.c | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index d6a34e3c5..36f70c859 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -631,44 +631,25 @@ varData->regionIdxCount * varData->itemCount ) ) goto Exit; - /* the delta set is stored as a 2-dimensional array of shorts */ - if ( long_words ) + for ( j = 0; j < varData->itemCount * varData->regionIdxCount; ) { - /* 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; ) + if ( long_words ) { for ( k = 0; k < wordDeltaCount; k++, j++ ) - { - /* read the short deltas */ - FT_Short delta; - - - if ( FT_READ_SHORT( delta ) ) + if ( FT_READ_LONG( varData->deltaSet[j] ) ) goto Exit; - - varData->deltaSet[j] = delta; - } - for ( ; k < varData->regionIdxCount; k++, j++ ) - { - /* read the (signed) byte deltas */ - FT_Char delta; - - - if ( FT_READ_CHAR( delta ) ) + if ( FT_READ_SHORT( varData->deltaSet[j] ) ) + goto Exit; + } + else + { + for ( k = 0; k < wordDeltaCount; k++, j++ ) + if ( FT_READ_SHORT( varData->deltaSet[j] ) ) + goto Exit; + for ( ; k < varData->regionIdxCount; k++, j++ ) + if ( FT_READ_CHAR( varData->deltaSet[j] ) ) goto Exit; - - varData->deltaSet[j] = delta; - } } } } @@ -964,8 +945,8 @@ FT_UInt outerIndex, FT_UInt innerIndex ) { - GX_ItemVarData varData; - FT_Short* deltaSet; + GX_ItemVarData varData; + FT_ItemVarDelta* deltaSet; FT_UInt master, j; FT_Fixed netAdjustment = 0; /* accumulated adjustment */ |