|
|
|
@ -2475,6 +2475,12 @@ struct VarRegionAxis |
|
|
|
|
* have to do that at runtime. */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool serialize (hb_serialize_context_t *c) const |
|
|
|
|
{ |
|
|
|
|
TRACE_SERIALIZE (this); |
|
|
|
|
return_trace (c->embed (this)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
F2DOT14 startCoord; |
|
|
|
|
F2DOT14 peakCoord; |
|
|
|
@ -2532,6 +2538,47 @@ struct VarRegionList |
|
|
|
|
return_trace (c->check_struct (this) && axesZ.sanitize (c, axisCount * regionCount)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool serialize (hb_serialize_context_t *c, |
|
|
|
|
const hb_vector_t<hb_tag_t>& axis_tags, |
|
|
|
|
const hb_vector_t<const hb_hashmap_t<hb_tag_t, Triple>*>& regions) |
|
|
|
|
{ |
|
|
|
|
TRACE_SERIALIZE (this); |
|
|
|
|
unsigned axis_count = axis_tags.length; |
|
|
|
|
unsigned region_count = regions.length; |
|
|
|
|
if (!axis_count || !region_count) return_trace (false); |
|
|
|
|
if (unlikely (hb_unsigned_mul_overflows (axis_count * region_count, |
|
|
|
|
VarRegionAxis::static_size))) return_trace (false); |
|
|
|
|
if (unlikely (!c->extend_min (this))) return_trace (false); |
|
|
|
|
axisCount = axis_count; |
|
|
|
|
regionCount = region_count; |
|
|
|
|
|
|
|
|
|
for (unsigned r = 0; r < region_count; r++) |
|
|
|
|
{ |
|
|
|
|
const auto& region = regions[r]; |
|
|
|
|
for (unsigned i = 0; i < axis_count; i++) |
|
|
|
|
{ |
|
|
|
|
hb_tag_t tag = axis_tags.arrayZ[i]; |
|
|
|
|
VarRegionAxis var_region_rec; |
|
|
|
|
Triple *coords; |
|
|
|
|
if (region->has (tag, &coords)) |
|
|
|
|
{ |
|
|
|
|
var_region_rec.startCoord.set_float (coords->minimum); |
|
|
|
|
var_region_rec.peakCoord.set_float (coords->middle); |
|
|
|
|
var_region_rec.endCoord.set_float (coords->maximum); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
var_region_rec.startCoord.set_int (0); |
|
|
|
|
var_region_rec.peakCoord.set_int (0); |
|
|
|
|
var_region_rec.endCoord.set_int (0); |
|
|
|
|
} |
|
|
|
|
if (!var_region_rec.serialize (c)) |
|
|
|
|
return_trace (false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return_trace (true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool serialize (hb_serialize_context_t *c, const VarRegionList *src, const hb_inc_bimap_t ®ion_map) |
|
|
|
|
{ |
|
|
|
|
TRACE_SERIALIZE (this); |
|
|
|
|