shithub: freetype+ttf2subf

Download patch

ref: 1e89d15a2708f98cacb95ec8a0f1386adf062a64
parent: 10385e379e6a0a31537cee16032e6f48aa98410d
author: suzuki toshiya <[email protected]>
date: Sat Apr 30 13:55:57 EDT 2011

[truetype] Register a set of tricky fonts, NEC FA family.

* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids):
Add 8 checksum sets for NEC FA family.  For the tricky fonts
without some tables (e.g. NEC FA fonts lack cvt table),
extra check is added to assure that 0-length table in the
registry is not included in the font.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-04-30  suzuki toshiya  <[email protected]>
+
+	[truetype] Register a set of tricky fonts, NEC FA family.
+
+	* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids):
+	Add 8 checksum sets for NEC FA family.  For the tricky fonts
+	without some tables (e.g. NEC FA fonts lack cvt table),
+	extra check is added to assure that 0-length table in the
+	registry is not included in the font.
+
 2011-04-29  suzuki toshiya  <[email protected]>
 
 	[truetype] Fix a bug in the sfnt table checksum getter.
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -242,7 +242,7 @@
   tt_check_trickyness_sfnt_ids( TT_Face  face )
   {
 #define TRICK_SFNT_IDS_PER_FACE   3
-#define TRICK_SFNT_IDS_NUM_FACES  5
+#define TRICK_SFNT_IDS_NUM_FACES  13
 
     static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
                                        [TRICK_SFNT_IDS_PER_FACE] = {
@@ -275,16 +275,60 @@
         { 0xfffbfffc, 0x00000008 }, /* cvt  */
         { 0x0a5a0483, 0x00017c39 }, /* fpgm */
         { 0x70020112, 0x00000008 }  /* prep */
+      },
+      { /* NEC fadpop7.ttf */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x40c92555, 0x000000e5 }, /* fpgm */
+        { 0xa39b58e3, 0x0000117c }  /* prep */
+      },
+      { /* NEC fadrei5.ttf */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x33c41652, 0x000000e5 }, /* fpgm */
+        { 0x26d6c52a, 0x00000f6a }  /* prep */
+      },
+      { /* NEC fangot7.ttf */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x6db1651d, 0x0000019d }, /* fpgm */
+        { 0x6c6e4b03, 0x00002492 }  /* prep */
+      },
+      { /* NEC fangyo5.ttf */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x40c92555, 0x000000e5 }, /* fpgm */
+        { 0xde51fad0, 0x0000117c }  /* prep */
+      },
+      { /* NEC fankyo5.ttf */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x85e47664, 0x000000e5 }, /* fpgm */
+        { 0xa6c62831, 0x00001caa }  /* prep */
+      },
+      { /* NEC fanrgo5.ttf */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x2d891cfd, 0x0000019d }, /* fpgm */
+        { 0xa0604633, 0x00001de8 }  /* prep */
+      },
+      { /* NEC fangot5.ttc */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x40aa774c, 0x000001cb }, /* fpgm */
+        { 0x9b5caa96, 0x00001f9a }  /* prep */
+      },
+      { /* NEC fanmin3.ttc */
+        { 0x00000000, 0x00000000 }, /* cvt  */
+        { 0x0d3de9cb, 0x00000141 }, /* fpgm */
+        { 0xd4127766, 0x00002280 }  /* prep */
       }
     };
 
     FT_ULong  checksum;
     int       num_matched_ids[TRICK_SFNT_IDS_NUM_FACES];
+    FT_Bool   has_cvt, has_fpgm, has_prep;
     int       i, j, k;
 
 
     FT_MEM_SET( num_matched_ids, 0,
                 sizeof( int ) * TRICK_SFNT_IDS_NUM_FACES );
+    has_cvt  = FALSE;
+    has_fpgm = FALSE;
+    has_prep = FALSE;
 
     for ( i = 0; i < face->num_tables; i++ )
     {
@@ -294,14 +338,17 @@
       {
       case TTAG_cvt:
         k = TRICK_SFNT_ID_cvt;
+        has_cvt  = TRUE;
         break;
 
       case TTAG_fpgm:
         k = TRICK_SFNT_ID_fpgm;
+        has_fpgm = TRUE;
         break;
 
       case TTAG_prep:
         k = TRICK_SFNT_ID_prep;
+        has_prep = TRUE;
         break;
 
       default:
@@ -320,6 +367,18 @@
           if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
             return TRUE;
         }
+    }
+
+    for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
+    {
+      if ( !has_cvt  && !sfnt_id[j][TRICK_SFNT_ID_cvt].Length )
+        num_matched_ids[j] ++;
+      if ( !has_fpgm && !sfnt_id[j][TRICK_SFNT_ID_fpgm].Length )
+        num_matched_ids[j] ++;
+      if ( !has_prep && !sfnt_id[j][TRICK_SFNT_ID_prep].Length )
+        num_matched_ids[j] ++;
+      if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
+        return TRUE;
     }
 
     return FALSE;