[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 390e47c..d6a34e3 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 ),