freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master cdab9cf: [psaux] Fix PostScript interpreter rewinding


From: Hew Yih Shiuan Ewald
Subject: [freetype2] master cdab9cf: [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251)
Date: Fri, 3 Nov 2017 03:23:42 -0400 (EDT)

branch: master
commit cdab9cfae9f336bddf709bad6f4f1de66f67524e
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>

    [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251)
    
    The interpreter in Type 1 mode rewinds the charstring after collecting
    all hints for building the initial hintmap (commit d52dd7f). However,
    some charstrings use `endchar' in a final subroutine call, rewinding to
    the start of that subroutine, and only a small section of the actual
    glyph is drawn.
    
    * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdENDCHAR>:
    Ensure we are on the top level charstring before rewinding.
---
 ChangeLog           | 13 +++++++++++++
 src/psaux/psintrp.c | 13 +++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 2c84dbd..6ce0c20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-11-03  Ewald Hew  <address@hidden>
+
+       [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251)
+
+       The interpreter in Type 1 mode rewinds the charstring after collecting
+       all hints for building the initial hintmap (commit d52dd7f). However,
+       some charstrings use `endchar' in a final subroutine call, rewinding to
+       the start of that subroutine, and only a small section of the actual
+       glyph is drawn.
+
+       * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdENDCHAR>:
+       Ensure we are on the top level charstring before rewinding.
+
 2017-11-03  suzuki toshiya  <address@hidden>
 
        [truetype] Add more tricky fonts.
diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index a60597e..5c0ee78 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -2462,6 +2462,19 @@
           hintMask.isNew   = TRUE;
 
           /* rewind charstring */
+          /* some charstrings use endchar from a final subroutine call */
+          /* without returning, detect these and exit to the top level */
+          /* charstring                                                */
+          while ( charstringIndex > 0 )
+          {
+            FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
+
+            /* restore position in previous charstring */
+            charstring = (CF2_Buffer)
+                           cf2_arrstack_getPointer(
+                             &subrStack,
+                             (CF2_UInt)--charstringIndex );
+          }
           charstring->ptr = charstring->start;
 
           break;



reply via email to

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