[OTLayout] More collect_glyphs()
This commit is contained in:
parent
c6fb843f2a
commit
26514d51b6
|
@ -1374,10 +1374,10 @@ struct PosLookup : Lookup
|
|||
|
||||
inline bool apply_once (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY (this);
|
||||
if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props, &c->property))
|
||||
return false;
|
||||
|
||||
return process (c);
|
||||
return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (process (c));
|
||||
}
|
||||
|
||||
static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
|
||||
|
|
|
@ -50,6 +50,7 @@ struct SingleSubstFormat1
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
hb_codepoint_t glyph_id = iter.get_glyph ();
|
||||
|
@ -126,6 +127,7 @@ struct SingleSubstFormat2
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
c->input.add (iter.get_glyph ());
|
||||
|
@ -259,6 +261,7 @@ struct Sequence
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
unsigned int count = substitute.len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
c->output.add (substitute[i]);
|
||||
|
@ -316,6 +319,7 @@ struct MultipleSubstFormat1
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
(this+coverage).add_coverage (&c->input);
|
||||
unsigned int count = sequence.len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
|
@ -444,6 +448,7 @@ struct AlternateSubstFormat1
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
c->input.add (iter.get_glyph ());
|
||||
|
@ -587,6 +592,7 @@ struct Ligature
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
unsigned int count = component.len;
|
||||
for (unsigned int i = 1; i < count; i++)
|
||||
c->input.add (component[i]);
|
||||
|
@ -680,6 +686,7 @@ struct LigatureSet
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
unsigned int num_ligs = ligature.len;
|
||||
for (unsigned int i = 0; i < num_ligs; i++)
|
||||
(this+ligature[i]).collect_glyphs (c);
|
||||
|
@ -757,6 +764,7 @@ struct LigatureSubstFormat1
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
c->input.add (iter.get_glyph ());
|
||||
|
@ -919,6 +927,8 @@ struct ReverseChainSingleSubstFormat1
|
|||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
|
||||
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
|
||||
unsigned int count;
|
||||
|
@ -1145,8 +1155,16 @@ struct SubstLookup : Lookup
|
|||
|
||||
inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE (this);
|
||||
c->set_recurse_func (process_recurse_func<hb_closure_context_t>);
|
||||
return process (c);
|
||||
return TRACE_RETURN (process (c));
|
||||
}
|
||||
|
||||
inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
c->set_recurse_func (process_recurse_func<hb_collect_glyphs_context_t>);
|
||||
return TRACE_RETURN (process (c));
|
||||
}
|
||||
|
||||
template <typename set_t>
|
||||
|
@ -1174,10 +1192,10 @@ struct SubstLookup : Lookup
|
|||
|
||||
inline bool apply_once (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY (this);
|
||||
if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props, &c->property))
|
||||
return false;
|
||||
|
||||
return process (c);
|
||||
return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (process (c));
|
||||
}
|
||||
|
||||
static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
|
||||
|
@ -1330,12 +1348,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);
|
||||
|
||||
#if 0
|
||||
inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
|
||||
unsigned int lookup_index) const
|
||||
{ return get_lookup (lookup_index).process (c); }
|
||||
#endif
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!GSUBGPOS::sanitize (c))) return TRACE_RETURN (false);
|
||||
|
|
|
@ -147,15 +147,19 @@ struct hb_collect_glyphs_context_t
|
|||
inline const char *get_name (void) { return "COLLECT_GLYPHS"; }
|
||||
static const unsigned int max_debug_depth = HB_DEBUG_COLLECT_GLYPHS;
|
||||
typedef void_t return_t;
|
||||
typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
|
||||
template <typename T>
|
||||
inline return_t process (const T &obj) { obj.collect_glyphs (this); return VOID; }
|
||||
static return_t default_return_value (void) { return VOID; }
|
||||
bool stop_iteration (const return_t r) const { return false; }
|
||||
bool stop_sublookup_iteration (const return_t r) const { return false; }
|
||||
return_t recurse (unsigned int lookup_index)
|
||||
{
|
||||
#if 0
|
||||
/* XXX */
|
||||
#endif
|
||||
if (unlikely (nesting_level_left == 0 || !recurse_func))
|
||||
return default_return_value ();
|
||||
|
||||
nesting_level_left--;
|
||||
recurse_func (this, lookup_index);
|
||||
nesting_level_left++;
|
||||
return default_return_value ();
|
||||
}
|
||||
|
||||
|
@ -164,19 +168,26 @@ struct hb_collect_glyphs_context_t
|
|||
hb_set_t &input;
|
||||
hb_set_t &after;
|
||||
hb_set_t &output;
|
||||
recurse_func_t recurse_func;
|
||||
unsigned int nesting_level_left;
|
||||
unsigned int debug_depth;
|
||||
|
||||
hb_collect_glyphs_context_t (hb_face_t *face_,
|
||||
hb_set_t *glyphs_before, /* OUT. May be NULL */
|
||||
hb_set_t *glyphs_input, /* OUT. May be NULL */
|
||||
hb_set_t *glyphs_after, /* OUT. May be NULL */
|
||||
hb_set_t *glyphs_output /* OUT. May be NULL */) :
|
||||
hb_set_t *glyphs_output, /* OUT. May be NULL */
|
||||
unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
|
||||
face (face_),
|
||||
before (glyphs_before ? *glyphs_before : *hb_set_get_empty ()),
|
||||
input (glyphs_input ? *glyphs_input : *hb_set_get_empty ()),
|
||||
after (glyphs_after ? *glyphs_after : *hb_set_get_empty ()),
|
||||
output (glyphs_output ? *glyphs_output : *hb_set_get_empty ()),
|
||||
recurse_func (NULL),
|
||||
nesting_level_left (nesting_level_left_),
|
||||
debug_depth (0) {}
|
||||
|
||||
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -1005,6 +1016,11 @@ struct ContextFormat1
|
|||
}
|
||||
}
|
||||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
/* XXXXXXXXXX */
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
@ -1078,6 +1094,11 @@ struct ContextFormat2
|
|||
}
|
||||
}
|
||||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
/* XXXXXXXXXX */
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
@ -1153,6 +1174,11 @@ struct ContextFormat3
|
|||
lookup_context);
|
||||
}
|
||||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
/* XXXXXXXXXX */
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
@ -1463,6 +1489,11 @@ struct ChainContextFormat1
|
|||
}
|
||||
}
|
||||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
/* XXXXXXXXXX */
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
@ -1538,6 +1569,11 @@ struct ChainContextFormat2
|
|||
}
|
||||
}
|
||||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
/* XXXXXXXXXX */
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
@ -1634,6 +1670,11 @@ struct ChainContextFormat3
|
|||
lookup_context);
|
||||
}
|
||||
|
||||
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||
{
|
||||
/* XXXXXXXXXX */
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
|
Loading…
Reference in New Issue