Add variant integers to buffer item types. More cleanup coming.
- Fix tt kern on/off
-- Remove hb_internal_glyph_info_t, etc
-
- Remove synthesized GDEF
- Remove fixed-size feature/lookup arrays in hb-ot-map
#define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
+#define component() var1.u16[0]
+#define lig_id() var1.u16[1]
+#define gproperty() var2.u32
+#define back() var.u16[0] /* number of glyphs to go back for drawing current glyph */
+#define cursive_chain() var.i16[1] /* character to which this connects, may be positive or negative */
-
-typedef struct _hb_internal_glyph_info_t {
- hb_codepoint_t codepoint;
- hb_mask_t mask;
- uint32_t cluster;
- uint16_t component;
- uint16_t lig_id;
- uint32_t gproperty;
-} hb_internal_glyph_info_t;
-
-typedef struct _hb_internal_glyph_position_t {
- hb_position_t x_advance;
- hb_position_t y_advance;
- hb_position_t x_offset;
- hb_position_t y_offset;
- uint32_t back : 16; /* number of glyphs to go back
- for drawing current glyph */
- int32_t cursive_chain : 16; /* character to which this connects,
- may be positive or negative */
-} hb_internal_glyph_position_t;
-
-ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_internal_glyph_info_t));
-ASSERT_STATIC (sizeof (hb_glyph_position_t) == sizeof (hb_internal_glyph_position_t));
+ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
typedef struct _hb_segment_properties_t {
unsigned int len; /* Length of ->info and ->pos arrays */
unsigned int out_len; /* Length of ->out array */
- hb_internal_glyph_info_t *info;
- hb_internal_glyph_info_t *out_info;
- hb_internal_glyph_position_t *pos;
+ hb_glyph_info_t *info;
+ hb_glyph_info_t *out_info;
+ hb_glyph_position_t *pos;
/* Other stuff */
return FALSE;
unsigned int new_allocated = buffer->allocated;
- hb_internal_glyph_position_t *new_pos;
- hb_internal_glyph_info_t *new_info;
+ hb_glyph_position_t *new_pos;
+ hb_glyph_info_t *new_info;
bool separate_out;
separate_out = buffer->out_info != buffer->info;
while (size > new_allocated)
new_allocated += (new_allocated >> 1) + 8;
- new_pos = (hb_internal_glyph_position_t *) realloc (buffer->pos, new_allocated * sizeof (buffer->pos[0]));
- new_info = (hb_internal_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0]));
+ new_pos = (hb_glyph_position_t *) realloc (buffer->pos, new_allocated * sizeof (buffer->pos[0]));
+ new_info = (hb_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0]));
if (unlikely (!new_pos || !new_info))
buffer->in_error = TRUE;
if (likely (new_info))
buffer->info = new_info;
- buffer->out_info = separate_out ? (hb_internal_glyph_info_t *) buffer->pos : buffer->info;
+ buffer->out_info = separate_out ? (hb_glyph_info_t *) buffer->pos : buffer->info;
if (likely (!buffer->in_error))
buffer->allocated = new_allocated;
{
assert (buffer->have_output);
- buffer->out_info = (hb_internal_glyph_info_t *) buffer->pos;
+ buffer->out_info = (hb_glyph_info_t *) buffer->pos;
memcpy (buffer->out_info, buffer->info, buffer->out_len * sizeof (buffer->out_info[0]));
}
hb_mask_t mask,
unsigned int cluster)
{
- hb_internal_glyph_info_t *glyph;
+ hb_glyph_info_t *glyph;
if (unlikely (!_hb_buffer_ensure (buffer, buffer->len + 1))) return;
glyph->codepoint = codepoint;
glyph->mask = mask;
glyph->cluster = cluster;
- glyph->component = 0;
- glyph->lig_id = 0;
- glyph->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
+ glyph->component() = 0;
+ glyph->lig_id() = 0;
+ glyph->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
buffer->len++;
}
if (unlikely (!buffer->pos))
{
- buffer->pos = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->pos[0]));
+ buffer->pos = (hb_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->pos[0]));
return;
}
if (buffer->out_info != buffer->info)
{
- hb_internal_glyph_info_t *tmp_string;
+ hb_glyph_info_t *tmp_string;
tmp_string = buffer->info;
buffer->info = buffer->out_info;
buffer->out_info = tmp_string;
- buffer->pos = (hb_internal_glyph_position_t *) buffer->out_info;
+ buffer->pos = (hb_glyph_position_t *) buffer->out_info;
}
tmp = buffer->len;
mask = buffer->info[buffer->i].mask;
cluster = buffer->info[buffer->i].cluster;
if (component == 0xFFFF)
- component = buffer->info[buffer->i].component;
+ component = buffer->info[buffer->i].component();
if (lig_id == 0xFFFF)
- lig_id = buffer->info[buffer->i].lig_id;
+ lig_id = buffer->info[buffer->i].lig_id();
for (i = 0; i < num_out; i++)
{
- hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_len + i];
+ hb_glyph_info_t *info = &buffer->out_info[buffer->out_len + i];
info->codepoint = glyph_data[i];
info->mask = mask;
info->cluster = cluster;
- info->component = component;
- info->lig_id = lig_id;
- info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
+ info->component() = component;
+ info->lig_id() = lig_id;
+ info->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
}
buffer->i += num_in;
mask = buffer->info[buffer->i].mask;
cluster = buffer->info[buffer->i].cluster;
if (component == 0xFFFF)
- component = buffer->info[buffer->i].component;
+ component = buffer->info[buffer->i].component();
if (lig_id == 0xFFFF)
- lig_id = buffer->info[buffer->i].lig_id;
+ lig_id = buffer->info[buffer->i].lig_id();
for (i = 0; i < num_out; i++)
{
- hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_len + i];
+ hb_glyph_info_t *info = &buffer->out_info[buffer->out_len + i];
info->codepoint = hb_be_uint16 (glyph_data_be[i]);
info->mask = mask;
info->cluster = cluster;
- info->component = component;
- info->lig_id = lig_id;
- info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
+ info->component() = component;
+ info->lig_id() = lig_id;
+ info->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
}
buffer->i += num_in;
unsigned short component,
unsigned short lig_id)
{
- hb_internal_glyph_info_t *info;
+ hb_glyph_info_t *info;
if (buffer->out_info != buffer->info)
{
info = &buffer->out_info[buffer->out_len];
info->codepoint = glyph_index;
if (component != 0xFFFF)
- info->component = component;
+ info->component() = component;
if (lig_id != 0xFFFF)
- info->lig_id = lig_id;
- info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
+ info->lig_id() = lig_id;
+ info->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
buffer->i++;
buffer->out_len++;
unsigned int i, j;
for (i = start, j = end - 1; i < j; i++, j--) {
- hb_internal_glyph_info_t t;
+ hb_glyph_info_t t;
t = buffer->info[i];
buffer->info[i] = buffer->info[j];
if (buffer->pos) {
for (i = 0, j = end - 1; i < j; i++, j--) {
- hb_internal_glyph_position_t t;
+ hb_glyph_position_t t;
t = buffer->pos[i];
buffer->pos[i] = buffer->pos[j];
hb_position_t y_advance;
hb_position_t x_offset;
hb_position_t y_offset;
- hb_var_int_t var1;
+ hb_var_int_t var;
} hb_glyph_position_t;
inline unsigned int get_size (void) const
{ return get_len () * Value::static_size; }
- void apply_value (hb_ot_layout_context_t *layout,
- const void *base,
- const Value *values,
- hb_internal_glyph_position_t &glyph_pos) const
+ void apply_value (hb_ot_layout_context_t *layout,
+ const void *base,
+ const Value *values,
+ hb_glyph_position_t &glyph_pos) const
{
unsigned int x_ppem, y_ppem;
unsigned int format = *this;
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->i];
+ hb_glyph_position_t &o = c->buffer->pos[c->buffer->i];
o.x_offset = base_x - mark_x;
o.y_offset = base_y - mark_y;
- o.back = c->buffer->i - glyph_pos;
+ o.back() = c->buffer->i - glyph_pos;
c->buffer->i++;
return true;
if (c->lookup_flag & LookupFlag::RightToLeft)
{
- c->buffer->pos[i].cursive_chain = j - i;
+ c->buffer->pos[i].cursive_chain() = j - i;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
c->buffer->pos[i].y_offset = entry_y - exit_y;
else
}
else
{
- c->buffer->pos[j].cursive_chain = i - j;
+ c->buffer->pos[j].cursive_chain() = i - j;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
c->buffer->pos[j].y_offset = exit_y - entry_y;
else
* 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->i].lig_id && c->buffer->info[c->buffer->i].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->i].component - 1;
+ comp_index = c->buffer->info[c->buffer->i].component() - 1;
if (comp_index >= comp_count)
comp_index = comp_count - 1;
}
/* 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->i].component) ||
- (c->buffer->info[j].component && c->buffer->info[j].lig_id != c->buffer->info[c->buffer->i].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->buffer->add_output_glyphs_be16 (i,
1, (const uint16_t *) &ligGlyph,
0,
- c->buffer->info[c->buffer->i].lig_id && !c->buffer->info[c->buffer->i].component ?
+ c->buffer->info[c->buffer->i].lig_id() && !c->buffer->info[c->buffer->i].component() ?
0xFFFF : c->buffer->allocate_lig_id ());
else
{
HB_INTERNAL hb_bool_t
_hb_ot_layout_check_glyph_property (hb_face_t *face,
- hb_internal_glyph_info_t *ginfo,
+ hb_glyph_info_t *ginfo,
unsigned int lookup_flags,
unsigned int *property);
HB_INTERNAL hb_bool_t
_hb_ot_layout_skip_mark (hb_face_t *face,
- hb_internal_glyph_info_t *ginfo,
+ hb_glyph_info_t *ginfo,
unsigned int lookup_flags,
unsigned int *property);
hb_bool_t
_hb_ot_layout_check_glyph_property (hb_face_t *face,
- hb_internal_glyph_info_t *ginfo,
+ hb_glyph_info_t *ginfo,
unsigned int lookup_flags,
unsigned int *property_out)
{
unsigned int property;
- if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
- ginfo->gproperty = _hb_ot_layout_get_glyph_property (face, ginfo->codepoint);
- property = ginfo->gproperty;
+ if (ginfo->gproperty() == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
+ ginfo->gproperty() = _hb_ot_layout_get_glyph_property (face, ginfo->codepoint);
+ property = ginfo->gproperty();
if (property_out)
*property_out = property;
hb_bool_t
_hb_ot_layout_skip_mark (hb_face_t *face,
- hb_internal_glyph_info_t *ginfo,
+ hb_glyph_info_t *ginfo,
unsigned int lookup_flags,
unsigned int *property_out)
{
unsigned int property;
- if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
- ginfo->gproperty = _hb_ot_layout_get_glyph_property (face, ginfo->codepoint);
- property = ginfo->gproperty;
+ if (ginfo->gproperty() == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
+ ginfo->gproperty() = _hb_ot_layout_get_glyph_property (face, ginfo->codepoint);
+ property = ginfo->gproperty();
if (property_out)
*property_out = property;
{
unsigned int i, j;
unsigned int len = hb_buffer_get_length (buffer);
- hb_internal_glyph_position_t *pos = (hb_internal_glyph_position_t *) hb_buffer_get_glyph_positions (buffer);
+ hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer);
hb_direction_t direction = buffer->props.direction;
/* TODO: Vertical */
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
{
for (j = 0; j < len; j++) {
- if (pos[j].cursive_chain < 0)
- pos[j].y_offset += pos[j + pos[j].cursive_chain].y_offset;
+ if (pos[j].cursive_chain() < 0)
+ pos[j].y_offset += pos[j + pos[j].cursive_chain()].y_offset;
}
for (i = len; i > 0; i--) {
j = i - 1;
- if (pos[j].cursive_chain > 0)
- pos[j].y_offset += pos[j + pos[j].cursive_chain].y_offset;
+ if (pos[j].cursive_chain() > 0)
+ pos[j].y_offset += pos[j + pos[j].cursive_chain()].y_offset;
}
}
else
{
for (j = 0; j < len; j++) {
- if (pos[j].cursive_chain < 0)
- pos[j].x_offset += pos[j + pos[j].cursive_chain].x_offset;
+ if (pos[j].cursive_chain() < 0)
+ pos[j].x_offset += pos[j + pos[j].cursive_chain()].x_offset;
}
for (i = len; i > 0; i--) {
j = i - 1;
- if (pos[j].cursive_chain > 0)
- pos[j].x_offset += pos[j + pos[j].cursive_chain].x_offset;
+ if (pos[j].cursive_chain() > 0)
+ pos[j].x_offset += pos[j + pos[j].cursive_chain()].x_offset;
}
}
/* Handle attachments */
for (i = 0; i < len; i++)
- if (pos[i].back)
+ if (pos[i].back())
{
- unsigned int back = i - pos[i].back;
- pos[i].back = 0;
+ unsigned int back = i - pos[i].back();
pos[i].x_offset += pos[back].x_offset;
pos[i].y_offset += pos[back].y_offset;
unsigned int this_type = get_joining_type (c->buffer->info[i].codepoint, c->buffer->unicode->v.get_general_category (c->buffer->info[i].codepoint));
if (unlikely (this_type == JOINING_TYPE_T)) {
- c->buffer->info[i].gproperty = NONE;
+ c->buffer->info[i].var2.u32 = NONE;
continue;
}
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
if (entry->prev_action != NONE)
- c->buffer->info[prev].gproperty = entry->prev_action;
+ c->buffer->info[prev].var2.u32 = entry->prev_action;
- c->buffer->info[i].gproperty = entry->curr_action;
+ c->buffer->info[i].var2.u32 = entry->curr_action;
prev = i;
state = entry->next_state;
mask_array[i] = c->plan->map.get_1_mask (arabic_syriac_features[i]);
for (unsigned int i = 0; i < count; i++)
- c->buffer->info[i].mask |= mask_array[c->buffer->info[i].gproperty];
+ c->buffer->info[i].mask |= mask_array[c->buffer->info[i].var2.u32];
}