shithub: freetype+ttf2subf

Download patch

ref: 913f436d12dfe682c349eff8bf4cdd9065ff117d
parent: 67ff7664e4cce992764e70cde25381d07377afee
author: Werner Lemberg <[email protected]>
date: Thu Mar 23 14:37:06 EDT 2017

[sfnt] Fix check for default named instance.

* src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four
bytes, not two...

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-03-23  Werner Lemberg  <[email protected]>
 
+	[sfnt] Fix check for default named instance.
+
+	* src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four
+	bytes, not two...
+
+2017-03-23  Werner Lemberg  <[email protected]>
+
 	Make MM fonts work (again).
 
 	* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1013,8 +1013,8 @@
        */
 
       if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
-           !( FT_ALLOC( default_values, num_axes * 2 )  ||
-              FT_ALLOC( instance_values, num_axes * 2 ) )      )
+           !( FT_ALLOC( default_values, num_axes * 4 )  ||
+              FT_ALLOC( instance_values, num_axes * 4 ) )      )
       {
         /* the current stream position is 16 bytes after the table start */
         FT_ULong  array_start = FT_STREAM_POS() - 16 + offset;
@@ -1029,10 +1029,10 @@
 
         for ( i = 0; i < num_axes; i++ )
         {
-          (void)FT_STREAM_READ_AT( default_value_offset, p, 2 );
+          (void)FT_STREAM_READ_AT( default_value_offset, p, 4 );
 
           default_value_offset += axis_size;
-          p                    += 2;
+          p                    += 4;
         }
 
         instance_offset = array_start + axis_size * num_axes + 4;
@@ -1041,9 +1041,9 @@
         {
           (void)FT_STREAM_READ_AT( instance_offset,
                                    instance_values,
-                                   num_axes * 2 );
+                                   num_axes * 4 );
 
-          if ( !ft_memcmp( default_values, instance_values, num_axes * 2 ) )
+          if ( !ft_memcmp( default_values, instance_values, num_axes * 4 ) )
             break;
 
           instance_offset += instance_size;