提交 9b34677f 编写于 作者: B Behdad Esfahbod

[OTLayout] Clean up closure() a bit

上级 adf7758a
......@@ -1141,6 +1141,13 @@ struct SubstLookup : Lookup
return TRACE_RETURN (c->default_return_value ());
}
static inline void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index);
inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
{
c->set_recurse_func (closure_recurse_func);
return process (c);
}
template <typename set_t>
inline void add_coverage (set_t *glyphs) const
{
......@@ -1173,7 +1180,6 @@ struct SubstLookup : Lookup
}
static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
inline bool apply_string (hb_apply_context_t *c, const hb_set_digest_t *digest) const
{
bool ret = false;
......@@ -1323,20 +1329,6 @@ struct GSUB : GSUBGPOS
static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer);
static inline void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
{
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index);
return l.process (c);
}
inline hb_closure_context_t::return_t closure_lookup (hb_face_t *face,
hb_set_t *glyphs,
unsigned int lookup_index) const
{
hb_closure_context_t c (face, glyphs, closure_recurse_func);
return get_lookup (lookup_index).process (&c);
}
#if 0
inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
unsigned int lookup_index) const
......@@ -1385,6 +1377,13 @@ inline bool ExtensionSubst::is_reverse (void) const
return SubstLookup::lookup_type_is_reverse (type);
}
inline void_t SubstLookup::closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
{
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index);
return l.process (c);
}
inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
{
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
......
......@@ -65,7 +65,7 @@ struct hb_closure_context_t
bool stop_sublookup_iteration (const return_t r) const { return false; }
return_t recurse (unsigned int lookup_index)
{
if (unlikely (nesting_level_left == 0))
if (unlikely (nesting_level_left == 0 || !recurse_func))
return default_return_value ();
nesting_level_left--;
......@@ -82,13 +82,14 @@ struct hb_closure_context_t
hb_closure_context_t (hb_face_t *face_,
hb_set_t *glyphs_,
recurse_func_t recurse_func_,
unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
face (face_),
glyphs (glyphs_),
recurse_func (recurse_func_),
recurse_func (NULL),
nesting_level_left (nesting_level_left_),
debug_depth (0) {}
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
};
......
......@@ -498,7 +498,11 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
unsigned int lookup_index,
hb_set_t *glyphs)
{
_get_gsub (face).closure_lookup (face, glyphs, lookup_index);
OT::hb_closure_context_t c (face, glyphs);
const OT::SubstLookup& l = _get_gsub (face).get_lookup (lookup_index);
l.closure (&c);
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册