diff options
author | Dominik Röttsches <drott@chromium.org> | 2022-05-20 17:20:08 +0300 |
---|---|---|
committer | Dominik Röttsches <drott@chromium.org> | 2022-05-20 17:20:08 +0300 |
commit | 9aa99f226279f6fae80565d346ba9f81d396bd02 (patch) | |
tree | e5618a1fd636c3b703e1a8bd65f26e52ee0880c6 /src/truetype/ttgxvar.c | |
parent | a4c4566b6d51a0bd60133e1e1a7fcc19e8fcba9e (diff) | |
download | freetype2-9aa99f226279f6fae80565d346ba9f81d396bd02.tar.gz |
[truetype] Handle 0xFFFF special value inside delta retrieval function
* truetype/ttgxvar.c (tt_hvadvance_adjust, tt_apply_mvar,
tt_var_get_item_delta): Remove special 0xFFFF handling in favor of less
redundant handling inside the tt_var_get_item_delta function, as it is
equivalent to returning a 0 delta. Avoids code-duplication checking for
special value 0xFFFF.
Diffstat (limited to 'src/truetype/ttgxvar.c')
-rw-r--r-- | src/truetype/ttgxvar.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 390e47c83..d6a34e3c5 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -972,6 +972,10 @@ FT_Fixed scaledDelta; FT_Fixed delta; + /* OpenType 1.8.4+: No variation data for this item + * as indices have special value 0xFFFF. */ + if (outerIndex == 0xFFFF && innerIndex == 0xFFFF) + return 0; /* See pseudo code from `Font Variations Overview' */ /* in the OpenType specification. */ @@ -1148,20 +1152,12 @@ } } - /* new test introduced in OpenType 1.8.4 */ - if ( outerIndex == 0xFFFFU && innerIndex == 0xFFFFU ) - { - FT_TRACE5(( "no adjustment to %s value %d\n", - vertical ? "vertical height" : "horizontal width", - *avalue )); - } - else - { - delta = tt_var_get_item_delta( face, - &table->itemStore, - outerIndex, - innerIndex ); + delta = tt_var_get_item_delta( face, + &table->itemStore, + outerIndex, + innerIndex ); + if ( delta ) { FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n", vertical ? "vertical height" : "horizontal width", *avalue, @@ -1459,19 +1455,12 @@ FT_Int delta; - /* new test introduced in OpenType 1.8.4 */ - if ( value->outerIndex == 0xFFFFU && value->innerIndex == 0xFFFFU ) - { - /* no variation data for this item */ - continue; - } - delta = tt_var_get_item_delta( face, &blend->mvar_table->itemStore, value->outerIndex, value->innerIndex ); - if ( p ) + if ( p && delta ) { FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n", (FT_Char)( value->tag >> 24 ), |