freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master d28eac2: [type42] Support `CharStrings' entry format


From: Werner LEMBERG
Subject: [freetype2] master d28eac2: [type42] Support `CharStrings' entry format as created by LilyPond.
Date: Sun, 29 May 2016 22:24:34 +0000 (UTC)

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

    [type42] Support `CharStrings' entry format as created by LilyPond.
    
    * src/type42/t42parse.c (t42_parse_charstrings): Handle entries
    having the format
    
      (foo) cvn 12345 def
---
 ChangeLog             |    9 +++++++++
 src/type42/t42parse.c |   19 +++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 839023a..b3592bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-05-30  Werner Lemberg  <address@hidden>
+
+       [type42] Support `CharStrings' entry format as created by LilyPond.
+
+       * src/type42/t42parse.c (t42_parse_charstrings): Handle entries
+       having the format
+
+         (foo) cvn 12345 def
+
 2016-05-28  Werner Lemberg  <address@hidden>
 
        * src/autofit/afranges.c: Remove `UL' postfix from hex numbers.
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index cf9009b..f948916 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -899,8 +899,13 @@
 
     for (;;)
     {
-      /* The format is simple:                   */
-      /*   `/glyphname' + index [+ def]          */
+      /* We support two formats.                     */
+      /*                                             */
+      /*   `/glyphname' + index [+ `def']            */
+      /*   `(glyphname)' [+ `cvn'] + index [+ `def'] */
+      /*                                             */
+      /* The latter format gets created by the       */
+      /* LilyPond typesetting program.               */
 
       T1_Skip_Spaces( parser );
 
@@ -928,12 +933,13 @@
       if ( parser->root.error )
         return;
 
-      if ( *cur == '/' )
+      if ( *cur == '/' || *cur == '(' )
       {
         FT_UInt  len;
+        FT_Bool  have_literal = ( *cur == '(' );
 
 
-        if ( cur + 2 >= limit )
+        if ( cur + ( have_literal ? 3 : 2 ) >= limit )
         {
           FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
           error = FT_THROW( Invalid_File_Format );
@@ -942,6 +948,8 @@
 
         cur++;                              /* skip `/' */
         len = (FT_UInt)( parser->root.cursor - cur );
+        if ( have_literal )
+          len--;
 
         error = T1_Add_Table( name_table, n, cur, len + 1 );
         if ( error )
@@ -961,6 +969,9 @@
 
         T1_Skip_Spaces( parser );
 
+        if ( have_literal )
+          T1_Skip_PS_Token( parser );
+
         cur = parser->root.cursor;
 
         (void)T1_ToInt( parser );



reply via email to

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