freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master ce36777: [sfnt, truetype] Minor adjustments for OpenT


From: Werner LEMBERG
Subject: [freetype2] master ce36777: [sfnt, truetype] Minor adjustments for OpenType 1.8.2.
Date: Tue, 1 Aug 2017 02:25:21 -0400 (EDT)

branch: master
commit ce367774d20072018d46bfe26f7c7b823dfad79c
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [sfnt, truetype] Minor adjustments for OpenType 1.8.2.
    
    * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now
    (tighter) limits.
    
    * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType
    version explicitly allows all negative values for the number of
    contours if we have a composite glyph (this is for better backwards
    compatibility I guess), but it still recommends value -1.
---
 ChangeLog              | 12 ++++++++++++
 src/sfnt/sfobjs.c      |  5 ++++-
 src/truetype/ttgload.c | 11 ++++-------
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 375975e..7f50f71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-08-01  Werner Lemberg  <address@hidden>
+
+       [sfnt, truetype] Minor adjustments for OpenType 1.8.2.
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now
+       (tighter) limits.
+
+       * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType
+       version explicitly allows all negative values for the number of
+       contours if we have a composite glyph (this is for better backwards
+       compatibility I guess), but it still recommends value -1.
+
 2017-07-26  Werner Lemberg  <address@hidden>
 
        [cff] Integer overflow.
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 1526908..58f67c0 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1224,7 +1224,10 @@
         goto Exit;
     }
 
-    if ( face->header.Units_Per_EM == 0 )
+    /* OpenType 1.8.2 introduced limits to this value;    */
+    /* however, they make sense for older SFNT fonts also */
+    if ( face->header.Units_Per_EM <    16 ||
+         face->header.Units_Per_EM > 16384 )
     {
       error = FT_THROW( Invalid_Table );
 
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index d1351e7..086ebca 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1686,7 +1686,7 @@
     /***********************************************************************/
 
     /* otherwise, load a composite! */
-    else if ( loader->n_contours == -1 )
+    else if ( loader->n_contours < 0 )
     {
       FT_Memory  memory = face->root.memory;
 
@@ -1697,6 +1697,9 @@
       FT_ListNode  node, node2;
 
 
+      /* normalize the `n_contours' value */
+      loader->n_contours = -1;
+
       /*
        * We store the glyph index directly in the `node->data' pointer,
        * following the glib solution (cf. macro `GUINT_TO_POINTER') with a
@@ -1991,12 +1994,6 @@
         }
       }
     }
-    else
-    {
-      /* invalid composite count (negative but not -1) */
-      error = FT_THROW( Invalid_Outline );
-      goto Exit;
-    }
 
     /***********************************************************************/
     /***********************************************************************/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]