This commit is contained in:
Behdad Esfahbod 2010-04-29 02:24:25 -04:00
parent 1376fb7bf9
commit b4c7fab762
3 changed files with 78 additions and 78 deletions

View File

@ -87,7 +87,7 @@ struct ValueFormat : USHORT
inline unsigned int get_size () const inline unsigned int get_size () const
{ return get_len () * Value::get_size (); } { return get_len () * Value::get_size (); }
void apply_value (hb_ot_layout_context_t *context, void apply_value (hb_ot_layout_context_t *layout_context,
const char *base, const char *base,
const Value *values, const Value *values,
hb_internal_glyph_position_t *glyph_pos) const hb_internal_glyph_position_t *glyph_pos) const
@ -98,16 +98,16 @@ struct ValueFormat : USHORT
if (!format) return; if (!format) return;
x_scale = context->font->x_scale; x_scale = layout_context->font->x_scale;
y_scale = context->font->y_scale; y_scale = layout_context->font->y_scale;
/* design units -> fractional pixel */ /* design units -> fractional pixel */
if (format & xPlacement) glyph_pos->x_offset += _hb_16dot16_mul_round (x_scale, *(SHORT*)values++); if (format & xPlacement) glyph_pos->x_offset += _hb_16dot16_mul_round (x_scale, *(SHORT*)values++);
if (format & yPlacement) glyph_pos->y_offset += _hb_16dot16_mul_round (y_scale, *(SHORT*)values++); if (format & yPlacement) glyph_pos->y_offset += _hb_16dot16_mul_round (y_scale, *(SHORT*)values++);
if (format & xAdvance) glyph_pos->x_advance += _hb_16dot16_mul_round (x_scale, *(SHORT*)values++); if (format & xAdvance) glyph_pos->x_advance += _hb_16dot16_mul_round (x_scale, *(SHORT*)values++);
if (format & yAdvance) glyph_pos->y_advance += _hb_16dot16_mul_round (y_scale, *(SHORT*)values++); if (format & yAdvance) glyph_pos->y_advance += _hb_16dot16_mul_round (y_scale, *(SHORT*)values++);
x_ppem = context->font->x_ppem; x_ppem = layout_context->font->x_ppem;
y_ppem = context->font->y_ppem; y_ppem = layout_context->font->y_ppem;
/* pixel -> fractional pixel */ /* pixel -> fractional pixel */
if (format & xPlaDevice) { if (format & xPlaDevice) {
if (x_ppem) glyph_pos->x_offset += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 16; else values++; if (x_ppem) glyph_pos->x_offset += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 16; else values++;
@ -194,11 +194,11 @@ struct AnchorFormat1
friend struct Anchor; friend struct Anchor;
private: private:
inline void get_anchor (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_GNUC_UNUSED, inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_GNUC_UNUSED,
hb_position_t *x, hb_position_t *y) const hb_position_t *x, hb_position_t *y) const
{ {
*x = _hb_16dot16_mul_round (context->font->x_scale, xCoordinate); *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
*y = _hb_16dot16_mul_round (context->font->y_scale, yCoordinate); *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
@ -218,13 +218,13 @@ struct AnchorFormat2
friend struct Anchor; friend struct Anchor;
private: private:
inline void get_anchor (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id, inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id,
hb_position_t *x, hb_position_t *y) const hb_position_t *x, hb_position_t *y) const
{ {
/* TODO Contour /* TODO Contour
* NOTE only adjust directions with nonzero ppem */ * NOTE only adjust directions with nonzero ppem */
*x = _hb_16dot16_mul_round (context->font->x_scale, xCoordinate); *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
*y = _hb_16dot16_mul_round (context->font->y_scale, yCoordinate); *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
@ -245,17 +245,17 @@ struct AnchorFormat3
friend struct Anchor; friend struct Anchor;
private: private:
inline void get_anchor (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_GNUC_UNUSED, inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_GNUC_UNUSED,
hb_position_t *x, hb_position_t *y) const hb_position_t *x, hb_position_t *y) const
{ {
*x = _hb_16dot16_mul_round (context->font->x_scale, xCoordinate); *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
*y = _hb_16dot16_mul_round (context->font->y_scale, yCoordinate); *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
/* pixel -> fractional pixel */ /* pixel -> fractional pixel */
if (context->font->x_ppem) if (layout_context->font->x_ppem)
*x += (this+xDeviceTable).get_delta (context->font->x_ppem) << 16; *x += (this+xDeviceTable).get_delta (layout_context->font->x_ppem) << 16;
if (context->font->y_ppem) if (layout_context->font->y_ppem)
*y += (this+yDeviceTable).get_delta (context->font->y_ppem) << 16; *y += (this+yDeviceTable).get_delta (layout_context->font->y_ppem) << 16;
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
@ -280,15 +280,15 @@ ASSERT_SIZE (AnchorFormat3, 10);
struct Anchor struct Anchor
{ {
inline void get_anchor (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id, inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id,
hb_position_t *x, hb_position_t *y) const hb_position_t *x, hb_position_t *y) const
{ {
*x = *y = 0; *x = *y = 0;
switch (u.format) { switch (u.format) {
case 1: u.format1->get_anchor (context, glyph_id, x, y); return; case 1: u.format1->get_anchor (layout_context, glyph_id, x, y); return;
case 2: u.format2->get_anchor (context, glyph_id, x, y); return; case 2: u.format2->get_anchor (layout_context, glyph_id, x, y); return;
case 3: u.format3->get_anchor (context, glyph_id, x, y); return; case 3: u.format3->get_anchor (layout_context, glyph_id, x, y); return;
default: return; default: return;
} }
} }
@ -375,8 +375,8 @@ struct MarkArray
hb_position_t mark_x, mark_y, base_x, base_y; hb_position_t mark_x, mark_y, base_x, base_y;
mark_anchor.get_anchor (context, IN_CURGLYPH (), &mark_x, &mark_y); mark_anchor.get_anchor (layout_context, IN_CURGLYPH (), &mark_x, &mark_y);
glyph_anchor.get_anchor (context, IN_GLYPH (glyph_pos), &base_x, &base_y); glyph_anchor.get_anchor (layout_context, IN_GLYPH (glyph_pos), &base_x, &base_y);
hb_internal_glyph_position_t *o = POSITION (buffer->in_pos); hb_internal_glyph_position_t *o = POSITION (buffer->in_pos);
o->x_advance = 0; o->x_advance = 0;
@ -415,7 +415,7 @@ struct SinglePosFormat1
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
valueFormat.apply_value (context, CharP(this), values, CURPOSITION ()); valueFormat.apply_value (layout_context, CharP(this), values, CURPOSITION ());
buffer->in_pos++; buffer->in_pos++;
return true; return true;
@ -455,7 +455,7 @@ struct SinglePosFormat2
if (HB_LIKELY (index >= valueCount)) if (HB_LIKELY (index >= valueCount))
return false; return false;
valueFormat.apply_value (context, CharP(this), valueFormat.apply_value (layout_context, CharP(this),
&values[index * valueFormat.get_len ()], &values[index * valueFormat.get_len ()],
CURPOSITION ()); CURPOSITION ());
@ -566,7 +566,7 @@ struct PairPosFormat1
return false; return false;
unsigned int j = buffer->in_pos + 1; unsigned int j = buffer->in_pos + 1;
while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), apply_context->lookup_flag, NULL))
{ {
if (HB_UNLIKELY (j == end)) if (HB_UNLIKELY (j == end))
return false; return false;
@ -584,8 +584,8 @@ struct PairPosFormat1
{ {
if (IN_GLYPH (j) == record->secondGlyph) if (IN_GLYPH (j) == record->secondGlyph)
{ {
valueFormat1.apply_value (context, CharP(this), &record->values[0], CURPOSITION ()); valueFormat1.apply_value (layout_context, CharP(this), &record->values[0], CURPOSITION ());
valueFormat2.apply_value (context, CharP(this), &record->values[len1], POSITION (j)); valueFormat2.apply_value (layout_context, CharP(this), &record->values[len1], POSITION (j));
if (len2) if (len2)
j++; j++;
buffer->in_pos = j; buffer->in_pos = j;
@ -658,7 +658,7 @@ struct PairPosFormat2
return false; return false;
unsigned int j = buffer->in_pos + 1; unsigned int j = buffer->in_pos + 1;
while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), apply_context->lookup_flag, NULL))
{ {
if (HB_UNLIKELY (j == end)) if (HB_UNLIKELY (j == end))
return false; return false;
@ -675,8 +675,8 @@ struct PairPosFormat2
return false; return false;
const Value *v = &values[record_len * (klass1 * class2Count + klass2)]; const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
valueFormat1.apply_value (context, CharP(this), v, CURPOSITION ()); valueFormat1.apply_value (layout_context, CharP(this), v, CURPOSITION ());
valueFormat2.apply_value (context, CharP(this), v + len1, POSITION (j)); valueFormat2.apply_value (layout_context, CharP(this), v + len1, POSITION (j));
if (len2) if (len2)
j++; j++;
@ -908,7 +908,7 @@ struct CursivePosFormat1
Since horizontal advance widths or vertical advance heights Since horizontal advance widths or vertical advance heights
can be used alone but not together, no ambiguity occurs. */ can be used alone but not together, no ambiguity occurs. */
struct hb_ot_layout_context_t::info_t::gpos_t *gpi = &context->info.gpos; struct hb_ot_layout_context_t::info_t::gpos_t *gpi = &layout_context->info.gpos;
hb_codepoint_t last_pos = gpi->last; hb_codepoint_t last_pos = gpi->last;
gpi->last = HB_OT_LAYOUT_GPOS_NO_LAST; gpi->last = HB_OT_LAYOUT_GPOS_NO_LAST;
@ -926,7 +926,7 @@ struct CursivePosFormat1
goto end; goto end;
hb_position_t entry_x, entry_y; hb_position_t entry_x, entry_y;
(this+record.entryAnchor).get_anchor (context, IN_CURGLYPH (), &entry_x, &entry_y); (this+record.entryAnchor).get_anchor (layout_context, IN_CURGLYPH (), &entry_x, &entry_y);
/* TODO vertical */ /* TODO vertical */
@ -956,7 +956,7 @@ struct CursivePosFormat1
if (record.exitAnchor) if (record.exitAnchor)
{ {
gpi->last = buffer->in_pos; gpi->last = buffer->in_pos;
(this+record.exitAnchor).get_anchor (context, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y); (this+record.exitAnchor).get_anchor (layout_context, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
} }
buffer->in_pos++; buffer->in_pos++;
@ -1035,7 +1035,7 @@ struct MarkBasePosFormat1
if (HB_UNLIKELY (!j)) if (HB_UNLIKELY (!j))
return false; return false;
j--; j--;
} while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property)); } while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
#if 0 #if 0
/* The following assertion is too strong. */ /* The following assertion is too strong. */
@ -1135,7 +1135,7 @@ struct MarkLigPosFormat1
if (HB_UNLIKELY (!j)) if (HB_UNLIKELY (!j))
return false; return false;
j--; j--;
} while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property)); } while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
#if 0 #if 0
/* The following assertion is too strong. */ /* The following assertion is too strong. */
@ -1252,7 +1252,7 @@ struct MarkMarkPosFormat1
if (HB_UNLIKELY (!j)) if (HB_UNLIKELY (!j))
return false; return false;
j--; j--;
} while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, &property)); } while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), apply_context->lookup_flag, &property));
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
return false; return false;
@ -1450,7 +1450,7 @@ struct PosLookup : Lookup
inline const PosLookupSubTable& get_subtable (unsigned int i) const inline const PosLookupSubTable& get_subtable (unsigned int i) const
{ return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; } { return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; }
inline bool apply_once (hb_ot_layout_context_t *context, inline bool apply_once (hb_ot_layout_context_t *layout_context,
hb_buffer_t *buffer, hb_buffer_t *buffer,
unsigned int context_length, unsigned int context_length,
unsigned int nesting_level_left, unsigned int nesting_level_left,
@ -1462,7 +1462,7 @@ struct PosLookup : Lookup
apply_context->nesting_level_left = nesting_level_left; apply_context->nesting_level_left = nesting_level_left;
apply_context->lookup_flag = get_flag (); apply_context->lookup_flag = get_flag ();
if (!_hb_ot_layout_check_glyph_property (context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property)) if (!_hb_ot_layout_check_glyph_property (layout_context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property))
return false; return false;
for (unsigned int i = 0; i < get_subtable_count (); i++) for (unsigned int i = 0; i < get_subtable_count (); i++)
@ -1472,7 +1472,7 @@ struct PosLookup : Lookup
return false; return false;
} }
inline bool apply_string (hb_ot_layout_context_t *context, inline bool apply_string (hb_ot_layout_context_t *layout_context,
hb_buffer_t *buffer, hb_buffer_t *buffer,
hb_mask_t mask) const hb_mask_t mask) const
{ {
@ -1481,7 +1481,7 @@ struct PosLookup : Lookup
if (HB_UNLIKELY (!buffer->in_length)) if (HB_UNLIKELY (!buffer->in_length))
return false; return false;
context->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */ layout_context->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */
buffer->in_pos = 0; buffer->in_pos = 0;
while (buffer->in_pos < buffer->in_length) while (buffer->in_pos < buffer->in_length)
@ -1489,7 +1489,7 @@ struct PosLookup : Lookup
bool done; bool done;
if (~IN_MASK (buffer->in_pos) & mask) if (~IN_MASK (buffer->in_pos) & mask)
{ {
done = apply_once (context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0); done = apply_once (layout_context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0);
ret |= done; ret |= done;
} }
else else
@ -1497,7 +1497,7 @@ struct PosLookup : Lookup
done = false; done = false;
/* Contrary to properties defined in GDEF, user-defined properties /* Contrary to properties defined in GDEF, user-defined properties
will always stop a possible cursive positioning. */ will always stop a possible cursive positioning. */
context->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST; layout_context->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST;
} }
if (!done) if (!done)
@ -1529,11 +1529,11 @@ struct GPOS : GSUBGPOS
inline const PosLookup& get_lookup (unsigned int i) const inline const PosLookup& get_lookup (unsigned int i) const
{ return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); } { return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
inline bool position_lookup (hb_ot_layout_context_t *context, inline bool position_lookup (hb_ot_layout_context_t *layout_context,
hb_buffer_t *buffer, hb_buffer_t *buffer,
unsigned int lookup_index, unsigned int lookup_index,
hb_mask_t mask) const hb_mask_t mask) const
{ return get_lookup (lookup_index).apply_string (context, buffer, mask); } { return get_lookup (lookup_index).apply_string (layout_context, buffer, mask); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
@ -1564,7 +1564,7 @@ inline bool ExtensionPos::sanitize (SANITIZE_ARG_DEF)
static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index) static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
{ {
const GPOS &gpos = *(context->face->ot_layout.gpos); const GPOS &gpos = *(layout_context->face->ot_layout.gpos);
const PosLookup &l = gpos.get_lookup (lookup_index); const PosLookup &l = gpos.get_lookup (lookup_index);
if (HB_UNLIKELY (apply_context->nesting_level_left == 0)) if (HB_UNLIKELY (apply_context->nesting_level_left == 0))
@ -1573,7 +1573,7 @@ static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
if (HB_UNLIKELY (context_length < 1)) if (HB_UNLIKELY (context_length < 1))
return false; return false;
return l.apply_once (context, buffer, context_length, apply_context->nesting_level_left - 1, apply_depth + 1); return l.apply_once (layout_context, buffer, context_length, apply_context->nesting_level_left - 1, apply_depth + 1);
} }

View File

@ -48,8 +48,8 @@ struct SingleSubstFormat1
_hb_buffer_replace_glyph (buffer, glyph_id); _hb_buffer_replace_glyph (buffer, glyph_id);
/* We inherit the old glyph class to the substituted glyph */ /* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->face)) if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
_hb_ot_layout_set_glyph_property (context->face, glyph_id, apply_context->property); _hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, apply_context->property);
return true; return true;
} }
@ -90,8 +90,8 @@ struct SingleSubstFormat2
_hb_buffer_replace_glyph (buffer, glyph_id); _hb_buffer_replace_glyph (buffer, glyph_id);
/* We inherit the old glyph class to the substituted glyph */ /* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->face)) if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
_hb_ot_layout_set_glyph_property (context->face, glyph_id, apply_context->property); _hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, apply_context->property);
return true; return true;
} }
@ -163,7 +163,7 @@ struct Sequence
0xFFFF, 0xFFFF); 0xFFFF, 0xFFFF);
/* This is a guess only ... */ /* This is a guess only ... */
if (_hb_ot_layout_has_new_glyph_classes (context->face)) if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
{ {
unsigned int property = apply_context->property; unsigned int property = apply_context->property;
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE) if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
@ -171,7 +171,7 @@ struct Sequence
unsigned int count = substitute.len; unsigned int count = substitute.len;
for (unsigned int n = 0; n < count; n++) for (unsigned int n = 0; n < count; n++)
_hb_ot_layout_set_glyph_property (context->face, substitute[n], property); _hb_ot_layout_set_glyph_property (layout_context->face, substitute[n], property);
} }
return true; return true;
@ -281,8 +281,8 @@ struct AlternateSubstFormat1
unsigned int alt_index = 0; unsigned int alt_index = 0;
/* XXX callback to user to choose alternate /* XXX callback to user to choose alternate
if (context->face->altfunc) if (layout_context->face->altfunc)
alt_index = (context->face->altfunc)(context->layout, buffer, alt_index = (layout_context->face->altfunc)(layout_context->layout, buffer,
buffer->out_pos, glyph_id, buffer->out_pos, glyph_id,
alt_set.len, alt_set.array); alt_set.len, alt_set.array);
*/ */
@ -295,8 +295,8 @@ struct AlternateSubstFormat1
_hb_buffer_replace_glyph (buffer, glyph_id); _hb_buffer_replace_glyph (buffer, glyph_id);
/* We inherit the old glyph class to the substituted glyph */ /* We inherit the old glyph class to the substituted glyph */
if (_hb_ot_layout_has_new_glyph_classes (context->face)) if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
_hb_ot_layout_set_glyph_property (context->face, glyph_id, apply_context->property); _hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, apply_context->property);
return true; return true;
} }
@ -366,7 +366,7 @@ struct Ligature
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++) for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{ {
unsigned int property; unsigned int property;
while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, &property)) while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), apply_context->lookup_flag, &property))
{ {
if (HB_UNLIKELY (j + count - i == end)) if (HB_UNLIKELY (j + count - i == end))
return false; return false;
@ -380,8 +380,8 @@ struct Ligature
return false; return false;
} }
/* This is just a guess ... */ /* This is just a guess ... */
if (_hb_ot_layout_has_new_glyph_classes (context->face)) if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
_hb_ot_layout_set_glyph_class (context->face, ligGlyph, _hb_ot_layout_set_glyph_class (layout_context->face, ligGlyph,
is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE); : HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
@ -407,7 +407,7 @@ struct Ligature
for ( i = 1; i < count; i++ ) for ( i = 1; i < count; i++ )
{ {
while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, IN_CURINFO (), apply_context->lookup_flag, NULL))
_hb_buffer_add_output_glyph (buffer, IN_CURGLYPH (), i, lig_id); _hb_buffer_add_output_glyph (buffer, IN_CURGLYPH (), i, lig_id);
(buffer->in_pos)++; (buffer->in_pos)++;
@ -759,7 +759,7 @@ struct SubstLookup : Lookup
} }
inline bool apply_once ( hb_ot_layout_context_t *context, inline bool apply_once ( hb_ot_layout_context_t *layout_context,
hb_buffer_t *buffer, hb_buffer_t *buffer,
unsigned int context_length, unsigned int context_length,
unsigned int nesting_level_left, unsigned int nesting_level_left,
@ -771,7 +771,7 @@ struct SubstLookup : Lookup
apply_context->nesting_level_left = nesting_level_left; apply_context->nesting_level_left = nesting_level_left;
apply_context->lookup_flag = get_flag (); apply_context->lookup_flag = get_flag ();
if (!_hb_ot_layout_check_glyph_property (context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property)) if (!_hb_ot_layout_check_glyph_property (layout_context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property))
return false; return false;
if (HB_UNLIKELY (lookup_type == SubstLookupSubTable::Extension)) if (HB_UNLIKELY (lookup_type == SubstLookupSubTable::Extension))
@ -796,7 +796,7 @@ struct SubstLookup : Lookup
return false; return false;
} }
inline bool apply_string (hb_ot_layout_context_t *context, inline bool apply_string (hb_ot_layout_context_t *layout_context,
hb_buffer_t *buffer, hb_buffer_t *buffer,
hb_mask_t mask) const hb_mask_t mask) const
{ {
@ -813,7 +813,7 @@ struct SubstLookup : Lookup
while (buffer->in_pos < buffer->in_length) while (buffer->in_pos < buffer->in_length)
{ {
if ((~IN_MASK (buffer->in_pos) & mask) && if ((~IN_MASK (buffer->in_pos) & mask) &&
apply_once (context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0)) apply_once (layout_context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0))
ret = true; ret = true;
else else
_hb_buffer_next_glyph (buffer); _hb_buffer_next_glyph (buffer);
@ -829,7 +829,7 @@ struct SubstLookup : Lookup
do do
{ {
if ((~IN_MASK (buffer->in_pos) & mask) && if ((~IN_MASK (buffer->in_pos) & mask) &&
apply_once (context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0)) apply_once (layout_context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0))
ret = true; ret = true;
else else
buffer->in_pos--; buffer->in_pos--;
@ -863,11 +863,11 @@ struct GSUB : GSUBGPOS
inline const SubstLookup& get_lookup (unsigned int i) const inline const SubstLookup& get_lookup (unsigned int i) const
{ return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); } { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
inline bool substitute_lookup (hb_ot_layout_context_t *context, inline bool substitute_lookup (hb_ot_layout_context_t *layout_context,
hb_buffer_t *buffer, hb_buffer_t *buffer,
unsigned int lookup_index, unsigned int lookup_index,
hb_mask_t mask) const hb_mask_t mask) const
{ return get_lookup (lookup_index).apply_string (context, buffer, mask); } { return get_lookup (lookup_index).apply_string (layout_context, buffer, mask); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
@ -907,7 +907,7 @@ inline bool ExtensionSubst::is_reverse (void) const
static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index) static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
{ {
const GSUB &gsub = *(context->face->ot_layout.gsub); const GSUB &gsub = *(layout_context->face->ot_layout.gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index); const SubstLookup &l = gsub.get_lookup (lookup_index);
if (HB_UNLIKELY (apply_context->nesting_level_left == 0)) if (HB_UNLIKELY (apply_context->nesting_level_left == 0))
@ -916,7 +916,7 @@ static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
if (HB_UNLIKELY (context_length < 1)) if (HB_UNLIKELY (context_length < 1))
return false; return false;
return l.apply_once (context, buffer, context_length, apply_context->nesting_level_left - 1, apply_depth + 1); return l.apply_once (layout_context, buffer, context_length, apply_context->nesting_level_left - 1, apply_depth + 1);
} }

View File

@ -44,13 +44,13 @@
#define APPLY_ARG_DEF \ #define APPLY_ARG_DEF \
hb_apply_context_t *apply_context, \ hb_apply_context_t *apply_context, \
hb_ot_layout_context_t *context, \ hb_ot_layout_context_t *layout_context, \
hb_buffer_t *buffer, \ hb_buffer_t *buffer, \
unsigned int context_length HB_GNUC_UNUSED, \ unsigned int context_length HB_GNUC_UNUSED, \
unsigned int apply_depth HB_GNUC_UNUSED unsigned int apply_depth HB_GNUC_UNUSED
#define APPLY_ARG \ #define APPLY_ARG \
apply_context, \ apply_context, \
context, \ layout_context, \
buffer, \ buffer, \
context_length, \ context_length, \
(HB_DEBUG_APPLY ? apply_depth + 1 : 0) (HB_DEBUG_APPLY ? apply_depth + 1 : 0)
@ -105,7 +105,7 @@ static inline bool match_input (APPLY_ARG_DEF,
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++) for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{ {
while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), apply_context->lookup_flag, NULL))
{ {
if (HB_UNLIKELY (j + count - i == end)) if (HB_UNLIKELY (j + count - i == end))
return false; return false;
@ -132,7 +132,7 @@ static inline bool match_backtrack (APPLY_ARG_DEF,
for (unsigned int i = 0, j = buffer->out_pos - 1; i < count; i++, j--) 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), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, OUT_INFO (j), apply_context->lookup_flag, NULL))
{ {
if (HB_UNLIKELY (j + 1 == count - i)) if (HB_UNLIKELY (j + 1 == count - i))
return false; return false;
@ -160,7 +160,7 @@ static inline bool match_lookahead (APPLY_ARG_DEF,
for (i = 0, j = buffer->in_pos + offset; i < count; i++, j++) for (i = 0, j = buffer->in_pos + offset; i < count; i++, j++)
{ {
while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, OUT_INFO (j), apply_context->lookup_flag, NULL))
{ {
if (HB_UNLIKELY (j + count - i == end)) if (HB_UNLIKELY (j + count - i == end))
return false; return false;
@ -210,7 +210,7 @@ static inline bool apply_lookup (APPLY_ARG_DEF,
*/ */
for (unsigned int i = 0; i < count; /* NOP */) for (unsigned int i = 0; i < count; /* NOP */)
{ {
while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), apply_context->lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (layout_context->face, IN_CURINFO (), apply_context->lookup_flag, NULL))
{ {
if (HB_UNLIKELY (buffer->in_pos == end)) if (HB_UNLIKELY (buffer->in_pos == end))
return true; return true;