4c33b1
From 55bbb98f5c5a89230127d6b998a6e23e634b5d0e Mon Sep 17 00:00:00 2001
4c33b1
From: Behdad Esfahbod <behdad@behdad.org>
4c33b1
Date: Tue, 1 Aug 2017 09:17:02 +0200
4c33b1
Subject: [PATCH 077/132] [truetype] Fix loading of named instances.
4c33b1
4c33b1
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position
4c33b1
while loading the `avar' table.
4c33b1
---
4c33b1
 ChangeLog               |  7 +++++++
4c33b1
 include/freetype/ftmm.h |  2 +-
4c33b1
 src/truetype/ttgxvar.c  | 11 ++++++++++-
4c33b1
 3 files changed, 18 insertions(+), 2 deletions(-)
4c33b1
4c33b1
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
4c33b1
index 68458362e..df42b3bfd 100644
4c33b1
--- a/src/truetype/ttgxvar.c
4c33b1
+++ b/src/truetype/ttgxvar.c
4c33b1
@@ -2136,8 +2136,16 @@
4c33b1
         goto Exit;
4c33b1
 
4c33b1
       if ( fvar_head.instanceCount && !face->blend->avar_loaded )
4c33b1
+      {
4c33b1
+        FT_ULong  offset = FT_STREAM_POS();
4c33b1
+
4c33b1
+
4c33b1
         ft_var_load_avar( face );
4c33b1
 
4c33b1
+        if ( FT_STREAM_SEEK( offset ) )
4c33b1
+          goto Exit;
4c33b1
+      }
4c33b1
+
4c33b1
       ns  = mmvar->namedstyle;
4c33b1
       nsc = face->blend->normalized_stylecoords;
4c33b1
       for ( i = 0; i < fvar_head.instanceCount; i++, ns++ )
4c33b1
@@ -2171,7 +2179,7 @@
4c33b1
         SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
4c33b1
 
4c33b1
         FT_Int   found, dummy1, dummy2;
4c33b1
-        FT_UInt  strid = 0xFFFFFFFFUL;
4c33b1
+        FT_UInt  strid = ~0U;
4c33b1
 
4c33b1
 
4c33b1
         /* the default instance is missing in array the   */
4c33b1
-- 
4c33b1
2.13.5
4c33b1