[OTLayout] Minor refactoring
This commit is contained in:
parent
407fc12466
commit
c074ebc466
@ -1029,8 +1029,9 @@ struct MarkBasePosFormat1
|
||||
|
||||
/* now we search backwards for a non-mark glyph */
|
||||
hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||
do {
|
||||
if (!skippy_iter.prev (LookupFlag::IgnoreMarks)) return TRACE_RETURN (false);
|
||||
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
||||
/* We only want to attach to the first of a MultipleSubst sequence. Reject others. */
|
||||
if (0 == get_lig_comp (c->buffer->info[skippy_iter.idx])) break;
|
||||
skippy_iter.reject ();
|
||||
@ -1132,7 +1133,8 @@ struct MarkLigPosFormat1
|
||||
|
||||
/* now we search backwards for a non-mark glyph */
|
||||
hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
||||
if (!skippy_iter.prev (LookupFlag::IgnoreMarks)) return TRACE_RETURN (false);
|
||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
||||
|
||||
/* The following assertion is too strong, so we've disabled it. */
|
||||
if (!(c->buffer->info[skippy_iter.idx].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE)) {/*return TRACE_RETURN (false);*/}
|
||||
@ -1247,7 +1249,8 @@ struct MarkMarkPosFormat1
|
||||
|
||||
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
|
||||
hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
||||
if (!skippy_iter.prev (c->lookup_props & ~LookupFlag::IgnoreFlags)) return TRACE_RETURN (false);
|
||||
skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreFlags);
|
||||
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
||||
|
||||
if (!(c->buffer->info[skippy_iter.idx].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) { return TRACE_RETURN (false); }
|
||||
|
||||
|
@ -281,9 +281,9 @@ struct hb_apply_context_t
|
||||
has_glyph_classes (gdef.has_glyph_classes ()),
|
||||
debug_depth (0) {}
|
||||
|
||||
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
|
||||
void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; }
|
||||
void set_lookup (const Lookup &l) { lookup_props = l.get_props (); }
|
||||
inline void set_recurse_func (recurse_func_t func) { recurse_func = func; }
|
||||
inline void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; }
|
||||
inline void set_lookup (const Lookup &l) { lookup_props = l.get_props (); }
|
||||
|
||||
struct skipping_forward_iterator_t
|
||||
{
|
||||
@ -293,12 +293,17 @@ struct hb_apply_context_t
|
||||
bool context_match = false)
|
||||
{
|
||||
c = c_;
|
||||
lookup_props = c->lookup_props;
|
||||
idx = start_index_;
|
||||
num_items = num_items_;
|
||||
mask = context_match ? -1 : c->lookup_mask;
|
||||
syllable = context_match ? 0 : c->buffer->cur().syllable ();
|
||||
end = c->buffer->len;
|
||||
}
|
||||
inline void set_lookup_props (unsigned int lookup_props_)
|
||||
{
|
||||
lookup_props = lookup_props_;
|
||||
}
|
||||
inline bool has_no_chance (void) const
|
||||
{
|
||||
return unlikely (num_items && idx + num_items >= end);
|
||||
@ -307,7 +312,7 @@ struct hb_apply_context_t
|
||||
{
|
||||
num_items++;
|
||||
}
|
||||
inline bool next (unsigned int lookup_props)
|
||||
inline bool next (void)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
do
|
||||
@ -319,14 +324,11 @@ struct hb_apply_context_t
|
||||
num_items--;
|
||||
return (c->buffer->info[idx].mask & mask) && (!syllable || syllable == c->buffer->info[idx].syllable ());
|
||||
}
|
||||
inline bool next (void)
|
||||
{
|
||||
return next (c->lookup_props);
|
||||
}
|
||||
|
||||
unsigned int idx;
|
||||
protected:
|
||||
hb_apply_context_t *c;
|
||||
unsigned int lookup_props;
|
||||
unsigned int num_items;
|
||||
hb_mask_t mask;
|
||||
uint8_t syllable;
|
||||
@ -342,11 +344,16 @@ struct hb_apply_context_t
|
||||
bool match_syllable_ = true)
|
||||
{
|
||||
c = c_;
|
||||
lookup_props = c->lookup_props;
|
||||
idx = start_index_;
|
||||
num_items = num_items_;
|
||||
mask = mask_ ? mask_ : c->lookup_mask;
|
||||
syllable = match_syllable_ ? c->buffer->cur().syllable () : 0;
|
||||
}
|
||||
inline void set_lookup_props (unsigned int lookup_props_)
|
||||
{
|
||||
lookup_props = lookup_props_;
|
||||
}
|
||||
inline bool has_no_chance (void) const
|
||||
{
|
||||
return unlikely (idx < num_items);
|
||||
@ -355,7 +362,7 @@ struct hb_apply_context_t
|
||||
{
|
||||
num_items++;
|
||||
}
|
||||
inline bool prev (unsigned int lookup_props)
|
||||
inline bool prev (void)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
do
|
||||
@ -367,14 +374,11 @@ struct hb_apply_context_t
|
||||
num_items--;
|
||||
return (c->buffer->out_info[idx].mask & mask) && (!syllable || syllable == c->buffer->out_info[idx].syllable ());
|
||||
}
|
||||
inline bool prev (void)
|
||||
{
|
||||
return prev (c->lookup_props);
|
||||
}
|
||||
|
||||
unsigned int idx;
|
||||
protected:
|
||||
hb_apply_context_t *c;
|
||||
unsigned int lookup_props;
|
||||
unsigned int num_items;
|
||||
hb_mask_t mask;
|
||||
uint8_t syllable;
|
||||
|
Loading…
Reference in New Issue
Block a user