Fix partial disabling of default-on features

Surprisingly, if user ever tried to turn a default feature off partially
(say, disable liga for a range), the feature was being turned off
globally!  Fixed now.
This commit is contained in:
Behdad Esfahbod 2013-02-15 07:40:10 -05:00
parent cb90b1bbe6
commit 398238a252
1 changed files with 2 additions and 3 deletions

View File

@ -194,11 +194,11 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
} else { } else {
feature_infos[j].flags &= ~F_GLOBAL; feature_infos[j].flags &= ~F_GLOBAL;
feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value); feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value);
/* Inherit default_value from j */
} }
feature_infos[j].flags |= (feature_infos[i].flags & F_HAS_FALLBACK); feature_infos[j].flags |= (feature_infos[i].flags & F_HAS_FALLBACK);
feature_infos[j].stage[0] = MIN (feature_infos[j].stage[0], feature_infos[i].stage[0]); feature_infos[j].stage[0] = MIN (feature_infos[j].stage[0], feature_infos[i].stage[0]);
feature_infos[j].stage[1] = MIN (feature_infos[j].stage[1], feature_infos[i].stage[1]); feature_infos[j].stage[1] = MIN (feature_infos[j].stage[1], feature_infos[i].stage[1]);
/* Inherit default_value from j */
} }
feature_infos.shrink (j + 1); feature_infos.shrink (j + 1);
} }
@ -252,8 +252,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
map->shift = next_bit; map->shift = next_bit;
map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit); map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);
next_bit += bits_needed; next_bit += bits_needed;
if ((info->flags & F_GLOBAL)) m.global_mask |= (info->default_value << map->shift) & map->mask;
m.global_mask |= (info->default_value << map->shift) & map->mask;
} }
map->_1_mask = (1 << map->shift) & map->mask; map->_1_mask = (1 << map->shift) & map->mask;
map->needs_fallback = !found; map->needs_fallback = !found;