ensure fdmap initialized as identity for single-FD (non-CID) fonts

This commit is contained in:
Michiharu Ariza 2018-11-16 13:46:58 -08:00
parent b403be8ad9
commit b6903bd6c4
2 changed files with 12 additions and 3 deletions

View File

@ -647,8 +647,9 @@ struct cff_subset_plan {
} }
/* Determine re-mapping of font index as fdmap among other info */ /* Determine re-mapping of font index as fdmap among other info */
if (acc.fdSelect != &Null(CFF1FDSelect) if (acc.fdSelect != &Null(CFF1FDSelect))
&& unlikely (!hb_plan_subset_cff_fdselect (plan->glyphs, {
if (unlikely (!hb_plan_subset_cff_fdselect (plan->glyphs,
orig_fdcount, orig_fdcount,
*acc.fdSelect, *acc.fdSelect,
subset_fdcount, subset_fdcount,
@ -657,6 +658,9 @@ struct cff_subset_plan {
subset_fdselect_ranges, subset_fdselect_ranges,
fdmap))) fdmap)))
return false; return false;
}
else
fdmap.identity (1);
/* remove unused SIDs & reassign SIDs */ /* remove unused SIDs & reassign SIDs */
{ {
@ -790,6 +794,9 @@ struct cff_subset_plan {
unsigned int priv_size = PrivateDict::calculate_serialized_size (acc.privateDicts[i], privSzr, has_localsubrs); unsigned int priv_size = PrivateDict::calculate_serialized_size (acc.privateDicts[i], privSzr, has_localsubrs);
TableInfo privInfo = { final_size, priv_size, 0 }; TableInfo privInfo = { final_size, priv_size, 0 };
FontDictValuesMod fontdict_mod; FontDictValuesMod fontdict_mod;
if (!acc.is_CID ())
fontdict_mod.init ( &Null(CFF1FontDictValues), CFF_UNDEF_SID, privInfo );
else
fontdict_mod.init ( &acc.fontDicts[i], sidmap[acc.fontDicts[i].fontName], privInfo ); fontdict_mod.init ( &acc.fontDicts[i], sidmap[acc.fontDicts[i].fontName], privInfo );
fontdicts_mod.push (fontdict_mod); fontdicts_mod.push (fontdict_mod);
final_size += privInfo.size; final_size += privInfo.size;

View File

@ -356,6 +356,8 @@ struct cff2_subset_plan {
final_size += offsets.FDSelectInfo.size; final_size += offsets.FDSelectInfo.size;
} }
else
fdmap.identity (1);
/* FDArray (FDIndex) */ /* FDArray (FDIndex) */
{ {