freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 8982405 2/2: [truetype] Various minor fixes.


From: Werner LEMBERG
Subject: [freetype2] master 8982405 2/2: [truetype] Various minor fixes.
Date: Tue, 3 Jan 2017 08:46:38 +0000 (UTC)

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

    [truetype] Various minor fixes.
    
    * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction
    size only if we do native hinting.
    (TT_Load_Glyph): Trace returned error code.
    
    * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace
    returned error code.
    (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is
    invalid.
---
 ChangeLog              |   13 +++++++++++++
 src/truetype/ttgload.c |   35 ++++++++++++++++++++++++-----------
 src/truetype/ttobjs.c  |   17 +++++++++++++++--
 3 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 780714f..36fae67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-01-03  Werner Lemberg  <address@hidden>
 
+       [truetype] Various minor fixes.
+
+       * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction
+       size only if we do native hinting.
+       (TT_Load_Glyph): Trace returned error code.
+
+       * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace
+       returned error code.
+       (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is
+       invalid.
+
+2017-01-03  Werner Lemberg  <address@hidden>
+
        [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid.
 
        These tables are optional.
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index a0cdfc8..65297a0 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -398,18 +398,18 @@
 
     FT_TRACE5(( "  Instructions size: %u\n", n_ins ));
 
-    /* check it */
-    if ( ( limit - p ) < n_ins )
-    {
-      FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" ));
-      error = FT_THROW( Too_Many_Hints );
-      goto Fail;
-    }
-
 #ifdef TT_USE_BYTECODE_INTERPRETER
 
     if ( IS_HINTED( load->load_flags ) )
     {
+      /* check instructions size */
+      if ( ( limit - p ) < n_ins )
+      {
+        FT_TRACE1(( "TT_Load_Simple_Glyph: instruction count mismatch\n" ));
+        error = FT_THROW( Too_Many_Hints );
+        goto Fail;
+      }
+
       /* we don't trust `maxSizeOfInstructions' in the `maxp' table */
       /* and thus update the bytecode array size by ourselves       */
 
@@ -2649,14 +2649,20 @@
 
     /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */
     if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid )
-      return FT_THROW( Invalid_Size_Handle );
+    {
+      error = FT_THROW( Invalid_Size_Handle );
+      goto Exit;
+    }
 
     if ( load_flags & FT_LOAD_SBITS_ONLY )
-      return FT_THROW( Invalid_Argument );
+    {
+      error = FT_THROW( Invalid_Argument );
+      goto Exit;
+    }
 
     error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
     if ( error )
-      return error;
+      goto Exit;
 
     glyph->format        = FT_GLYPH_FORMAT_OUTLINE;
     glyph->num_subglyphs = 0;
@@ -2731,6 +2737,13 @@
          size->root.metrics.y_ppem < 24     )
       glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
 
+  Exit:
+#ifdef FT_DEBUG_LEVEL_TRACE
+    if ( error )
+      FT_TRACE1(( "  failed (error code 0x%x)\n",
+                  error ));
+#endif
+
     return error;
   }
 
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 7e37113..4cc852b 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -819,6 +819,11 @@
 
       FT_TRACE4(( "Executing `fpgm' table.\n" ));
       error = face->interpreter( exec );
+#ifdef FT_DEBUG_LEVEL_TRACE
+      if ( error )
+        FT_TRACE4(( "  interpretation failed with error code 0x%x\n",
+                    error ));
+#endif
     }
     else
       error = FT_Err_Ok;
@@ -882,8 +887,12 @@
       TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
 
       FT_TRACE4(( "Executing `prep' table.\n" ));
-
       error = face->interpreter( exec );
+#ifdef FT_DEBUG_LEVEL_TRACE
+      if ( error )
+        FT_TRACE4(( "  interpretation failed with error code 0x%x\n",
+                    error ));
+#endif
     }
     else
       error = FT_Err_Ok;
@@ -1075,8 +1084,10 @@
 
     if ( size->bytecode_ready < 0 )
       error = tt_size_init_bytecode( (FT_Size)size, pedantic );
+    else
+      error = size->bytecode_ready;
 
-    if ( error || size->bytecode_ready )
+    if ( error )
       goto Exit;
 
     /* rescale CVT when needed */
@@ -1108,6 +1119,8 @@
 
       error = tt_size_run_prep( size, pedantic );
     }
+    else
+      error = size->cvt_ready;
 
   Exit:
     return error;



reply via email to

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