Fix applying default-value for features
Previously if a default global feature was overrided by a non-global
user feature, we were not setting any default mask for the feature,
essentially disabling the feature by default. Fix that.
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 94be14f..8c696f8 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -98,7 +98,8 @@
feature_infos[j] = feature_infos[i];
else {
feature_infos[j].global = false;
- feature_infos[j].value = MAX (feature_infos[j].value, feature_infos[i].value);
+ feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value);
+ /* Inherit default_value from j */
}
}
feature_count = j + 1;
@@ -112,13 +113,13 @@
unsigned int bits_needed;
- if (info->global && info->value == 1)
+ if (info->global && info->max_value == 1)
/* Uses the global bit */
bits_needed = 0;
else
- bits_needed = _hb_bit_storage (info->value);
+ bits_needed = _hb_bit_storage (info->max_value);
- if (!info->value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
+ if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
continue; /* Feature disabled, or not enough bits. */
@@ -140,7 +141,7 @@
map->tag = info->tag;
map->index[0] = feature_index[0];
map->index[1] = feature_index[1];
- if (info->global && info->value == 1) {
+ if (info->global && info->max_value == 1) {
/* Uses the global bit */
map->shift = 0;
map->mask = 1;
@@ -149,7 +150,7 @@
map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);
next_bit += bits_needed;
if (info->global)
- global_mask |= map->mask;
+ global_mask |= ((info->default_value << map->shift) & map->mask);
}
}