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
{
inline void init (void)
{
- TopDictValues::init ();
+ TopDictValues<CFF1TopDictVal>::init ();
nameSIDs.init ();
ros_supplement = 0;
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;
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;
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;
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]];
}
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>
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:
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;
}
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)
bool subset_charset;
RemapSID sidmap;
- unsigned int topDictModSIDs[NameDictValCount];
+ unsigned int topDictModSIDs[NameDictValues::ValCount];
};
static inline bool _write_cff1 (const cff_subset_plan &plan,