If a process operation results in less pages then the current set has, it will likely corrupt the page_map since it overwrites page_map entries ahead of where it's processing. This fixes that problem by removing page_map entries that will be dropped. Then dropping orphaned pages and re-indexing retained pages.
Follow up to c184180,
It was raising,
src/hb-ot-layout-common.hh:1067:63: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
| hb_filter ([=] (const OffsetTo<TSubTable> &_) { return (this+_).intersects (glyphset, lookup_type); })
^
src/hb-ot-layout-common.hh:1067:19: note: add an explicit capture of 'this' to capture '*this' by reference
| hb_filter ([=] (const OffsetTo<TSubTable> &_) { return (this+_).intersects (glyphset, lookup_type); })
^
, this
and
src/hb-ot-layout-common.hh:2626:38: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
{ r.collect_lookups (this, lookup_indexes); })
^
src/hb-ot-layout-common.hh:2625:18: note: add an explicit capture of 'this' to capture '*this' by reference
| hb_apply ([=] (const FeatureTableSubstitutionRecord& r)
^
, this
and
src/hb-ot-hdmx-table.hh:141:44: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
return device_record->widthsZ.as_array (get_num_glyphs ()) [_];
^
src/hb-ot-hdmx-table.hh:137:17: note: add an explicit capture of 'this' to capture '*this' by reference
| hb_map ([=] (hb_codepoint_t _)
^
, this
NotoColorEmoji.ttf uses two cmap subtables
Format 14 | Platform ID 0 | Platform Encoding ID 5
Format 12 | Platform ID 3 | Platform Encoding ID 10
This combination results in the cmap table being dropped during subsetting despite being valid/required.
This will fix inconsistency with fontTools.
Also according to the spec, namerecords must be sorted
first by platform ID, then by platform-specific ID,
then by language ID, and then by name ID.
Not all codepoints smaller than 0xFFFF go to cmap4 table.
Only subset codepoints existing in each table.
This will also make harfbuzz consistent with fontTools' behavior