This commit is contained in:
Behdad Esfahbod 2018-10-02 14:45:09 +02:00
parent 729f634728
commit 94d15528f8
2 changed files with 18 additions and 20 deletions

View File

@ -175,6 +175,7 @@ enum hb_ot_map_feature_flags_t
F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */ F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */
F_MANUAL_JOINERS = F_MANUAL_ZWNJ | F_MANUAL_ZWJ, F_MANUAL_JOINERS = F_MANUAL_ZWNJ | F_MANUAL_ZWJ,
F_GLOBAL_MANUAL_JOINERS= F_GLOBAL | F_MANUAL_JOINERS, F_GLOBAL_MANUAL_JOINERS= F_GLOBAL | F_MANUAL_JOINERS,
F_GLOBAL_HAS_FALLBACK = F_GLOBAL | F_HAS_FALLBACK,
F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */ F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */
F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */
}; };

View File

@ -70,24 +70,26 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
} }
static hb_tag_t common_features[] = static const hb_ot_map_feature_t
common_features[] =
{ {
HB_TAG('c','c','m','p'), {HB_TAG('c','c','m','p'), F_GLOBAL},
HB_TAG('l','o','c','l'), {HB_TAG('l','o','c','l'), F_GLOBAL},
HB_TAG('m','a','r','k'), {HB_TAG('m','a','r','k'), F_GLOBAL_MANUAL_JOINERS},
HB_TAG('m','k','m','k'), {HB_TAG('m','k','m','k'), F_GLOBAL_MANUAL_JOINERS},
HB_TAG('r','l','i','g'), {HB_TAG('r','l','i','g'), F_GLOBAL},
}; };
static hb_tag_t horizontal_features[] = static const hb_ot_map_feature_t
horizontal_features[] =
{ {
HB_TAG('c','a','l','t'), {HB_TAG('c','a','l','t'), F_GLOBAL},
HB_TAG('c','l','i','g'), {HB_TAG('c','l','i','g'), F_GLOBAL},
HB_TAG('c','u','r','s'), {HB_TAG('c','u','r','s'), F_GLOBAL},
HB_TAG('k','e','r','n'), {HB_TAG('k','e','r','n'), F_GLOBAL_HAS_FALLBACK},
HB_TAG('l','i','g','a'), {HB_TAG('l','i','g','a'), F_GLOBAL},
HB_TAG('r','c','l','t'), {HB_TAG('r','c','l','t'), F_GLOBAL},
}; };
static void static void
@ -129,16 +131,11 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
planner->shaper->collect_features (planner); planner->shaper->collect_features (planner);
for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++) for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++)
map->add_feature (common_features[i], F_GLOBAL | map->add_feature (common_features[i]);
(common_features[i] == HB_TAG('m','a','r','k') ||
common_features[i] == HB_TAG('m','k','m','k') ?
F_MANUAL_JOINERS : F_NONE));
if (HB_DIRECTION_IS_HORIZONTAL (props->direction)) if (HB_DIRECTION_IS_HORIZONTAL (props->direction))
for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++) for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++)
map->add_feature (horizontal_features[i], F_GLOBAL | map->add_feature (horizontal_features[i]);
(horizontal_features[i] == HB_TAG('k','e','r','n') ?
F_HAS_FALLBACK : F_NONE));
else else
{ {
/* We really want to find a 'vert' feature if there's any in the font, no /* We really want to find a 'vert' feature if there's any in the font, no