freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 2dd2091: [sfnt] If `COLR' is present, don't assume th


From: Werner LEMBERG
Subject: [freetype2] master 2dd2091: [sfnt] If `COLR' is present, don't assume that all glyphs use it.
Date: Tue, 15 May 2018 03:07:17 -0400 (EDT)

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

    [sfnt] If `COLR' is present, don't assume that all glyphs use it.
    
    * src/sfnt/ttcolr.c (tt_face_load_colr_layers): Return FT_Err_Ok if
    current glyph is not a `COLR' base glyph.
    
    * src/truetype/ttgload.c (TT_Load_Glyph): Don't allocate
    `color_layers' if there are no color layers.
---
 ChangeLog              | 10 ++++++++++
 src/base/ftobjs.c      |  2 +-
 src/sfnt/ttcolr.c      |  7 ++++++-
 src/truetype/ttgload.c | 15 +++++++++------
 4 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index be867e8..1a787b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-05-15  Werner Lemberg  <address@hidden>
+
+       [sfnt] If `COLR' is present, don't assume that all glyphs use it.
+
+       * src/sfnt/ttcolr.c (tt_face_load_colr_layers): Return FT_Err_Ok if
+       current glyph is not a `COLR' base glyph.
+
+       * src/truetype/ttgload.c (TT_Load_Glyph): Don't allocate
+       `color_layers' if there are no color layers.
+
 2018-05-14  Werner Lemberg  <address@hidden>
 
        * src/base/ftobjs.c (FT_Load_Glyph): Fix signature of `pixel_modes'.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3590ce1..c102bbe 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4526,7 +4526,7 @@
       break;
 
     default:
-      if ( slot->internal->color_layers != NULL )
+      if ( slot->internal->color_layers )
       {
         FT_Face  face = slot->face;
 
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 58499d3..1e469f5 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -315,7 +315,12 @@
                                   colr->num_base_glyphs,
                                   glyph_id,
                                   &glyph_record ) )
-      return FT_THROW ( Invalid_Table );
+    {
+      *ret_layers     = NULL;
+      *ret_num_layers = 0;
+
+      return FT_Err_Ok;
+    }
 
     /* Load all colors for the glyphs; this would be stored in the slot. */
     layer_record_ptr = colr->layers +
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 17d8d95..459fe2e 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2913,14 +2913,17 @@
       if ( error )
         return error;
 
-      if ( FT_NEW( color_layers ) )
-        return error;
+      if ( num_glyph_layers )
+      {
+        if ( FT_NEW( color_layers ) )
+          return error;
 
-      color_layers->layers     = glyph_layers;
-      color_layers->num_layers = num_glyph_layers;
-      color_layers->load_flags = load_flags;
+        color_layers->layers     = glyph_layers;
+        color_layers->num_layers = num_glyph_layers;
+        color_layers->load_flags = load_flags;
 
-      glyph->internal->color_layers = color_layers;
+        glyph->internal->color_layers = color_layers;
+      }
     }
 
   Exit:



reply via email to

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