diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index 4a48a7cc3..82eab9633 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -128,7 +128,7 @@ struct COLR bool is_valid () { return colr.get_blob ()->length; } void closure_glyphs (hb_codepoint_t glyph, - hb_set_t *related_ids /* OUT */) const + hb_set_t *related_ids /* OUT */) const { colr->closure_glyphs (glyph, related_ids); } private: @@ -136,12 +136,13 @@ struct COLR }; void closure_glyphs (hb_codepoint_t glyph, - hb_set_t *related_ids /* OUT */) const + hb_set_t *related_ids /* OUT */) const { const BaseGlyphRecord *record = get_base_glyph_record (glyph); if (!record) return; - hb_array_t glyph_layers = (this+layersZ).as_array (numLayers).sub_array (record->firstLayerIdx, record->numLayers); + auto glyph_layers = (this+layersZ).as_array (numLayers).sub_array (record->firstLayerIdx, + record->numLayers); if (!glyph_layers.length) return; related_ids->add_array (&glyph_layers[0].glyphId, glyph_layers.length, LayerRecord::min_size); } @@ -155,12 +156,12 @@ struct COLR } template + hb_requires (hb_is_iterator (BaseIterator)), + hb_requires (hb_is_iterator (LayerIterator))> bool serialize (hb_serialize_context_t *c, - unsigned version, - BaseIterator base_it, - LayerIterator layer_it) + unsigned version, + BaseIterator base_it, + LayerIterator layer_it) { TRACE_SERIALIZE (this); if (unlikely (base_it.len () != layer_it.len ())) @@ -175,7 +176,7 @@ struct COLR for (const hb_item_type& _ : + base_it.iter ()) { - auto* record = c->embed(_); + auto* record = c->embed (_); if (unlikely (!record)) return_trace (false); record->firstLayerIdx = numLayers; numLayers += record->numLayers; @@ -206,18 +207,18 @@ struct COLR auto base_it = + hb_range (c->plan->num_output_glyphs ()) | hb_map_retains_sorting ([&](hb_codepoint_t new_gid) - { - hb_codepoint_t old_gid = reverse_glyph_map.get (new_gid); + { + hb_codepoint_t old_gid = reverse_glyph_map.get (new_gid); - const BaseGlyphRecord* old_record = get_base_glyph_record (old_gid); - if (unlikely (!old_record)) - return hb_pair_t (false, Null (BaseGlyphRecord)); + const BaseGlyphRecord* old_record = get_base_glyph_record (old_gid); + if (unlikely (!old_record)) + return hb_pair_t (false, Null (BaseGlyphRecord)); - BaseGlyphRecord new_record; - new_record.glyphId = new_gid; - new_record.numLayers = old_record->numLayers; - return hb_pair_t (true, new_record); - }) + BaseGlyphRecord new_record; + new_record.glyphId = new_gid; + new_record.numLayers = old_record->numLayers; + return hb_pair_t (true, new_record); + }) | hb_filter (hb_first) | hb_map_retains_sorting (hb_second) ; @@ -226,28 +227,28 @@ struct COLR + hb_range (c->plan->num_output_glyphs ()) | hb_map (reverse_glyph_map) | hb_map_retains_sorting ([&](hb_codepoint_t old_gid) - { - const BaseGlyphRecord* old_record = get_base_glyph_record (old_gid); - hb_vector_t out_layers; + { + const BaseGlyphRecord* old_record = get_base_glyph_record (old_gid); + hb_vector_t out_layers; - if (unlikely (!old_record || - old_record->firstLayerIdx >= numLayers || - old_record->firstLayerIdx + old_record->numLayers > numLayers)) - return hb_pair_t> (false, out_layers); + if (unlikely (!old_record || + old_record->firstLayerIdx >= numLayers || + old_record->firstLayerIdx + old_record->numLayers > numLayers)) + return hb_pair_t> (false, out_layers); - hb_array_t layers = (this+layersZ).as_array (numLayers).sub_array(old_record->firstLayerIdx, - old_record->numLayers); - out_layers.resize (layers.length); - for (unsigned int i = 0; i < layers.length; i++) { - out_layers[i] = layers[i]; - hb_codepoint_t new_gid = 0; - if (unlikely (!c->plan->new_gid_for_old_gid (out_layers[i].glyphId, &new_gid))) - return hb_pair_t> (false, out_layers); - out_layers[i].glyphId = new_gid; - } + auto layers = (this+layersZ).as_array (numLayers).sub_array (old_record->firstLayerIdx, + old_record->numLayers); + out_layers.resize (layers.length); + for (unsigned int i = 0; i < layers.length; i++) { + out_layers[i] = layers[i]; + hb_codepoint_t new_gid = 0; + if (unlikely (!c->plan->new_gid_for_old_gid (out_layers[i].glyphId, &new_gid))) + return hb_pair_t> (false, out_layers); + out_layers[i].glyphId = new_gid; + } - return hb_pair_t> (true, out_layers); - }) + return hb_pair_t> (true, out_layers); + }) | hb_filter (hb_first) | hb_map_retains_sorting (hb_second) ;