inline unsigned int get_size () const
{ 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 Value *values,
hb_internal_glyph_position_t *glyph_pos) const
if (!format) return;
- x_scale = context->font->x_scale;
- y_scale = context->font->y_scale;
+ x_scale = layout_context->font->x_scale;
+ y_scale = layout_context->font->y_scale;
/* design units -> fractional pixel */
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 & 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++);
- x_ppem = context->font->x_ppem;
- y_ppem = context->font->y_ppem;
+ x_ppem = layout_context->font->x_ppem;
+ y_ppem = layout_context->font->y_ppem;
/* pixel -> fractional pixel */
if (format & xPlaDevice) {
if (x_ppem) glyph_pos->x_offset += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 16; else values++;
friend struct Anchor;
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
{
- *x = _hb_16dot16_mul_round (context->font->x_scale, xCoordinate);
- *y = _hb_16dot16_mul_round (context->font->y_scale, yCoordinate);
+ *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
+ *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
}
inline bool sanitize (SANITIZE_ARG_DEF) {
friend struct Anchor;
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
{
/* TODO Contour
* NOTE only adjust directions with nonzero ppem */
- *x = _hb_16dot16_mul_round (context->font->x_scale, xCoordinate);
- *y = _hb_16dot16_mul_round (context->font->y_scale, yCoordinate);
+ *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
+ *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
}
inline bool sanitize (SANITIZE_ARG_DEF) {
friend struct Anchor;
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
{
- *x = _hb_16dot16_mul_round (context->font->x_scale, xCoordinate);
- *y = _hb_16dot16_mul_round (context->font->y_scale, yCoordinate);
+ *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
+ *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
/* pixel -> fractional pixel */
- if (context->font->x_ppem)
- *x += (this+xDeviceTable).get_delta (context->font->x_ppem) << 16;
- if (context->font->y_ppem)
- *y += (this+yDeviceTable).get_delta (context->font->y_ppem) << 16;
+ if (layout_context->font->x_ppem)
+ *x += (this+xDeviceTable).get_delta (layout_context->font->x_ppem) << 16;
+ if (layout_context->font->y_ppem)
+ *y += (this+yDeviceTable).get_delta (layout_context->font->y_ppem) << 16;
}
inline bool sanitize (SANITIZE_ARG_DEF) {
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
{
*x = *y = 0;
switch (u.format) {
- case 1: u.format1->get_anchor (context, glyph_id, x, y); return;
- case 2: u.format2->get_anchor (context, glyph_id, x, y); return;
- case 3: u.format3->get_anchor (context, glyph_id, x, y); return;
- default: return;
+ case 1: u.format1->get_anchor (layout_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 (layout_context, glyph_id, x, y); return;
+ default: return;
}
}
hb_position_t mark_x, mark_y, base_x, base_y;
- mark_anchor.get_anchor (context, IN_CURGLYPH (), &mark_x, &mark_y);
- glyph_anchor.get_anchor (context, IN_GLYPH (glyph_pos), &base_x, &base_y);
+ mark_anchor.get_anchor (layout_context, IN_CURGLYPH (), &mark_x, &mark_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);
o->x_advance = 0;
if (HB_LIKELY (index == NOT_COVERED))
return false;
- valueFormat.apply_value (context, CharP(this), values, CURPOSITION ());
+ valueFormat.apply_value (layout_context, CharP(this), values, CURPOSITION ());
buffer->in_pos++;
return true;
if (HB_LIKELY (index >= valueCount))
return false;
- valueFormat.apply_value (context, CharP(this),
+ valueFormat.apply_value (layout_context, CharP(this),
&values[index * valueFormat.get_len ()],
CURPOSITION ());
return false;
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))
return false;
{
if (IN_GLYPH (j) == record->secondGlyph)
{
- valueFormat1.apply_value (context, CharP(this), &record->values[0], CURPOSITION ());
- valueFormat2.apply_value (context, CharP(this), &record->values[len1], POSITION (j));
+ valueFormat1.apply_value (layout_context, CharP(this), &record->values[0], CURPOSITION ());
+ valueFormat2.apply_value (layout_context, CharP(this), &record->values[len1], POSITION (j));
if (len2)
j++;
buffer->in_pos = j;
return false;
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))
return false;
return false;
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
- valueFormat1.apply_value (context, CharP(this), v, CURPOSITION ());
- valueFormat2.apply_value (context, CharP(this), v + len1, POSITION (j));
+ valueFormat1.apply_value (layout_context, CharP(this), v, CURPOSITION ());
+ valueFormat2.apply_value (layout_context, CharP(this), v + len1, POSITION (j));
if (len2)
j++;
Since horizontal advance widths or vertical advance heights
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;
gpi->last = HB_OT_LAYOUT_GPOS_NO_LAST;
goto end;
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 */
if (record.exitAnchor)
{
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++;
if (HB_UNLIKELY (!j))
return false;
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
/* The following assertion is too strong. */
if (HB_UNLIKELY (!j))
return false;
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
/* The following assertion is too strong. */
if (HB_UNLIKELY (!j))
return false;
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))
return false;
inline const PosLookupSubTable& get_subtable (unsigned int i) const
{ 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,
unsigned int context_length,
unsigned int nesting_level_left,
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))
+ if (!_hb_ot_layout_check_glyph_property (layout_context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++)
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_mask_t mask) const
{
if (HB_UNLIKELY (!buffer->in_length))
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;
while (buffer->in_pos < buffer->in_length)
bool done;
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;
}
else
done = false;
/* Contrary to properties defined in GDEF, user-defined properties
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)
inline const PosLookup& get_lookup (unsigned int i) const
{ 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,
unsigned int lookup_index,
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) {
TRACE_SANITIZE ();
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);
if (HB_UNLIKELY (apply_context->nesting_level_left == 0))
if (HB_UNLIKELY (context_length < 1))
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);
}
_hb_buffer_replace_glyph (buffer, glyph_id);
/* 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, apply_context->property);
+ if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
+ _hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, apply_context->property);
return true;
}
_hb_buffer_replace_glyph (buffer, glyph_id);
/* 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, apply_context->property);
+ if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
+ _hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, apply_context->property);
return true;
}
0xFFFF, 0xFFFF);
/* 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;
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
unsigned int count = substitute.len;
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;
unsigned int alt_index = 0;
/* XXX callback to user to choose alternate
- if (context->face->altfunc)
- alt_index = (context->face->altfunc)(context->layout, buffer,
+ if (layout_context->face->altfunc)
+ alt_index = (layout_context->face->altfunc)(layout_context->layout, buffer,
buffer->out_pos, glyph_id,
alt_set.len, alt_set.array);
*/
_hb_buffer_replace_glyph (buffer, glyph_id);
/* 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, apply_context->property);
+ if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
+ _hb_ot_layout_set_glyph_property (layout_context->face, glyph_id, apply_context->property);
return true;
}
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
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))
return false;
return false;
}
/* This is just a guess ... */
- if (_hb_ot_layout_has_new_glyph_classes (context->face))
- _hb_ot_layout_set_glyph_class (context->face, ligGlyph,
+ if (_hb_ot_layout_has_new_glyph_classes (layout_context->face))
+ _hb_ot_layout_set_glyph_class (layout_context->face, ligGlyph,
is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
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);
(buffer->in_pos)++;
}
- 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,
unsigned int context_length,
unsigned int nesting_level_left,
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))
+ if (!_hb_ot_layout_check_glyph_property (layout_context->face, IN_CURINFO (), apply_context->lookup_flag, &apply_context->property))
return false;
if (HB_UNLIKELY (lookup_type == SubstLookupSubTable::Extension))
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_mask_t mask) const
{
while (buffer->in_pos < buffer->in_length)
{
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;
else
_hb_buffer_next_glyph (buffer);
do
{
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;
else
buffer->in_pos--;
inline const SubstLookup& get_lookup (unsigned int i) const
{ 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,
unsigned int lookup_index,
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) {
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);
if (HB_UNLIKELY (apply_context->nesting_level_left == 0))
if (HB_UNLIKELY (context_length < 1))
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);
}