diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh index ccbc12ac3..46f66b7bd 100644 --- a/src/hb-ot-cff-common.hh +++ b/src/hb-ot-cff-common.hh @@ -184,7 +184,8 @@ struct CFFIndex else { serialize_header(c, + it | hb_map ([] (const byte_str_t &_) { return _.length; })); - + it | hb_apply ([&] (const byte_str_t &_) { _.copy (c); }); + for (const byte_str_t &_ : +it) + _.copy (c); } return_trace (true); } @@ -221,15 +222,13 @@ struct CFFIndex return_trace (false); /* serialize indices */ - unsigned int offset = 1; - unsigned int i = 0; - + it - | hb_apply ([&] (unsigned _) - { - CFFIndex::set_offset_at (i++, offset); - offset += _; - }) - ; + unsigned int offset = 1; + unsigned int i = 0; + for (unsigned _ : +it) + { + CFFIndex::set_offset_at (i++, offset); + offset += _; + } CFFIndex::set_offset_at (i, offset); return_trace (true); @@ -418,7 +417,7 @@ struct Dict : UnsizedByteStr c->add_link (ofs, link, whence); return true; } - + static bool serialize_link4_op (hb_serialize_context_t *c, op_code_t op, objidx_t link, whence_t whence = whence_t::Head) { return serialize_link_op (c, op, link, whence); } diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index a5caf3421..1cd142b47 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -83,18 +83,16 @@ struct CmapSubtableFormat4 HBUINT16 *endCode = c->start_embed (); hb_codepoint_t prev_endcp = 0xFFFF; - + it - | hb_apply ([&] (const hb_item_type _) - { - if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first) - { - HBUINT16 end_code; - end_code = prev_endcp; - c->copy (end_code); - } - prev_endcp = _.first; - }) - ; + for (const hb_item_type _ : +it) + { + if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first) + { + HBUINT16 end_code; + end_code = prev_endcp; + c->copy (end_code); + } + prev_endcp = _.first; + } { // last endCode @@ -121,19 +119,17 @@ struct CmapSubtableFormat4 HBUINT16 *startCode = c->start_embed (); hb_codepoint_t prev_cp = 0xFFFF; - + it - | hb_apply ([&] (const hb_item_type _) - { - if (prev_cp == 0xFFFF || prev_cp + 1u != _.first) - { - HBUINT16 start_code; - start_code = _.first; - c->copy (start_code); - } + for (const hb_item_type _ : +it) + { + if (prev_cp == 0xFFFF || prev_cp + 1u != _.first) + { + HBUINT16 start_code; + start_code = _.first; + c->copy (start_code); + } - prev_cp = _.first; - }) - ; + prev_cp = _.first; + } // There must be a final entry with end_code == 0xFFFF. if (it.len () == 0 || prev_cp != 0xFFFF) @@ -162,30 +158,28 @@ struct CmapSubtableFormat4 if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size) return nullptr; - + it - | hb_apply ([&] (const hb_item_type _) - { - if (_.first == startCode[i]) - { - use_delta = true; - start_gid = _.second; - } - else if (_.second != last_gid + 1) use_delta = false; + for (const hb_item_type _ : +it) + { + if (_.first == startCode[i]) + { + use_delta = true; + start_gid = _.second; + } + else if (_.second != last_gid + 1) use_delta = false; - if (_.first == endCode[i]) - { - HBINT16 delta; - if (use_delta) delta = (int)start_gid - (int)startCode[i]; - else delta = 0; - c->copy (delta); + if (_.first == endCode[i]) + { + HBINT16 delta; + if (use_delta) delta = (int)start_gid - (int)startCode[i]; + else delta = 0; + c->copy (delta); - i++; - } + i++; + } - last_gid = _.second; - last_cp = _.first; - }) - ; + last_gid = _.second; + last_cp = _.first; + } if (it.len () == 0 || last_cp != 0xFFFF) { @@ -599,33 +593,29 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented hb_codepoint_t startCharCode = 0xFFFF, endCharCode = 0xFFFF; hb_codepoint_t glyphID = 0; - + it - | hb_apply ([&] (const hb_item_type _) - { - if (startCharCode == 0xFFFF) - { - startCharCode = _.first; - endCharCode = _.first; - glyphID = _.second; - } - else if (!_is_gid_consecutive (endCharCode, startCharCode, glyphID, _.first, _.second)) - { - CmapSubtableLongGroup grouprecord; - grouprecord.startCharCode = startCharCode; - grouprecord.endCharCode = endCharCode; - grouprecord.glyphID = glyphID; - c->copy (grouprecord); + for (const hb_item_type _ : +it) + { + if (startCharCode == 0xFFFF) + { + startCharCode = _.first; + endCharCode = _.first; + glyphID = _.second; + } + else if (!_is_gid_consecutive (endCharCode, startCharCode, glyphID, _.first, _.second)) + { + CmapSubtableLongGroup grouprecord; + grouprecord.startCharCode = startCharCode; + grouprecord.endCharCode = endCharCode; + grouprecord.glyphID = glyphID; + c->copy (grouprecord); - startCharCode = _.first; - endCharCode = _.first; - glyphID = _.second; - } - else - { - endCharCode = _.first; - } - }) - ; + startCharCode = _.first; + endCharCode = _.first; + glyphID = _.second; + } + else + endCharCode = _.first; + } CmapSubtableLongGroup record; record.startCharCode = startCharCode; diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh index b4d1906a3..fcd68e392 100644 --- a/src/hb-ot-hdmx-table.hh +++ b/src/hb-ot-hdmx-table.hh @@ -107,11 +107,8 @@ struct hdmx this->numRecords = it.len (); this->sizeDeviceRecord = DeviceRecord::get_size (it ? (*it).second.len () : 0); - + it - | hb_apply ([c] (const hb_item_type& _) { - c->start_embed ()->serialize (c, _.first, _.second); - }) - ; + for (const hb_item_type& _ : +it) + c->start_embed ()->serialize (c, _.first, _.second); return_trace (c->successful); } diff --git a/src/hb-pool.hh b/src/hb-pool.hh index 83875dbe1..dcf0faf2a 100644 --- a/src/hb-pool.hh +++ b/src/hb-pool.hh @@ -41,9 +41,7 @@ struct hb_pool_t { next = nullptr; - + hb_iter (chunks) - | hb_apply ([] (chunk_t *_) { ::free (_); }) - ; + for (chunk_t *_ : chunks) ::free (_); chunks.fini (); }