summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh179
1 files changed, 89 insertions, 90 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
index 72dc0ef3e01..1effdf006cd 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
@@ -193,20 +193,20 @@ struct Encoding {
bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int enc_count,
- const hb_vector_t<code_pair>& code_ranges,
- const hb_vector_t<code_pair>& supp_codes)
+ const hb_vector_t<code_pair_t>& code_ranges,
+ const hb_vector_t<code_pair_t>& supp_codes)
{
TRACE_SERIALIZE (this);
Encoding *dest = c->extend_min (*this);
if (unlikely (dest == nullptr)) return_trace (false);
- dest->format.set (format | ((supp_codes.len > 0)? 0x80: 0));
+ dest->format.set (format | ((supp_codes.length > 0)? 0x80: 0));
if (format == 0)
{
Encoding0 *fmt0 = c->allocate_size<Encoding0> (Encoding0::min_size + HBUINT8::static_size * enc_count);
if (unlikely (fmt0 == nullptr)) return_trace (false);
fmt0->nCodes.set (enc_count);
unsigned int glyph = 0;
- for (unsigned int i = 0; i < code_ranges.len; i++)
+ for (unsigned int i = 0; i < code_ranges.length; i++)
{
hb_codepoint_t code = code_ranges[i].code;
for (int left = (int)code_ranges[i].glyph; left >= 0; left--)
@@ -217,10 +217,10 @@ struct Encoding {
}
else
{
- Encoding1 *fmt1 = c->allocate_size<Encoding1> (Encoding1::min_size + Encoding1_Range::static_size * code_ranges.len);
+ Encoding1 *fmt1 = c->allocate_size<Encoding1> (Encoding1::min_size + Encoding1_Range::static_size * code_ranges.length);
if (unlikely (fmt1 == nullptr)) return_trace (false);
- fmt1->nRanges.set (code_ranges.len);
- for (unsigned int i = 0; i < code_ranges.len; i++)
+ fmt1->nRanges.set (code_ranges.length);
+ for (unsigned int i = 0; i < code_ranges.length; i++)
{
if (unlikely (!((code_ranges[i].code <= 0xFF) && (code_ranges[i].glyph <= 0xFF))))
return_trace (false);
@@ -228,12 +228,12 @@ struct Encoding {
fmt1->ranges[i].nLeft.set (code_ranges[i].glyph);
}
}
- if (supp_codes.len > 0)
+ if (supp_codes.length > 0)
{
- CFF1SuppEncData *suppData = c->allocate_size<CFF1SuppEncData> (CFF1SuppEncData::min_size + SuppEncoding::static_size * supp_codes.len);
+ CFF1SuppEncData *suppData = c->allocate_size<CFF1SuppEncData> (CFF1SuppEncData::min_size + SuppEncoding::static_size * supp_codes.length);
if (unlikely (suppData == nullptr)) return_trace (false);
- suppData->nSups.set (supp_codes.len);
- for (unsigned int i = 0; i < supp_codes.len; i++)
+ suppData->nSups.set (supp_codes.length);
+ for (unsigned int i = 0; i < supp_codes.length; i++)
{
suppData->supps[i].code.set (supp_codes[i].code);
suppData->supps[i].glyph.set (supp_codes[i].glyph); /* actually SID */
@@ -467,7 +467,7 @@ struct Charset {
bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int num_glyphs,
- const hb_vector_t<code_pair>& sid_ranges)
+ const hb_vector_t<code_pair_t>& sid_ranges)
{
TRACE_SERIALIZE (this);
Charset *dest = c->extend_min (*this);
@@ -478,7 +478,7 @@ struct Charset {
Charset0 *fmt0 = c->allocate_size<Charset0> (Charset0::min_size + HBUINT16::static_size * (num_glyphs - 1));
if (unlikely (fmt0 == nullptr)) return_trace (false);
unsigned int glyph = 0;
- for (unsigned int i = 0; i < sid_ranges.len; i++)
+ for (unsigned int i = 0; i < sid_ranges.length; i++)
{
hb_codepoint_t sid = sid_ranges[i].code;
for (int left = (int)sid_ranges[i].glyph; left >= 0; left--)
@@ -487,9 +487,9 @@ struct Charset {
}
else if (format == 1)
{
- Charset1 *fmt1 = c->allocate_size<Charset1> (Charset1::min_size + Charset1_Range::static_size * sid_ranges.len);
+ Charset1 *fmt1 = c->allocate_size<Charset1> (Charset1::min_size + Charset1_Range::static_size * sid_ranges.length);
if (unlikely (fmt1 == nullptr)) return_trace (false);
- for (unsigned int i = 0; i < sid_ranges.len; i++)
+ for (unsigned int i = 0; i < sid_ranges.length; i++)
{
if (unlikely (!(sid_ranges[i].glyph <= 0xFF)))
return_trace (false);
@@ -499,9 +499,9 @@ struct Charset {
}
else /* format 2 */
{
- Charset2 *fmt2 = c->allocate_size<Charset2> (Charset2::min_size + Charset2_Range::static_size * sid_ranges.len);
+ Charset2 *fmt2 = c->allocate_size<Charset2> (Charset2::min_size + Charset2_Range::static_size * sid_ranges.length);
if (unlikely (fmt2 == nullptr)) return_trace (false);
- for (unsigned int i = 0; i < sid_ranges.len; i++)
+ for (unsigned int i = 0; i < sid_ranges.length; i++)
{
if (unlikely (!(sid_ranges[i].glyph <= 0xFFFF)))
return_trace (false);
@@ -573,7 +573,7 @@ struct Charset {
struct CFF1StringIndex : CFF1Index
{
bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings,
- unsigned int offSize_, const Remap &sidmap)
+ unsigned int offSize_, const remap_t &sidmap)
{
TRACE_SERIALIZE (this);
if (unlikely ((strings.count == 0) || (sidmap.get_count () == 0)))
@@ -584,7 +584,7 @@ struct CFF1StringIndex : CFF1Index
return_trace (true);
}
- ByteStrArray bytesArray;
+ byte_str_array_t bytesArray;
bytesArray.init ();
if (!bytesArray.resize (sidmap.get_count ()))
return_trace (false);
@@ -601,7 +601,7 @@ struct CFF1StringIndex : CFF1Index
}
/* in parallel to above */
- unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const Remap &sidmap) const
+ unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const remap_t &sidmap) const
{
offSize = 0;
if ((count == 0) || (sidmap.get_count () == 0))
@@ -617,18 +617,18 @@ struct CFF1StringIndex : CFF1Index
}
};
-struct CFF1TopDictInterpEnv : NumInterpEnv
+struct cff1_top_dict_interp_env_t : num_interp_env_t
{
- CFF1TopDictInterpEnv ()
- : NumInterpEnv(), prev_offset(0), last_offset(0) {}
+ cff1_top_dict_interp_env_t ()
+ : num_interp_env_t(), prev_offset(0), last_offset(0) {}
unsigned int prev_offset;
unsigned int last_offset;
};
-struct NameDictValues
+struct name_dict_values_t
{
- enum NameDictValIndex
+ enum name_dict_val_index_t
{
version,
notice,
@@ -657,7 +657,7 @@ struct NameDictValues
unsigned int operator[] (unsigned int i) const
{ assert (i < ValCount); return values[i]; }
- static enum NameDictValIndex name_op_to_index (OpCode op)
+ static enum name_dict_val_index_t name_op_to_index (op_code_t op)
{
switch (op) {
default: // can't happen - just make some compiler happy
@@ -685,16 +685,16 @@ struct NameDictValues
unsigned int values[ValCount];
};
-struct CFF1TopDictVal : OpStr
+struct cff1_top_dict_val_t : op_str_t
{
unsigned int last_arg_offset;
};
-struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
+struct cff1_top_dict_values_t : top_dict_values_t<cff1_top_dict_val_t>
{
void init ()
{
- TopDictValues<CFF1TopDictVal>::init ();
+ top_dict_values_t<cff1_top_dict_val_t>::init ();
nameSIDs.init ();
ros_supplement = 0;
@@ -704,12 +704,12 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
FDSelectOffset = 0;
privateDictInfo.init ();
}
- void fini () { TopDictValues<CFF1TopDictVal>::fini (); }
+ void fini () { top_dict_values_t<cff1_top_dict_val_t>::fini (); }
bool is_CID () const
- { return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; }
+ { return nameSIDs[name_dict_values_t::registry] != CFF_UNDEF_SID; }
- NameDictValues nameSIDs;
+ name_dict_values_t nameSIDs;
unsigned int ros_supplement_offset;
unsigned int ros_supplement;
unsigned int cidCount;
@@ -717,14 +717,14 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
unsigned int EncodingOffset;
unsigned int CharsetOffset;
unsigned int FDSelectOffset;
- TableInfo privateDictInfo;
+ table_info_t privateDictInfo;
};
-struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
+struct cff1_top_dict_opset_t : top_dict_opset_t<cff1_top_dict_val_t>
{
- static void process_op (OpCode op, CFF1TopDictInterpEnv& env, CFF1TopDictValues& dictval)
+ static void process_op (op_code_t op, cff1_top_dict_interp_env_t& env, cff1_top_dict_values_t& dictval)
{
- CFF1TopDictVal val;
+ cff1_top_dict_val_t val;
val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */
switch (op) {
@@ -736,7 +736,7 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
case OpCode_Weight:
case OpCode_PostScript:
case OpCode_BaseFontName:
- dictval.nameSIDs[NameDictValues::name_op_to_index (op)] = env.argStack.pop_uint ();
+ dictval.nameSIDs[name_dict_values_t::name_op_to_index (op)] = env.argStack.pop_uint ();
env.clear_args ();
break;
case OpCode_isFixedPitch:
@@ -765,8 +765,8 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
case OpCode_ROS:
dictval.ros_supplement = env.argStack.pop_uint ();
- dictval.nameSIDs[NameDictValues::ordering] = env.argStack.pop_uint ();
- dictval.nameSIDs[NameDictValues::registry] = env.argStack.pop_uint ();
+ dictval.nameSIDs[name_dict_values_t::ordering] = env.argStack.pop_uint ();
+ dictval.nameSIDs[name_dict_values_t::registry] = env.argStack.pop_uint ();
env.clear_args ();
break;
@@ -794,8 +794,8 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
break;
default:
- env.last_offset = env.substr.offset;
- TopDictOpSet<CFF1TopDictVal>::process_op (op, env, dictval);
+ env.last_offset = env.str_ref.offset;
+ top_dict_opset_t<cff1_top_dict_val_t>::process_op (op, env, dictval);
/* Record this operand below if stack is empty, otherwise done */
if (!env.argStack.is_empty ()) return;
break;
@@ -803,27 +803,27 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
if (unlikely (env.in_error ())) return;
- dictval.add_op (op, env.substr, val);
+ dictval.add_op (op, env.str_ref, val);
}
};
-struct CFF1FontDictValues : DictValues<OpStr>
+struct cff1_font_dict_values_t : dict_values_t<op_str_t>
{
void init ()
{
- DictValues<OpStr>::init ();
+ dict_values_t<op_str_t>::init ();
privateDictInfo.init ();
fontName = CFF_UNDEF_SID;
}
- void fini () { DictValues<OpStr>::fini (); }
+ void fini () { dict_values_t<op_str_t>::fini (); }
- TableInfo privateDictInfo;
+ table_info_t privateDictInfo;
unsigned int fontName;
};
-struct CFF1FontDictOpSet : DictOpSet
+struct cff1_font_dict_opset_t : dict_opset_t
{
- static void process_op (OpCode op, NumInterpEnv& env, CFF1FontDictValues& dictval)
+ static void process_op (op_code_t op, num_interp_env_t& env, cff1_font_dict_values_t& dictval)
{
switch (op) {
case OpCode_FontName:
@@ -841,36 +841,36 @@ struct CFF1FontDictOpSet : DictOpSet
break;
default:
- DictOpSet::process_op (op, env);
+ dict_opset_t::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
}
if (unlikely (env.in_error ())) return;
- dictval.add_op (op, env.substr);
+ dictval.add_op (op, env.str_ref);
}
};
template <typename VAL>
-struct CFF1PrivateDictValues_Base : DictValues<VAL>
+struct cff1_private_dict_values_base_t : dict_values_t<VAL>
{
void init ()
{
- DictValues<VAL>::init ();
+ dict_values_t<VAL>::init ();
subrsOffset = 0;
localSubrs = &Null(CFF1Subrs);
}
- void fini () { DictValues<VAL>::fini (); }
+ void fini () { dict_values_t<VAL>::fini (); }
unsigned int calculate_serialized_size () const
{
unsigned int size = 0;
- for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++)
- if (DictValues<VAL>::get_value (i).op == OpCode_Subrs)
+ for (unsigned int i = 0; i < dict_values_t<VAL>::get_count; i++)
+ if (dict_values_t<VAL>::get_value (i).op == OpCode_Subrs)
size += OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Subrs);
else
- size += DictValues<VAL>::get_value (i).str.len;
+ size += dict_values_t<VAL>::get_value (i).str.length;
return size;
}
@@ -878,14 +878,14 @@ struct CFF1PrivateDictValues_Base : DictValues<VAL>
const CFF1Subrs *localSubrs;
};
-typedef CFF1PrivateDictValues_Base<OpStr> CFF1PrivateDictValues_Subset;
-typedef CFF1PrivateDictValues_Base<NumDictVal> CFF1PrivateDictValues;
+typedef cff1_private_dict_values_base_t<op_str_t> cff1_private_dict_values_subset_t;
+typedef cff1_private_dict_values_base_t<num_dict_val_t> cff1_private_dict_values_t;
-struct CFF1PrivateDictOpSet : DictOpSet
+struct cff1_private_dict_opset_t : dict_opset_t
{
- static void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues& dictval)
+ static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_t& dictval)
{
- NumDictVal val;
+ num_dict_val_t val;
val.init ();
switch (op) {
@@ -917,20 +917,20 @@ struct CFF1PrivateDictOpSet : DictOpSet
break;
default:
- DictOpSet::process_op (op, env);
+ dict_opset_t::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
}
if (unlikely (env.in_error ())) return;
- dictval.add_op (op, env.substr, val);
+ dictval.add_op (op, env.str_ref, val);
}
};
-struct CFF1PrivateDictOpSet_Subset : DictOpSet
+struct cff1_private_dict_opset_subset : dict_opset_t
{
- static void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues_Subset& dictval)
+ static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_subset_t& dictval)
{
switch (op) {
case OpCode_BlueValues:
@@ -959,25 +959,24 @@ struct CFF1PrivateDictOpSet_Subset : DictOpSet
break;
default:
- DictOpSet::process_op (op, env);
+ dict_opset_t::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
}
if (unlikely (env.in_error ())) return;
- dictval.add_op (op, env.substr);
+ dictval.add_op (op, env.str_ref);
}
};
-typedef DictInterpreter<CFF1TopDictOpSet, CFF1TopDictValues, CFF1TopDictInterpEnv> CFF1TopDict_Interpreter;
-typedef DictInterpreter<CFF1FontDictOpSet, CFF1FontDictValues> CFF1FontDict_Interpreter;
-typedef DictInterpreter<CFF1PrivateDictOpSet, CFF1PrivateDictValues> CFF1PrivateDict_Interpreter;
+typedef dict_interpreter_t<cff1_top_dict_opset_t, cff1_top_dict_values_t, cff1_top_dict_interp_env_t> cff1_top_dict_interpreter_t;
+typedef dict_interpreter_t<cff1_font_dict_opset_t, cff1_font_dict_values_t> cff1_font_dict_interpreter_t;
typedef CFF1Index CFF1NameIndex;
typedef CFF1IndexOf<TopDict> CFF1TopDictIndex;
-}; /* namespace CFF */
+} /* namespace CFF */
namespace OT {
@@ -985,7 +984,7 @@ using namespace CFF;
struct cff1
{
- static const hb_tag_t tableTag = HB_OT_TAG_cff1;
+ static constexpr hb_tag_t tableTag = HB_OT_TAG_cff1;
bool sanitize (hb_sanitize_context_t *c) const
{
@@ -1023,9 +1022,9 @@ struct cff1
{ fini (); return; }
{ /* parse top dict */
- const ByteStr topDictStr = (*topDictIndex)[0];
+ const byte_str_t topDictStr = (*topDictIndex)[0];
if (unlikely (!topDictStr.sanitize (&sc))) { fini (); return; }
- CFF1TopDict_Interpreter top_interp;
+ cff1_top_dict_interpreter_t top_interp;
top_interp.env.init (topDictStr);
topDict.init ();
if (unlikely (!top_interp.interpret (topDict))) { fini (); return; }
@@ -1082,24 +1081,24 @@ struct cff1
{
for (unsigned int i = 0; i < fdCount; i++)
{
- ByteStr fontDictStr = (*fdArray)[i];
+ byte_str_t fontDictStr = (*fdArray)[i];
if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; }
- CFF1FontDictValues *font;
- CFF1FontDict_Interpreter font_interp;
+ cff1_font_dict_values_t *font;
+ cff1_font_dict_interpreter_t font_interp;
font_interp.env.init (fontDictStr);
font = fontDicts.push ();
- if (unlikely (font == &Crap(CFF1FontDictValues))) { fini (); return; }
+ if (unlikely (font == &Crap(cff1_font_dict_values_t))) { fini (); return; }
font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
PRIVDICTVAL *priv = &privateDicts[i];
- const ByteStr privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size);
+ const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size);
if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; }
- DictInterpreter<PRIVOPSET, PRIVDICTVAL> priv_interp;
+ dict_interpreter_t<PRIVOPSET, PRIVDICTVAL> priv_interp;
priv_interp.env.init (privDictStr);
priv->init ();
if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; }
- priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (privDictStr.str, priv->subrsOffset);
+ priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset);
if (priv->localSubrs != &Null(CFF1Subrs) &&
unlikely (!priv->localSubrs->sanitize (&sc)))
{ fini (); return; }
@@ -1107,17 +1106,17 @@ struct cff1
}
else /* non-CID */
{
- CFF1TopDictValues *font = &topDict;
+ cff1_top_dict_values_t *font = &topDict;
PRIVDICTVAL *priv = &privateDicts[0];
- const ByteStr privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size);
+ const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size);
if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; }
- DictInterpreter<PRIVOPSET, PRIVDICTVAL> priv_interp;
+ dict_interpreter_t<PRIVOPSET, PRIVDICTVAL> priv_interp;
priv_interp.env.init (privDictStr);
priv->init ();
if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; }
- priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (privDictStr.str, priv->subrsOffset);
+ priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset);
if (priv->localSubrs != &Null(CFF1Subrs) &&
unlikely (!priv->localSubrs->sanitize (&sc)))
{ fini (); return; }
@@ -1167,20 +1166,20 @@ struct cff1
const CFF1FDSelect *fdSelect;
unsigned int fdCount;
- CFF1TopDictValues topDict;
- hb_vector_t<CFF1FontDictValues> fontDicts;
+ cff1_top_dict_values_t topDict;
+ hb_vector_t<cff1_font_dict_values_t> fontDicts;
hb_vector_t<PRIVDICTVAL> privateDicts;
unsigned int num_glyphs;
};
- struct accelerator_t : accelerator_templ_t<CFF1PrivateDictOpSet, CFF1PrivateDictValues>
+ struct accelerator_t : accelerator_templ_t<cff1_private_dict_opset_t, cff1_private_dict_values_t>
{
HB_INTERNAL bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const;
HB_INTERNAL bool get_seac_components (hb_codepoint_t glyph, hb_codepoint_t *base, hb_codepoint_t *accent) const;
};
- struct accelerator_subset_t : accelerator_templ_t<CFF1PrivateDictOpSet_Subset, CFF1PrivateDictValues_Subset>
+ struct accelerator_subset_t : accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t>
{
void init (hb_face_t *face)
{
@@ -1257,7 +1256,7 @@ struct cff1
const Encoding *encoding;
private:
- typedef accelerator_templ_t<CFF1PrivateDictOpSet_Subset, CFF1PrivateDictValues_Subset> SUPER;
+ typedef accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t> SUPER;
};
bool subset (hb_subset_plan_t *plan) const