shithub: freetype+ttf2subf

Download patch

ref: cc7bb80bdea0fe0f60f6f01e3c0a054fa100bd48
parent: 118e651b0b14e842818bf40e14b2e547d0d0c97c
author: Werner Lemberg <[email protected]>
date: Mon Oct 20 04:35:50 EDT 2014

[sbit] Minor fixes.

* src/sfnt/ttsbit.c (tt_face_load_sbit) [TT_SBIT_TABLE_TYPE_SBIX]:
Accept overlay format also, but emit warning message in that case.
(tt_sbit_decoder_load_metrics): Add missing newline to error
message.
(tt_sbit_load_sbix_image): Add `rgbl' graphic type (as used on iOS
7.1) to the list of unsupported formats.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-10-20  Werner Lemberg  <[email protected]>
+
+	[sbit] Minor fixes.
+
+	* src/sfnt/ttsbit.c (tt_face_load_sbit) [TT_SBIT_TABLE_TYPE_SBIX]:
+	Accept overlay format also, but emit warning message in that case.
+	(tt_sbit_decoder_load_metrics): Add missing newline to error
+	message.
+	(tt_sbit_load_sbix_image): Add `rgbl' graphic type (as used on iOS
+	7.1) to the list of unsupported formats.
+
 2014-10-19  Alexei Podtelezhnikov  <[email protected]>
 
 	[truetype] Clean up bytecode rounding.
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1016,7 +1016,6 @@
     if ( is_apple_sbix )
       has_outline = FALSE;
 
-
     /* if this font doesn't contain outlines, we try to load */
     /* a `bhed' table                                        */
     if ( !has_outline && sfnt->load_bhed )
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -150,12 +150,25 @@
           error = FT_THROW( Unknown_File_Format );
           goto Exit;
         }
-        if ( flags != 0x0001 || num_strikes >= 0x10000UL )
+
+        /* Bit 0 must always be `1'.                            */
+        /* Bit 1 controls the overlay of bitmaps with outlines. */
+        /* All other bits should be zero.                       */
+        if ( !( flags == 1 || flags == 3 ) ||
+             num_strikes >= 0x10000UL      )
         {
           error = FT_THROW( Invalid_File_Format );
           goto Exit;
         }
 
+        /* we currently don't support bit 1; however, it is better to */
+        /* draw at least something...                                 */
+        if ( flags == 3 )
+          FT_TRACE1(( "tt_face_load_sbit_strikes:"
+                      " sbix overlay not supported yet\n"
+                      "                          "
+                      " expect bad rendering results\n" ));
+
         /*
          *  Count the number of strikes available in the table.  We are a bit
          *  paranoid there and don't trust the data.
@@ -518,7 +531,7 @@
     return FT_Err_Ok;
 
   Fail:
-    FT_TRACE1(( "tt_sbit_decoder_load_metrics: broken table" ));
+    FT_TRACE1(( "tt_sbit_decoder_load_metrics: broken table\n" ));
     return FT_THROW( Invalid_Argument );
   }
 
@@ -1342,6 +1355,7 @@
 
     case FT_MAKE_TAG( 'j', 'p', 'g', ' ' ):
     case FT_MAKE_TAG( 't', 'i', 'f', 'f' ):
+    case FT_MAKE_TAG( 'r', 'g', 'b', 'l' ): /* used on iOS 7.1 */
       error = FT_THROW( Unknown_File_Format );
       break;