hb_bool_t have_positions; /* whether we have positions */
unsigned int len;
unsigned int out_len;
- unsigned int in_pos;
+ unsigned int i;
hb_internal_glyph_info_t *info;
hb_internal_glyph_info_t *out_info;
buffer->have_positions = FALSE;
buffer->len = 0;
buffer->out_len = 0;
- buffer->in_pos = 0;
+ buffer->i = 0;
buffer->out_info = buffer->info;
buffer->max_lig_id = 0;
}
buffer->len = buffer->out_len;
buffer->out_len = tmp;
- buffer->in_pos = 0;
+ buffer->i = 0;
}
/* The following function copies `num_out' elements from `glyph_data'
Finally, it sets the `length' field of `out' equal to
`pos' of the `out' structure.
- If `component' is 0xFFFF, the component value from buffer->in_pos
+ If `component' is 0xFFFF, the component value from buffer->i
will copied `num_out' times, otherwise `component' itself will
be used to fill the `component' fields.
- If `lig_id' is 0xFFFF, the lig_id value from buffer->in_pos
+ If `lig_id' is 0xFFFF, the lig_id value from buffer->i
will copied `num_out' times, otherwise `lig_id' itself will
be used to fill the `lig_id' fields.
The mask for all replacement glyphs are taken
- from the glyph at position `buffer->in_pos'.
+ from the glyph at position `buffer->i'.
- The cluster value for the glyph at position buffer->in_pos is used
+ The cluster value for the glyph at position buffer->i is used
for all replacement glyphs */
void
unsigned int cluster;
if (buffer->out_info != buffer->info ||
- buffer->out_len + num_out > buffer->in_pos + num_in)
+ buffer->out_len + num_out > buffer->i + num_in)
{
hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
}
- mask = buffer->info[buffer->in_pos].mask;
- cluster = buffer->info[buffer->in_pos].cluster;
+ mask = buffer->info[buffer->i].mask;
+ cluster = buffer->info[buffer->i].cluster;
if (component == 0xFFFF)
- component = buffer->info[buffer->in_pos].component;
+ component = buffer->info[buffer->i].component;
if (lig_id == 0xFFFF)
- lig_id = buffer->info[buffer->in_pos].lig_id;
+ lig_id = buffer->info[buffer->i].lig_id;
for (i = 0; i < num_out; i++)
{
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
}
- buffer->in_pos += num_in;
+ buffer->i += num_in;
buffer->out_len += num_out;
}
unsigned int cluster;
if (buffer->out_info != buffer->info ||
- buffer->out_len + num_out > buffer->in_pos + num_in)
+ buffer->out_len + num_out > buffer->i + num_in)
{
hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
}
- mask = buffer->info[buffer->in_pos].mask;
- cluster = buffer->info[buffer->in_pos].cluster;
+ mask = buffer->info[buffer->i].mask;
+ cluster = buffer->info[buffer->i].cluster;
if (component == 0xFFFF)
- component = buffer->info[buffer->in_pos].component;
+ component = buffer->info[buffer->i].component;
if (lig_id == 0xFFFF)
- lig_id = buffer->info[buffer->in_pos].lig_id;
+ lig_id = buffer->info[buffer->i].lig_id;
for (i = 0; i < num_out; i++)
{
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
}
- buffer->in_pos += num_in;
+ buffer->i += num_in;
buffer->out_len += num_out;
}
if (buffer->out_info != buffer->info)
{
hb_buffer_ensure (buffer, buffer->out_len + 1);
- buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+ buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
}
- else if (buffer->out_len != buffer->in_pos)
- buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+ else if (buffer->out_len != buffer->i)
+ buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
info = &buffer->out_info[buffer->out_len];
info->codepoint = glyph_index;
info->lig_id = lig_id;
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
- buffer->in_pos++;
+ buffer->i++;
buffer->out_len++;
}
if (buffer->out_info != buffer->info)
{
hb_buffer_ensure (buffer, buffer->out_len + 1);
- buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+ buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
}
- else if (buffer->out_len != buffer->in_pos)
- buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+ else if (buffer->out_len != buffer->i)
+ buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
buffer->out_len++;
}
- buffer->in_pos++;
+ buffer->i++;
}
hb_position_t mark_x, mark_y, base_x, base_y;
- mark_anchor.get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &mark_x, &mark_y);
+ mark_anchor.get_anchor (c->layout, c->buffer->info[c->buffer->i].codepoint, &mark_x, &mark_y);
glyph_anchor.get_anchor (c->layout, c->buffer->info[glyph_pos].codepoint, &base_x, &base_y);
- hb_internal_glyph_position_t &o = c->buffer->pos[c->buffer->in_pos];
+ hb_internal_glyph_position_t &o = c->buffer->pos[c->buffer->i];
o.x_advance = 0;
o.y_advance = 0;
o.x_offset = base_x - mark_x;
o.y_offset = base_y - mark_y;
- o.back = c->buffer->in_pos - glyph_pos;
+ o.back = c->buffer->i - glyph_pos;
- c->buffer->in_pos++;
+ c->buffer->i++;
return true;
}
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
- valueFormat.apply_value (c->layout, this, values, c->buffer->pos[c->buffer->in_pos]);
+ valueFormat.apply_value (c->layout, this, values, c->buffer->pos[c->buffer->i]);
- c->buffer->in_pos++;
+ c->buffer->i++;
return true;
}
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
valueFormat.apply_value (c->layout, this,
&values[index * valueFormat.get_len ()],
- c->buffer->pos[c->buffer->in_pos]);
+ c->buffer->pos[c->buffer->i]);
- c->buffer->in_pos++;
+ c->buffer->i++;
return true;
}
{
if (c->buffer->info[pos].codepoint == record->secondGlyph)
{
- valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->pos[c->buffer->in_pos]);
+ valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->pos[c->buffer->i]);
valueFormats[1].apply_value (c->layout, this, &record->values[len1], c->buffer->pos[pos]);
if (len2)
pos++;
- c->buffer->in_pos = pos;
+ c->buffer->i = pos;
return true;
}
record = &StructAtOffset<PairValueRecord> (record, record_size);
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
- if (unlikely (c->buffer->in_pos + 2 > end))
+ unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+ if (unlikely (c->buffer->i + 2 > end))
return false;
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
- unsigned int j = c->buffer->in_pos + 1;
+ unsigned int j = c->buffer->i + 1;
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
{
if (unlikely (j == end))
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
- if (unlikely (c->buffer->in_pos + 2 > end))
+ unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+ if (unlikely (c->buffer->i + 2 > end))
return false;
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
- unsigned int j = c->buffer->in_pos + 1;
+ unsigned int j = c->buffer->i + 1;
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
{
if (unlikely (j == end))
unsigned int len2 = valueFormat2.get_len ();
unsigned int record_len = len1 + len2;
- unsigned int klass1 = (this+classDef1) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int klass1 = (this+classDef1) (c->buffer->info[c->buffer->i].codepoint);
unsigned int klass2 = (this+classDef2) (c->buffer->info[j].codepoint);
if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
return false;
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
- valueFormat1.apply_value (c->layout, this, v, c->buffer->pos[c->buffer->in_pos]);
+ valueFormat1.apply_value (c->layout, this, v, c->buffer->pos[c->buffer->i]);
valueFormat2.apply_value (c->layout, this, v + len1, c->buffer->pos[j]);
if (len2)
j++;
- c->buffer->in_pos = j;
+ c->buffer->i = j;
return true;
}
if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
return false;
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
goto end;
hb_position_t entry_x, entry_y;
- (this+record.entryAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &entry_x, &entry_y);
+ (this+record.entryAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->i].codepoint, &entry_x, &entry_y);
/* TODO vertical */
if (c->buffer->direction == HB_DIRECTION_RTL)
{
/* advance is absolute, not relative */
- c->buffer->pos[c->buffer->in_pos].x_advance = entry_x - gpi->anchor_x;
+ c->buffer->pos[c->buffer->i].x_advance = entry_x - gpi->anchor_x;
}
else
{
if (c->lookup_flag & LookupFlag::RightToLeft)
{
- c->buffer->pos[last_pos].cursive_chain = last_pos - c->buffer->in_pos;
+ c->buffer->pos[last_pos].cursive_chain = last_pos - c->buffer->i;
c->buffer->pos[last_pos].y_offset = entry_y - gpi->anchor_y;
}
else
{
- c->buffer->pos[c->buffer->in_pos].cursive_chain = c->buffer->in_pos - last_pos;
- c->buffer->pos[c->buffer->in_pos].y_offset = gpi->anchor_y - entry_y;
+ c->buffer->pos[c->buffer->i].cursive_chain = c->buffer->i - last_pos;
+ c->buffer->pos[c->buffer->i].y_offset = gpi->anchor_y - entry_y;
}
end:
if (record.exitAnchor)
{
- gpi->last = c->buffer->in_pos;
- (this+record.exitAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y);
+ gpi->last = c->buffer->i;
+ (this+record.exitAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->i].codepoint, &gpi->anchor_x, &gpi->anchor_y);
}
- c->buffer->in_pos++;
+ c->buffer->i++;
return true;
}
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (mark_index == NOT_COVERED))
return false;
/* now we search backwards for a non-mark glyph */
unsigned int property;
- unsigned int j = c->buffer->in_pos;
+ unsigned int j = c->buffer->i;
do
{
if (unlikely (!j))
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (mark_index == NOT_COVERED))
return false;
/* now we search backwards for a non-mark glyph */
unsigned int property;
- unsigned int j = c->buffer->in_pos;
+ unsigned int j = c->buffer->i;
do
{
if (unlikely (!j))
* is identical to the ligature ID of the found ligature. If yes, we
* can directly use the component index. If not, we attach the mark
* glyph to the last component of the ligature. */
- if (c->buffer->info[j].lig_id && c->buffer->info[j].lig_id == c->buffer->info[c->buffer->in_pos].lig_id && c->buffer->info[c->buffer->in_pos].component)
+ if (c->buffer->info[j].lig_id && c->buffer->info[j].lig_id == c->buffer->info[c->buffer->i].lig_id && c->buffer->info[c->buffer->i].component)
{
- comp_index = c->buffer->info[c->buffer->in_pos].component - 1;
+ comp_index = c->buffer->info[c->buffer->i].component - 1;
if (comp_index >= comp_count)
comp_index = comp_count - 1;
}
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- unsigned int mark1_index = (this+mark1Coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int mark1_index = (this+mark1Coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (mark1_index == NOT_COVERED))
return false;
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
unsigned int property;
- unsigned int j = c->buffer->in_pos;
+ unsigned int j = c->buffer->i;
do
{
if (unlikely (!j))
/* Two marks match only if they belong to the same base, or same component
* of the same ligature. That is, the component numbers must match, and
* if those are non-zero, the ligid number should also match. */
- if ((c->buffer->info[j].component != c->buffer->info[c->buffer->in_pos].component) ||
- (c->buffer->info[j].component && c->buffer->info[j].lig_id != c->buffer->info[c->buffer->in_pos].lig_id))
+ if ((c->buffer->info[j].component != c->buffer->info[c->buffer->i].component) ||
+ (c->buffer->info[j].component && c->buffer->info[j].lig_id != c->buffer->info[c->buffer->i].lig_id))
return false;
unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint);
c->nesting_level_left = nesting_level_left;
c->lookup_flag = get_flag ();
- if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, &c->property))
+ if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, &c->property))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++)
layout->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->len)
+ buffer->i = 0;
+ while (buffer->i < buffer->len)
{
bool done;
- if (~buffer->info[buffer->in_pos].mask & mask)
+ if (~buffer->info[buffer->i].mask & mask)
{
done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL);
ret |= done;
}
if (!done)
- buffer->in_pos++;
+ buffer->i++;
}
return ret;
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+ hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
return false;
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+ hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
return false;
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+ hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
TRACE_APPLY ();
unsigned int i, j;
unsigned int count = component.len;
- unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
- if (unlikely (c->buffer->in_pos + count > end))
+ unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+ if (unlikely (c->buffer->i + count > end))
return false;
- for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
+ for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
{
unsigned int property;
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property))
is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
- if (j == c->buffer->in_pos + i) /* No input glyphs skipped */
+ if (j == c->buffer->i + i) /* No input glyphs skipped */
/* We don't use a new ligature ID if there are no skipped
glyphs and the ligature already has an ID. */
c->buffer->add_output_glyphs_be16 (i,
1, (const uint16_t *) &ligGlyph,
0,
- c->buffer->info[c->buffer->in_pos].lig_id && !c->buffer->info[c->buffer->in_pos].component ?
+ c->buffer->info[c->buffer->i].lig_id && !c->buffer->info[c->buffer->i].component ?
0xFFFF : c->buffer->allocate_lig_id ());
else
{
for ( i = 1; i < count; i++ )
{
- while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, NULL))
- c->buffer->add_output_glyph (c->buffer->info[c->buffer->in_pos].codepoint, i, lig_id);
+ while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL))
+ c->buffer->add_output_glyph (c->buffer->info[c->buffer->i].codepoint, i, lig_id);
- (c->buffer->in_pos)++;
+ (c->buffer->i)++;
}
}
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
- hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+ hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
if (unlikely (c->context_length != NO_CONTEXT))
return false; /* No chaining to this type */
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
match_coverage, this,
1))
{
- c->buffer->info[c->buffer->in_pos].codepoint = substitute[index];
- c->buffer->in_pos--; /* Reverse! */
+ c->buffer->info[c->buffer->i].codepoint = substitute[index];
+ c->buffer->i--; /* Reverse! */
return true;
}
c->nesting_level_left = nesting_level_left;
c->lookup_flag = get_flag ();
- if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, &c->property))
+ if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, &c->property))
return false;
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
{
/* in/out forward substitution */
buffer->clear_output ();
- buffer->in_pos = 0;
- while (buffer->in_pos < buffer->len)
+ buffer->i = 0;
+ while (buffer->i < buffer->len)
{
- if ((~buffer->info[buffer->in_pos].mask & mask) &&
+ if ((~buffer->info[buffer->i].mask & mask) &&
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
ret = true;
else
else
{
/* in-place backward substitution */
- buffer->in_pos = buffer->len - 1;
+ buffer->i = buffer->len - 1;
do
{
- if ((~buffer->info[buffer->in_pos].mask & mask) &&
+ if ((~buffer->info[buffer->i].mask & mask) &&
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
ret = true;
else
- buffer->in_pos--;
+ buffer->i--;
}
- while ((int) buffer->in_pos >= 0);
+ while ((int) buffer->i >= 0);
}
return ret;
unsigned int *context_length_out)
{
unsigned int i, j;
- unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
- if (unlikely (c->buffer->in_pos + count > end))
+ unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+ if (unlikely (c->buffer->i + count > end))
return false;
- for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
+ for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
{
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
{
return false;
}
- *context_length_out = j - c->buffer->in_pos;
+ *context_length_out = j - c->buffer->i;
return true;
}
unsigned int offset)
{
unsigned int i, j;
- unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
- if (unlikely (c->buffer->in_pos + offset + count > end))
+ unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+ if (unlikely (c->buffer->i + offset + count > end))
return false;
- for (i = 0, j = c->buffer->in_pos + offset; i < count; i++, j++)
+ for (i = 0, j = c->buffer->i + offset; i < count; i++, j++)
{
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
{
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
apply_lookup_func_t apply_func)
{
- unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
- if (unlikely (c->buffer->in_pos + count > end))
+ unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+ if (unlikely (c->buffer->i + count > end))
return false;
/* TODO We don't support lookupRecord arrays that are not increasing:
*/
for (unsigned int i = 0; i < count; /* NOP */)
{
- while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, NULL))
+ while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL))
{
- if (unlikely (c->buffer->in_pos == end))
+ if (unlikely (c->buffer->i == end))
return true;
/* No lookup applied for this index */
c->buffer->next_glyph ();
if (lookupCount && i == lookupRecord->sequenceIndex)
{
- unsigned int old_pos = c->buffer->in_pos;
+ unsigned int old_pos = c->buffer->i;
/* Apply a lookup */
bool done = apply_func (c, lookupRecord->lookupListIndex);
lookupRecord++;
lookupCount--;
/* Err, this is wrong if the lookup jumped over some glyphs */
- i += c->buffer->in_pos - old_pos;
- if (unlikely (c->buffer->in_pos == end))
+ i += c->buffer->i - old_pos;
+ if (unlikely (c->buffer->i == end))
return true;
if (!done)
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
const ClassDef &class_def = this+classDef;
- index = class_def (c->buffer->info[c->buffer->in_pos].codepoint);
+ index = class_def (c->buffer->info[c->buffer->i].codepoint);
const RuleSet &rule_set = this+ruleSet[index];
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
{
/* First guess */
if (unlikely (c->buffer->out_len < backtrackCount ||
- c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->len ||
+ c->buffer->i + inputCount + lookaheadCount > c->buffer->len ||
inputCount + lookaheadCount > c->context_length))
return false;
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
- unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
const ClassDef &input_class_def = this+inputClassDef;
const ClassDef &lookahead_class_def = this+lookaheadClassDef;
- index = input_class_def (c->buffer->info[c->buffer->in_pos].codepoint);
+ index = input_class_def (c->buffer->info[c->buffer->i].codepoint);
const ChainRuleSet &rule_set = this+ruleSet[index];
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
TRACE_APPLY ();
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
- unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->in_pos].codepoint);
+ unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->i].codepoint);
if (likely (index == NOT_COVERED))
return false;
unsigned int count;
count = buffer->len;
- for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++)
- if (buffer->unicode->get_general_category (buffer->info[buffer->in_pos].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
- buffer->info[buffer->in_pos].cluster = buffer->info[buffer->in_pos - 1].cluster;
+ for (buffer->i = 1; buffer->i < count; buffer->i++)
+ if (buffer->unicode->get_general_category (buffer->info[buffer->i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
+ buffer->info[buffer->i].cluster = buffer->info[buffer->i - 1].cluster;
}
static hb_direction_t
return;
count = buffer->len;
- for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
- buffer->info[buffer->in_pos].codepoint = get_mirroring (buffer->info[buffer->in_pos].codepoint);
+ for (buffer->i = 0; buffer->i < count; buffer->i++) {
+ buffer->info[buffer->i].codepoint = get_mirroring (buffer->info[buffer->i].codepoint);
}
}
if (unlikely (!buffer->len))
return;
count = buffer->len - 1;
- for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
- if (unlikely (is_variation_selector (buffer->info[buffer->in_pos + 1].codepoint))) {
- buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, buffer->info[buffer->in_pos + 1].codepoint);
- buffer->in_pos++;
+ for (buffer->i = 0; buffer->i < count; buffer->i++) {
+ if (unlikely (is_variation_selector (buffer->info[buffer->i + 1].codepoint))) {
+ buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint);
+ buffer->i++;
} else {
- buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, 0);
+ buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0);
}
}
- buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, 0);
+ buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0);
}
static void
hb_buffer_clear_positions (buffer);
count = buffer->len;
- for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
+ for (buffer->i = 0; buffer->i < count; buffer->i++) {
hb_glyph_metrics_t metrics;
- hb_font_get_glyph_metrics (font, face, buffer->info[buffer->in_pos].codepoint, &metrics);
- buffer->pos[buffer->in_pos].x_advance = metrics.x_advance;
- buffer->pos[buffer->in_pos].y_advance = metrics.y_advance;
+ hb_font_get_glyph_metrics (font, face, buffer->info[buffer->i].codepoint, &metrics);
+ buffer->pos[buffer->i].x_advance = metrics.x_advance;
+ buffer->pos[buffer->i].y_advance = metrics.y_advance;
}
}
/* TODO Check for kern=0 */
count = buffer->len;
- for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++) {
+ for (buffer->i = 1; buffer->i < count; buffer->i++) {
hb_position_t kern, kern1, kern2;
- kern = hb_font_get_kerning (font, face, buffer->info[buffer->in_pos - 1].codepoint, buffer->info[buffer->in_pos].codepoint);
+ kern = hb_font_get_kerning (font, face, buffer->info[buffer->i - 1].codepoint, buffer->info[buffer->i].codepoint);
kern1 = kern >> 1;
kern2 = kern - kern1;
- buffer->pos[buffer->in_pos - 1].x_advance += kern1;
- buffer->pos[buffer->in_pos].x_advance += kern2;
- buffer->pos[buffer->in_pos].x_offset += kern2;
+ buffer->pos[buffer->i - 1].x_advance += kern1;
+ buffer->pos[buffer->i].x_advance += kern2;
+ buffer->pos[buffer->i].x_offset += kern2;
}
}