|
|
|
@ -57,6 +57,21 @@ enum |
|
|
|
|
// Reserved = 0xFFFC /* Reserved for future use — set to zero. */
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#ifndef HB_NO_VAR |
|
|
|
|
static bool axis_value_is_outside_axis_range (hb_tag_t axis_tag, float axis_value, |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const |
|
|
|
|
{ |
|
|
|
|
if (!user_axes_location->has (axis_tag)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
Triple axis_range = user_axes_location->get (axis_tag); |
|
|
|
|
if (axis_value < axis_range.minimum || axis_value > axis_range.maximum) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
struct StatAxisRecord |
|
|
|
|
{ |
|
|
|
|
int cmp (hb_tag_t key) const { return tag.cmp (key); } |
|
|
|
@ -96,23 +111,22 @@ struct AxisValueFormat1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool keep_axis_value (const hb_array_t<const StatAxisRecord> axis_records, |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float> *user_axes_location) const |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const |
|
|
|
|
{ |
|
|
|
|
hb_tag_t axis_tag = get_axis_tag (axis_records); |
|
|
|
|
float axis_value = get_value (); |
|
|
|
|
|
|
|
|
|
if (!user_axes_location->has (axis_tag) || |
|
|
|
|
fabsf(axis_value - user_axes_location->get (axis_tag)) < 0.001f) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
if (axis_value_is_outside_axis_range (axis_tag, axis_value, user_axes_location)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool subset (hb_subset_context_t *c, |
|
|
|
|
const hb_array_t<const StatAxisRecord> axis_records) const |
|
|
|
|
{ |
|
|
|
|
TRACE_SUBSET (this); |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float>* user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple>* user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
|
|
|
|
|
if (keep_axis_value (axis_records, user_axes_location)) |
|
|
|
|
return_trace (c->serializer->embed (this)); |
|
|
|
@ -155,23 +169,22 @@ struct AxisValueFormat2 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool keep_axis_value (const hb_array_t<const StatAxisRecord> axis_records, |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float> *user_axes_location) const |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const |
|
|
|
|
{ |
|
|
|
|
hb_tag_t axis_tag = get_axis_tag (axis_records); |
|
|
|
|
float axis_value = get_value (); |
|
|
|
|
|
|
|
|
|
if (!user_axes_location->has (axis_tag) || |
|
|
|
|
fabsf(axis_value - user_axes_location->get (axis_tag)) < 0.001f) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
if (axis_value_is_outside_axis_range (axis_tag, axis_value, user_axes_location)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool subset (hb_subset_context_t *c, |
|
|
|
|
const hb_array_t<const StatAxisRecord> axis_records) const |
|
|
|
|
{ |
|
|
|
|
TRACE_SUBSET (this); |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float>* user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple>* user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
|
|
|
|
|
if (keep_axis_value (axis_records, user_axes_location)) |
|
|
|
|
return_trace (c->serializer->embed (this)); |
|
|
|
@ -218,23 +231,22 @@ struct AxisValueFormat3 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool keep_axis_value (const hb_array_t<const StatAxisRecord> axis_records, |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float> *user_axes_location) const |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const |
|
|
|
|
{ |
|
|
|
|
hb_tag_t axis_tag = get_axis_tag (axis_records); |
|
|
|
|
float axis_value = get_value (); |
|
|
|
|
|
|
|
|
|
if (!user_axes_location->has (axis_tag) || |
|
|
|
|
fabsf(axis_value - user_axes_location->get (axis_tag)) < 0.001f) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
if (axis_value_is_outside_axis_range (axis_tag, axis_value, user_axes_location)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool subset (hb_subset_context_t *c, |
|
|
|
|
const hb_array_t<const StatAxisRecord> axis_records) const |
|
|
|
|
{ |
|
|
|
|
TRACE_SUBSET (this); |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float>* user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple>* user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
|
|
|
|
|
if (keep_axis_value (axis_records, user_axes_location)) |
|
|
|
|
return_trace (c->serializer->embed (this)); |
|
|
|
@ -291,7 +303,7 @@ struct AxisValueFormat4 |
|
|
|
|
{ return axisValues.as_array (axisCount)[axis_index]; } |
|
|
|
|
|
|
|
|
|
bool keep_axis_value (const hb_array_t<const StatAxisRecord> axis_records, |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float> *user_axes_location) const |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const |
|
|
|
|
{ |
|
|
|
|
hb_array_t<const AxisValueRecord> axis_value_records = axisValues.as_array (axisCount); |
|
|
|
|
|
|
|
|
@ -301,8 +313,7 @@ struct AxisValueFormat4 |
|
|
|
|
float axis_value = rec.get_value (); |
|
|
|
|
hb_tag_t axis_tag = axis_records[axis_idx].get_axis_tag (); |
|
|
|
|
|
|
|
|
|
if (user_axes_location->has (axis_tag) && |
|
|
|
|
fabsf(axis_value - user_axes_location->get (axis_tag)) > 0.001f) |
|
|
|
|
if (axis_value_is_outside_axis_range (axis_tag, axis_value, user_axes_location)) |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -313,7 +324,7 @@ struct AxisValueFormat4 |
|
|
|
|
const hb_array_t<const StatAxisRecord> axis_records) const |
|
|
|
|
{ |
|
|
|
|
TRACE_SUBSET (this); |
|
|
|
|
const hb_hashmap_t<hb_tag_t, float> *user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
const hb_hashmap_t<hb_tag_t, Triple> *user_axes_location = &c->plan->user_axes_location; |
|
|
|
|
if (!keep_axis_value (axis_records, user_axes_location)) |
|
|
|
|
return_trace (false); |
|
|
|
|
|
|
|
|
@ -402,7 +413,7 @@ struct AxisValue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool keep_axis_value (const hb_array_t<const StatAxisRecord> axis_records, |
|
|
|
|
hb_hashmap_t<hb_tag_t, float> *user_axes_location) const |
|
|
|
|
hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const |
|
|
|
|
{ |
|
|
|
|
switch (u.format) |
|
|
|
|
{ |
|
|
|
@ -517,7 +528,7 @@ struct STAT |
|
|
|
|
return axis_value.get_value_name_id (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void collect_name_ids (hb_hashmap_t<hb_tag_t, float> *user_axes_location, |
|
|
|
|
void collect_name_ids (hb_hashmap_t<hb_tag_t, Triple> *user_axes_location, |
|
|
|
|
hb_set_t *nameids_to_retain /* OUT */) const |
|
|
|
|
{ |
|
|
|
|
if (!has_data ()) return; |
|
|
|
|