[math] Use dagger (#2478)

* [math] Use dagger

* [ot-math] Address Behdad's review
This commit is contained in:
Ebrahim Byagowi 2020-06-20 00:31:46 +04:30 committed by GitHub
parent 1535440b48
commit 89a2c46e61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -515,10 +515,10 @@ struct MathGlyphAssembly
if (parts_count) if (parts_count)
{ {
int64_t mult = font->dir_mult (direction); int64_t mult = font->dir_mult (direction);
hb_array_t<const MathGlyphPartRecord> arr = partRecords.sub_array (start_offset, parts_count); + hb_zip (partRecords.sub_array (start_offset, parts_count), hb_array (parts, *parts_count))
unsigned int count = arr.length; | hb_apply ([&] (hb_pair_t<const MathGlyphPartRecord &, hb_ot_math_glyph_part_t &> _)
for (unsigned int i = 0; i < count; i++) { _.first.extract (_.second, mult, font); })
arr[i].extract (parts[i], mult, font); ;
} }
if (italics_correction) if (italics_correction)
@ -563,13 +563,11 @@ struct MathGlyphConstruction
if (variants_count) if (variants_count)
{ {
int64_t mult = font->dir_mult (direction); int64_t mult = font->dir_mult (direction);
hb_array_t<const MathGlyphVariantRecord> arr = mathGlyphVariantRecord.sub_array (start_offset, variants_count); + hb_zip (mathGlyphVariantRecord.sub_array (start_offset, variants_count),
unsigned int count = arr.length; hb_array (variants, *variants_count))
for (unsigned int i = 0; i < count; i++) | hb_apply ([&] (hb_pair_t<const MathGlyphVariantRecord &, hb_ot_math_glyph_variant_t &> _)
{ { _.second = {_.first.variantGlyph, font->em_mult (_.first.advanceMeasurement, mult)}; })
variants[i].glyph = arr[i].variantGlyph; ;
variants[i].advance = font->em_mult (arr[i].advanceMeasurement, mult);
}
} }
return mathGlyphVariantRecord.len; return mathGlyphVariantRecord.len;
} }