context, \
(HB_DEBUG_SANITIZE ? sanitize_depth + 1 : 0)
-
-typedef struct _hb_sanitize_context_t hb_sanitize_context_t;
-struct _hb_sanitize_context_t
+struct hb_sanitize_context_t
{
const char *start, *end;
hb_bool_t writable;
unsigned int edit_count;
};
+
static HB_GNUC_UNUSED void
_hb_sanitize_init (hb_sanitize_context_t *context,
hb_blob_t *blob)
return false;
unsigned int j = buffer->in_pos + 1;
- while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, NULL))
{
if (HB_UNLIKELY (j == end))
return false;
return false;
unsigned int j = buffer->in_pos + 1;
- while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, NULL))
{
if (HB_UNLIKELY (j == end))
return false;
gpi->last = HB_OT_LAYOUT_GPOS_NO_LAST;
/* We don't handle mark glyphs here. */
- if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+ if (apply_context->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
return false;
unsigned int index = (this+coverage) (IN_CURGLYPH ());
POSITION (last_pos)->x_advance = gpi->anchor_x - entry_x;
}
- if (lookup_flag & LookupFlag::RightToLeft)
+ if (apply_context->lookup_flag & LookupFlag::RightToLeft)
{
POSITION (last_pos)->cursive_chain = last_pos - buffer->in_pos;
POSITION (last_pos)->y_offset = entry_y - gpi->anchor_y;
return false;
/* now we search backwards for a non-mark glyph */
+ unsigned int property;
unsigned int j = buffer->in_pos;
do
{
return false;
/* now we search backwards for a non-mark glyph */
+ unsigned int property;
unsigned int j = buffer->in_pos;
do
{
return false;
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
+ unsigned int property;
unsigned int j = buffer->in_pos;
do
{
if (HB_UNLIKELY (!j))
return false;
j--;
- } while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), lookup_flag, &property));
+ } while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, &property));
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
return false;
unsigned int apply_depth) const
{
unsigned int lookup_type = get_type ();
- unsigned int lookup_flag = get_flag ();
- unsigned int property;
+ hb_apply_context_t apply_context[1];
+
+ apply_context->nesting_level_left = nesting_level_left;
+ apply_context->lookup_flag = get_flag ();
- if (!_hb_ot_layout_check_glyph_property (context->face, IN_CURINFO (), lookup_flag, &property))
+ if (!_hb_ot_layout_check_glyph_property (context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++)
const GPOS &gpos = *(context->face->ot_layout.gpos);
const PosLookup &l = gpos.get_lookup (lookup_index);
- if (HB_UNLIKELY (nesting_level_left == 0))
+ if (HB_UNLIKELY (apply_context->nesting_level_left == 0))
return false;
- nesting_level_left--;
if (HB_UNLIKELY (context_length < 1))
return false;
- return l.apply_once (context, buffer, context_length, nesting_level_left, apply_depth);
+ return l.apply_once (context, buffer, context_length, apply_context->nesting_level_left - 1, apply_depth + 1);
}
/* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->face))
- _hb_ot_layout_set_glyph_property (context->face, glyph_id, property);
+ _hb_ot_layout_set_glyph_property (context->face, glyph_id, apply_context->property);
return true;
}
/* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->face))
- _hb_ot_layout_set_glyph_property (context->face, glyph_id, property);
+ _hb_ot_layout_set_glyph_property (context->face, glyph_id, apply_context->property);
return true;
}
/* This is a guess only ... */
if (_hb_ot_layout_has_new_glyph_classes (context->face))
{
+ unsigned int property = apply_context->property;
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
/* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->face))
- _hb_ot_layout_set_glyph_property (context->face, glyph_id, property);
+ _hb_ot_layout_set_glyph_property (context->face, glyph_id, apply_context->property);
return true;
}
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
- while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), lookup_flag, &property))
+ unsigned int property;
+ while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, &property))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
for ( i = 1; i < count; i++ )
{
- while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), apply_context->lookup_flag, NULL))
_hb_buffer_add_output_glyph (buffer, IN_CURGLYPH (), i, lig_id);
(buffer->in_pos)++;
TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH ();
- bool first_is_mark = !!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
+ bool first_is_mark = !!(apply_context->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
unsigned int index = (this+coverage) (glyph_id);
if (HB_LIKELY (index == NOT_COVERED))
}
- inline bool apply_once (hb_ot_layout_context_t *context,
- hb_buffer_t *buffer,
- unsigned int context_length,
- unsigned int nesting_level_left,
- unsigned int apply_depth) const
+ inline bool apply_once ( hb_ot_layout_context_t *context,
+ hb_buffer_t *buffer,
+ unsigned int context_length,
+ unsigned int nesting_level_left,
+ unsigned int apply_depth) const
{
unsigned int lookup_type = get_type ();
- unsigned int lookup_flag = get_flag ();
- unsigned int property;
+ hb_apply_context_t apply_context[1];
- if (!_hb_ot_layout_check_glyph_property (context->face, IN_CURINFO (), lookup_flag, &property))
+ apply_context->nesting_level_left = nesting_level_left;
+ apply_context->lookup_flag = get_flag ();
+
+ if (!_hb_ot_layout_check_glyph_property (context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property))
return false;
if (HB_UNLIKELY (lookup_type == SubstLookupSubTable::Extension))
const GSUB &gsub = *(context->face->ot_layout.gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index);
- if (HB_UNLIKELY (nesting_level_left == 0))
+ if (HB_UNLIKELY (apply_context->nesting_level_left == 0))
return false;
- nesting_level_left--;
if (HB_UNLIKELY (context_length < 1))
return false;
- return l.apply_once (context, buffer, context_length, nesting_level_left, apply_depth);
+ return l.apply_once (context, buffer, context_length, apply_context->nesting_level_left - 1, apply_depth + 1);
}
#define APPLY_ARG_DEF \
+ hb_apply_context_t *apply_context, \
hb_ot_layout_context_t *context, \
- hb_buffer_t *buffer, \
- unsigned int context_length HB_GNUC_UNUSED, \
- unsigned int nesting_level_left HB_GNUC_UNUSED, \
- unsigned int lookup_flag HB_GNUC_UNUSED, \
- unsigned int property HB_GNUC_UNUSED, /* propety of first glyph */ \
- unsigned int apply_depth HB_GNUC_UNUSED
+ hb_buffer_t *buffer, \
+ unsigned int context_length HB_GNUC_UNUSED, \
+ unsigned int apply_depth HB_GNUC_UNUSED
#define APPLY_ARG \
+ apply_context, \
context, \
buffer, \
context_length, \
- nesting_level_left, \
- lookup_flag, \
- property, \
(HB_DEBUG_APPLY ? apply_depth + 1 : 0)
+struct hb_apply_context_t
+{
+ unsigned int nesting_level_left;
+ unsigned int lookup_flag;
+ unsigned int property; /* propety of first glyph (TODO remove) */
+};
+
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const char *data);
typedef bool (*apply_lookup_func_t) (APPLY_ARG_DEF, unsigned int lookup_index);
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
- while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, NULL))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
for (unsigned int i = 0, j = buffer->out_pos - 1; i < count; i++, j--)
{
- while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), apply_context->lookup_flag, NULL))
{
if (HB_UNLIKELY (j + 1 == count - i))
return false;
for (i = 0, j = buffer->in_pos + offset; i < count; i++, j++)
{
- while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), apply_context->lookup_flag, NULL))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
*/
for (unsigned int i = 0; i < count; /* NOP */)
{
- while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), apply_context->lookup_flag, NULL))
{
if (HB_UNLIKELY (buffer->in_pos == end))
return true;