fix build attempt

This commit is contained in:
Michiharu Ariza 2018-09-10 17:02:31 -07:00
parent cc52e53cf0
commit c6f75c3049
2 changed files with 43 additions and 43 deletions

View File

@ -584,62 +584,62 @@ struct CFF1TopDictInterpEnv : NumInterpEnv
unsigned int last_offset;
};
enum NameDictValIndex
{
version,
notice,
copyright,
fullName,
familyName,
weight,
postscript,
fontName,
baseFontName,
registry,
ordering,
NameDictValCount
};
struct NameDictValues
{
enum NameDictValIndex
{
version,
notice,
copyright,
fullName,
familyName,
weight,
postscript,
fontName,
baseFontName,
registry,
ordering,
ValCount
};
inline void init (void)
{
for (unsigned int i = 0; i < NameDictValCount; i++)
for (unsigned int i = 0; i < ValCount; i++)
values[i] = CFF_UNDEF_SID;
}
inline unsigned int& operator[] (unsigned int i)
{ assert (i < NameDictValCount); return values[i]; }
{ assert (i < ValCount); return values[i]; }
inline unsigned int operator[] (unsigned int i) const
{ assert (i < NameDictValCount); return values[i]; }
{ assert (i < ValCount); return values[i]; }
static inline enum NameDictValIndex name_op_to_index (OpCode op)
{
switch (op) {
case OpCode_version:
return NameDictValIndex::version;
return version;
case OpCode_Notice:
return NameDictValIndex::notice;
return notice;
case OpCode_Copyright:
return NameDictValIndex::copyright;
return copyright;
case OpCode_FullName:
return NameDictValIndex::fullName;
return fullName;
case OpCode_FamilyName:
return NameDictValIndex::familyName;
return familyName;
case OpCode_Weight:
return NameDictValIndex::weight;
return weight;
case OpCode_PostScript:
return NameDictValIndex::postscript;
return postscript;
case OpCode_FontName:
return NameDictValIndex::fontName;
return fontName;
default:
assert (0);
}
}
unsigned int values[NameDictValCount];
unsigned int values[ValCount];
};
struct CFF1TopDictVal : OpStr
@ -651,7 +651,7 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
{
inline void init (void)
{
TopDictValues::init ();
TopDictValues<CFF1TopDictVal>::init ();
nameSIDs.init ();
ros_supplement = 0;
@ -664,11 +664,11 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
inline void fini (void)
{
TopDictValues::fini ();
TopDictValues<CFF1TopDictVal>::fini ();
}
inline bool is_CID (void) const
{ return nameSIDs[NameDictValIndex::registry] != CFF_UNDEF_SID; }
{ return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; }
NameDictValues nameSIDs;
unsigned int ros_supplement_offset;
@ -728,8 +728,8 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
case OpCode_ROS:
if (unlikely (!env.argStack.check_pop_uint (dictval.ros_supplement) ||
!env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValIndex::ordering]) ||
!env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValIndex::registry])))
!env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValues::ordering]) ||
!env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValues::registry])))
return false;
env.clear_args ();
break;
@ -762,7 +762,7 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
default:
env.last_offset = env.substr.offset;
if (unlikely (!TopDictOpSet::process_op (op, env, dictval)))
if (unlikely (!TopDictOpSet<CFF1TopDictVal>::process_op (op, env, dictval)))
return false;
/* Record this operand below if stack is empty, otherwise done */
if (!env.argStack.is_empty ()) return true;

View File

@ -107,7 +107,7 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues
inline void reassignSIDs (const RemapSID& sidmap)
{
for (unsigned int i = 0; i < NameDictValCount; i++)
for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
nameSIDs[i] = sidmap[base->nameSIDs[i]];
}
@ -119,13 +119,13 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues
struct TopDictModifiers
{
inline TopDictModifiers (const CFF1SubTableOffsets &offsets_,
const unsigned int (&nameSIDs_)[NameDictValCount])
const unsigned int (&nameSIDs_)[NameDictValues::ValCount])
: offsets (offsets_),
nameSIDs (nameSIDs_)
{}
const CFF1SubTableOffsets &offsets;
const unsigned int (&nameSIDs)[NameDictValCount];
const unsigned int (&nameSIDs)[NameDictValues::ValCount];
};
struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
@ -177,8 +177,8 @@ struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
supp_op.str.str = opstr.str.str + opstr.last_arg_offset;
assert (opstr.str.len >= opstr.last_arg_offset + 3);
supp_op.str.len = opstr.str.len - opstr.last_arg_offset;
return_trace (UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValIndex::registry]) &&
UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValIndex::ordering]) &&
return_trace (UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValues::registry]) &&
UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValues::ordering]) &&
copy_opstr (c, supp_op));
}
default:
@ -342,7 +342,7 @@ struct cff_subset_plan {
subset_enc_supp_codes.init ();
subset_charset_ranges.init ();
sidmap.init ();
for (unsigned int i = 0; i < NameDictValCount; i++)
for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
topDictModSIDs[i] = CFF_UNDEF_SID;
}
@ -491,7 +491,7 @@ struct cff_subset_plan {
if (unlikely (!sidmap.reset (acc.stringIndex->count)))
return false;
for (unsigned int i = 0; i < NameDictValCount; i++)
for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
{
unsigned int sid = acc.topDict.nameSIDs[i];
if (sid != CFF_UNDEF_SID)
@ -714,7 +714,7 @@ struct cff_subset_plan {
bool subset_charset;
RemapSID sidmap;
unsigned int topDictModSIDs[NameDictValCount];
unsigned int topDictModSIDs[NameDictValues::ValCount];
};
static inline bool _write_cff1 (const cff_subset_plan &plan,