[cmap] minor, turn 8 spaces to tab

This commit is contained in:
Ebrahim Byagowi 2019-09-21 14:19:14 +04:30
parent 4315666283
commit d8af4e7701
2 changed files with 115 additions and 115 deletions

View File

@ -677,7 +677,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
} }
DefaultUVS* copy (hb_serialize_context_t *c, DefaultUVS* copy (hb_serialize_context_t *c,
const hb_set_t *unicodes) const const hb_set_t *unicodes) const
{ {
DefaultUVS *out = c->start_embed<DefaultUVS> (); DefaultUVS *out = c->start_embed<DefaultUVS> ();
if (unlikely (!out)) return nullptr; if (unlikely (!out)) return nullptr;
@ -693,29 +693,29 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
+ as_array () + as_array ()
| hb_apply ([&] (const UnicodeValueRange& _) | hb_apply ([&] (const UnicodeValueRange& _)
{ {
+ hb_range ((unsigned)_.additionalCount + 1) + hb_range ((unsigned)_.additionalCount + 1)
| hb_apply ([&] (const unsigned addcnt) | hb_apply ([&] (const unsigned addcnt)
{ {
unsigned curEntry = (unsigned)_.startUnicodeValue + addcnt; unsigned curEntry = (unsigned)_.startUnicodeValue + addcnt;
if (!hb_set_has (unicodes, curEntry)) return; if (!hb_set_has (unicodes, curEntry)) return;
count += 1; count += 1;
if (lastCode == HB_MAP_VALUE_INVALID) if (lastCode == HB_MAP_VALUE_INVALID)
{ {
lastCode = curEntry; lastCode = curEntry;
} else if (lastCode + count != curEntry) } else if (lastCode + count != curEntry)
{ {
UnicodeValueRange rec; UnicodeValueRange rec;
rec.startUnicodeValue = lastCode; rec.startUnicodeValue = lastCode;
rec.additionalCount = count - 1; rec.additionalCount = count - 1;
c->copy<UnicodeValueRange> (rec); c->copy<UnicodeValueRange> (rec);
lastCode = curEntry; lastCode = curEntry;
count = 0; count = 0;
} }
}) })
; ;
}) })
; ;
if (lastCode != HB_MAP_VALUE_INVALID) if (lastCode != HB_MAP_VALUE_INVALID)
@ -771,7 +771,7 @@ struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
} }
void closure_glyphs (const hb_set_t *unicodes, void closure_glyphs (const hb_set_t *unicodes,
hb_set_t *glyphset) const hb_set_t *glyphset) const
{ {
+ as_array () + as_array ()
| hb_filter (unicodes, &UVSMapping::unicodeValue) | hb_filter (unicodes, &UVSMapping::unicodeValue)
@ -781,9 +781,9 @@ struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
} }
NonDefaultUVS* copy (hb_serialize_context_t *c, NonDefaultUVS* copy (hb_serialize_context_t *c,
const hb_set_t *unicodes, const hb_set_t *unicodes,
const hb_set_t *glyphs, const hb_set_t *glyphs,
const hb_map_t *glyph_map) const const hb_map_t *glyph_map) const
{ {
NonDefaultUVS *out = c->start_embed<NonDefaultUVS> (); NonDefaultUVS *out = c->start_embed<NonDefaultUVS> ();
if (unlikely (!out)) return nullptr; if (unlikely (!out)) return nullptr;
@ -791,9 +791,9 @@ struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
auto it = auto it =
+ as_array () + as_array ()
| hb_filter ([&] (const UVSMapping& _) | hb_filter ([&] (const UVSMapping& _)
{ {
return hb_set_has (unicodes, _.unicodeValue) || hb_set_has (glyphs, _.glyphID); return hb_set_has (unicodes, _.unicodeValue) || hb_set_has (glyphs, _.glyphID);
}) })
; ;
if (!it) return nullptr; if (!it) return nullptr;
@ -804,12 +804,12 @@ struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
+ it + it
| hb_apply ([&] (const UVSMapping& _) | hb_apply ([&] (const UVSMapping& _)
{ {
UVSMapping mapping; UVSMapping mapping;
mapping.unicodeValue = _.unicodeValue; mapping.unicodeValue = _.unicodeValue;
mapping.glyphID = glyph_map->get (_.glyphID); mapping.glyphID = glyph_map->get (_.glyphID);
c->copy<UVSMapping> (mapping); c->copy<UVSMapping> (mapping);
}) })
; ;
return out; return out;
@ -856,16 +856,16 @@ struct VariationSelectorRecord
} }
VariationSelectorRecord* copy (hb_serialize_context_t *c, VariationSelectorRecord* copy (hb_serialize_context_t *c,
const hb_set_t *unicodes, const hb_set_t *unicodes,
const hb_set_t *glyphs, const hb_set_t *glyphs,
const hb_map_t *glyph_map, const hb_map_t *glyph_map,
const void *src_base, const void *src_base,
const void *dst_base) const const void *dst_base) const
{ {
auto snap = c->snapshot (); auto snap = c->snapshot ();
auto *out = c->embed<VariationSelectorRecord> (*this); auto *out = c->embed<VariationSelectorRecord> (*this);
if (unlikely (!out)) return nullptr; if (unlikely (!out)) return nullptr;
out->defaultUVS = 0; out->defaultUVS = 0;
out->nonDefaultUVS = 0; out->nonDefaultUVS = 0;
@ -876,8 +876,8 @@ struct VariationSelectorRecord
c->push (); c->push ();
if (c->copy (src_base+defaultUVS, unicodes)) if (c->copy (src_base+defaultUVS, unicodes))
{ {
c->add_link (out->defaultUVS, c->pop_pack (), dst_base); c->add_link (out->defaultUVS, c->pop_pack (), dst_base);
drop = false; drop = false;
} }
else c->pop_discard (); else c->pop_discard ();
} }
@ -887,8 +887,8 @@ struct VariationSelectorRecord
c->push (); c->push ();
if (c->copy (src_base+nonDefaultUVS, unicodes, glyphs, glyph_map)) if (c->copy (src_base+nonDefaultUVS, unicodes, glyphs, glyph_map))
{ {
c->add_link (out->nonDefaultUVS, c->pop_pack (), dst_base); c->add_link (out->nonDefaultUVS, c->pop_pack (), dst_base);
drop = false; drop = false;
} }
else c->pop_discard (); else c->pop_discard ();
} }
@ -932,10 +932,10 @@ struct CmapSubtableFormat14
} }
void serialize (hb_serialize_context_t *c, void serialize (hb_serialize_context_t *c,
const hb_set_t *unicodes, const hb_set_t *unicodes,
const hb_set_t *glyphs, const hb_set_t *glyphs,
const hb_map_t *glyph_map, const hb_map_t *glyph_map,
const void *src_base) const void *src_base)
{ {
auto snap = c->snapshot (); auto snap = c->snapshot ();
unsigned table_initpos = c->length (); unsigned table_initpos = c->length ();
@ -947,9 +947,9 @@ struct CmapSubtableFormat14
const CmapSubtableFormat14 *src_tbl = reinterpret_cast<const CmapSubtableFormat14*> (src_base); const CmapSubtableFormat14 *src_tbl = reinterpret_cast<const CmapSubtableFormat14*> (src_base);
+ hb_iter (src_tbl->record) + hb_iter (src_tbl->record)
| hb_apply ([&] (const VariationSelectorRecord& _) | hb_apply ([&] (const VariationSelectorRecord& _)
{ {
c->copy (_, unicodes, glyphs, glyph_map, src_base, this); c->copy (_, unicodes, glyphs, glyph_map, src_base, this);
}) })
; ;
if (c->length () - table_initpos == CmapSubtableFormat14::min_size) if (c->length () - table_initpos == CmapSubtableFormat14::min_size)
@ -965,7 +965,7 @@ struct CmapSubtableFormat14
} }
void closure_glyphs (const hb_set_t *unicodes, void closure_glyphs (const hb_set_t *unicodes,
hb_set_t *glyphset) const hb_set_t *glyphset) const
{ {
+ hb_iter (record) + hb_iter (record)
| hb_filter (hb_bool, &VariationSelectorRecord::nonDefaultUVS) | hb_filter (hb_bool, &VariationSelectorRecord::nonDefaultUVS)
@ -1028,9 +1028,9 @@ struct CmapSubtable
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c, void serialize (hb_serialize_context_t *c,
Iterator it, Iterator it,
unsigned format, unsigned format,
const hb_subset_plan_t *plan, const hb_subset_plan_t *plan,
const void *src_base) const void *src_base)
{ {
switch (format) { switch (format) {
case 4: u.format4.serialize (c, it); return; case 4: u.format4.serialize (c, it); return;
@ -1094,12 +1094,12 @@ struct EncodingRecord
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
EncodingRecord* copy (hb_serialize_context_t *c, EncodingRecord* copy (hb_serialize_context_t *c,
Iterator it, Iterator it,
unsigned format, unsigned format,
const void *src_base, const void *src_base,
const void *dst_base, const void *dst_base,
const hb_subset_plan_t *plan, const hb_subset_plan_t *plan,
/* INOUT */ unsigned *objidx) const /* INOUT */ unsigned *objidx) const
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
auto snap = c->snapshot (); auto snap = c->snapshot ();
@ -1121,7 +1121,7 @@ struct EncodingRecord
c->revert (snap); c->revert (snap);
return_trace (nullptr); return_trace (nullptr);
} }
c->add_link (out->subtable, *objidx, dst_base); c->add_link (out->subtable, *objidx, dst_base);
return_trace (out); return_trace (out);
} }
@ -1139,12 +1139,12 @@ struct cmap
static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap; static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap;
template<typename Iterator, typename EncodingRecIter, template<typename Iterator, typename EncodingRecIter,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c, void serialize (hb_serialize_context_t *c,
Iterator it, Iterator it,
EncodingRecIter encodingrec_iter, EncodingRecIter encodingrec_iter,
const void *src_base, const void *src_base,
const hb_subset_plan_t *plan) const hb_subset_plan_t *plan)
{ {
if (unlikely (!c->extend_min ((*this)))) return; if (unlikely (!c->extend_min ((*this)))) return;
this->version = 0; this->version = 0;
@ -1153,20 +1153,20 @@ struct cmap
+ encodingrec_iter + encodingrec_iter
| hb_apply ([&] (const EncodingRecord& _) | hb_apply ([&] (const EncodingRecord& _)
{ {
unsigned format = (src_base+_.subtable).u.format; unsigned format = (src_base+_.subtable).u.format;
if (format == 4) c->copy (_, it, 4u, src_base, this, plan, &format4objidx); if (format == 4) c->copy (_, it, 4u, src_base, this, plan, &format4objidx);
else if (format == 12) c->copy (_, it, 12u, src_base, this, plan, &format12objidx); else if (format == 12) c->copy (_, it, 12u, src_base, this, plan, &format12objidx);
else if (format == 14) c->copy (_, it, 14u, src_base, this, plan, &format14objidx); else if (format == 14) c->copy (_, it, 14u, src_base, this, plan, &format14objidx);
}) })
; ;
c->check_assign(this->encodingRecord.len, (c->length () - cmap::min_size)/EncodingRecord::static_size); c->check_assign(this->encodingRecord.len, (c->length () - cmap::min_size)/EncodingRecord::static_size);
} }
void closure_glyphs (const hb_set_t *unicodes, void closure_glyphs (const hb_set_t *unicodes,
hb_set_t *glyphset) const hb_set_t *glyphset) const
{ {
+ hb_iter (encodingRecord) + hb_iter (encodingRecord)
| hb_map (&EncodingRecord::subtable) | hb_map (&EncodingRecord::subtable)
@ -1186,51 +1186,51 @@ struct cmap
auto encodingrec_iter = auto encodingrec_iter =
+ hb_iter (encodingRecord) + hb_iter (encodingRecord)
| hb_filter ([&] (const EncodingRecord& _) | hb_filter ([&] (const EncodingRecord& _)
{ {
if ((_.platformID == 0 && _.encodingID == 3) || if ((_.platformID == 0 && _.encodingID == 3) ||
(_.platformID == 0 && _.encodingID == 4) || (_.platformID == 0 && _.encodingID == 4) ||
(_.platformID == 3 && _.encodingID == 1) || (_.platformID == 3 && _.encodingID == 1) ||
(_.platformID == 3 && _.encodingID == 10) || (_.platformID == 3 && _.encodingID == 10) ||
(this + _.subtable).u.format == 14) (this + _.subtable).u.format == 14)
return true; return true;
return false; return false;
}) })
; ;
if (unlikely (!encodingrec_iter.len ())) return_trace (false); if (unlikely (!encodingrec_iter.len ())) return_trace (false);
const EncodingRecord *unicode_bmp= nullptr, *unicode_ucs4 = nullptr, *ms_bmp = nullptr, *ms_ucs4 = nullptr; const EncodingRecord *unicode_bmp= nullptr, *unicode_ucs4 = nullptr, *ms_bmp = nullptr, *ms_ucs4 = nullptr;
bool has_format12 = false, has_format14 = false; bool has_format12 = false, has_format14 = false;
+ encodingrec_iter + encodingrec_iter
| hb_apply ([&] (const EncodingRecord& _) | hb_apply ([&] (const EncodingRecord& _)
{ {
unsigned format = (this + _.subtable).u.format; unsigned format = (this + _.subtable).u.format;
if (format == 12) has_format12 = true; if (format == 12) has_format12 = true;
if (format == 14) has_format14 = true; if (format == 14) has_format14 = true;
const EncodingRecord *table = hb_addressof (_); const EncodingRecord *table = hb_addressof (_);
if (_.platformID == 0 && _.encodingID == 3) if (_.platformID == 0 && _.encodingID == 3)
{ {
unicode_bmp = table; unicode_bmp = table;
} }
else if (_.platformID == 0 && _.encodingID == 4) else if (_.platformID == 0 && _.encodingID == 4)
{ {
unicode_ucs4 = table; unicode_ucs4 = table;
} }
else if (_.platformID == 3 && _.encodingID == 1) else if (_.platformID == 3 && _.encodingID == 1)
{ {
ms_bmp = table; ms_bmp = table;
} }
else if (_.platformID == 3 && _.encodingID == 10) else if (_.platformID == 3 && _.encodingID == 10)
{ {
ms_ucs4 = table; ms_ucs4 = table;
} }
}) })
; ;
if (unlikely (!unicode_bmp && !ms_bmp)) return_trace (false); if (unlikely (!unicode_bmp && !ms_bmp)) return_trace (false);
if (unlikely (has_format12 && (!unicode_ucs4 && !ms_ucs4))) return_trace (false); if (unlikely (has_format12 && (!unicode_ucs4 && !ms_ucs4))) return_trace (false);

View File

@ -89,8 +89,8 @@ _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain)
static inline void static inline void
_cmap_closure (hb_face_t *face, _cmap_closure (hb_face_t *face,
const hb_set_t *unicodes, const hb_set_t *unicodes,
hb_set_t *glyphset) hb_set_t *glyphset)
{ {
face->table.cmap->table->closure_glyphs (unicodes, glyphset); face->table.cmap->table->closure_glyphs (unicodes, glyphset);
} }
@ -136,7 +136,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
plan->codepoint_to_glyph->set (cp, gid); plan->codepoint_to_glyph->set (cp, gid);
plan->_glyphset_gsub->add (gid); plan->_glyphset_gsub->add (gid);
} }
_cmap_closure (plan->source, plan->unicodes, plan->_glyphset_gsub); _cmap_closure (plan->source, plan->unicodes, plan->_glyphset_gsub);
#ifndef HB_NO_SUBSET_LAYOUT #ifndef HB_NO_SUBSET_LAYOUT