{
TRACE_APPLY (this);
+ hb_mask_t trak_mask = c->plan->trak_mask;
+
const float ptem = c->font->ptem;
if (unlikely (ptem <= 0.f))
return_trace (false);
hb_position_t advance_to_add = c->font->em_scalef_x (tracking);
foreach_grapheme (buffer, start, end)
{
+ if (!(buffer->info[start].mask & trak_mask)) continue;
buffer->pos[start].x_advance += advance_to_add;
buffer->pos[start].x_offset += offset_to_add;
}
hb_position_t advance_to_add = c->font->em_scalef_y (tracking);
foreach_grapheme (buffer, start, end)
{
+ if (!(buffer->info[start].mask & trak_mask)) continue;
buffer->pos[start].y_advance += advance_to_add;
buffer->pos[start].y_offset += offset_to_add;
}
plan.shaper = shaper;
map.compile (plan.map, coords, num_coords);
- plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m'));
plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c'));
plan.numr_mask = plan.map.get_1_mask (HB_TAG ('n','u','m','r'));
plan.dnom_mask = plan.map.get_1_mask (HB_TAG ('d','n','o','m'));
plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask);
+ plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m'));
hb_tag_t kern_tag = HB_DIRECTION_IS_HORIZONTAL (plan.props.direction) ?
HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n');
plan.kern_mask = plan.map.get_mask (kern_tag);
+ plan.trak_mask = plan.map.get_mask (HB_TAG ('t','r','a','k'));
plan.requested_kerning = !!plan.kern_mask;
+ plan.requested_tracking = !!plan.trak_mask;
bool has_gpos_kern = plan.map.get_feature_index (1, kern_tag) != HB_OT_LAYOUT_NO_FEATURE_INDEX;
bool disable_gpos = plan.shaper->gpos_tag &&
plan.shaper->gpos_tag != plan.map.chosen_script[1];
plan.fallback_mark_positioning = true;
/* Currently we always apply trak. */
- plan.apply_trak = hb_aat_layout_has_tracking (face) &&
- plan.map.needs_fallback (HB_TAG ('t','r','a','k'));
+ plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking (face);
}
/* Random! */
map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE);
- /* Tracking. */
+ /* Tracking. We enable dummy feature here just to allow disabling
+ * AAT 'trak' table using features.
+ * https://github.com/harfbuzz/harfbuzz/issues/1303 */
map->enable_feature (HB_TAG ('t','r','a','k'), F_HAS_FALLBACK);
map->enable_feature (HB_TAG ('H','A','R','F'));
../fonts/TestTRAK.ttf:--font-ptem=144:U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1@-107,0+786|C.alt=2@-107,0+786]
../fonts/TestTRAK.ttf:--font-ptem=144:U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1@-107,0+786|C.alt=2@-107,0+786]
../fonts/TestTRAK.ttf:--font-ptem=144 --features=-trak:U+0041,U+0042,U+0043:[A.alt=0+1000|B=1+1000|C.alt=2+1000]
+../fonts/TestTRAK.ttf:--font-ptem=144 --features=-trak[1;3]:U+0041,U+0042,U+0043,U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1+1000|C.alt=2+1000|A.alt=3@-107,0+786|B=4@-107,0+786|C.alt=5@-107,0+786]