[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.
This commit is contained in:
suzuki toshiya 2011-04-30 17:55:57 +09:00
parent 10385e379e
commit 1e89d15a27
2 changed files with 70 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2011-04-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[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 <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Fix a bug in the sfnt table checksum getter.

View File

@ -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:
@ -322,6 +369,18 @@
}
}
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;
}