From 7e7007a1c9bf2c07a8369752126ece8fa6164248 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 14 May 2010 22:02:37 -0400 Subject: [PATCH] Shortening buffer accessors: rename buffer->in_string to buffer->info --- src/hb-buffer-private.hh | 2 +- src/hb-buffer.cc | 82 ++++++++++++++-------------- src/hb-ot-layout-gpos-private.hh | 58 ++++++++++---------- src/hb-ot-layout-gsub-private.hh | 30 +++++----- src/hb-ot-layout-gsubgpos-private.hh | 26 ++++----- src/hb-shape.cc | 18 +++--- 6 files changed, 108 insertions(+), 108 deletions(-) diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index 9296fb510..16d3e197b 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -114,7 +114,7 @@ struct _hb_buffer_t { unsigned int out_length; unsigned int in_pos; - hb_internal_glyph_info_t *in_string; + hb_internal_glyph_info_t *info; hb_internal_glyph_info_t *out_string; hb_internal_glyph_position_t *positions; diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 1f8f1830c..008105c75 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -38,20 +38,20 @@ static hb_buffer_t _hb_buffer_nil = { /* Here is how the buffer works internally: * - * There are two string pointers: in_string and out_string. They + * There are two string pointers: info and out_string. They * always have same allocated size, but different length and positions. * - * As an optimization, both in_string and out_string may point to the - * same piece of memory, which is owned by in_string. This remains the + * As an optimization, both info and out_string may point to the + * same piece of memory, which is owned by info. This remains the * case as long as out_length doesn't exceed in_length at any time. * In that case, swap() is no-op and the glyph operations operate mostly * in-place. * - * As soon as out_string gets longer than in_string, out_string is moved over + * As soon as out_string gets longer than info, out_string is moved over * to an alternate buffer (which we reuse the positions buffer for!), and its * current contents (out_length entries) are copied to the alt buffer. * This should all remain transparent to the user. swap() then switches - * in_string and out_string. + * info and out_string. */ /* XXX err handling */ @@ -62,14 +62,14 @@ static void hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size) { hb_buffer_ensure (buffer, size); - if (buffer->out_string == buffer->in_string) + if (buffer->out_string == buffer->info) { assert (buffer->have_output); if (!buffer->positions) buffer->positions = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->positions[0])); buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions; - memcpy (buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0])); + memcpy (buffer->out_string, buffer->info, buffer->out_length * sizeof (buffer->out_string[0])); } } @@ -110,7 +110,7 @@ hb_buffer_destroy (hb_buffer_t *buffer) hb_unicode_funcs_destroy (buffer->unicode); - free (buffer->in_string); + free (buffer->info); free (buffer->positions); free (buffer); @@ -184,7 +184,7 @@ hb_buffer_clear (hb_buffer_t *buffer) buffer->in_length = 0; buffer->out_length = 0; buffer->in_pos = 0; - buffer->out_string = buffer->in_string; + buffer->out_string = buffer->info; buffer->max_lig_id = 0; } @@ -201,15 +201,15 @@ hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size) if (buffer->positions) buffer->positions = (hb_internal_glyph_position_t *) realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0])); - if (buffer->out_string != buffer->in_string) + if (buffer->out_string != buffer->info) { - buffer->in_string = (hb_internal_glyph_info_t *) realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); + buffer->info = (hb_internal_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0])); buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions; } else { - buffer->in_string = (hb_internal_glyph_info_t *) realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); - buffer->out_string = buffer->in_string; + buffer->info = (hb_internal_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0])); + buffer->out_string = buffer->info; } buffer->allocated = new_allocated; @@ -226,7 +226,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer, hb_buffer_ensure (buffer, buffer->in_length + 1); - glyph = &buffer->in_string[buffer->in_length]; + glyph = &buffer->info[buffer->in_length]; glyph->codepoint = codepoint; glyph->mask = mask; glyph->cluster = cluster; @@ -246,7 +246,7 @@ _hb_buffer_clear_output (hb_buffer_t *buffer) buffer->have_output = TRUE; buffer->have_positions = FALSE; buffer->out_length = 0; - buffer->out_string = buffer->in_string; + buffer->out_string = buffer->info; } void @@ -272,11 +272,11 @@ _hb_buffer_swap (hb_buffer_t *buffer) assert (buffer->have_output); - if (buffer->out_string != buffer->in_string) + if (buffer->out_string != buffer->info) { hb_internal_glyph_info_t *tmp_string; - tmp_string = buffer->in_string; - buffer->in_string = buffer->out_string; + tmp_string = buffer->info; + buffer->info = buffer->out_string; buffer->out_string = tmp_string; buffer->positions = (hb_internal_glyph_position_t *) buffer->out_string; } @@ -320,18 +320,18 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer, unsigned int mask; unsigned int cluster; - if (buffer->out_string != buffer->in_string || + if (buffer->out_string != buffer->info || buffer->out_length + num_out > buffer->in_pos + num_in) { hb_buffer_ensure_separate (buffer, buffer->out_length + num_out); } - mask = buffer->in_string[buffer->in_pos].mask; - cluster = buffer->in_string[buffer->in_pos].cluster; + mask = buffer->info[buffer->in_pos].mask; + cluster = buffer->info[buffer->in_pos].cluster; if (component == 0xFFFF) - component = buffer->in_string[buffer->in_pos].component; + component = buffer->info[buffer->in_pos].component; if (lig_id == 0xFFFF) - lig_id = buffer->in_string[buffer->in_pos].lig_id; + lig_id = buffer->info[buffer->in_pos].lig_id; for (i = 0; i < num_out; i++) { @@ -360,18 +360,18 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer, unsigned int mask; unsigned int cluster; - if (buffer->out_string != buffer->in_string || + if (buffer->out_string != buffer->info || buffer->out_length + num_out > buffer->in_pos + num_in) { hb_buffer_ensure_separate (buffer, buffer->out_length + num_out); } - mask = buffer->in_string[buffer->in_pos].mask; - cluster = buffer->in_string[buffer->in_pos].cluster; + mask = buffer->info[buffer->in_pos].mask; + cluster = buffer->info[buffer->in_pos].cluster; if (component == 0xFFFF) - component = buffer->in_string[buffer->in_pos].component; + component = buffer->info[buffer->in_pos].component; if (lig_id == 0xFFFF) - lig_id = buffer->in_string[buffer->in_pos].lig_id; + lig_id = buffer->info[buffer->in_pos].lig_id; for (i = 0; i < num_out; i++) { @@ -396,13 +396,13 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer, { hb_internal_glyph_info_t *info; - if (buffer->out_string != buffer->in_string) + if (buffer->out_string != buffer->info) { hb_buffer_ensure (buffer, buffer->out_length + 1); - buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos]; + buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos]; } else if (buffer->out_length != buffer->in_pos) - buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos]; + buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos]; info = &buffer->out_string[buffer->out_length]; info->codepoint = glyph_index; @@ -421,13 +421,13 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer) { if (buffer->have_output) { - if (buffer->out_string != buffer->in_string) + if (buffer->out_string != buffer->info) { hb_buffer_ensure (buffer, buffer->out_length + 1); - buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos]; + buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos]; } else if (buffer->out_length != buffer->in_pos) - buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos]; + buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos]; buffer->out_length++; } @@ -446,7 +446,7 @@ hb_buffer_get_length (hb_buffer_t *buffer) hb_glyph_info_t * hb_buffer_get_glyph_infos (hb_buffer_t *buffer) { - return (hb_glyph_info_t *) buffer->in_string; + return (hb_glyph_info_t *) buffer->info; } /* Return value valid as long as buffer not modified */ @@ -470,9 +470,9 @@ reverse_range (hb_buffer_t *buffer, for (i = start, j = end - 1; i < j; i++, j--) { hb_internal_glyph_info_t t; - t = buffer->in_string[i]; - buffer->in_string[i] = buffer->in_string[j]; - buffer->in_string[j] = t; + t = buffer->info[i]; + buffer->info[i] = buffer->info[j]; + buffer->info[j] = t; } if (buffer->positions) { @@ -507,12 +507,12 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer) count = buffer->in_length; start = 0; - last_cluster = buffer->in_string[0].cluster; + last_cluster = buffer->info[0].cluster; for (i = 1; i < count; i++) { - if (last_cluster != buffer->in_string[i].cluster) { + if (last_cluster != buffer->info[i].cluster) { reverse_range (buffer, start, i); start = i; - last_cluster = buffer->in_string[i].cluster; + last_cluster = buffer->info[i].cluster; } } reverse_range (buffer, start, i); diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index e021b0931..249fae2bb 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -399,8 +399,8 @@ struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage orde hb_position_t mark_x, mark_y, base_x, base_y; - mark_anchor.get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &mark_x, &mark_y); - glyph_anchor.get_anchor (c->layout, c->buffer->in_string[glyph_pos].codepoint, &base_x, &base_y); + 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]; o.x_advance = 0; @@ -430,7 +430,7 @@ struct SinglePosFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -469,7 +469,7 @@ struct SinglePosFormat2 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -570,7 +570,7 @@ struct PairSet const PairValueRecord *record = CastP (array); for (unsigned int i = 0; i < count; i++) { - if (c->buffer->in_string[pos].codepoint == record->secondGlyph) + 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]); @@ -623,12 +623,12 @@ struct PairPosFormat1 if (unlikely (c->buffer->in_pos + 2 > end)) return false; - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; unsigned int j = c->buffer->in_pos + 1; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[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)) return false; @@ -685,12 +685,12 @@ struct PairPosFormat2 if (unlikely (c->buffer->in_pos + 2 > end)) return false; - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; unsigned int j = c->buffer->in_pos + 1; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[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)) return false; @@ -701,8 +701,8 @@ struct PairPosFormat2 unsigned int len2 = valueFormat2.get_len (); unsigned int record_len = len1 + len2; - unsigned int klass1 = (this+classDef1) (c->buffer->in_string[c->buffer->in_pos].codepoint); - unsigned int klass2 = (this+classDef2) (c->buffer->in_string[j].codepoint); + unsigned int klass1 = (this+classDef1) (c->buffer->info[c->buffer->in_pos].codepoint); + unsigned int klass2 = (this+classDef2) (c->buffer->info[j].codepoint); if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return false; @@ -954,7 +954,7 @@ struct CursivePosFormat1 if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK) return false; - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -964,7 +964,7 @@ struct CursivePosFormat1 goto end; hb_position_t entry_x, entry_y; - (this+record.entryAnchor).get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &entry_x, &entry_y); + (this+record.entryAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &entry_x, &entry_y); /* TODO vertical */ @@ -994,7 +994,7 @@ struct CursivePosFormat1 if (record.exitAnchor) { gpi->last = c->buffer->in_pos; - (this+record.exitAnchor).get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y); + (this+record.exitAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y); } c->buffer->in_pos++; @@ -1063,7 +1063,7 @@ struct MarkBasePosFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - unsigned int mark_index = (this+markCoverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (mark_index == NOT_COVERED)) return false; @@ -1075,13 +1075,13 @@ struct MarkBasePosFormat1 if (unlikely (!j)) return false; j--; - } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], LookupFlag::IgnoreMarks, &property)); + } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], LookupFlag::IgnoreMarks, &property)); /* The following assertion is too strong, so we've disabled it. */ if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) return false; - unsigned int base_index = (this+baseCoverage) (c->buffer->in_string[j].codepoint); + unsigned int base_index = (this+baseCoverage) (c->buffer->info[j].codepoint); if (base_index == NOT_COVERED) return false; @@ -1165,7 +1165,7 @@ struct MarkLigPosFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - unsigned int mark_index = (this+markCoverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (mark_index == NOT_COVERED)) return false; @@ -1177,13 +1177,13 @@ struct MarkLigPosFormat1 if (unlikely (!j)) return false; j--; - } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], LookupFlag::IgnoreMarks, &property)); + } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], LookupFlag::IgnoreMarks, &property)); /* The following assertion is too strong, so we've disabled it. */ if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)) return false; - unsigned int lig_index = (this+ligatureCoverage) (c->buffer->in_string[j].codepoint); + unsigned int lig_index = (this+ligatureCoverage) (c->buffer->info[j].codepoint); if (lig_index == NOT_COVERED) return false; @@ -1199,9 +1199,9 @@ struct MarkLigPosFormat1 * 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->in_string[j].lig_id && c->buffer->in_string[j].lig_id == c->buffer->in_string[c->buffer->in_pos].lig_id && c->buffer->in_string[c->buffer->in_pos].component) + 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) { - comp_index = c->buffer->in_string[c->buffer->in_pos].component - 1; + comp_index = c->buffer->info[c->buffer->in_pos].component - 1; if (comp_index >= comp_count) comp_index = comp_count - 1; } @@ -1284,7 +1284,7 @@ struct MarkMarkPosFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - unsigned int mark1_index = (this+mark1Coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int mark1_index = (this+mark1Coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (mark1_index == NOT_COVERED)) return false; @@ -1296,7 +1296,7 @@ struct MarkMarkPosFormat1 if (unlikely (!j)) return false; j--; - } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, &property)); + } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property)); if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) return false; @@ -1304,11 +1304,11 @@ struct MarkMarkPosFormat1 /* 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->in_string[j].component != c->buffer->in_string[c->buffer->in_pos].component) || - (c->buffer->in_string[j].component && c->buffer->in_string[j].lig_id != c->buffer->in_string[c->buffer->in_pos].lig_id)) + 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)) return false; - unsigned int mark2_index = (this+mark2Coverage) (c->buffer->in_string[j].codepoint); + unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint); if (mark2_index == NOT_COVERED) return false; @@ -1513,7 +1513,7 @@ struct PosLookup : Lookup c->nesting_level_left = nesting_level_left; c->lookup_flag = get_flag (); - if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, &c->property)) + if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, &c->property)) return false; for (unsigned int i = 0; i < get_subtable_count (); i++) @@ -1538,7 +1538,7 @@ struct PosLookup : Lookup while (buffer->in_pos < buffer->in_length) { bool done; - if (~buffer->in_string[buffer->in_pos].mask & mask) + if (~buffer->info[buffer->in_pos].mask & mask) { done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL); ret |= done; diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index 965d19908..f5b359374 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -39,7 +39,7 @@ struct SingleSubstFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint; + hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint; unsigned int index = (this+coverage) (glyph_id); if (likely (index == NOT_COVERED)) return false; @@ -80,7 +80,7 @@ struct SingleSubstFormat2 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint; + hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint; unsigned int index = (this+coverage) (glyph_id); if (likely (index == NOT_COVERED)) return false; @@ -204,7 +204,7 @@ struct MultipleSubstFormat1 { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -273,7 +273,7 @@ struct AlternateSubstFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint; + hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint; unsigned int index = (this+coverage) (glyph_id); if (likely (index == NOT_COVERED)) @@ -374,7 +374,7 @@ struct Ligature for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++) { unsigned int property; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, &property)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property)) { if (unlikely (j + count - i == end)) return false; @@ -384,7 +384,7 @@ struct Ligature if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) is_mark = false; - if (likely (c->buffer->in_string[j].codepoint != component[i])) + if (likely (c->buffer->info[j].codepoint != component[i])) return false; } /* This is just a guess ... */ @@ -399,7 +399,7 @@ struct Ligature c->buffer->add_output_glyphs_be16 (i, 1, (const uint16_t *) &ligGlyph, 0, - c->buffer->in_string[c->buffer->in_pos].lig_id && !c->buffer->in_string[c->buffer->in_pos].component ? + c->buffer->info[c->buffer->in_pos].lig_id && !c->buffer->info[c->buffer->in_pos].component ? 0xFFFF : c->buffer->allocate_lig_id ()); else { @@ -415,8 +415,8 @@ struct Ligature for ( i = 1; i < count; i++ ) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, NULL)) - c->buffer->add_output_glyph (c->buffer->in_string[c->buffer->in_pos].codepoint, i, lig_id); + 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); (c->buffer->in_pos)++; } @@ -483,7 +483,7 @@ struct LigatureSubstFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint; + hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint; 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)) return false; /* No chaining to this type */ - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -619,7 +619,7 @@ struct ReverseChainSingleSubstFormat1 match_coverage, this, 1)) { - c->buffer->in_string[c->buffer->in_pos].codepoint = substitute[index]; + c->buffer->info[c->buffer->in_pos].codepoint = substitute[index]; c->buffer->in_pos--; /* Reverse! */ return true; } @@ -789,7 +789,7 @@ struct SubstLookup : Lookup c->nesting_level_left = nesting_level_left; c->lookup_flag = get_flag (); - if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, &c->property)) + if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, &c->property)) return false; if (unlikely (lookup_type == SubstLookupSubTable::Extension)) @@ -830,7 +830,7 @@ struct SubstLookup : Lookup buffer->in_pos = 0; while (buffer->in_pos < buffer->in_length) { - if ((~buffer->in_string[buffer->in_pos].mask & mask) && + if ((~buffer->info[buffer->in_pos].mask & mask) && apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL)) ret = true; else @@ -846,7 +846,7 @@ struct SubstLookup : Lookup buffer->in_pos = buffer->in_length - 1; do { - if ((~buffer->in_string[buffer->in_pos].mask & mask) && + if ((~buffer->info[buffer->in_pos].mask & mask) && apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL)) ret = true; else diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 5c2279713..a74557f48 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -94,14 +94,14 @@ static inline bool match_input (hb_apply_context_t *c, for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[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 + count - i == end)) return false; j++; } - if (likely (!match_func (c->buffer->in_string[j].codepoint, input[i - 1], match_data))) + if (likely (!match_func (c->buffer->info[j].codepoint, input[i - 1], match_data))) return false; } @@ -149,14 +149,14 @@ static inline bool match_lookahead (hb_apply_context_t *c, for (i = 0, j = c->buffer->in_pos + offset; i < count; i++, j++) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[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 + count - i == end)) return false; j++; } - if (likely (!match_func (c->buffer->in_string[j].codepoint, lookahead[i], match_data))) + if (likely (!match_func (c->buffer->info[j].codepoint, lookahead[i], match_data))) return false; } @@ -198,7 +198,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, */ for (unsigned int i = 0; i < count; /* NOP */) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, NULL)) { if (unlikely (c->buffer->in_pos == end)) return true; @@ -337,7 +337,7 @@ struct ContextFormat1 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -376,12 +376,12 @@ struct ContextFormat2 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; const ClassDef &class_def = this+classDef; - index = class_def (c->buffer->in_string[c->buffer->in_pos].codepoint); + index = class_def (c->buffer->info[c->buffer->in_pos].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. @@ -424,7 +424,7 @@ struct ContextFormat3 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->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -628,7 +628,7 @@ struct ChainContextFormat1 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -666,7 +666,7 @@ struct ChainContextFormat2 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const { TRACE_APPLY (); - unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; @@ -674,7 +674,7 @@ struct ChainContextFormat2 const ClassDef &input_class_def = this+inputClassDef; const ClassDef &lookahead_class_def = this+lookaheadClassDef; - index = input_class_def (c->buffer->in_string[c->buffer->in_pos].codepoint); + index = input_class_def (c->buffer->info[c->buffer->in_pos].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. @@ -732,7 +732,7 @@ struct ChainContextFormat3 TRACE_APPLY (); const OffsetArrayOf &input = StructAfter > (backtrack); - unsigned int index = (this+input[0]) (c->buffer->in_string[c->buffer->in_pos].codepoint); + unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->in_pos].codepoint); if (likely (index == NOT_COVERED)) return false; diff --git a/src/hb-shape.cc b/src/hb-shape.cc index de3780c4e..a0f166f29 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -50,8 +50,8 @@ hb_form_clusters (hb_buffer_t *buffer) count = buffer->in_length; for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++) - if (buffer->unicode->get_general_category (buffer->in_string[buffer->in_pos].codepoint) == HB_CATEGORY_NON_SPACING_MARK) - buffer->in_string[buffer->in_pos].cluster = buffer->in_string[buffer->in_pos - 1].cluster; + 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; } static hb_direction_t @@ -84,7 +84,7 @@ hb_mirror_chars (hb_buffer_t *buffer) count = buffer->in_length; for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) { - buffer->in_string[buffer->in_pos].codepoint = get_mirroring (buffer->in_string[buffer->in_pos].codepoint); + buffer->info[buffer->in_pos].codepoint = get_mirroring (buffer->info[buffer->in_pos].codepoint); } } @@ -99,14 +99,14 @@ hb_map_glyphs (hb_font_t *font, return; count = buffer->in_length - 1; for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) { - if (unlikely (is_variation_selector (buffer->in_string[buffer->in_pos + 1].codepoint))) { - buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, buffer->in_string[buffer->in_pos + 1].codepoint); + 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++; } else { - buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, 0); + buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, 0); } } - buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, 0); + buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, 0); } static void @@ -157,7 +157,7 @@ hb_position_default (hb_font_t *font, count = buffer->in_length; 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->in_string[buffer->in_pos].codepoint, &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; } @@ -196,7 +196,7 @@ hb_truetype_kern (hb_font_t *font, count = buffer->in_length; for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++) { hb_position_t kern, kern1, kern2; - kern = hb_font_get_kerning (font, face, buffer->in_string[buffer->in_pos - 1].codepoint, buffer->in_string[buffer->in_pos].codepoint); + 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;