shithub: freetype+ttf2subf

Download patch

ref: 6342da9a8d518544ad590b887a21c122c10f8773
parent: dd64a6227ceda32a90c06f77cf44e23dad95cb78
author: Werner Lemberg <[email protected]>
date: Mon Mar 20 01:36:41 EDT 2017

[sfnt] Don't add instances to non-variation fonts.

* src/sfnt/sfobjs.c (sfnt_init_face): Fix it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-03-20  Werner Lemberg  <[email protected]>
 
+	[sfnt] Don't add instances to non-variation fonts.
+
+	* src/sfnt/sfobjs.c (sfnt_init_face): Fix it.
+
+2017-03-20  Werner Lemberg  <[email protected]>
+
 	* src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578).
 
 2017-03-18  Werner Lemberg  <[email protected]>
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1012,8 +1012,9 @@
        *  later on.  Here, we have to adjust `num_instances' accordingly.
        */
 
-      if ( !( FT_ALLOC( default_values, num_axes * 2 )  ||
-              FT_ALLOC( instance_values, num_axes * 2 ) ) )
+      if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
+           !( FT_ALLOC( default_values, num_axes * 2 )  ||
+              FT_ALLOC( instance_values, num_axes * 2 ) )      )
       {
         /* the current stream position is 16 bytes after the table start */
         FT_ULong  array_start = FT_STREAM_POS() - 16 + offset;