Minor clean up of 'rand' patchset
This commit is contained in:
parent
b545e27d88
commit
80de4bcd26
|
@ -534,10 +534,13 @@ struct AlternateSet
|
|||
|
||||
if (unlikely (!count)) return_trace (false);
|
||||
|
||||
if (c->random) {
|
||||
if (c->random)
|
||||
{
|
||||
c->random_state = (0x5DEECE66Dull * c->random_state + 11) & (((uint64_t) 1 << 48) - 1);
|
||||
c->replace_glyph (alternates[(c->random_state >> 32) % count]);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_mask_t glyph_mask = c->buffer->cur().mask;
|
||||
hb_mask_t lookup_mask = c->lookup_mask;
|
||||
|
||||
|
|
|
@ -478,11 +478,12 @@ struct hb_ot_apply_context_t :
|
|||
unsigned int nesting_level_left;
|
||||
unsigned int debug_depth;
|
||||
|
||||
bool has_glyph_classes;
|
||||
bool auto_zwnj;
|
||||
bool auto_zwj;
|
||||
bool random;
|
||||
|
||||
uint64_t random_state;
|
||||
bool has_glyph_classes;
|
||||
|
||||
|
||||
hb_ot_apply_context_t (unsigned int table_index_,
|
||||
|
@ -500,11 +501,11 @@ struct hb_ot_apply_context_t :
|
|||
lookup_props (0),
|
||||
nesting_level_left (HB_MAX_NESTING_LEVEL),
|
||||
debug_depth (0),
|
||||
has_glyph_classes (gdef.has_glyph_classes ()),
|
||||
auto_zwnj (true),
|
||||
auto_zwj (true),
|
||||
random (false),
|
||||
random_state (1),
|
||||
has_glyph_classes (gdef.has_glyph_classes ()) {}
|
||||
random_state (1) {}
|
||||
|
||||
inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; }
|
||||
inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; }
|
||||
|
|
|
@ -70,7 +70,6 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
|||
unsigned int num_user_features)
|
||||
{
|
||||
hb_ot_map_builder_t *map = &planner->map;
|
||||
bool default_rand = true;
|
||||
|
||||
map->add_global_bool_feature (HB_TAG('r','v','r','n'));
|
||||
map->add_gsub_pause (nullptr);
|
||||
|
@ -91,10 +90,14 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
|||
break;
|
||||
}
|
||||
|
||||
/* Automatic fractions. */
|
||||
map->add_feature (HB_TAG ('f','r','a','c'), 1, F_NONE);
|
||||
map->add_feature (HB_TAG ('n','u','m','r'), 1, F_NONE);
|
||||
map->add_feature (HB_TAG ('d','n','o','m'), 1, F_NONE);
|
||||
|
||||
/* Random! */
|
||||
map->add_feature (HB_TAG ('r','a','n','d'), 1, F_GLOBAL | F_RANDOM);
|
||||
|
||||
if (planner->shaper->collect_features)
|
||||
planner->shaper->collect_features (planner);
|
||||
|
||||
|
@ -118,17 +121,13 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
|||
if (planner->shaper->override_features)
|
||||
planner->shaper->override_features (planner);
|
||||
|
||||
for (unsigned int i = 0; i < num_user_features; i++) {
|
||||
for (unsigned int i = 0; i < num_user_features; i++)
|
||||
{
|
||||
const hb_feature_t *feature = &user_features[i];
|
||||
map->add_feature (feature->tag, feature->value,
|
||||
(feature->start == 0 && feature->end == (unsigned int) -1) ?
|
||||
F_GLOBAL : F_NONE);
|
||||
if (feature->tag == HB_TAG ('r','a','n','d'))
|
||||
default_rand = false;
|
||||
}
|
||||
|
||||
if (default_rand)
|
||||
map->add_feature (HB_TAG ('r','a','n','d'), 1, F_GLOBAL | F_RANDOM);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=-rand:U+0054,U+0055,U+0056:[1=0+560|2=1+602|3=2+602]
|
||||
../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602]
|
||||
#../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602]
|
||||
../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[6=0+560|9=1+602|10=2+602|6=3+560|9=4+602|12=5+602|5=6+560|8=7+602|11=8+602|6=9+560|8=10+602|10=11+602]
|
||||
|
|
Loading…
Reference in New Issue