To be used in the next patch.
hb_face_t *face;
const hb_codepoint_t *glyphs;
unsigned int len;
+ bool zero_context;
const hb_set_digest_t digest;
unsigned int debug_depth;
hb_would_apply_context_t (hb_face_t *face_,
const hb_codepoint_t *glyphs_,
unsigned int len_,
+ bool zero_context_,
const hb_set_digest_t *digest_
) :
face (face_),
glyphs (glyphs_),
len (len_),
+ zero_context (zero_context_),
digest (*digest_),
debug_depth (0) {};
};
const LookupRecord lookupRecord[],
ChainContextApplyLookupContext &lookup_context)
{
- return !backtrackCount
- && !lookaheadCount
+ return (c->zero_context ? !backtrackCount && !lookaheadCount : true)
&& would_match_input (c,
inputCount, input,
lookup_context.funcs.match, lookup_context.match_data[1]);
HB_INTERNAL hb_bool_t
hb_ot_layout_would_substitute_lookup_fast (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index);
+ hb_bool_t zero_context);
/* Should be called before all the substitute_lookup's are done. */
hb_bool_t
hb_ot_layout_would_substitute_lookup (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index)
+ hb_bool_t zero_context)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return false;
- return hb_ot_layout_would_substitute_lookup_fast (face, glyphs, glyphs_length, lookup_index);
+ return hb_ot_layout_would_substitute_lookup_fast (face, lookup_index, glyphs, glyphs_length, zero_context);
}
hb_bool_t
hb_ot_layout_would_substitute_lookup_fast (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index)
+ hb_bool_t zero_context)
{
if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
- hb_would_apply_context_t c (face, glyphs, glyphs_length, &hb_ot_layout_from_face (face)->gsub_digests[lookup_index]);
+ hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context, &hb_ot_layout_from_face (face)->gsub_digests[lookup_index]);
return hb_ot_layout_from_face (face)->gsub->would_substitute_lookup (&c, lookup_index);
}
void
hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
- hb_set_t *glyphs,
- unsigned int lookup_index)
+ unsigned int lookup_index,
+ hb_set_t *glyphs)
{
hb_closure_context_t c (face, glyphs);
_get_gsub (face).closure_lookup (&c, lookup_index);
hb_bool_t
hb_ot_layout_would_substitute_lookup (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index);
+ hb_bool_t zero_context);
void
hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
- hb_set_t *glyphs,
- unsigned int lookup_index);
+ unsigned int lookup_index,
+ hb_set_t *glyphs);
/*
* GPOS
void hb_ot_map_t::substitute_closure (const hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const
{
unsigned int table_index = 0;
- unsigned int i = 0;
-
- for (unsigned int pause_index = 0; pause_index < pauses[table_index].len; pause_index++) {
- const pause_map_t *pause = &pauses[table_index][pause_index];
- for (; i < pause->num_lookups; i++)
- hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
- }
-
- for (; i < lookups[table_index].len; i++)
- hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
+ for (unsigned int i = 0; i < lookups[table_index].len; i++)
+ hb_ot_layout_substitute_closure_lookup (face, lookups[table_index][i].index, glyphs);
}
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
hb_face_t *face) const
{
for (unsigned int i = 0; i < count; i++)
- if (hb_ot_layout_would_substitute_lookup_fast (face, glyphs, glyphs_count, lookups[i].index))
+ if (hb_ot_layout_would_substitute_lookup_fast (face, lookups[i].index, glyphs, glyphs_count, true))
return true;
return false;
}
(argc > 4 &&
!hb_font_glyph_from_string (font, argv[4], -1, &glyphs[1])))
return 2;
- return !hb_ot_layout_would_substitute_lookup (face, glyphs, len, strtol (argv[2], NULL, 0));
+ return !hb_ot_layout_would_substitute_lookup (face, strtol (argv[2], NULL, 0), glyphs, len, false);
}