Shortening buffer accessors: rename buffer->in_pos to buffer->i
This commit is contained in:
parent
29427c5c51
commit
36b73c80df
|
@ -112,7 +112,7 @@ struct _hb_buffer_t {
|
||||||
hb_bool_t have_positions; /* whether we have positions */
|
hb_bool_t have_positions; /* whether we have positions */
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
unsigned int out_len;
|
unsigned int out_len;
|
||||||
unsigned int in_pos;
|
unsigned int i;
|
||||||
|
|
||||||
hb_internal_glyph_info_t *info;
|
hb_internal_glyph_info_t *info;
|
||||||
hb_internal_glyph_info_t *out_info;
|
hb_internal_glyph_info_t *out_info;
|
||||||
|
|
|
@ -183,7 +183,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
|
||||||
buffer->have_positions = FALSE;
|
buffer->have_positions = FALSE;
|
||||||
buffer->len = 0;
|
buffer->len = 0;
|
||||||
buffer->out_len = 0;
|
buffer->out_len = 0;
|
||||||
buffer->in_pos = 0;
|
buffer->i = 0;
|
||||||
buffer->out_info = buffer->info;
|
buffer->out_info = buffer->info;
|
||||||
buffer->max_lig_id = 0;
|
buffer->max_lig_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ _hb_buffer_swap (hb_buffer_t *buffer)
|
||||||
buffer->len = buffer->out_len;
|
buffer->len = buffer->out_len;
|
||||||
buffer->out_len = tmp;
|
buffer->out_len = tmp;
|
||||||
|
|
||||||
buffer->in_pos = 0;
|
buffer->i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following function copies `num_out' elements from `glyph_data'
|
/* The following function copies `num_out' elements from `glyph_data'
|
||||||
|
@ -294,18 +294,18 @@ _hb_buffer_swap (hb_buffer_t *buffer)
|
||||||
Finally, it sets the `length' field of `out' equal to
|
Finally, it sets the `length' field of `out' equal to
|
||||||
`pos' of the `out' structure.
|
`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
|
will copied `num_out' times, otherwise `component' itself will
|
||||||
be used to fill the `component' fields.
|
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
|
will copied `num_out' times, otherwise `lig_id' itself will
|
||||||
be used to fill the `lig_id' fields.
|
be used to fill the `lig_id' fields.
|
||||||
|
|
||||||
The mask for all replacement glyphs are taken
|
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 */
|
for all replacement glyphs */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -321,17 +321,17 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
|
||||||
unsigned int cluster;
|
unsigned int cluster;
|
||||||
|
|
||||||
if (buffer->out_info != buffer->info ||
|
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);
|
hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
mask = buffer->info[buffer->in_pos].mask;
|
mask = buffer->info[buffer->i].mask;
|
||||||
cluster = buffer->info[buffer->in_pos].cluster;
|
cluster = buffer->info[buffer->i].cluster;
|
||||||
if (component == 0xFFFF)
|
if (component == 0xFFFF)
|
||||||
component = buffer->info[buffer->in_pos].component;
|
component = buffer->info[buffer->i].component;
|
||||||
if (lig_id == 0xFFFF)
|
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++)
|
for (i = 0; i < num_out; i++)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
|
||||||
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->in_pos += num_in;
|
buffer->i += num_in;
|
||||||
buffer->out_len += num_out;
|
buffer->out_len += num_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,17 +361,17 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
|
||||||
unsigned int cluster;
|
unsigned int cluster;
|
||||||
|
|
||||||
if (buffer->out_info != buffer->info ||
|
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);
|
hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
mask = buffer->info[buffer->in_pos].mask;
|
mask = buffer->info[buffer->i].mask;
|
||||||
cluster = buffer->info[buffer->in_pos].cluster;
|
cluster = buffer->info[buffer->i].cluster;
|
||||||
if (component == 0xFFFF)
|
if (component == 0xFFFF)
|
||||||
component = buffer->info[buffer->in_pos].component;
|
component = buffer->info[buffer->i].component;
|
||||||
if (lig_id == 0xFFFF)
|
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++)
|
for (i = 0; i < num_out; i++)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +384,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
|
||||||
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->in_pos += num_in;
|
buffer->i += num_in;
|
||||||
buffer->out_len += num_out;
|
buffer->out_len += num_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,10 +399,10 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
|
||||||
if (buffer->out_info != buffer->info)
|
if (buffer->out_info != buffer->info)
|
||||||
{
|
{
|
||||||
hb_buffer_ensure (buffer, buffer->out_len + 1);
|
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)
|
else if (buffer->out_len != buffer->i)
|
||||||
buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
|
buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
|
||||||
|
|
||||||
info = &buffer->out_info[buffer->out_len];
|
info = &buffer->out_info[buffer->out_len];
|
||||||
info->codepoint = glyph_index;
|
info->codepoint = glyph_index;
|
||||||
|
@ -412,7 +412,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
|
||||||
info->lig_id = lig_id;
|
info->lig_id = lig_id;
|
||||||
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
|
||||||
|
|
||||||
buffer->in_pos++;
|
buffer->i++;
|
||||||
buffer->out_len++;
|
buffer->out_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,15 +424,15 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
|
||||||
if (buffer->out_info != buffer->info)
|
if (buffer->out_info != buffer->info)
|
||||||
{
|
{
|
||||||
hb_buffer_ensure (buffer, buffer->out_len + 1);
|
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)
|
else if (buffer->out_len != buffer->i)
|
||||||
buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
|
buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
|
||||||
|
|
||||||
buffer->out_len++;
|
buffer->out_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->in_pos++;
|
buffer->i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -399,17 +399,17 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
|
||||||
|
|
||||||
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 (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);
|
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.x_advance = 0;
|
||||||
o.y_advance = 0;
|
o.y_advance = 0;
|
||||||
o.x_offset = base_x - mark_x;
|
o.x_offset = base_x - mark_x;
|
||||||
o.y_offset = base_y - mark_y;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,13 +430,13 @@ struct SinglePosFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ struct SinglePosFormat2
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -478,9 +478,9 @@ struct SinglePosFormat2
|
||||||
|
|
||||||
valueFormat.apply_value (c->layout, this,
|
valueFormat.apply_value (c->layout, this,
|
||||||
&values[index * valueFormat.get_len ()],
|
&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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,11 +572,11 @@ struct PairSet
|
||||||
{
|
{
|
||||||
if (c->buffer->info[pos].codepoint == record->secondGlyph)
|
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]);
|
valueFormats[1].apply_value (c->layout, this, &record->values[len1], c->buffer->pos[pos]);
|
||||||
if (len2)
|
if (len2)
|
||||||
pos++;
|
pos++;
|
||||||
c->buffer->in_pos = pos;
|
c->buffer->i = pos;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
record = &StructAtOffset<PairValueRecord> (record, record_size);
|
record = &StructAtOffset<PairValueRecord> (record, record_size);
|
||||||
|
@ -619,15 +619,15 @@ struct PairPosFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
|
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
|
||||||
if (unlikely (c->buffer->in_pos + 2 > end))
|
if (unlikely (c->buffer->i + 2 > end))
|
||||||
return false;
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
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))
|
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j == end))
|
if (unlikely (j == end))
|
||||||
|
@ -681,15 +681,15 @@ struct PairPosFormat2
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
|
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
|
||||||
if (unlikely (c->buffer->in_pos + 2 > end))
|
if (unlikely (c->buffer->i + 2 > end))
|
||||||
return false;
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
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))
|
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j == end))
|
if (unlikely (j == end))
|
||||||
|
@ -701,18 +701,18 @@ struct PairPosFormat2
|
||||||
unsigned int len2 = valueFormat2.get_len ();
|
unsigned int len2 = valueFormat2.get_len ();
|
||||||
unsigned int record_len = len1 + len2;
|
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);
|
unsigned int klass2 = (this+classDef2) (c->buffer->info[j].codepoint);
|
||||||
if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
|
if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
|
||||||
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 (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]);
|
valueFormat2.apply_value (c->layout, this, v + len1, c->buffer->pos[j]);
|
||||||
|
|
||||||
if (len2)
|
if (len2)
|
||||||
j++;
|
j++;
|
||||||
c->buffer->in_pos = j;
|
c->buffer->i = j;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -954,7 +954,7 @@ struct CursivePosFormat1
|
||||||
if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
|
if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
|
||||||
return false;
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -964,14 +964,14 @@ 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 (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 */
|
/* TODO vertical */
|
||||||
|
|
||||||
if (c->buffer->direction == HB_DIRECTION_RTL)
|
if (c->buffer->direction == HB_DIRECTION_RTL)
|
||||||
{
|
{
|
||||||
/* advance is absolute, not relative */
|
/* 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -981,23 +981,23 @@ struct CursivePosFormat1
|
||||||
|
|
||||||
if (c->lookup_flag & LookupFlag::RightToLeft)
|
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;
|
c->buffer->pos[last_pos].y_offset = entry_y - gpi->anchor_y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c->buffer->pos[c->buffer->in_pos].cursive_chain = c->buffer->in_pos - last_pos;
|
c->buffer->pos[c->buffer->i].cursive_chain = c->buffer->i - last_pos;
|
||||||
c->buffer->pos[c->buffer->in_pos].y_offset = gpi->anchor_y - entry_y;
|
c->buffer->pos[c->buffer->i].y_offset = gpi->anchor_y - entry_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (record.exitAnchor)
|
if (record.exitAnchor)
|
||||||
{
|
{
|
||||||
gpi->last = c->buffer->in_pos;
|
gpi->last = c->buffer->i;
|
||||||
(this+record.exitAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y);
|
(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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1063,13 +1063,13 @@ struct MarkBasePosFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (mark_index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* now we search backwards for a non-mark glyph */
|
/* now we search backwards for a non-mark glyph */
|
||||||
unsigned int property;
|
unsigned int property;
|
||||||
unsigned int j = c->buffer->in_pos;
|
unsigned int j = c->buffer->i;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (unlikely (!j))
|
if (unlikely (!j))
|
||||||
|
@ -1165,13 +1165,13 @@ struct MarkLigPosFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (mark_index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* now we search backwards for a non-mark glyph */
|
/* now we search backwards for a non-mark glyph */
|
||||||
unsigned int property;
|
unsigned int property;
|
||||||
unsigned int j = c->buffer->in_pos;
|
unsigned int j = c->buffer->i;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (unlikely (!j))
|
if (unlikely (!j))
|
||||||
|
@ -1199,9 +1199,9 @@ struct MarkLigPosFormat1
|
||||||
* is identical to the ligature ID of the found ligature. If yes, we
|
* 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
|
* can directly use the component index. If not, we attach the mark
|
||||||
* glyph to the last component of the ligature. */
|
* 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)
|
if (comp_index >= comp_count)
|
||||||
comp_index = comp_count - 1;
|
comp_index = comp_count - 1;
|
||||||
}
|
}
|
||||||
|
@ -1284,13 +1284,13 @@ struct MarkMarkPosFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (mark1_index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
|
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
|
||||||
unsigned int property;
|
unsigned int property;
|
||||||
unsigned int j = c->buffer->in_pos;
|
unsigned int j = c->buffer->i;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (unlikely (!j))
|
if (unlikely (!j))
|
||||||
|
@ -1304,8 +1304,8 @@ struct MarkMarkPosFormat1
|
||||||
/* Two marks match only if they belong to the same base, or same component
|
/* 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
|
* of the same ligature. That is, the component numbers must match, and
|
||||||
* if those are non-zero, the ligid number should also match. */
|
* 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) ||
|
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->in_pos].lig_id))
|
(c->buffer->info[j].component && c->buffer->info[j].lig_id != c->buffer->info[c->buffer->i].lig_id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint);
|
unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint);
|
||||||
|
@ -1513,7 +1513,7 @@ struct PosLookup : Lookup
|
||||||
c->nesting_level_left = nesting_level_left;
|
c->nesting_level_left = nesting_level_left;
|
||||||
c->lookup_flag = get_flag ();
|
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;
|
return false;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < get_subtable_count (); i++)
|
for (unsigned int i = 0; i < get_subtable_count (); i++)
|
||||||
|
@ -1534,11 +1534,11 @@ struct PosLookup : Lookup
|
||||||
|
|
||||||
layout->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->i = 0;
|
||||||
while (buffer->in_pos < buffer->len)
|
while (buffer->i < buffer->len)
|
||||||
{
|
{
|
||||||
bool done;
|
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);
|
done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL);
|
||||||
ret |= done;
|
ret |= done;
|
||||||
|
@ -1552,7 +1552,7 @@ struct PosLookup : Lookup
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
buffer->in_pos++;
|
buffer->i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct SingleSubstFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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);
|
unsigned int index = (this+coverage) (glyph_id);
|
||||||
if (likely (index == NOT_COVERED))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
@ -80,7 +80,7 @@ struct SingleSubstFormat2
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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);
|
unsigned int index = (this+coverage) (glyph_id);
|
||||||
if (likely (index == NOT_COVERED))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,7 +204,7 @@ struct MultipleSubstFormat1
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ struct AlternateSubstFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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);
|
unsigned int index = (this+coverage) (glyph_id);
|
||||||
if (likely (index == NOT_COVERED))
|
if (likely (index == NOT_COVERED))
|
||||||
|
@ -367,11 +367,11 @@ struct Ligature
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int count = component.len;
|
unsigned int count = component.len;
|
||||||
unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
|
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
|
||||||
if (unlikely (c->buffer->in_pos + count > end))
|
if (unlikely (c->buffer->i + count > end))
|
||||||
return false;
|
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;
|
unsigned int property;
|
||||||
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property))
|
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property))
|
||||||
|
@ -393,13 +393,13 @@ struct Ligature
|
||||||
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);
|
||||||
|
|
||||||
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
|
/* We don't use a new ligature ID if there are no skipped
|
||||||
glyphs and the ligature already has an ID. */
|
glyphs and the ligature already has an ID. */
|
||||||
c->buffer->add_output_glyphs_be16 (i,
|
c->buffer->add_output_glyphs_be16 (i,
|
||||||
1, (const uint16_t *) &ligGlyph,
|
1, (const uint16_t *) &ligGlyph,
|
||||||
0,
|
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 ());
|
0xFFFF : c->buffer->allocate_lig_id ());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -415,10 +415,10 @@ struct Ligature
|
||||||
|
|
||||||
for ( i = 1; i < count; i++ )
|
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))
|
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->in_pos].codepoint, i, lig_id);
|
c->buffer->add_output_glyph (c->buffer->info[c->buffer->i].codepoint, i, lig_id);
|
||||||
|
|
||||||
(c->buffer->in_pos)++;
|
(c->buffer->i)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ struct LigatureSubstFormat1
|
||||||
inline bool apply (hb_apply_context_t *c) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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);
|
bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ struct ReverseChainSingleSubstFormat1
|
||||||
if (unlikely (c->context_length != NO_CONTEXT))
|
if (unlikely (c->context_length != NO_CONTEXT))
|
||||||
return false; /* No chaining to this type */
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -619,8 +619,8 @@ struct ReverseChainSingleSubstFormat1
|
||||||
match_coverage, this,
|
match_coverage, this,
|
||||||
1))
|
1))
|
||||||
{
|
{
|
||||||
c->buffer->info[c->buffer->in_pos].codepoint = substitute[index];
|
c->buffer->info[c->buffer->i].codepoint = substitute[index];
|
||||||
c->buffer->in_pos--; /* Reverse! */
|
c->buffer->i--; /* Reverse! */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@ struct SubstLookup : Lookup
|
||||||
c->nesting_level_left = nesting_level_left;
|
c->nesting_level_left = nesting_level_left;
|
||||||
c->lookup_flag = get_flag ();
|
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;
|
return false;
|
||||||
|
|
||||||
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
|
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
|
||||||
|
@ -827,10 +827,10 @@ struct SubstLookup : Lookup
|
||||||
{
|
{
|
||||||
/* in/out forward substitution */
|
/* in/out forward substitution */
|
||||||
buffer->clear_output ();
|
buffer->clear_output ();
|
||||||
buffer->in_pos = 0;
|
buffer->i = 0;
|
||||||
while (buffer->in_pos < buffer->len)
|
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))
|
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
|
||||||
ret = true;
|
ret = true;
|
||||||
else
|
else
|
||||||
|
@ -843,17 +843,17 @@ struct SubstLookup : Lookup
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* in-place backward substitution */
|
/* in-place backward substitution */
|
||||||
buffer->in_pos = buffer->len - 1;
|
buffer->i = buffer->len - 1;
|
||||||
do
|
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))
|
apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
|
||||||
ret = true;
|
ret = true;
|
||||||
else
|
else
|
||||||
buffer->in_pos--;
|
buffer->i--;
|
||||||
|
|
||||||
}
|
}
|
||||||
while ((int) buffer->in_pos >= 0);
|
while ((int) buffer->i >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -88,11 +88,11 @@ static inline bool match_input (hb_apply_context_t *c,
|
||||||
unsigned int *context_length_out)
|
unsigned int *context_length_out)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
|
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
|
||||||
if (unlikely (c->buffer->in_pos + count > end))
|
if (unlikely (c->buffer->i + count > end))
|
||||||
return false;
|
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))
|
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ static inline bool match_input (hb_apply_context_t *c,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*context_length_out = j - c->buffer->in_pos;
|
*context_length_out = j - c->buffer->i;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -143,11 +143,11 @@ static inline bool match_lookahead (hb_apply_context_t *c,
|
||||||
unsigned int offset)
|
unsigned int offset)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
|
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
|
||||||
if (unlikely (c->buffer->in_pos + offset + count > end))
|
if (unlikely (c->buffer->i + offset + count > end))
|
||||||
return false;
|
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))
|
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
|
@ -185,8 +185,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
|
||||||
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
|
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
|
||||||
apply_lookup_func_t apply_func)
|
apply_lookup_func_t apply_func)
|
||||||
{
|
{
|
||||||
unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
|
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
|
||||||
if (unlikely (c->buffer->in_pos + count > end))
|
if (unlikely (c->buffer->i + count > end))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* TODO We don't support lookupRecord arrays that are not increasing:
|
/* TODO We don't support lookupRecord arrays that are not increasing:
|
||||||
|
@ -198,9 +198,9 @@ static inline bool apply_lookup (hb_apply_context_t *c,
|
||||||
*/
|
*/
|
||||||
for (unsigned int i = 0; i < count; /* NOP */)
|
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;
|
return true;
|
||||||
/* No lookup applied for this index */
|
/* No lookup applied for this index */
|
||||||
c->buffer->next_glyph ();
|
c->buffer->next_glyph ();
|
||||||
|
@ -208,7 +208,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
|
||||||
|
|
||||||
if (lookupCount && i == lookupRecord->sequenceIndex)
|
if (lookupCount && i == lookupRecord->sequenceIndex)
|
||||||
{
|
{
|
||||||
unsigned int old_pos = c->buffer->in_pos;
|
unsigned int old_pos = c->buffer->i;
|
||||||
|
|
||||||
/* Apply a lookup */
|
/* Apply a lookup */
|
||||||
bool done = apply_func (c, lookupRecord->lookupListIndex);
|
bool done = apply_func (c, lookupRecord->lookupListIndex);
|
||||||
|
@ -216,8 +216,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
|
||||||
lookupRecord++;
|
lookupRecord++;
|
||||||
lookupCount--;
|
lookupCount--;
|
||||||
/* Err, this is wrong if the lookup jumped over some glyphs */
|
/* Err, this is wrong if the lookup jumped over some glyphs */
|
||||||
i += c->buffer->in_pos - old_pos;
|
i += c->buffer->i - old_pos;
|
||||||
if (unlikely (c->buffer->in_pos == end))
|
if (unlikely (c->buffer->i == end))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
|
@ -337,7 +337,7 @@ struct ContextFormat1
|
||||||
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -376,12 +376,12 @@ struct ContextFormat2
|
||||||
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ClassDef &class_def = this+classDef;
|
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];
|
const RuleSet &rule_set = this+ruleSet[index];
|
||||||
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
|
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
|
||||||
* them across subrule lookups. Not sure it's worth it.
|
* them across subrule lookups. Not sure it's worth it.
|
||||||
|
@ -424,7 +424,7 @@ struct ContextFormat3
|
||||||
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
|
||||||
{
|
{
|
||||||
/* First guess */
|
/* First guess */
|
||||||
if (unlikely (c->buffer->out_len < backtrackCount ||
|
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))
|
inputCount + lookaheadCount > c->context_length))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ struct ChainContextFormat1
|
||||||
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ struct ChainContextFormat2
|
||||||
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ struct ChainContextFormat2
|
||||||
const ClassDef &input_class_def = this+inputClassDef;
|
const ClassDef &input_class_def = this+inputClassDef;
|
||||||
const ClassDef &lookahead_class_def = this+lookaheadClassDef;
|
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];
|
const ChainRuleSet &rule_set = this+ruleSet[index];
|
||||||
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
|
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
|
||||||
* them across subrule lookups. Not sure it's worth it.
|
* them across subrule lookups. Not sure it's worth it.
|
||||||
|
@ -732,7 +732,7 @@ struct ChainContextFormat3
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
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))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ hb_form_clusters (hb_buffer_t *buffer)
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
count = buffer->len;
|
count = buffer->len;
|
||||||
for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++)
|
for (buffer->i = 1; buffer->i < count; buffer->i++)
|
||||||
if (buffer->unicode->get_general_category (buffer->info[buffer->in_pos].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
|
if (buffer->unicode->get_general_category (buffer->info[buffer->i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
|
||||||
buffer->info[buffer->in_pos].cluster = buffer->info[buffer->in_pos - 1].cluster;
|
buffer->info[buffer->i].cluster = buffer->info[buffer->i - 1].cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hb_direction_t
|
static hb_direction_t
|
||||||
|
@ -83,8 +83,8 @@ hb_mirror_chars (hb_buffer_t *buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
count = buffer->len;
|
count = buffer->len;
|
||||||
for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
|
for (buffer->i = 0; buffer->i < count; buffer->i++) {
|
||||||
buffer->info[buffer->in_pos].codepoint = get_mirroring (buffer->info[buffer->in_pos].codepoint);
|
buffer->info[buffer->i].codepoint = get_mirroring (buffer->info[buffer->i].codepoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,15 +98,15 @@ hb_map_glyphs (hb_font_t *font,
|
||||||
if (unlikely (!buffer->len))
|
if (unlikely (!buffer->len))
|
||||||
return;
|
return;
|
||||||
count = buffer->len - 1;
|
count = buffer->len - 1;
|
||||||
for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
|
for (buffer->i = 0; buffer->i < count; buffer->i++) {
|
||||||
if (unlikely (is_variation_selector (buffer->info[buffer->in_pos + 1].codepoint))) {
|
if (unlikely (is_variation_selector (buffer->info[buffer->i + 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->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint);
|
||||||
buffer->in_pos++;
|
buffer->i++;
|
||||||
} else {
|
} 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
|
static void
|
||||||
|
@ -155,11 +155,11 @@ hb_position_default (hb_font_t *font,
|
||||||
hb_buffer_clear_positions (buffer);
|
hb_buffer_clear_positions (buffer);
|
||||||
|
|
||||||
count = buffer->len;
|
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_glyph_metrics_t metrics;
|
||||||
hb_font_get_glyph_metrics (font, face, buffer->info[buffer->in_pos].codepoint, &metrics);
|
hb_font_get_glyph_metrics (font, face, buffer->info[buffer->i].codepoint, &metrics);
|
||||||
buffer->pos[buffer->in_pos].x_advance = metrics.x_advance;
|
buffer->pos[buffer->i].x_advance = metrics.x_advance;
|
||||||
buffer->pos[buffer->in_pos].y_advance = metrics.y_advance;
|
buffer->pos[buffer->i].y_advance = metrics.y_advance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,14 +194,14 @@ hb_truetype_kern (hb_font_t *font,
|
||||||
|
|
||||||
/* TODO Check for kern=0 */
|
/* TODO Check for kern=0 */
|
||||||
count = buffer->len;
|
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;
|
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;
|
kern1 = kern >> 1;
|
||||||
kern2 = kern - kern1;
|
kern2 = kern - kern1;
|
||||||
buffer->pos[buffer->in_pos - 1].x_advance += kern1;
|
buffer->pos[buffer->i - 1].x_advance += kern1;
|
||||||
buffer->pos[buffer->in_pos].x_advance += kern2;
|
buffer->pos[buffer->i].x_advance += kern2;
|
||||||
buffer->pos[buffer->in_pos].x_offset += kern2;
|
buffer->pos[buffer->i].x_offset += kern2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue