diff --git a/src/hb-ot-cff-common-private.hh b/src/hb-ot-cff-common-private.hh index a5262954a..e22ee8718 100644 --- a/src/hb-ot-cff-common-private.hh +++ b/src/hb-ot-cff-common-private.hh @@ -54,7 +54,7 @@ inline unsigned int calcOffSize(unsigned int offset) /* CFF INDEX */ template -struct Index +struct CFFIndex { inline bool sanitize (hb_sanitize_context_t *c) const { @@ -73,11 +73,11 @@ struct Index inline static unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize) { return min_size + calculate_offset_array_size (offSize, count) + dataSize; } - inline bool serialize (hb_serialize_context_t *c, const Index &src) + inline bool serialize (hb_serialize_context_t *c, const CFFIndex &src) { TRACE_SERIALIZE (this); unsigned int size = src.get_size (); - Index *dest = c->allocate_size (size); + CFFIndex *dest = c->allocate_size (size); if (unlikely (dest == nullptr)) return_trace (false); memcpy (dest, &src, size); return_trace (true); @@ -88,7 +88,7 @@ struct Index const hb_vector_t &byteArray) { TRACE_SERIALIZE (this); - /* serialize Index header */ + /* serialize CFFIndex header */ if (unlikely (!c->extend_min (*this))) return_trace (false); this->count.set (byteArray.len); this->offSize.set (offSize_); @@ -158,12 +158,12 @@ struct Index inline unsigned int get_size (void) const { - if (this != &Null(Index)) + if (this != &Null(CFFIndex)) { if (count > 0) return min_size + offset_array_size () + (offset_at (count) - 1); else - return count.static_size; /* empty Index contains count only */ + return count.static_size; /* empty CFFIndex contains count only */ } else return 0; @@ -191,12 +191,12 @@ struct Index }; template -struct IndexOf : Index +struct IndexOf : CFFIndex { inline const ByteStr operator [] (unsigned int index) const { - if (likely (index < Index::count)) - return ByteStr (Index::data_base () + Index::offset_at (index) - 1, Index::length_at (index)); + if (likely (index < CFFIndex::count)) + return ByteStr (CFFIndex::data_base () + CFFIndex::offset_at (index) - 1, CFFIndex::length_at (index)); return Null(ByteStr); } @@ -209,7 +209,7 @@ struct IndexOf : Index const PARAM2 ¶m2) { TRACE_SERIALIZE (this); - /* serialize Index header */ + /* serialize CFFIndex header */ if (unlikely (!c->extend_min (*this))) return_trace (false); this->count.set (dataArray.len); this->offSize.set (offSize_); @@ -221,10 +221,10 @@ struct IndexOf : Index unsigned int i = 0; for (; i < dataArray.len; i++) { - Index::set_offset_at (i, offset); + CFFIndex::set_offset_at (i, offset); offset += dataSizeArray[i]; } - Index::set_offset_at (i, offset); + CFFIndex::set_offset_at (i, offset); /* serialize data */ for (unsigned int i = 0; i < dataArray.len; i++) @@ -254,7 +254,7 @@ struct IndexOf : Index } offSize_ = calcOffSize (totalDataSize); - return Index::calculate_serialized_size (offSize_, dataArray.len, totalDataSize); + return CFFIndex::calculate_serialized_size (offSize_, dataArray.len, totalDataSize); } }; @@ -407,7 +407,7 @@ struct FDArray : IndexOf dictsSize += FontDict::calculate_serialized_size (fontDicts[i], opszr); offSize_ = calcOffSize (dictsSize + 1); - return Index::calculate_serialized_size (offSize_, fdCount, dictsSize); + return CFFIndex::calculate_serialized_size (offSize_, fdCount, dictsSize); } }; @@ -552,7 +552,7 @@ struct FDSelect { }; template -struct Subrs : Index +struct Subrs : CFFIndex { inline bool serialize (hb_serialize_context_t *c, const Subrs &subrs, unsigned int offSize, const hb_set_t *set, const ByteStr& nullStr = ByteStr()) { @@ -561,7 +561,7 @@ struct Subrs : Index { if (!unlikely (c->allocate_size (COUNT::static_size))) return_trace (false); - Index::count.set (0); + CFFIndex::count.set (0); return_trace (true); } @@ -572,7 +572,7 @@ struct Subrs : Index for (hb_codepoint_t i = 0; i < subrs.count; i++) bytesArray[i] = (hb_set_has (set, i))? subrs[i]: nullStr; - bool result = Index::serialize (c, offSize, bytesArray); + bool result = CFFIndex::serialize (c, offSize, bytesArray); bytesArray.fini (); return_trace (result); } @@ -580,7 +580,7 @@ struct Subrs : Index /* in parallel to above */ inline unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const hb_set_t *set, unsigned int nullStrSize = 0) const { - unsigned int count_ = Index::count; + unsigned int count_ = CFFIndex::count; offSize = 0; if ((count_ == 0) || (hb_set_get_population (set) == 0)) return COUNT::static_size; @@ -594,7 +594,7 @@ struct Subrs : Index dataSize += nullStrSize; } offSize = calcOffSize(dataSize); - return Index::calculate_serialized_size (offSize, count_, dataSize); + return CFFIndex::calculate_serialized_size (offSize, count_, dataSize); } }; diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index b794bbaaf..f2a255c70 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -38,10 +38,10 @@ namespace CFF { */ #define HB_OT_TAG_cff1 HB_TAG('C','F','F',' ') -typedef Index CFF1Index; +typedef CFFIndex CFF1Index; template struct CFF1IndexOf : IndexOf {}; -typedef Index CFF1Index; +typedef CFFIndex CFF1Index; typedef CFF1Index CFF1CharStrings; typedef FDArray CFF1FDArray; typedef Subrs CFF1Subrs; diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index 71e00c4bb..f5d356d4e 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -38,7 +38,7 @@ namespace CFF { */ #define HB_OT_TAG_cff2 HB_TAG('C','F','F','2') -typedef Index CFF2Index; +typedef CFFIndex CFF2Index; template struct CFF2IndexOf : IndexOf {}; typedef CFF2Index CFF2CharStrings; diff --git a/src/hb-subset-cff2.cc b/src/hb-subset-cff2.cc index 4f865d6c6..7835523a9 100644 --- a/src/hb-subset-cff2.cc +++ b/src/hb-subset-cff2.cc @@ -312,7 +312,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, assert (cff2->topDict + plan.offsets.topDictSize == c.head - c.start); CFF2Subrs *dest = c.start_embed (); if (unlikely (dest == nullptr)) return false; - CFF::Index *super = dest; + CFFIndex *super = dest; if (unlikely (!super->serialize (&c, *acc.globalSubrs))) { DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 global subrs"); @@ -409,7 +409,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, DEBUG_MSG (SUBSET, nullptr, "CFF2 subset: local subrs unexpectedly null [%d]", i); return false; } - CFF::Index *super = subrs; + CFFIndex *super = subrs; if (unlikely (!super->serialize (&c, *acc.privateDicts[i].localSubrs))) { DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 local subrs [%d]", i);