Move layout_context into apply_context
This commit is contained in:
parent
fff9aa263d
commit
63493f956d
|
@ -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 *layout_context,
|
void apply_value (hb_ot_layout_context_t *layout,
|
||||||
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,8 +98,8 @@ struct ValueFormat : USHORT
|
||||||
|
|
||||||
if (!format) return;
|
if (!format) return;
|
||||||
|
|
||||||
x_scale = layout_context->font->x_scale;
|
x_scale = layout->font->x_scale;
|
||||||
y_scale = layout_context->font->y_scale;
|
y_scale = layout->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++);
|
||||||
|
@ -108,8 +108,8 @@ struct ValueFormat : USHORT
|
||||||
|
|
||||||
if (!has_device ()) return;
|
if (!has_device ()) return;
|
||||||
|
|
||||||
x_ppem = layout_context->font->x_ppem;
|
x_ppem = layout->font->x_ppem;
|
||||||
y_ppem = layout_context->font->y_ppem;
|
y_ppem = layout->font->y_ppem;
|
||||||
|
|
||||||
if (!x_ppem && !y_ppem) return;
|
if (!x_ppem && !y_ppem) return;
|
||||||
|
|
||||||
|
@ -199,11 +199,11 @@ struct AnchorFormat1
|
||||||
friend struct Anchor;
|
friend struct Anchor;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_UNUSED,
|
inline void get_anchor (hb_ot_layout_context_t *layout, hb_codepoint_t glyph_id HB_UNUSED,
|
||||||
hb_position_t *x, hb_position_t *y) const
|
hb_position_t *x, hb_position_t *y) const
|
||||||
{
|
{
|
||||||
*x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
|
*x = _hb_16dot16_mul_round (layout->font->x_scale, xCoordinate);
|
||||||
*y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
|
*y = _hb_16dot16_mul_round (layout->font->y_scale, yCoordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *context) {
|
||||||
|
@ -223,18 +223,18 @@ struct AnchorFormat2
|
||||||
friend struct Anchor;
|
friend struct Anchor;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id,
|
inline void get_anchor (hb_ot_layout_context_t *layout, hb_codepoint_t glyph_id,
|
||||||
hb_position_t *x, hb_position_t *y) const
|
hb_position_t *x, hb_position_t *y) const
|
||||||
{
|
{
|
||||||
unsigned int x_ppem = layout_context->font->x_ppem;
|
unsigned int x_ppem = layout->font->x_ppem;
|
||||||
unsigned int y_ppem = layout_context->font->y_ppem;
|
unsigned int y_ppem = layout->font->y_ppem;
|
||||||
hb_position_t cx, cy;
|
hb_position_t cx, cy;
|
||||||
hb_bool_t ret;
|
hb_bool_t ret;
|
||||||
|
|
||||||
if (x_ppem || y_ppem)
|
if (x_ppem || y_ppem)
|
||||||
ret = hb_font_get_contour_point (layout_context->font, layout_context->face, anchorPoint, glyph_id, &cx, &cy);
|
ret = hb_font_get_contour_point (layout->font, layout->face, anchorPoint, glyph_id, &cx, &cy);
|
||||||
*x = x_ppem && ret ? cx : _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
|
*x = x_ppem && ret ? cx : _hb_16dot16_mul_round (layout->font->x_scale, xCoordinate);
|
||||||
*y = y_ppem && ret ? cy : _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
|
*y = y_ppem && ret ? cy : _hb_16dot16_mul_round (layout->font->y_scale, yCoordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *context) {
|
||||||
|
@ -255,17 +255,17 @@ struct AnchorFormat3
|
||||||
friend struct Anchor;
|
friend struct Anchor;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_UNUSED,
|
inline void get_anchor (hb_ot_layout_context_t *layout, hb_codepoint_t glyph_id HB_UNUSED,
|
||||||
hb_position_t *x, hb_position_t *y) const
|
hb_position_t *x, hb_position_t *y) const
|
||||||
{
|
{
|
||||||
*x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
|
*x = _hb_16dot16_mul_round (layout->font->x_scale, xCoordinate);
|
||||||
*y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
|
*y = _hb_16dot16_mul_round (layout->font->y_scale, yCoordinate);
|
||||||
|
|
||||||
/* pixel -> fractional pixel */
|
/* pixel -> fractional pixel */
|
||||||
if (layout_context->font->x_ppem)
|
if (layout->font->x_ppem)
|
||||||
*x += (this+xDeviceTable).get_delta (layout_context->font->x_ppem) << 16;
|
*x += (this+xDeviceTable).get_delta (layout->font->x_ppem) << 16;
|
||||||
if (layout_context->font->y_ppem)
|
if (layout->font->y_ppem)
|
||||||
*y += (this+yDeviceTable).get_delta (layout_context->font->y_ppem) << 16;
|
*y += (this+yDeviceTable).get_delta (layout->font->y_ppem) << 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *context) {
|
||||||
|
@ -292,14 +292,14 @@ ASSERT_SIZE (AnchorFormat3, 10);
|
||||||
|
|
||||||
struct Anchor
|
struct Anchor
|
||||||
{
|
{
|
||||||
inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id,
|
inline void get_anchor (hb_ot_layout_context_t *layout, 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 (layout_context, glyph_id, x, y); return;
|
case 1: u.format1->get_anchor (layout, glyph_id, x, y); return;
|
||||||
case 2: u.format2->get_anchor (layout_context, glyph_id, x, y); return;
|
case 2: u.format2->get_anchor (layout, glyph_id, x, y); return;
|
||||||
case 3: u.format3->get_anchor (layout_context, glyph_id, x, y); return;
|
case 3: u.format3->get_anchor (layout, glyph_id, x, y); return;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,8 +388,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 (layout_context, IN_CURGLYPH (), &mark_x, &mark_y);
|
mark_anchor.get_anchor (context->layout, IN_CURGLYPH (), &mark_x, &mark_y);
|
||||||
glyph_anchor.get_anchor (layout_context, IN_GLYPH (glyph_pos), &base_x, &base_y);
|
glyph_anchor.get_anchor (context->layout, 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;
|
||||||
|
@ -428,7 +428,7 @@ struct SinglePosFormat1
|
||||||
if (likely (index == NOT_COVERED))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
valueFormat.apply_value (layout_context, CharP(this), values, CURPOSITION ());
|
valueFormat.apply_value (context->layout, CharP(this), values, CURPOSITION ());
|
||||||
|
|
||||||
buffer->in_pos++;
|
buffer->in_pos++;
|
||||||
return true;
|
return true;
|
||||||
|
@ -469,7 +469,7 @@ struct SinglePosFormat2
|
||||||
if (likely (index >= valueCount))
|
if (likely (index >= valueCount))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
valueFormat.apply_value (layout_context, CharP(this),
|
valueFormat.apply_value (context->layout, CharP(this),
|
||||||
&values[index * valueFormat.get_len ()],
|
&values[index * valueFormat.get_len ()],
|
||||||
CURPOSITION ());
|
CURPOSITION ());
|
||||||
|
|
||||||
|
@ -581,7 +581,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 (layout_context->face, IN_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j == end))
|
if (unlikely (j == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -599,8 +599,8 @@ struct PairPosFormat1
|
||||||
{
|
{
|
||||||
if (IN_GLYPH (j) == record->secondGlyph)
|
if (IN_GLYPH (j) == record->secondGlyph)
|
||||||
{
|
{
|
||||||
valueFormat1.apply_value (layout_context, CharP(this), &record->values[0], CURPOSITION ());
|
valueFormat1.apply_value (context->layout, CharP(this), &record->values[0], CURPOSITION ());
|
||||||
valueFormat2.apply_value (layout_context, CharP(this), &record->values[len1], POSITION (j));
|
valueFormat2.apply_value (context->layout, CharP(this), &record->values[len1], POSITION (j));
|
||||||
if (len2)
|
if (len2)
|
||||||
j++;
|
j++;
|
||||||
buffer->in_pos = j;
|
buffer->in_pos = j;
|
||||||
|
@ -674,7 +674,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 (layout_context->face, IN_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j == end))
|
if (unlikely (j == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -691,8 +691,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 (layout_context, CharP(this), v, CURPOSITION ());
|
valueFormat1.apply_value (context->layout, CharP(this), v, CURPOSITION ());
|
||||||
valueFormat2.apply_value (layout_context, CharP(this), v + len1, POSITION (j));
|
valueFormat2.apply_value (context->layout, CharP(this), v + len1, POSITION (j));
|
||||||
|
|
||||||
if (len2)
|
if (len2)
|
||||||
j++;
|
j++;
|
||||||
|
@ -927,7 +927,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 = &layout_context->info.gpos;
|
struct hb_ot_layout_context_t::info_t::gpos_t *gpi = &context->layout->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;
|
||||||
|
|
||||||
|
@ -945,7 +945,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 (layout_context, IN_CURGLYPH (), &entry_x, &entry_y);
|
(this+record.entryAnchor).get_anchor (context->layout, IN_CURGLYPH (), &entry_x, &entry_y);
|
||||||
|
|
||||||
/* TODO vertical */
|
/* TODO vertical */
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ struct CursivePosFormat1
|
||||||
if (record.exitAnchor)
|
if (record.exitAnchor)
|
||||||
{
|
{
|
||||||
gpi->last = buffer->in_pos;
|
gpi->last = buffer->in_pos;
|
||||||
(this+record.exitAnchor).get_anchor (layout_context, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
|
(this+record.exitAnchor).get_anchor (context->layout, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->in_pos++;
|
buffer->in_pos++;
|
||||||
|
@ -1055,7 +1055,7 @@ struct MarkBasePosFormat1
|
||||||
if (unlikely (!j))
|
if (unlikely (!j))
|
||||||
return false;
|
return false;
|
||||||
j--;
|
j--;
|
||||||
} while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
|
} while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* The following assertion is too strong. */
|
/* The following assertion is too strong. */
|
||||||
|
@ -1158,7 +1158,7 @@ struct MarkLigPosFormat1
|
||||||
if (unlikely (!j))
|
if (unlikely (!j))
|
||||||
return false;
|
return false;
|
||||||
j--;
|
j--;
|
||||||
} while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
|
} while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* The following assertion is too strong. */
|
/* The following assertion is too strong. */
|
||||||
|
@ -1278,7 +1278,7 @@ struct MarkMarkPosFormat1
|
||||||
if (unlikely (!j))
|
if (unlikely (!j))
|
||||||
return false;
|
return false;
|
||||||
j--;
|
j--;
|
||||||
} while (_hb_ot_layout_skip_mark (layout_context->face, IN_INFO (j), context->lookup_flag, &property));
|
} while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, &property));
|
||||||
|
|
||||||
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
|
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1479,7 +1479,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 *layout_context,
|
inline bool apply_once (hb_ot_layout_context_t *layout,
|
||||||
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,
|
||||||
|
@ -1488,10 +1488,11 @@ struct PosLookup : Lookup
|
||||||
unsigned int lookup_type = get_type ();
|
unsigned int lookup_type = get_type ();
|
||||||
hb_apply_context_t context[1];
|
hb_apply_context_t context[1];
|
||||||
|
|
||||||
|
context->layout = layout;
|
||||||
context->nesting_level_left = nesting_level_left;
|
context->nesting_level_left = nesting_level_left;
|
||||||
context->lookup_flag = get_flag ();
|
context->lookup_flag = get_flag ();
|
||||||
|
|
||||||
if (!_hb_ot_layout_check_glyph_property (layout_context->face, IN_CURINFO (), context->lookup_flag, &context->property))
|
if (!_hb_ot_layout_check_glyph_property (context->layout->face, IN_CURINFO (), context->lookup_flag, &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++)
|
||||||
|
@ -1501,7 +1502,7 @@ struct PosLookup : Lookup
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool apply_string (hb_ot_layout_context_t *layout_context,
|
inline bool apply_string (hb_ot_layout_context_t *layout,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
hb_mask_t mask) const
|
hb_mask_t mask) const
|
||||||
{
|
{
|
||||||
|
@ -1510,7 +1511,7 @@ struct PosLookup : Lookup
|
||||||
if (unlikely (!buffer->in_length))
|
if (unlikely (!buffer->in_length))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
layout_context->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */
|
layout->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)
|
||||||
|
@ -1518,7 +1519,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 (layout_context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0);
|
done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0);
|
||||||
ret |= done;
|
ret |= done;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1526,7 +1527,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. */
|
||||||
layout_context->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST;
|
layout->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
|
@ -1558,11 +1559,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 *layout_context,
|
inline bool position_lookup (hb_ot_layout_context_t *layout,
|
||||||
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 (layout_context, buffer, mask); }
|
{ return get_lookup (lookup_index).apply_string (layout, buffer, mask); }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *context) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
|
@ -1593,7 +1594,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context)
|
||||||
|
|
||||||
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 = *(layout_context->face->ot_layout.gpos);
|
const GPOS &gpos = *(context->layout->face->ot_layout.gpos);
|
||||||
const PosLookup &l = gpos.get_lookup (lookup_index);
|
const PosLookup &l = gpos.get_lookup (lookup_index);
|
||||||
|
|
||||||
if (unlikely (context->nesting_level_left == 0))
|
if (unlikely (context->nesting_level_left == 0))
|
||||||
|
@ -1602,7 +1603,7 @@ static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
|
||||||
if (unlikely (context_length < 1))
|
if (unlikely (context_length < 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return l.apply_once (layout_context, buffer, context_length, context->nesting_level_left - 1, apply_depth + 1);
|
return l.apply_once (context->layout, buffer, context_length, context->nesting_level_left - 1, apply_depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 (layout_context->face))
|
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
||||||
_hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, context->property);
|
_hb_ot_layout_set_glyph_property (context->layout->face, glyph_id, context->property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,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 (layout_context->face))
|
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
||||||
_hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, context->property);
|
_hb_ot_layout_set_glyph_property (context->layout->face, glyph_id, context->property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,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 (layout_context->face))
|
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
||||||
{
|
{
|
||||||
unsigned int property = context->property;
|
unsigned int property = context->property;
|
||||||
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
|
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
|
||||||
|
@ -173,7 +173,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 (layout_context->face, substitute[n], property);
|
_hb_ot_layout_set_glyph_property (context->layout->face, substitute[n], property);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -284,8 +284,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 (layout_context->face->altfunc)
|
if (context->layout->face->altfunc)
|
||||||
alt_index = (layout_context->face->altfunc)(layout_context->layout, buffer,
|
alt_index = (context->layout->face->altfunc)(context->layout->layout, buffer,
|
||||||
buffer->out_pos, glyph_id,
|
buffer->out_pos, glyph_id,
|
||||||
alt_set.len, alt_set.array);
|
alt_set.len, alt_set.array);
|
||||||
*/
|
*/
|
||||||
|
@ -298,8 +298,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 (layout_context->face))
|
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
||||||
_hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, context->property);
|
_hb_ot_layout_set_glyph_property (context->layout->face, glyph_id, context->property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,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 (layout_context->face, IN_INFO (j), context->lookup_flag, &property))
|
while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, &property))
|
||||||
{
|
{
|
||||||
if (unlikely (j + count - i == end))
|
if (unlikely (j + count - i == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -384,8 +384,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 (layout_context->face))
|
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
||||||
_hb_ot_layout_set_glyph_class (layout_context->face, ligGlyph,
|
_hb_ot_layout_set_glyph_class (context->layout->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);
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ struct Ligature
|
||||||
|
|
||||||
for ( i = 1; i < count; i++ )
|
for ( i = 1; i < count; i++ )
|
||||||
{
|
{
|
||||||
while (_hb_ot_layout_skip_mark (layout_context->face, IN_CURINFO (), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, IN_CURINFO (), 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)++;
|
||||||
|
@ -765,7 +765,7 @@ struct SubstLookup : Lookup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool apply_once ( hb_ot_layout_context_t *layout_context,
|
inline bool apply_once (hb_ot_layout_context_t *layout,
|
||||||
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,
|
||||||
|
@ -774,10 +774,11 @@ struct SubstLookup : Lookup
|
||||||
unsigned int lookup_type = get_type ();
|
unsigned int lookup_type = get_type ();
|
||||||
hb_apply_context_t context[1];
|
hb_apply_context_t context[1];
|
||||||
|
|
||||||
|
context->layout = layout;
|
||||||
context->nesting_level_left = nesting_level_left;
|
context->nesting_level_left = nesting_level_left;
|
||||||
context->lookup_flag = get_flag ();
|
context->lookup_flag = get_flag ();
|
||||||
|
|
||||||
if (!_hb_ot_layout_check_glyph_property (layout_context->face, IN_CURINFO (), context->lookup_flag, &context->property))
|
if (!_hb_ot_layout_check_glyph_property (context->layout->face, IN_CURINFO (), context->lookup_flag, &context->property))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
|
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
|
||||||
|
@ -802,7 +803,7 @@ struct SubstLookup : Lookup
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool apply_string (hb_ot_layout_context_t *layout_context,
|
inline bool apply_string (hb_ot_layout_context_t *layout,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
hb_mask_t mask) const
|
hb_mask_t mask) const
|
||||||
{
|
{
|
||||||
|
@ -819,7 +820,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 (layout_context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0))
|
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0))
|
||||||
ret = true;
|
ret = true;
|
||||||
else
|
else
|
||||||
_hb_buffer_next_glyph (buffer);
|
_hb_buffer_next_glyph (buffer);
|
||||||
|
@ -835,7 +836,7 @@ struct SubstLookup : Lookup
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ((~IN_MASK (buffer->in_pos) & mask) &&
|
if ((~IN_MASK (buffer->in_pos) & mask) &&
|
||||||
apply_once (layout_context, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0))
|
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, 0))
|
||||||
ret = true;
|
ret = true;
|
||||||
else
|
else
|
||||||
buffer->in_pos--;
|
buffer->in_pos--;
|
||||||
|
@ -869,11 +870,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 *layout_context,
|
inline bool substitute_lookup (hb_ot_layout_context_t *layout,
|
||||||
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 (layout_context, buffer, mask); }
|
{ return get_lookup (lookup_index).apply_string (layout, buffer, mask); }
|
||||||
|
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *context) {
|
||||||
|
@ -913,7 +914,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 = *(layout_context->face->ot_layout.gsub);
|
const GSUB &gsub = *(context->layout->face->ot_layout.gsub);
|
||||||
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
||||||
|
|
||||||
if (unlikely (context->nesting_level_left == 0))
|
if (unlikely (context->nesting_level_left == 0))
|
||||||
|
@ -922,7 +923,7 @@ static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
|
||||||
if (unlikely (context_length < 1))
|
if (unlikely (context_length < 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return l.apply_once (layout_context, buffer, context_length, context->nesting_level_left - 1, apply_depth + 1);
|
return l.apply_once (context->layout, buffer, context_length, context->nesting_level_left - 1, apply_depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,19 +44,18 @@
|
||||||
|
|
||||||
#define APPLY_ARG_DEF \
|
#define APPLY_ARG_DEF \
|
||||||
hb_apply_context_t *context, \
|
hb_apply_context_t *context, \
|
||||||
hb_ot_layout_context_t *layout_context, \
|
|
||||||
hb_buffer_t *buffer, \
|
hb_buffer_t *buffer, \
|
||||||
unsigned int context_length HB_UNUSED, \
|
unsigned int context_length HB_UNUSED, \
|
||||||
unsigned int apply_depth HB_UNUSED
|
unsigned int apply_depth HB_UNUSED
|
||||||
#define APPLY_ARG \
|
#define APPLY_ARG \
|
||||||
context, \
|
context, \
|
||||||
layout_context, \
|
|
||||||
buffer, \
|
buffer, \
|
||||||
context_length, \
|
context_length, \
|
||||||
(HB_DEBUG_APPLY ? apply_depth + 1 : 0)
|
(HB_DEBUG_APPLY ? apply_depth + 1 : 0)
|
||||||
|
|
||||||
struct hb_apply_context_t
|
struct hb_apply_context_t
|
||||||
{
|
{
|
||||||
|
hb_ot_layout_context_t *layout;
|
||||||
unsigned int nesting_level_left;
|
unsigned int nesting_level_left;
|
||||||
unsigned int lookup_flag;
|
unsigned int lookup_flag;
|
||||||
unsigned int property; /* propety of first glyph (TODO remove) */
|
unsigned int property; /* propety of first glyph (TODO remove) */
|
||||||
|
@ -105,7 +104,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 (layout_context->face, IN_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j + count - i == end))
|
if (unlikely (j + count - i == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,7 +131,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 (layout_context->face, OUT_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, OUT_INFO (j), context->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j + 1 == count - i))
|
if (unlikely (j + 1 == count - i))
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,7 +159,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 (layout_context->face, OUT_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, OUT_INFO (j), context->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j + count - i == end))
|
if (unlikely (j + count - i == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -210,7 +209,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 (layout_context->face, IN_CURINFO (), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (context->layout->face, IN_CURINFO (), context->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (buffer->in_pos == end))
|
if (unlikely (buffer->in_pos == end))
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue