Shortening buffer accessors: rename buffer->positions to buffer->pos

This commit is contained in:
Behdad Esfahbod 2010-05-14 22:05:53 -04:00
parent 9d5e26df08
commit 1b621823f3
4 changed files with 36 additions and 36 deletions

View File

@ -116,11 +116,11 @@ struct _hb_buffer_t {
hb_internal_glyph_info_t *info;
hb_internal_glyph_info_t *out_info;
hb_internal_glyph_position_t *positions;
hb_internal_glyph_position_t *pos;
/* Other stuff */
unsigned int max_lig_id;
unsigned int max_lig_id;
/* Methods */

View File

@ -65,10 +65,10 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
if (buffer->out_info == buffer->info)
{
assert (buffer->have_output);
if (!buffer->positions)
buffer->positions = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->positions[0]));
if (!buffer->pos)
buffer->pos = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->pos[0]));
buffer->out_info = (hb_internal_glyph_info_t *) buffer->positions;
buffer->out_info = (hb_internal_glyph_info_t *) buffer->pos;
memcpy (buffer->out_info, buffer->info, buffer->out_length * sizeof (buffer->out_info[0]));
}
}
@ -111,7 +111,7 @@ hb_buffer_destroy (hb_buffer_t *buffer)
hb_unicode_funcs_destroy (buffer->unicode);
free (buffer->info);
free (buffer->positions);
free (buffer->pos);
free (buffer);
}
@ -198,13 +198,13 @@ hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
while (size > new_allocated)
new_allocated += (new_allocated >> 1) + 8;
if (buffer->positions)
buffer->positions = (hb_internal_glyph_position_t *) realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0]));
if (buffer->pos)
buffer->pos = (hb_internal_glyph_position_t *) realloc (buffer->pos, new_allocated * sizeof (buffer->pos[0]));
if (buffer->out_info != buffer->info)
{
buffer->info = (hb_internal_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0]));
buffer->out_info = (hb_internal_glyph_info_t *) buffer->positions;
buffer->out_info = (hb_internal_glyph_info_t *) buffer->pos;
}
else
{
@ -256,13 +256,13 @@ hb_buffer_clear_positions (hb_buffer_t *buffer)
buffer->have_output = FALSE;
buffer->have_positions = TRUE;
if (unlikely (!buffer->positions))
if (unlikely (!buffer->pos))
{
buffer->positions = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->positions[0]));
buffer->pos = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->pos[0]));
return;
}
memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length);
memset (buffer->pos, 0, sizeof (buffer->pos[0]) * buffer->in_length);
}
void
@ -278,7 +278,7 @@ _hb_buffer_swap (hb_buffer_t *buffer)
tmp_string = buffer->info;
buffer->info = buffer->out_info;
buffer->out_info = tmp_string;
buffer->positions = (hb_internal_glyph_position_t *) buffer->out_info;
buffer->pos = (hb_internal_glyph_position_t *) buffer->out_info;
}
tmp = buffer->in_length;
@ -456,7 +456,7 @@ hb_buffer_get_glyph_positions (hb_buffer_t *buffer)
if (!buffer->have_positions)
hb_buffer_clear_positions (buffer);
return (hb_glyph_position_t *) buffer->positions;
return (hb_glyph_position_t *) buffer->pos;
}
@ -475,13 +475,13 @@ reverse_range (hb_buffer_t *buffer,
buffer->info[j] = t;
}
if (buffer->positions) {
if (buffer->pos) {
for (i = 0, j = end - 1; i < j; i++, j--) {
hb_internal_glyph_position_t t;
t = buffer->positions[i];
buffer->positions[i] = buffer->positions[j];
buffer->positions[j] = t;
t = buffer->pos[i];
buffer->pos[i] = buffer->pos[j];
buffer->pos[j] = t;
}
}
}

View File

@ -402,7 +402,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
mark_anchor.get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].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->positions[c->buffer->in_pos];
hb_internal_glyph_position_t &o = c->buffer->pos[c->buffer->in_pos];
o.x_advance = 0;
o.y_advance = 0;
o.x_offset = base_x - mark_x;
@ -434,7 +434,7 @@ struct SinglePosFormat1
if (likely (index == NOT_COVERED))
return false;
valueFormat.apply_value (c->layout, this, values, c->buffer->positions[c->buffer->in_pos]);
valueFormat.apply_value (c->layout, this, values, c->buffer->pos[c->buffer->in_pos]);
c->buffer->in_pos++;
return true;
@ -478,7 +478,7 @@ struct SinglePosFormat2
valueFormat.apply_value (c->layout, this,
&values[index * valueFormat.get_len ()],
c->buffer->positions[c->buffer->in_pos]);
c->buffer->pos[c->buffer->in_pos]);
c->buffer->in_pos++;
return true;
@ -572,8 +572,8 @@ struct PairSet
{
if (c->buffer->info[pos].codepoint == record->secondGlyph)
{
valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->positions[c->buffer->in_pos]);
valueFormats[1].apply_value (c->layout, this, &record->values[len1], c->buffer->positions[pos]);
valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->pos[c->buffer->in_pos]);
valueFormats[1].apply_value (c->layout, this, &record->values[len1], c->buffer->pos[pos]);
if (len2)
pos++;
c->buffer->in_pos = pos;
@ -707,8 +707,8 @@ struct PairPosFormat2
return false;
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
valueFormat1.apply_value (c->layout, this, v, c->buffer->positions[c->buffer->in_pos]);
valueFormat2.apply_value (c->layout, this, v + len1, c->buffer->positions[j]);
valueFormat1.apply_value (c->layout, this, v, c->buffer->pos[c->buffer->in_pos]);
valueFormat2.apply_value (c->layout, this, v + len1, c->buffer->pos[j]);
if (len2)
j++;
@ -971,23 +971,23 @@ struct CursivePosFormat1
if (c->buffer->direction == HB_DIRECTION_RTL)
{
/* advance is absolute, not relative */
c->buffer->positions[c->buffer->in_pos].x_advance = entry_x - gpi->anchor_x;
c->buffer->pos[c->buffer->in_pos].x_advance = entry_x - gpi->anchor_x;
}
else
{
/* advance is absolute, not relative */
c->buffer->positions[last_pos].x_advance = gpi->anchor_x - entry_x;
c->buffer->pos[last_pos].x_advance = gpi->anchor_x - entry_x;
}
if (c->lookup_flag & LookupFlag::RightToLeft)
{
c->buffer->positions[last_pos].cursive_chain = last_pos - c->buffer->in_pos;
c->buffer->positions[last_pos].y_offset = entry_y - gpi->anchor_y;
c->buffer->pos[last_pos].cursive_chain = last_pos - c->buffer->in_pos;
c->buffer->pos[last_pos].y_offset = entry_y - gpi->anchor_y;
}
else
{
c->buffer->positions[c->buffer->in_pos].cursive_chain = c->buffer->in_pos - last_pos;
c->buffer->positions[c->buffer->in_pos].y_offset = gpi->anchor_y - entry_y;
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;
}
end:

View File

@ -158,8 +158,8 @@ hb_position_default (hb_font_t *font,
for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
hb_glyph_metrics_t metrics;
hb_font_get_glyph_metrics (font, face, buffer->info[buffer->in_pos].codepoint, &metrics);
buffer->positions[buffer->in_pos].x_advance = metrics.x_advance;
buffer->positions[buffer->in_pos].y_advance = metrics.y_advance;
buffer->pos[buffer->in_pos].x_advance = metrics.x_advance;
buffer->pos[buffer->in_pos].y_advance = metrics.y_advance;
}
}
@ -199,9 +199,9 @@ hb_truetype_kern (hb_font_t *font,
kern = hb_font_get_kerning (font, face, buffer->info[buffer->in_pos - 1].codepoint, buffer->info[buffer->in_pos].codepoint);
kern1 = kern >> 1;
kern2 = kern - kern1;
buffer->positions[buffer->in_pos - 1].x_advance += kern1;
buffer->positions[buffer->in_pos].x_advance += kern2;
buffer->positions[buffer->in_pos].x_offset += kern2;
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;
}
}