[HarfBuzz] harfbuzz-ng: Branch 'master' - 24 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri May 14 20:49:10 PDT 2010


 src/hb-buffer-private.hh             |   44 +----
 src/hb-buffer.cc                     |  306 ++++++++++++++++++-----------------
 src/hb-buffer.h                      |    2 
 src/hb-ot-layout-gpos-private.hh     |  158 ++++++++----------
 src/hb-ot-layout-gsub-private.hh     |   72 +++-----
 src/hb-ot-layout-gsubgpos-private.hh |   69 +++----
 src/hb-shape.cc                      |   62 +++----
 7 files changed, 342 insertions(+), 371 deletions(-)

New commits:
commit 73af7756dc6d3961f176854246e5722baff101fb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 23:38:08 2010 -0400

    Indent

diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 5cd8956..f8ad1f8 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -163,8 +163,8 @@ struct Sequence
       return false;
 
     c->buffer->add_output_glyphs_be16 (1,
-					     substitute.len, (const uint16_t *) substitute.array,
-					     0xFFFF, 0xFFFF);
+				       substitute.len, (const uint16_t *) substitute.array,
+				       0xFFFF, 0xFFFF);
 
     /* This is a guess only ... */
     if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
@@ -397,10 +397,10 @@ struct Ligature
       /* We don't use a new ligature ID if there are no skipped
 	 glyphs and the ligature already has an ID. */
       c->buffer->add_output_glyphs_be16 (i,
-					       1, (const uint16_t *) &ligGlyph,
-					       0,
-					       c->buffer->info[c->buffer->i].lig_id && !c->buffer->info[c->buffer->i].component ?
-					       0xFFFF : c->buffer->allocate_lig_id ());
+					 1, (const uint16_t *) &ligGlyph,
+					 0,
+					 c->buffer->info[c->buffer->i].lig_id && !c->buffer->info[c->buffer->i].component ?
+					 0xFFFF : c->buffer->allocate_lig_id ());
     else
     {
       unsigned int lig_id = c->buffer->allocate_lig_id ();
commit 3567b87cce541dfb0af7caf024ec67c9d3c09214
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 23:28:44 2010 -0400

    Add an inline version of hb_buffer_ensure()

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 6f970d0..a384d1f 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -55,12 +55,51 @@ static hb_buffer_t _hb_buffer_nil = {
  */
 
 
-/* Internal API */
+static hb_bool_t
+_hb_buffer_enlarge (hb_buffer_t *buffer, unsigned int size)
+{
+  if (unlikely (buffer->in_error))
+    return FALSE;
+
+  unsigned int new_allocated = buffer->allocated;
+  hb_internal_glyph_position_t *new_pos;
+  hb_internal_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]));
+
+  if (unlikely (!new_pos || !new_info))
+    buffer->in_error = TRUE;
+
+  if (likely (new_pos))
+    buffer->pos = new_pos;
+
+  if (likely (new_info))
+    buffer->info = new_info;
+
+  buffer->out_info = separate_out ? (hb_internal_glyph_info_t *) buffer->pos : buffer->info;
+  if (likely (!buffer->in_error))
+    buffer->allocated = new_allocated;
+
+  return likely (!buffer->in_error);
+}
+
+static inline hb_bool_t
+_hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
+{
+  return likely (size <= buffer->allocated) ? TRUE : _hb_buffer_enlarge (buffer, size);
+}
 
 static hb_bool_t
-hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
+_hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
 {
-  if (unlikely (!hb_buffer_ensure (buffer, size))) return FALSE;
+  if (unlikely (!_hb_buffer_ensure (buffer, size))) return FALSE;
 
   if (buffer->out_info == buffer->info)
   {
@@ -73,6 +112,7 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
   return TRUE;
 }
 
+
 /* Public API */
 
 hb_buffer_t *
@@ -84,7 +124,7 @@ hb_buffer_create (unsigned int pre_alloc_size)
     return &_hb_buffer_nil;
 
   if (pre_alloc_size)
-    hb_buffer_ensure (buffer, pre_alloc_size);
+    _hb_buffer_ensure (buffer, pre_alloc_size);
 
   buffer->unicode = &_hb_unicode_funcs_nil;
 
@@ -192,39 +232,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
 hb_bool_t
 hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
 {
-  if (unlikely (size > buffer->allocated))
-  {
-    if (unlikely (buffer->in_error))
-      return FALSE;
-
-    unsigned int new_allocated = buffer->allocated;
-    hb_internal_glyph_position_t *new_pos;
-    hb_internal_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]));
-
-    if (unlikely (!new_pos || !new_info))
-      buffer->in_error = TRUE;
-
-    if (likely (new_pos))
-      buffer->pos = new_pos;
-
-    if (likely (new_info))
-      buffer->info = new_info;
-
-    buffer->out_info = separate_out ? (hb_internal_glyph_info_t *) buffer->pos : buffer->info;
-    if (likely (!buffer->in_error))
-      buffer->allocated = new_allocated;
-  }
-
-  return likely (!buffer->in_error);
+  return _hb_buffer_ensure (buffer, size);
 }
 
 void
@@ -235,7 +243,7 @@ hb_buffer_add_glyph (hb_buffer_t    *buffer,
 {
   hb_internal_glyph_info_t *glyph;
 
-  if (unlikely (!hb_buffer_ensure (buffer, buffer->len + 1))) return;
+  if (unlikely (!_hb_buffer_ensure (buffer, buffer->len + 1))) return;
 
   glyph = &buffer->info[buffer->len];
   glyph->codepoint = codepoint;
@@ -248,18 +256,6 @@ hb_buffer_add_glyph (hb_buffer_t    *buffer,
   buffer->len++;
 }
 
-
-/* HarfBuzz-Internal API */
-
-void
-_hb_buffer_clear_output (hb_buffer_t *buffer)
-{
-  buffer->have_output = TRUE;
-  buffer->have_positions = FALSE;
-  buffer->out_len = 0;
-  buffer->out_info = buffer->info;
-}
-
 void
 hb_buffer_clear_positions (hb_buffer_t *buffer)
 {
@@ -276,6 +272,17 @@ hb_buffer_clear_positions (hb_buffer_t *buffer)
   memset (buffer->pos, 0, sizeof (buffer->pos[0]) * buffer->len);
 }
 
+/* HarfBuzz-Internal API */
+
+void
+_hb_buffer_clear_output (hb_buffer_t *buffer)
+{
+  buffer->have_output = TRUE;
+  buffer->have_positions = FALSE;
+  buffer->out_len = 0;
+  buffer->out_info = buffer->info;
+}
+
 void
 _hb_buffer_swap (hb_buffer_t *buffer)
 {
@@ -336,7 +343,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   if (buffer->out_info != buffer->info ||
       buffer->out_len + num_out > buffer->i + num_in)
   {
-    if (unlikely (!hb_buffer_ensure_separate (buffer, buffer->out_len + num_out)))
+    if (unlikely (!_hb_buffer_ensure_separate (buffer, buffer->out_len + num_out)))
       return;
   }
 
@@ -377,7 +384,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   if (buffer->out_info != buffer->info ||
       buffer->out_len + num_out > buffer->i + num_in)
   {
-    if (unlikely (!hb_buffer_ensure_separate (buffer, buffer->out_len + num_out)))
+    if (unlikely (!_hb_buffer_ensure_separate (buffer, buffer->out_len + num_out)))
       return;
   }
 
@@ -413,7 +420,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
 
   if (buffer->out_info != buffer->info)
   {
-    if (unlikely (!hb_buffer_ensure (buffer, buffer->out_len + 1))) return;
+    if (unlikely (!_hb_buffer_ensure (buffer, buffer->out_len + 1))) return;
     buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
   }
   else if (buffer->out_len != buffer->i)
@@ -438,7 +445,7 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
   {
     if (buffer->out_info != buffer->info)
     {
-      if (unlikely (!hb_buffer_ensure (buffer, buffer->out_len + 1))) return;
+      if (unlikely (!_hb_buffer_ensure (buffer, buffer->out_len + 1))) return;
       buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
     }
     else if (buffer->out_len != buffer->i)
@@ -451,6 +458,8 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
 }
 
 
+/* Public API again */
+
 unsigned int
 hb_buffer_get_length (hb_buffer_t *buffer)
 {
commit a6a79df5fe2ed2cd307e7a991346faee164e70d9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 23:20:16 2010 -0400

    Handle malloc failture in the buffer

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index b293b96..d897627 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -108,8 +108,9 @@ struct _hb_buffer_t {
 
   unsigned int allocated; /* Length of allocated arrays */
 
-  hb_bool_t    have_output; /* Whether we have an output buffer going on */
-  hb_bool_t    have_positions; /* Whether we have positions */
+  hb_bool_t have_output; /* Whether we have an output buffer going on */
+  hb_bool_t have_positions; /* Whether we have positions */
+  hb_bool_t in_error; /* Allocation failed */
 
   unsigned int i; /* Cursor into ->info and ->pos arrays */
   unsigned int len; /* Length of ->info and ->pos arrays */
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index e546def..6f970d0 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -54,23 +54,23 @@ static hb_buffer_t _hb_buffer_nil = {
  * switches info and out_info.
  */
 
-/* XXX err handling */
 
 /* Internal API */
 
-static void
+static hb_bool_t
 hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
 {
-  hb_buffer_ensure (buffer, size);
+  if (unlikely (!hb_buffer_ensure (buffer, size))) return FALSE;
+
   if (buffer->out_info == buffer->info)
   {
     assert (buffer->have_output);
-    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->pos;
     memcpy (buffer->out_info, buffer->info, buffer->out_len * sizeof (buffer->out_info[0]));
   }
+
+  return TRUE;
 }
 
 /* Public API */
@@ -84,7 +84,7 @@ hb_buffer_create (unsigned int pre_alloc_size)
     return &_hb_buffer_nil;
 
   if (pre_alloc_size)
-    hb_buffer_ensure(buffer, pre_alloc_size);
+    hb_buffer_ensure (buffer, pre_alloc_size);
 
   buffer->unicode = &_hb_unicode_funcs_nil;
 
@@ -181,6 +181,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
 {
   buffer->have_output = FALSE;
   buffer->have_positions = FALSE;
+  buffer->in_error = FALSE;
   buffer->len = 0;
   buffer->out_len = 0;
   buffer->i = 0;
@@ -188,32 +189,42 @@ hb_buffer_clear (hb_buffer_t *buffer)
   buffer->max_lig_id = 0;
 }
 
-void
+hb_bool_t
 hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
 {
-  unsigned int new_allocated = buffer->allocated;
-
-  if (size > new_allocated)
+  if (unlikely (size > buffer->allocated))
   {
+    if (unlikely (buffer->in_error))
+      return FALSE;
+
+    unsigned int new_allocated = buffer->allocated;
+    hb_internal_glyph_position_t *new_pos;
+    hb_internal_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;
 
-    if (buffer->pos)
-      buffer->pos = (hb_internal_glyph_position_t *) realloc (buffer->pos, new_allocated * sizeof (buffer->pos[0]));
+    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]));
 
-    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->pos;
-    }
-    else
-    {
-      buffer->info = (hb_internal_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0]));
-      buffer->out_info = buffer->info;
-    }
+    if (unlikely (!new_pos || !new_info))
+      buffer->in_error = TRUE;
 
-    buffer->allocated = new_allocated;
+    if (likely (new_pos))
+      buffer->pos = new_pos;
+
+    if (likely (new_info))
+      buffer->info = new_info;
+
+    buffer->out_info = separate_out ? (hb_internal_glyph_info_t *) buffer->pos : buffer->info;
+    if (likely (!buffer->in_error))
+      buffer->allocated = new_allocated;
   }
+
+  return likely (!buffer->in_error);
 }
 
 void
@@ -224,7 +235,7 @@ hb_buffer_add_glyph (hb_buffer_t    *buffer,
 {
   hb_internal_glyph_info_t *glyph;
 
-  hb_buffer_ensure (buffer, buffer->len + 1);
+  if (unlikely (!hb_buffer_ensure (buffer, buffer->len + 1))) return;
 
   glyph = &buffer->info[buffer->len];
   glyph->codepoint = codepoint;
@@ -272,6 +283,8 @@ _hb_buffer_swap (hb_buffer_t *buffer)
 
   assert (buffer->have_output);
 
+  if (unlikely (buffer->in_error)) return;
+
   if (buffer->out_info != buffer->info)
   {
     hb_internal_glyph_info_t *tmp_string;
@@ -323,7 +336,8 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   if (buffer->out_info != buffer->info ||
       buffer->out_len + num_out > buffer->i + num_in)
   {
-    hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
+    if (unlikely (!hb_buffer_ensure_separate (buffer, buffer->out_len + num_out)))
+      return;
   }
 
   mask = buffer->info[buffer->i].mask;
@@ -363,7 +377,8 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   if (buffer->out_info != buffer->info ||
       buffer->out_len + num_out > buffer->i + num_in)
   {
-    hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
+    if (unlikely (!hb_buffer_ensure_separate (buffer, buffer->out_len + num_out)))
+      return;
   }
 
   mask = buffer->info[buffer->i].mask;
@@ -398,7 +413,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
 
   if (buffer->out_info != buffer->info)
   {
-    hb_buffer_ensure (buffer, buffer->out_len + 1);
+    if (unlikely (!hb_buffer_ensure (buffer, buffer->out_len + 1))) return;
     buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
   }
   else if (buffer->out_len != buffer->i)
@@ -423,7 +438,7 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
   {
     if (buffer->out_info != buffer->info)
     {
-      hb_buffer_ensure (buffer, buffer->out_len + 1);
+      if (unlikely (!hb_buffer_ensure (buffer, buffer->out_len + 1))) return;
       buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
     }
     else if (buffer->out_len != buffer->i)
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index d1772d4..7b8b7ea 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -101,7 +101,7 @@ hb_buffer_clear (hb_buffer_t *buffer);
 void
 hb_buffer_clear_positions (hb_buffer_t *buffer);
 
-void
+hb_bool_t
 hb_buffer_ensure (hb_buffer_t  *buffer,
 		  unsigned int  size);
 
commit ca54a12658510f9aa0b2db82f20a8fac230d6bb6
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:25:42 2010 -0400

    Minor

diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index f4bc85c..b77677c 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -46,12 +46,10 @@ is_variation_selector (hb_codepoint_t unicode)
 static void
 hb_form_clusters (hb_buffer_t *buffer)
 {
-  unsigned int count;
-
-  count = buffer->len;
-  for (buffer->i = 1; buffer->i < count; buffer->i++)
-    if (buffer->unicode->get_general_category (buffer->info[buffer->i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
-      buffer->info[buffer->i].cluster = buffer->info[buffer->i - 1].cluster;
+  unsigned int count = buffer->len;
+  for (unsigned int i = 1; i < count; i++)
+    if (buffer->unicode->get_general_category (buffer->info[i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
+      buffer->info[i].cluster = buffer->info[i - 1].cluster;
 }
 
 static hb_direction_t
@@ -76,15 +74,14 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
 static void
 hb_mirror_chars (hb_buffer_t *buffer)
 {
-  unsigned int count;
   hb_unicode_get_mirroring_func_t get_mirroring = buffer->unicode->get_mirroring;
 
   if (HB_DIRECTION_IS_FORWARD (buffer->direction))
     return;
 
-  count = buffer->len;
-  for (buffer->i = 0; buffer->i < count; buffer->i++) {
-      buffer->info[buffer->i].codepoint = get_mirroring (buffer->info[buffer->i].codepoint);
+  unsigned int count = buffer->len;
+  for (unsigned int i = 0; i < count; i++) {
+      buffer->info[i].codepoint = get_mirroring (buffer->info[i].codepoint);
   }
 }
 
@@ -93,20 +90,19 @@ hb_map_glyphs (hb_font_t    *font,
 	       hb_face_t    *face,
 	       hb_buffer_t  *buffer)
 {
-  unsigned int count;
-
   if (unlikely (!buffer->len))
     return;
-  count = buffer->len - 1;
-  for (buffer->i = 0; buffer->i < count; buffer->i++) {
-    if (unlikely (is_variation_selector (buffer->info[buffer->i + 1].codepoint))) {
-      buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint);
-      buffer->i++;
+
+  unsigned int count = buffer->len - 1;
+  for (unsigned int i = 0; i < count; i++) {
+    if (unlikely (is_variation_selector (buffer->info[i + 1].codepoint))) {
+      buffer->info[i].codepoint = hb_font_get_glyph (font, face, buffer->info[i].codepoint, buffer->info[i + 1].codepoint);
+      i++;
     } else {
-      buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0);
+      buffer->info[i].codepoint = hb_font_get_glyph (font, face, buffer->info[i].codepoint, 0);
     }
   }
-  buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0);
+  buffer->info[count].codepoint = hb_font_get_glyph (font, face, buffer->info[count].codepoint, 0);
 }
 
 static void
@@ -150,16 +146,14 @@ hb_position_default (hb_font_t    *font,
 		     hb_feature_t *features HB_UNUSED,
 		     unsigned int  num_features HB_UNUSED)
 {
-  unsigned int count;
-
   hb_buffer_clear_positions (buffer);
 
-  count = buffer->len;
-  for (buffer->i = 0; buffer->i < count; buffer->i++) {
+  unsigned int count = buffer->len;
+  for (unsigned int i = 0; i < count; i++) {
     hb_glyph_metrics_t metrics;
-    hb_font_get_glyph_metrics (font, face, buffer->info[buffer->i].codepoint, &metrics);
-    buffer->pos[buffer->i].x_advance = metrics.x_advance;
-    buffer->pos[buffer->i].y_advance = metrics.y_advance;
+    hb_font_get_glyph_metrics (font, face, buffer->info[i].codepoint, &metrics);
+    buffer->pos[i].x_advance = metrics.x_advance;
+    buffer->pos[i].y_advance = metrics.y_advance;
   }
 }
 
@@ -190,18 +184,16 @@ hb_truetype_kern (hb_font_t    *font,
 		  hb_feature_t *features HB_UNUSED,
 		  unsigned int  num_features HB_UNUSED)
 {
-  unsigned int count;
-
   /* TODO Check for kern=0 */
-  count = buffer->len;
-  for (buffer->i = 1; buffer->i < count; buffer->i++) {
+  unsigned int count = buffer->len;
+  for (unsigned int i = 1; i < count; i++) {
     hb_position_t kern, kern1, kern2;
-    kern = hb_font_get_kerning (font, face, buffer->info[buffer->i - 1].codepoint, buffer->info[buffer->i].codepoint);
+    kern = hb_font_get_kerning (font, face, buffer->info[i - 1].codepoint, buffer->info[i].codepoint);
     kern1 = kern >> 1;
     kern2 = kern - kern1;
-    buffer->pos[buffer->i - 1].x_advance += kern1;
-    buffer->pos[buffer->i].x_advance += kern2;
-    buffer->pos[buffer->i].x_offset += kern2;
+    buffer->pos[i - 1].x_advance += kern1;
+    buffer->pos[i].x_advance += kern2;
+    buffer->pos[i].x_offset += kern2;
   }
 }
 
commit 910a33fe8457a8e13f7eb77fc92fa59c31f5e8fd
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:13:38 2010 -0400

    Update buffer docs

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 2ba4858..b293b96 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -106,13 +106,14 @@ struct _hb_buffer_t {
 
   /* Buffer contents */
 
-  unsigned int allocated;
+  unsigned int allocated; /* Length of allocated arrays */
 
-  hb_bool_t    have_output; /* whether we have an output buffer going on */
-  hb_bool_t    have_positions; /* whether we have positions */
-  unsigned int len;
-  unsigned int out_len;
-  unsigned int i;
+  hb_bool_t    have_output; /* Whether we have an output buffer going on */
+  hb_bool_t    have_positions; /* Whether we have positions */
+
+  unsigned int i; /* Cursor into ->info and ->pos arrays */
+  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;
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 73fbb10..e546def 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: info and out_info.  They
- * always have same allocated size, but different length and positions.
+ * There are two info pointers: info and out_info.  They always have
+ * the same allocated size, but different lengths.
  *
  * As an optimization, both info and out_info may point to the
  * same piece of memory, which is owned by info.  This remains the
  * case as long as out_len doesn't exceed len at any time.
- * In that case, swap() is no-op and the glyph operations operate mostly
- * in-place.
+ * In that case, swap() is no-op and the glyph operations operate
+ * mostly in-place.
  *
  * As soon as out_info gets longer than info, out_info is moved over
- * to an alternate buffer (which we reuse the positions buffer for!), and its
- * current contents (out_len entries) are copied to the alt buffer.
- * This should all remain transparent to the user.  swap() then switches
- * info and out_info.
+ * to an alternate buffer (which we reuse the pos buffer for!), and its
+ * current contents (out_len entries) are copied to the new place.
+ * This should all remain transparent to the user.  swap() then
+ * switches info and out_info.
  */
 
 /* XXX err handling */
commit 36b73c80df91e96492357c6da945e081e9046a93
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:10:39 2010 -0400

    Shortening buffer accessors: rename buffer->in_pos to buffer->i

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index be6f128..2ba4858 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -112,7 +112,7 @@ struct _hb_buffer_t {
   hb_bool_t    have_positions; /* whether we have positions */
   unsigned int len;
   unsigned int out_len;
-  unsigned int in_pos;
+  unsigned int i;
 
   hb_internal_glyph_info_t     *info;
   hb_internal_glyph_info_t     *out_info;
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 00d2af9..73fbb10 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -183,7 +183,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
   buffer->have_positions = FALSE;
   buffer->len = 0;
   buffer->out_len = 0;
-  buffer->in_pos = 0;
+  buffer->i = 0;
   buffer->out_info = buffer->info;
   buffer->max_lig_id = 0;
 }
@@ -285,7 +285,7 @@ _hb_buffer_swap (hb_buffer_t *buffer)
   buffer->len = buffer->out_len;
   buffer->out_len = tmp;
 
-  buffer->in_pos = 0;
+  buffer->i = 0;
 }
 
 /* The following function copies `num_out' elements from `glyph_data'
@@ -294,18 +294,18 @@ _hb_buffer_swap (hb_buffer_t *buffer)
    Finally, it sets the `length' field of `out' equal to
    `pos' of the `out' structure.
 
-   If `component' is 0xFFFF, the component value from buffer->in_pos
+   If `component' is 0xFFFF, the component value from buffer->i
    will copied `num_out' times, otherwise `component' itself will
    be used to fill the `component' fields.
 
-   If `lig_id' is 0xFFFF, the lig_id value from buffer->in_pos
+   If `lig_id' is 0xFFFF, the lig_id value from buffer->i
    will copied `num_out' times, otherwise `lig_id' itself will
    be used to fill the `lig_id' fields.
 
    The mask for all replacement glyphs are taken
-   from the glyph at position `buffer->in_pos'.
+   from the glyph at position `buffer->i'.
 
-   The cluster value for the glyph at position buffer->in_pos is used
+   The cluster value for the glyph at position buffer->i is used
    for all replacement glyphs */
 
 void
@@ -321,17 +321,17 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   unsigned int cluster;
 
   if (buffer->out_info != buffer->info ||
-      buffer->out_len + num_out > buffer->in_pos + num_in)
+      buffer->out_len + num_out > buffer->i + num_in)
   {
     hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
   }
 
-  mask = buffer->info[buffer->in_pos].mask;
-  cluster = buffer->info[buffer->in_pos].cluster;
+  mask = buffer->info[buffer->i].mask;
+  cluster = buffer->info[buffer->i].cluster;
   if (component == 0xFFFF)
-    component = buffer->info[buffer->in_pos].component;
+    component = buffer->info[buffer->i].component;
   if (lig_id == 0xFFFF)
-    lig_id = buffer->info[buffer->in_pos].lig_id;
+    lig_id = buffer->info[buffer->i].lig_id;
 
   for (i = 0; i < num_out; i++)
   {
@@ -344,7 +344,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
     info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
   }
 
-  buffer->in_pos  += num_in;
+  buffer->i  += num_in;
   buffer->out_len += num_out;
 }
 
@@ -361,17 +361,17 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   unsigned int cluster;
 
   if (buffer->out_info != buffer->info ||
-      buffer->out_len + num_out > buffer->in_pos + num_in)
+      buffer->out_len + num_out > buffer->i + num_in)
   {
     hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
   }
 
-  mask = buffer->info[buffer->in_pos].mask;
-  cluster = buffer->info[buffer->in_pos].cluster;
+  mask = buffer->info[buffer->i].mask;
+  cluster = buffer->info[buffer->i].cluster;
   if (component == 0xFFFF)
-    component = buffer->info[buffer->in_pos].component;
+    component = buffer->info[buffer->i].component;
   if (lig_id == 0xFFFF)
-    lig_id = buffer->info[buffer->in_pos].lig_id;
+    lig_id = buffer->info[buffer->i].lig_id;
 
   for (i = 0; i < num_out; i++)
   {
@@ -384,7 +384,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
     info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
   }
 
-  buffer->in_pos  += num_in;
+  buffer->i  += num_in;
   buffer->out_len += num_out;
 }
 
@@ -399,10 +399,10 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
   if (buffer->out_info != buffer->info)
   {
     hb_buffer_ensure (buffer, buffer->out_len + 1);
-    buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+    buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
   }
-  else if (buffer->out_len != buffer->in_pos)
-    buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+  else if (buffer->out_len != buffer->i)
+    buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
 
   info = &buffer->out_info[buffer->out_len];
   info->codepoint = glyph_index;
@@ -412,7 +412,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
     info->lig_id = lig_id;
   info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
 
-  buffer->in_pos++;
+  buffer->i++;
   buffer->out_len++;
 }
 
@@ -424,15 +424,15 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
     if (buffer->out_info != buffer->info)
     {
       hb_buffer_ensure (buffer, buffer->out_len + 1);
-      buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+      buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
     }
-    else if (buffer->out_len != buffer->in_pos)
-      buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
+    else if (buffer->out_len != buffer->i)
+      buffer->out_info[buffer->out_len] = buffer->info[buffer->i];
 
     buffer->out_len++;
   }
 
-  buffer->in_pos++;
+  buffer->i++;
 }
 
 
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 2a66f42..35673b8 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -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;
 
-    mark_anchor.get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &mark_x, &mark_y);
+    mark_anchor.get_anchor (c->layout, c->buffer->info[c->buffer->i].codepoint, &mark_x, &mark_y);
     glyph_anchor.get_anchor (c->layout, c->buffer->info[glyph_pos].codepoint, &base_x, &base_y);
 
-    hb_internal_glyph_position_t &o = c->buffer->pos[c->buffer->in_pos];
+    hb_internal_glyph_position_t &o = c->buffer->pos[c->buffer->i];
     o.x_advance = 0;
     o.y_advance = 0;
     o.x_offset  = base_x - mark_x;
     o.y_offset  = base_y - mark_y;
-    o.back      = c->buffer->in_pos - glyph_pos;
+    o.back      = c->buffer->i - glyph_pos;
 
-    c->buffer->in_pos++;
+    c->buffer->i++;
     return true;
   }
 
@@ -430,13 +430,13 @@ struct SinglePosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
-    valueFormat.apply_value (c->layout, this, values, c->buffer->pos[c->buffer->in_pos]);
+    valueFormat.apply_value (c->layout, this, values, c->buffer->pos[c->buffer->i]);
 
-    c->buffer->in_pos++;
+    c->buffer->i++;
     return true;
   }
 
@@ -469,7 +469,7 @@ struct SinglePosFormat2
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -478,9 +478,9 @@ struct SinglePosFormat2
 
     valueFormat.apply_value (c->layout, this,
 			     &values[index * valueFormat.get_len ()],
-			     c->buffer->pos[c->buffer->in_pos]);
+			     c->buffer->pos[c->buffer->i]);
 
-    c->buffer->in_pos++;
+    c->buffer->i++;
     return true;
   }
 
@@ -572,11 +572,11 @@ struct PairSet
     {
       if (c->buffer->info[pos].codepoint == record->secondGlyph)
       {
-	valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->pos[c->buffer->in_pos]);
+	valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->pos[c->buffer->i]);
 	valueFormats[1].apply_value (c->layout, this, &record->values[len1], c->buffer->pos[pos]);
 	if (len2)
 	  pos++;
-	c->buffer->in_pos = pos;
+	c->buffer->i = pos;
 	return true;
       }
       record = &StructAtOffset<PairValueRecord> (record, record_size);
@@ -619,15 +619,15 @@ struct PairPosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
-    if (unlikely (c->buffer->in_pos + 2 > end))
+    unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+    if (unlikely (c->buffer->i + 2 > end))
       return false;
 
-    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
-    unsigned int j = c->buffer->in_pos + 1;
+    unsigned int j = c->buffer->i + 1;
     while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
     {
       if (unlikely (j == end))
@@ -681,15 +681,15 @@ struct PairPosFormat2
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
-    if (unlikely (c->buffer->in_pos + 2 > end))
+    unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+    if (unlikely (c->buffer->i + 2 > end))
       return false;
 
-    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
-    unsigned int j = c->buffer->in_pos + 1;
+    unsigned int j = c->buffer->i + 1;
     while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
     {
       if (unlikely (j == end))
@@ -701,18 +701,18 @@ struct PairPosFormat2
     unsigned int len2 = valueFormat2.get_len ();
     unsigned int record_len = len1 + len2;
 
-    unsigned int klass1 = (this+classDef1) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int klass1 = (this+classDef1) (c->buffer->info[c->buffer->i].codepoint);
     unsigned int klass2 = (this+classDef2) (c->buffer->info[j].codepoint);
     if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
       return false;
 
     const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
-    valueFormat1.apply_value (c->layout, this, v, c->buffer->pos[c->buffer->in_pos]);
+    valueFormat1.apply_value (c->layout, this, v, c->buffer->pos[c->buffer->i]);
     valueFormat2.apply_value (c->layout, this, v + len1, c->buffer->pos[j]);
 
     if (len2)
       j++;
-    c->buffer->in_pos = j;
+    c->buffer->i = j;
 
     return true;
   }
@@ -954,7 +954,7 @@ struct CursivePosFormat1
     if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
       return false;
 
-    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -964,14 +964,14 @@ struct CursivePosFormat1
       goto end;
 
     hb_position_t entry_x, entry_y;
-    (this+record.entryAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &entry_x, &entry_y);
+    (this+record.entryAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->i].codepoint, &entry_x, &entry_y);
 
     /* TODO vertical */
 
     if (c->buffer->direction == HB_DIRECTION_RTL)
     {
       /* advance is absolute, not relative */
-      c->buffer->pos[c->buffer->in_pos].x_advance = entry_x - gpi->anchor_x;
+      c->buffer->pos[c->buffer->i].x_advance = entry_x - gpi->anchor_x;
     }
     else
     {
@@ -981,23 +981,23 @@ struct CursivePosFormat1
 
     if  (c->lookup_flag & LookupFlag::RightToLeft)
     {
-      c->buffer->pos[last_pos].cursive_chain = last_pos - c->buffer->in_pos;
+      c->buffer->pos[last_pos].cursive_chain = last_pos - c->buffer->i;
       c->buffer->pos[last_pos].y_offset = entry_y - gpi->anchor_y;
     }
     else
     {
-      c->buffer->pos[c->buffer->in_pos].cursive_chain = c->buffer->in_pos - last_pos;
-      c->buffer->pos[c->buffer->in_pos].y_offset = gpi->anchor_y - entry_y;
+      c->buffer->pos[c->buffer->i].cursive_chain = c->buffer->i - last_pos;
+      c->buffer->pos[c->buffer->i].y_offset = gpi->anchor_y - entry_y;
     }
 
   end:
     if (record.exitAnchor)
     {
-      gpi->last = c->buffer->in_pos;
-      (this+record.exitAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y);
+      gpi->last = c->buffer->i;
+      (this+record.exitAnchor).get_anchor (c->layout, c->buffer->info[c->buffer->i].codepoint, &gpi->anchor_x, &gpi->anchor_y);
     }
 
-    c->buffer->in_pos++;
+    c->buffer->i++;
     return true;
   }
 
@@ -1063,13 +1063,13 @@ struct MarkBasePosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (mark_index == NOT_COVERED))
       return false;
 
     /* now we search backwards for a non-mark glyph */
     unsigned int property;
-    unsigned int j = c->buffer->in_pos;
+    unsigned int j = c->buffer->i;
     do
     {
       if (unlikely (!j))
@@ -1165,13 +1165,13 @@ struct MarkLigPosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (mark_index == NOT_COVERED))
       return false;
 
     /* now we search backwards for a non-mark glyph */
     unsigned int property;
-    unsigned int j = c->buffer->in_pos;
+    unsigned int j = c->buffer->i;
     do
     {
       if (unlikely (!j))
@@ -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->info[j].lig_id && c->buffer->info[j].lig_id == c->buffer->info[c->buffer->in_pos].lig_id && c->buffer->info[c->buffer->in_pos].component)
+    if (c->buffer->info[j].lig_id && c->buffer->info[j].lig_id == c->buffer->info[c->buffer->i].lig_id && c->buffer->info[c->buffer->i].component)
     {
-      comp_index = c->buffer->info[c->buffer->in_pos].component - 1;
+      comp_index = c->buffer->info[c->buffer->i].component - 1;
       if (comp_index >= comp_count)
 	comp_index = comp_count - 1;
     }
@@ -1284,13 +1284,13 @@ struct MarkMarkPosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int mark1_index = (this+mark1Coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int mark1_index = (this+mark1Coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (mark1_index == NOT_COVERED))
       return false;
 
     /* now we search backwards for a suitable mark glyph until a non-mark glyph */
     unsigned int property;
-    unsigned int j = c->buffer->in_pos;
+    unsigned int j = c->buffer->i;
     do
     {
       if (unlikely (!j))
@@ -1304,8 +1304,8 @@ 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->info[j].component != c->buffer->info[c->buffer->in_pos].component) ||
-	(c->buffer->info[j].component && c->buffer->info[j].lig_id != c->buffer->info[c->buffer->in_pos].lig_id))
+    if ((c->buffer->info[j].component != c->buffer->info[c->buffer->i].component) ||
+	(c->buffer->info[j].component && c->buffer->info[j].lig_id != c->buffer->info[c->buffer->i].lig_id))
       return false;
 
     unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint);
@@ -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->info[c->buffer->in_pos], c->lookup_flag, &c->property))
+    if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, &c->property))
       return false;
 
     for (unsigned int i = 0; i < get_subtable_count (); i++)
@@ -1534,11 +1534,11 @@ struct PosLookup : Lookup
 
     layout->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */
 
-    buffer->in_pos = 0;
-    while (buffer->in_pos < buffer->len)
+    buffer->i = 0;
+    while (buffer->i < buffer->len)
     {
       bool done;
-      if (~buffer->info[buffer->in_pos].mask & mask)
+      if (~buffer->info[buffer->i].mask & mask)
       {
 	  done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL);
 	  ret |= done;
@@ -1552,7 +1552,7 @@ struct PosLookup : Lookup
       }
 
       if (!done)
-	buffer->in_pos++;
+	buffer->i++;
     }
 
     return ret;
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 6eed981..5cd8956 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->info[c->buffer->in_pos].codepoint;
+    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
     unsigned int index = (this+coverage) (glyph_id);
     if (likely (index == NOT_COVERED))
       return false;
@@ -80,7 +80,7 @@ struct SingleSubstFormat2
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
     unsigned int index = (this+coverage) (glyph_id);
     if (likely (index == NOT_COVERED))
       return false;
@@ -204,7 +204,7 @@ struct MultipleSubstFormat1
   {
     TRACE_APPLY ();
 
-    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -273,7 +273,7 @@ struct AlternateSubstFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
 
     unsigned int index = (this+coverage) (glyph_id);
     if (likely (index == NOT_COVERED))
@@ -367,11 +367,11 @@ struct Ligature
     TRACE_APPLY ();
     unsigned int i, j;
     unsigned int count = component.len;
-    unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
-    if (unlikely (c->buffer->in_pos + count > end))
+    unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+    if (unlikely (c->buffer->i + count > end))
       return false;
 
-    for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
+    for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
     {
       unsigned int property;
       while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property))
@@ -393,13 +393,13 @@ struct Ligature
 				     is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
 					     : HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
 
-    if (j == c->buffer->in_pos + i) /* No input glyphs skipped */
+    if (j == c->buffer->i + i) /* No input glyphs skipped */
       /* We don't use a new ligature ID if there are no skipped
 	 glyphs and the ligature already has an ID. */
       c->buffer->add_output_glyphs_be16 (i,
 					       1, (const uint16_t *) &ligGlyph,
 					       0,
-					       c->buffer->info[c->buffer->in_pos].lig_id && !c->buffer->info[c->buffer->in_pos].component ?
+					       c->buffer->info[c->buffer->i].lig_id && !c->buffer->info[c->buffer->i].component ?
 					       0xFFFF : c->buffer->allocate_lig_id ());
     else
     {
@@ -415,10 +415,10 @@ struct Ligature
 
       for ( i = 1; i < count; i++ )
       {
-	while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, NULL))
-	  c->buffer->add_output_glyph (c->buffer->info[c->buffer->in_pos].codepoint, i, lig_id);
+	while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL))
+	  c->buffer->add_output_glyph (c->buffer->info[c->buffer->i].codepoint, i, lig_id);
 
-	(c->buffer->in_pos)++;
+	(c->buffer->i)++;
       }
     }
 
@@ -483,7 +483,7 @@ struct LigatureSubstFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->in_pos].codepoint;
+    hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
 
     bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
 
@@ -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->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -619,8 +619,8 @@ struct ReverseChainSingleSubstFormat1
 			 match_coverage, this,
 			 1))
     {
-      c->buffer->info[c->buffer->in_pos].codepoint = substitute[index];
-      c->buffer->in_pos--; /* Reverse! */
+      c->buffer->info[c->buffer->i].codepoint = substitute[index];
+      c->buffer->i--; /* Reverse! */
       return true;
     }
 
@@ -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->info[c->buffer->in_pos], c->lookup_flag, &c->property))
+    if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, &c->property))
       return false;
 
     if (unlikely (lookup_type == SubstLookupSubTable::Extension))
@@ -827,10 +827,10 @@ struct SubstLookup : Lookup
     {
 	/* in/out forward substitution */
 	buffer->clear_output ();
-	buffer->in_pos = 0;
-	while (buffer->in_pos < buffer->len)
+	buffer->i = 0;
+	while (buffer->i < buffer->len)
 	{
-	  if ((~buffer->info[buffer->in_pos].mask & mask) &&
+	  if ((~buffer->info[buffer->i].mask & mask) &&
 	      apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
 	    ret = true;
 	  else
@@ -843,17 +843,17 @@ struct SubstLookup : Lookup
     else
     {
 	/* in-place backward substitution */
-	buffer->in_pos = buffer->len - 1;
+	buffer->i = buffer->len - 1;
 	do
 	{
-	  if ((~buffer->info[buffer->in_pos].mask & mask) &&
+	  if ((~buffer->info[buffer->i].mask & mask) &&
 	      apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
 	    ret = true;
 	  else
-	    buffer->in_pos--;
+	    buffer->i--;
 
 	}
-	while ((int) buffer->in_pos >= 0);
+	while ((int) buffer->i >= 0);
     }
 
     return ret;
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 939071a..351285d 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -88,11 +88,11 @@ static inline bool match_input (hb_apply_context_t *c,
 				unsigned int *context_length_out)
 {
   unsigned int i, j;
-  unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
-  if (unlikely (c->buffer->in_pos + count > end))
+  unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+  if (unlikely (c->buffer->i + count > end))
     return false;
 
-  for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
+  for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
   {
     while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
     {
@@ -105,7 +105,7 @@ static inline bool match_input (hb_apply_context_t *c,
       return false;
   }
 
-  *context_length_out = j - c->buffer->in_pos;
+  *context_length_out = j - c->buffer->i;
 
   return true;
 }
@@ -143,11 +143,11 @@ static inline bool match_lookahead (hb_apply_context_t *c,
 				    unsigned int offset)
 {
   unsigned int i, j;
-  unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
-  if (unlikely (c->buffer->in_pos + offset + count > end))
+  unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+  if (unlikely (c->buffer->i + offset + count > end))
     return false;
 
-  for (i = 0, j = c->buffer->in_pos + offset; i < count; i++, j++)
+  for (i = 0, j = c->buffer->i + offset; i < count; i++, j++)
   {
     while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
     {
@@ -185,8 +185,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
 				 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
 				 apply_lookup_func_t apply_func)
 {
-  unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
-  if (unlikely (c->buffer->in_pos + count > end))
+  unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
+  if (unlikely (c->buffer->i + count > end))
     return false;
 
   /* TODO We don't support lookupRecord arrays that are not increasing:
@@ -198,9 +198,9 @@ 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->info[c->buffer->in_pos], c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL))
     {
-      if (unlikely (c->buffer->in_pos == end))
+      if (unlikely (c->buffer->i == end))
 	return true;
       /* No lookup applied for this index */
       c->buffer->next_glyph ();
@@ -208,7 +208,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
 
     if (lookupCount && i == lookupRecord->sequenceIndex)
     {
-      unsigned int old_pos = c->buffer->in_pos;
+      unsigned int old_pos = c->buffer->i;
 
       /* Apply a lookup */
       bool done = apply_func (c, lookupRecord->lookupListIndex);
@@ -216,8 +216,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
       lookupRecord++;
       lookupCount--;
       /* Err, this is wrong if the lookup jumped over some glyphs */
-      i += c->buffer->in_pos - old_pos;
-      if (unlikely (c->buffer->in_pos == end))
+      i += c->buffer->i - old_pos;
+      if (unlikely (c->buffer->i == end))
 	return true;
 
       if (!done)
@@ -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->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -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->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
     const ClassDef &class_def = this+classDef;
-    index = class_def (c->buffer->info[c->buffer->in_pos].codepoint);
+    index = class_def (c->buffer->info[c->buffer->i].codepoint);
     const RuleSet &rule_set = this+ruleSet[index];
     /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
      * them across subrule lookups.  Not sure it's worth it.
@@ -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->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -520,7 +520,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
 {
   /* First guess */
   if (unlikely (c->buffer->out_len < backtrackCount ||
-		c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->len ||
+		c->buffer->i + inputCount + lookaheadCount > c->buffer->len ||
 		inputCount + lookaheadCount > c->context_length))
     return false;
 
@@ -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->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -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->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -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->info[c->buffer->in_pos].codepoint);
+    index = input_class_def (c->buffer->info[c->buffer->i].codepoint);
     const ChainRuleSet &rule_set = this+ruleSet[index];
     /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
      * them across subrule lookups.  Not sure it's worth it.
@@ -732,7 +732,7 @@ struct ChainContextFormat3
     TRACE_APPLY ();
     const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
 
-    unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->in_pos].codepoint);
+    unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->i].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 0f03109..f4bc85c 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -49,9 +49,9 @@ hb_form_clusters (hb_buffer_t *buffer)
   unsigned int count;
 
   count = buffer->len;
-  for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++)
-    if (buffer->unicode->get_general_category (buffer->info[buffer->in_pos].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
-      buffer->info[buffer->in_pos].cluster = buffer->info[buffer->in_pos - 1].cluster;
+  for (buffer->i = 1; buffer->i < count; buffer->i++)
+    if (buffer->unicode->get_general_category (buffer->info[buffer->i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
+      buffer->info[buffer->i].cluster = buffer->info[buffer->i - 1].cluster;
 }
 
 static hb_direction_t
@@ -83,8 +83,8 @@ hb_mirror_chars (hb_buffer_t *buffer)
     return;
 
   count = buffer->len;
-  for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
-      buffer->info[buffer->in_pos].codepoint = get_mirroring (buffer->info[buffer->in_pos].codepoint);
+  for (buffer->i = 0; buffer->i < count; buffer->i++) {
+      buffer->info[buffer->i].codepoint = get_mirroring (buffer->info[buffer->i].codepoint);
   }
 }
 
@@ -98,15 +98,15 @@ hb_map_glyphs (hb_font_t    *font,
   if (unlikely (!buffer->len))
     return;
   count = buffer->len - 1;
-  for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
-    if (unlikely (is_variation_selector (buffer->info[buffer->in_pos + 1].codepoint))) {
-      buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, buffer->info[buffer->in_pos + 1].codepoint);
-      buffer->in_pos++;
+  for (buffer->i = 0; buffer->i < count; buffer->i++) {
+    if (unlikely (is_variation_selector (buffer->info[buffer->i + 1].codepoint))) {
+      buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint);
+      buffer->i++;
     } else {
-      buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, 0);
+      buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0);
     }
   }
-  buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, 0);
+  buffer->info[buffer->i].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0);
 }
 
 static void
@@ -155,11 +155,11 @@ hb_position_default (hb_font_t    *font,
   hb_buffer_clear_positions (buffer);
 
   count = buffer->len;
-  for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
+  for (buffer->i = 0; buffer->i < count; buffer->i++) {
     hb_glyph_metrics_t metrics;
-    hb_font_get_glyph_metrics (font, face, buffer->info[buffer->in_pos].codepoint, &metrics);
-    buffer->pos[buffer->in_pos].x_advance = metrics.x_advance;
-    buffer->pos[buffer->in_pos].y_advance = metrics.y_advance;
+    hb_font_get_glyph_metrics (font, face, buffer->info[buffer->i].codepoint, &metrics);
+    buffer->pos[buffer->i].x_advance = metrics.x_advance;
+    buffer->pos[buffer->i].y_advance = metrics.y_advance;
   }
 }
 
@@ -194,14 +194,14 @@ hb_truetype_kern (hb_font_t    *font,
 
   /* TODO Check for kern=0 */
   count = buffer->len;
-  for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++) {
+  for (buffer->i = 1; buffer->i < count; buffer->i++) {
     hb_position_t kern, kern1, kern2;
-    kern = hb_font_get_kerning (font, face, buffer->info[buffer->in_pos - 1].codepoint, buffer->info[buffer->in_pos].codepoint);
+    kern = hb_font_get_kerning (font, face, buffer->info[buffer->i - 1].codepoint, buffer->info[buffer->i].codepoint);
     kern1 = kern >> 1;
     kern2 = kern - kern1;
-    buffer->pos[buffer->in_pos - 1].x_advance += kern1;
-    buffer->pos[buffer->in_pos].x_advance += kern2;
-    buffer->pos[buffer->in_pos].x_offset += kern2;
+    buffer->pos[buffer->i - 1].x_advance += kern1;
+    buffer->pos[buffer->i].x_advance += kern2;
+    buffer->pos[buffer->i].x_offset += kern2;
   }
 }
 
commit 29427c5c51ac70aca53ed523fa5ddb3de4355fb0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:08:22 2010 -0400

    Shortening buffer accessors: rename buffer->out_length to buffer->out_len

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 40c3787..be6f128 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -111,7 +111,7 @@ struct _hb_buffer_t {
   hb_bool_t    have_output; /* whether we have an output buffer going on */
   hb_bool_t    have_positions; /* whether we have positions */
   unsigned int len;
-  unsigned int out_length;
+  unsigned int out_len;
   unsigned int in_pos;
 
   hb_internal_glyph_info_t     *info;
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index c2101bb..00d2af9 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -43,13 +43,13 @@ static hb_buffer_t _hb_buffer_nil = {
  *
  * As an optimization, both info and out_info 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 len at any time.
+ * case as long as out_len doesn't exceed len at any time.
  * In that case, swap() is no-op and the glyph operations operate mostly
  * in-place.
  *
  * As soon as out_info gets longer than info, out_info 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.
+ * current contents (out_len entries) are copied to the alt buffer.
  * This should all remain transparent to the user.  swap() then switches
  * info and out_info.
  */
@@ -69,7 +69,7 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
       buffer->pos = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->pos[0]));
 
     buffer->out_info = (hb_internal_glyph_info_t *) buffer->pos;
-    memcpy (buffer->out_info, buffer->info, buffer->out_length * sizeof (buffer->out_info[0]));
+    memcpy (buffer->out_info, buffer->info, buffer->out_len * sizeof (buffer->out_info[0]));
   }
 }
 
@@ -182,7 +182,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
   buffer->have_output = FALSE;
   buffer->have_positions = FALSE;
   buffer->len = 0;
-  buffer->out_length = 0;
+  buffer->out_len = 0;
   buffer->in_pos = 0;
   buffer->out_info = buffer->info;
   buffer->max_lig_id = 0;
@@ -245,7 +245,7 @@ _hb_buffer_clear_output (hb_buffer_t *buffer)
 {
   buffer->have_output = TRUE;
   buffer->have_positions = FALSE;
-  buffer->out_length = 0;
+  buffer->out_len = 0;
   buffer->out_info = buffer->info;
 }
 
@@ -282,8 +282,8 @@ _hb_buffer_swap (hb_buffer_t *buffer)
   }
 
   tmp = buffer->len;
-  buffer->len = buffer->out_length;
-  buffer->out_length = tmp;
+  buffer->len = buffer->out_len;
+  buffer->out_len = tmp;
 
   buffer->in_pos = 0;
 }
@@ -321,9 +321,9 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   unsigned int cluster;
 
   if (buffer->out_info != buffer->info ||
-      buffer->out_length + num_out > buffer->in_pos + num_in)
+      buffer->out_len + num_out > buffer->in_pos + num_in)
   {
-    hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
+    hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
   }
 
   mask = buffer->info[buffer->in_pos].mask;
@@ -335,7 +335,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
 
   for (i = 0; i < num_out; i++)
   {
-    hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_length + i];
+    hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_len + i];
     info->codepoint = glyph_data[i];
     info->mask = mask;
     info->cluster = cluster;
@@ -345,7 +345,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   }
 
   buffer->in_pos  += num_in;
-  buffer->out_length += num_out;
+  buffer->out_len += num_out;
 }
 
 void
@@ -361,9 +361,9 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   unsigned int cluster;
 
   if (buffer->out_info != buffer->info ||
-      buffer->out_length + num_out > buffer->in_pos + num_in)
+      buffer->out_len + num_out > buffer->in_pos + num_in)
   {
-    hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
+    hb_buffer_ensure_separate (buffer, buffer->out_len + num_out);
   }
 
   mask = buffer->info[buffer->in_pos].mask;
@@ -375,7 +375,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
 
   for (i = 0; i < num_out; i++)
   {
-    hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_length + i];
+    hb_internal_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;
@@ -385,7 +385,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   }
 
   buffer->in_pos  += num_in;
-  buffer->out_length += num_out;
+  buffer->out_len += num_out;
 }
 
 void
@@ -398,13 +398,13 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
 
   if (buffer->out_info != buffer->info)
   {
-    hb_buffer_ensure (buffer, buffer->out_length + 1);
-    buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
+    hb_buffer_ensure (buffer, buffer->out_len + 1);
+    buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
   }
-  else if (buffer->out_length != buffer->in_pos)
-    buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
+  else if (buffer->out_len != buffer->in_pos)
+    buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
 
-  info = &buffer->out_info[buffer->out_length];
+  info = &buffer->out_info[buffer->out_len];
   info->codepoint = glyph_index;
   if (component != 0xFFFF)
     info->component = component;
@@ -413,7 +413,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
   info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
 
   buffer->in_pos++;
-  buffer->out_length++;
+  buffer->out_len++;
 }
 
 void
@@ -423,13 +423,13 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
   {
     if (buffer->out_info != buffer->info)
     {
-      hb_buffer_ensure (buffer, buffer->out_length + 1);
-      buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
+      hb_buffer_ensure (buffer, buffer->out_len + 1);
+      buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
     }
-    else if (buffer->out_length != buffer->in_pos)
-      buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
+    else if (buffer->out_len != buffer->in_pos)
+      buffer->out_info[buffer->out_len] = buffer->info[buffer->in_pos];
 
-    buffer->out_length++;
+    buffer->out_len++;
   }
 
   buffer->in_pos++;
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index b0b0387..6eed981 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -289,7 +289,7 @@ struct AlternateSubstFormat1
     /* XXX callback to user to choose alternate
     if (c->layout->face->altfunc)
       alt_index = (c->layout->face->altfunc)(c->layout->layout, c->buffer,
-				    c->buffer->out_length, glyph_id,
+				    c->buffer->out_len, glyph_id,
 				    alt_set.len, alt_set.array);
 				   */
 
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 7183e6e..939071a 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -116,10 +116,10 @@ static inline bool match_backtrack (hb_apply_context_t *c,
 				    match_func_t match_func,
 				    const void *match_data)
 {
-  if (unlikely (c->buffer->out_length < count))
+  if (unlikely (c->buffer->out_len < count))
     return false;
 
-  for (unsigned int i = 0, j = c->buffer->out_length - 1; i < count; i++, j--)
+  for (unsigned int i = 0, j = c->buffer->out_len - 1; i < count; i++, j--)
   {
     while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_flag, NULL))
     {
@@ -519,7 +519,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
 					 ChainContextLookupContext &lookup_context)
 {
   /* First guess */
-  if (unlikely (c->buffer->out_length < backtrackCount ||
+  if (unlikely (c->buffer->out_len < backtrackCount ||
 		c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->len ||
 		inputCount + lookaheadCount > c->context_length))
     return false;
commit 6960350be97f24e97140391025b56369c393a3df
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:07:46 2010 -0400

    Shortening buffer accessors: rename buffer->in_length to buffer->len

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 9164e1c..40c3787 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -110,7 +110,7 @@ struct _hb_buffer_t {
 
   hb_bool_t    have_output; /* whether we have an output buffer going on */
   hb_bool_t    have_positions; /* whether we have positions */
-  unsigned int in_length;
+  unsigned int len;
   unsigned int out_length;
   unsigned int in_pos;
 
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 64f6144..c2101bb 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -43,7 +43,7 @@ static hb_buffer_t _hb_buffer_nil = {
  *
  * As an optimization, both info and out_info 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.
+ * case as long as out_length doesn't exceed len at any time.
  * In that case, swap() is no-op and the glyph operations operate mostly
  * in-place.
  *
@@ -181,7 +181,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
 {
   buffer->have_output = FALSE;
   buffer->have_positions = FALSE;
-  buffer->in_length = 0;
+  buffer->len = 0;
   buffer->out_length = 0;
   buffer->in_pos = 0;
   buffer->out_info = buffer->info;
@@ -224,9 +224,9 @@ hb_buffer_add_glyph (hb_buffer_t    *buffer,
 {
   hb_internal_glyph_info_t *glyph;
 
-  hb_buffer_ensure (buffer, buffer->in_length + 1);
+  hb_buffer_ensure (buffer, buffer->len + 1);
 
-  glyph = &buffer->info[buffer->in_length];
+  glyph = &buffer->info[buffer->len];
   glyph->codepoint = codepoint;
   glyph->mask = mask;
   glyph->cluster = cluster;
@@ -234,7 +234,7 @@ hb_buffer_add_glyph (hb_buffer_t    *buffer,
   glyph->lig_id = 0;
   glyph->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
 
-  buffer->in_length++;
+  buffer->len++;
 }
 
 
@@ -262,7 +262,7 @@ hb_buffer_clear_positions (hb_buffer_t *buffer)
     return;
   }
 
-  memset (buffer->pos, 0, sizeof (buffer->pos[0]) * buffer->in_length);
+  memset (buffer->pos, 0, sizeof (buffer->pos[0]) * buffer->len);
 }
 
 void
@@ -281,8 +281,8 @@ _hb_buffer_swap (hb_buffer_t *buffer)
     buffer->pos = (hb_internal_glyph_position_t *) buffer->out_info;
   }
 
-  tmp = buffer->in_length;
-  buffer->in_length = buffer->out_length;
+  tmp = buffer->len;
+  buffer->len = buffer->out_length;
   buffer->out_length = tmp;
 
   buffer->in_pos = 0;
@@ -439,7 +439,7 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
 unsigned int
 hb_buffer_get_length (hb_buffer_t *buffer)
 {
-  return buffer->in_length;
+  return buffer->len;
 }
 
 /* Return value valid as long as buffer not modified */
@@ -489,10 +489,10 @@ reverse_range (hb_buffer_t *buffer,
 void
 hb_buffer_reverse (hb_buffer_t *buffer)
 {
-  if (unlikely (!buffer->in_length))
+  if (unlikely (!buffer->len))
     return;
 
-  reverse_range (buffer, 0, buffer->in_length);
+  reverse_range (buffer, 0, buffer->len);
 }
 
 void
@@ -500,12 +500,12 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer)
 {
   unsigned int i, start, count, last_cluster;
 
-  if (unlikely (!buffer->in_length))
+  if (unlikely (!buffer->len))
     return;
 
   hb_buffer_reverse (buffer);
 
-  count = buffer->in_length;
+  count = buffer->len;
   start = 0;
   last_cluster = buffer->info[0].cluster;
   for (i = 1; i < count; i++) {
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index a2501d0..2a66f42 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -619,7 +619,7 @@ struct PairPosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
+    unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
     if (unlikely (c->buffer->in_pos + 2 > end))
       return false;
 
@@ -681,7 +681,7 @@ struct PairPosFormat2
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
+    unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
     if (unlikely (c->buffer->in_pos + 2 > end))
       return false;
 
@@ -1529,13 +1529,13 @@ struct PosLookup : Lookup
   {
     bool ret = false;
 
-    if (unlikely (!buffer->in_length))
+    if (unlikely (!buffer->len))
       return false;
 
     layout->info.gpos.last = HB_OT_LAYOUT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */
 
     buffer->in_pos = 0;
-    while (buffer->in_pos < buffer->in_length)
+    while (buffer->in_pos < buffer->len)
     {
       bool done;
       if (~buffer->info[buffer->in_pos].mask & mask)
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index f5b3593..b0b0387 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -367,7 +367,7 @@ struct Ligature
     TRACE_APPLY ();
     unsigned int i, j;
     unsigned int count = component.len;
-    unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
+    unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
     if (unlikely (c->buffer->in_pos + count > end))
       return false;
 
@@ -820,7 +820,7 @@ struct SubstLookup : Lookup
   {
     bool ret = false;
 
-    if (unlikely (!buffer->in_length))
+    if (unlikely (!buffer->len))
       return false;
 
     if (likely (!is_reverse ()))
@@ -828,7 +828,7 @@ struct SubstLookup : Lookup
 	/* in/out forward substitution */
 	buffer->clear_output ();
 	buffer->in_pos = 0;
-	while (buffer->in_pos < buffer->in_length)
+	while (buffer->in_pos < buffer->len)
 	{
 	  if ((~buffer->info[buffer->in_pos].mask & mask) &&
 	      apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
@@ -843,7 +843,7 @@ struct SubstLookup : Lookup
     else
     {
 	/* in-place backward substitution */
-	buffer->in_pos = buffer->in_length - 1;
+	buffer->in_pos = buffer->len - 1;
 	do
 	{
 	  if ((~buffer->info[buffer->in_pos].mask & mask) &&
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 4019c93..7183e6e 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -88,7 +88,7 @@ static inline bool match_input (hb_apply_context_t *c,
 				unsigned int *context_length_out)
 {
   unsigned int i, j;
-  unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
+  unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
   if (unlikely (c->buffer->in_pos + count > end))
     return false;
 
@@ -143,7 +143,7 @@ static inline bool match_lookahead (hb_apply_context_t *c,
 				    unsigned int offset)
 {
   unsigned int i, j;
-  unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
+  unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
   if (unlikely (c->buffer->in_pos + offset + count > end))
     return false;
 
@@ -185,7 +185,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
 				 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
 				 apply_lookup_func_t apply_func)
 {
-  unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
+  unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
   if (unlikely (c->buffer->in_pos + count > end))
     return false;
 
@@ -520,7 +520,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
 {
   /* First guess */
   if (unlikely (c->buffer->out_length < backtrackCount ||
-		c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->in_length ||
+		c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->len ||
 		inputCount + lookaheadCount > c->context_length))
     return false;
 
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index a6a45e0..0f03109 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -48,7 +48,7 @@ hb_form_clusters (hb_buffer_t *buffer)
 {
   unsigned int count;
 
-  count = buffer->in_length;
+  count = buffer->len;
   for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++)
     if (buffer->unicode->get_general_category (buffer->info[buffer->in_pos].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
       buffer->info[buffer->in_pos].cluster = buffer->info[buffer->in_pos - 1].cluster;
@@ -82,7 +82,7 @@ hb_mirror_chars (hb_buffer_t *buffer)
   if (HB_DIRECTION_IS_FORWARD (buffer->direction))
     return;
 
-  count = buffer->in_length;
+  count = buffer->len;
   for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
       buffer->info[buffer->in_pos].codepoint = get_mirroring (buffer->info[buffer->in_pos].codepoint);
   }
@@ -95,9 +95,9 @@ hb_map_glyphs (hb_font_t    *font,
 {
   unsigned int count;
 
-  if (unlikely (!buffer->in_length))
+  if (unlikely (!buffer->len))
     return;
-  count = buffer->in_length - 1;
+  count = buffer->len - 1;
   for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
     if (unlikely (is_variation_selector (buffer->info[buffer->in_pos + 1].codepoint))) {
       buffer->info[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->info[buffer->in_pos].codepoint, buffer->info[buffer->in_pos + 1].codepoint);
@@ -154,7 +154,7 @@ hb_position_default (hb_font_t    *font,
 
   hb_buffer_clear_positions (buffer);
 
-  count = buffer->in_length;
+  count = buffer->len;
   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);
@@ -193,7 +193,7 @@ hb_truetype_kern (hb_font_t    *font,
   unsigned int count;
 
   /* TODO Check for kern=0 */
-  count = buffer->in_length;
+  count = buffer->len;
   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->info[buffer->in_pos - 1].codepoint, buffer->info[buffer->in_pos].codepoint);
commit 1b621823f3e31b48c80cc8b0691dfa873ba086cd
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:05:53 2010 -0400

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

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index bd291e6..9164e1c 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -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 */
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index f6acc67..64f6144 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -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;
     }
   }
 }
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 249fae2..a2501d0 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -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:
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index a0f166f..a6a45e0 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -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;
   }
 }
 
commit 9d5e26df0877aa5b187764ba09bd7bf221e92968
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:03:11 2010 -0400

    Shortening buffer accessors: rename buffer->out_string to buffer->out_info

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 16d3e19..bd291e6 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -115,7 +115,7 @@ struct _hb_buffer_t {
   unsigned int in_pos;
 
   hb_internal_glyph_info_t     *info;
-  hb_internal_glyph_info_t     *out_string;
+  hb_internal_glyph_info_t     *out_info;
   hb_internal_glyph_position_t *positions;
 
   /* Other stuff */
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 008105c..f6acc67 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: info and out_string.  They
+ * There are two string pointers: info and out_info.  They
  * always have same allocated size, but different length and positions.
  *
- * As an optimization, both info and out_string may point to the
+ * As an optimization, both info and out_info 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 info, out_string is moved over
+ * As soon as out_info gets longer than info, out_info 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
- * info and out_string.
+ * info and out_info.
  */
 
 /* 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->info)
+  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]));
 
-    buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions;
-    memcpy (buffer->out_string, buffer->info, buffer->out_length * sizeof (buffer->out_string[0]));
+    buffer->out_info = (hb_internal_glyph_info_t *) buffer->positions;
+    memcpy (buffer->out_info, buffer->info, buffer->out_length * sizeof (buffer->out_info[0]));
   }
 }
 
@@ -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->info;
+  buffer->out_info = 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->info)
+    if (buffer->out_info != buffer->info)
     {
       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;
+      buffer->out_info = (hb_internal_glyph_info_t *) buffer->positions;
     }
     else
     {
       buffer->info = (hb_internal_glyph_info_t *) realloc (buffer->info, new_allocated * sizeof (buffer->info[0]));
-      buffer->out_string = buffer->info;
+      buffer->out_info = buffer->info;
     }
 
     buffer->allocated = new_allocated;
@@ -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->info;
+  buffer->out_info = buffer->info;
 }
 
 void
@@ -272,13 +272,13 @@ _hb_buffer_swap (hb_buffer_t *buffer)
 
   assert (buffer->have_output);
 
-  if (buffer->out_string != buffer->info)
+  if (buffer->out_info != buffer->info)
   {
     hb_internal_glyph_info_t *tmp_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;
+    buffer->info = buffer->out_info;
+    buffer->out_info = tmp_string;
+    buffer->positions = (hb_internal_glyph_position_t *) buffer->out_info;
   }
 
   tmp = buffer->in_length;
@@ -289,7 +289,7 @@ _hb_buffer_swap (hb_buffer_t *buffer)
 }
 
 /* The following function copies `num_out' elements from `glyph_data'
-   to `buffer->out_string', advancing the in array pointer in the structure
+   to `buffer->out_info', advancing the in array pointer in the structure
    by `num_in' elements, and the out array pointer by `num_out' elements.
    Finally, it sets the `length' field of `out' equal to
    `pos' of the `out' structure.
@@ -320,7 +320,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   unsigned int mask;
   unsigned int cluster;
 
-  if (buffer->out_string != buffer->info ||
+  if (buffer->out_info != buffer->info ||
       buffer->out_length + num_out > buffer->in_pos + num_in)
   {
     hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
@@ -335,7 +335,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
 
   for (i = 0; i < num_out; i++)
   {
-    hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_length + i];
+    hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_length + i];
     info->codepoint = glyph_data[i];
     info->mask = mask;
     info->cluster = cluster;
@@ -360,7 +360,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   unsigned int mask;
   unsigned int cluster;
 
-  if (buffer->out_string != buffer->info ||
+  if (buffer->out_info != buffer->info ||
       buffer->out_length + num_out > buffer->in_pos + num_in)
   {
     hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
@@ -375,7 +375,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
 
   for (i = 0; i < num_out; i++)
   {
-    hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_length + i];
+    hb_internal_glyph_info_t *info = &buffer->out_info[buffer->out_length + i];
     info->codepoint = hb_be_uint16 (glyph_data_be[i]);
     info->mask = mask;
     info->cluster = cluster;
@@ -396,15 +396,15 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
 {
   hb_internal_glyph_info_t *info;
 
-  if (buffer->out_string != buffer->info)
+  if (buffer->out_info != buffer->info)
   {
     hb_buffer_ensure (buffer, buffer->out_length + 1);
-    buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos];
+    buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
   }
   else if (buffer->out_length != buffer->in_pos)
-    buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos];
+    buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
 
-  info = &buffer->out_string[buffer->out_length];
+  info = &buffer->out_info[buffer->out_length];
   info->codepoint = glyph_index;
   if (component != 0xFFFF)
     info->component = component;
@@ -421,13 +421,13 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
 {
   if (buffer->have_output)
   {
-    if (buffer->out_string != buffer->info)
+    if (buffer->out_info != buffer->info)
     {
       hb_buffer_ensure (buffer, buffer->out_length + 1);
-      buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos];
+      buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
     }
     else if (buffer->out_length != buffer->in_pos)
-      buffer->out_string[buffer->out_length] = buffer->info[buffer->in_pos];
+      buffer->out_info[buffer->out_length] = buffer->info[buffer->in_pos];
 
     buffer->out_length++;
   }
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index a74557f..4019c93 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -121,14 +121,14 @@ static inline bool match_backtrack (hb_apply_context_t *c,
 
   for (unsigned int i = 0, j = c->buffer->out_length - 1; i < count; i++, j--)
   {
-    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_string[j], c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_flag, NULL))
     {
       if (unlikely (j + 1 == count - i))
 	return false;
       j--;
     }
 
-    if (likely (!match_func (c->buffer->out_string[j].codepoint, backtrack[i], match_data)))
+    if (likely (!match_func (c->buffer->out_info[j].codepoint, backtrack[i], match_data)))
       return false;
   }
 
commit 7e7007a1c9bf2c07a8369752126ece8fa6164248
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 22:02:37 2010 -0400

    Shortening buffer accessors: rename buffer->in_string to buffer->info

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 9296fb5..16d3e19 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 1f8f183..008105c 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 e021b09..249fae2 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -399,8 +399,8 @@ struct MarkArray : ArrayOf<MarkRecord>	/* 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<PairValueRecord> (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 965d199..f5b3593 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 5c22797..a74557f 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<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (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 de3780c..a0f166f 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;
commit 8e6b6bb2932946ebc7b01c3abf575b654c741e20
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:58:22 2010 -0400

    Merge buffer->out_pos and buffer->out_length

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index fabfbd4..9296fb5 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -113,7 +113,6 @@ struct _hb_buffer_t {
   unsigned int in_length;
   unsigned int out_length;
   unsigned int in_pos;
-  unsigned int out_pos; /* out_length and out_pos are actually always the same */
 
   hb_internal_glyph_info_t     *in_string;
   hb_internal_glyph_info_t     *out_string;
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index bad5dcd..1f8f183 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -184,7 +184,6 @@ hb_buffer_clear (hb_buffer_t *buffer)
   buffer->in_length = 0;
   buffer->out_length = 0;
   buffer->in_pos = 0;
-  buffer->out_pos = 0;
   buffer->out_string = buffer->in_string;
   buffer->max_lig_id = 0;
 }
@@ -247,7 +246,6 @@ _hb_buffer_clear_output (hb_buffer_t *buffer)
   buffer->have_output = TRUE;
   buffer->have_positions = FALSE;
   buffer->out_length = 0;
-  buffer->out_pos = 0;
   buffer->out_string = buffer->in_string;
 }
 
@@ -287,9 +285,7 @@ _hb_buffer_swap (hb_buffer_t *buffer)
   buffer->in_length = buffer->out_length;
   buffer->out_length = tmp;
 
-  tmp = buffer->in_pos;
-  buffer->in_pos = buffer->out_pos;
-  buffer->out_pos = tmp;
+  buffer->in_pos = 0;
 }
 
 /* The following function copies `num_out' elements from `glyph_data'
@@ -325,9 +321,9 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   unsigned int cluster;
 
   if (buffer->out_string != buffer->in_string ||
-      buffer->out_pos + num_out > buffer->in_pos + num_in)
+      buffer->out_length + num_out > buffer->in_pos + num_in)
   {
-    hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out);
+    hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
   }
 
   mask = buffer->in_string[buffer->in_pos].mask;
@@ -339,7 +335,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
 
   for (i = 0; i < num_out; i++)
   {
-    hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_pos + i];
+    hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_length + i];
     info->codepoint = glyph_data[i];
     info->mask = mask;
     info->cluster = cluster;
@@ -349,8 +345,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
   }
 
   buffer->in_pos  += num_in;
-  buffer->out_pos += num_out;
-  buffer->out_length = buffer->out_pos;
+  buffer->out_length += num_out;
 }
 
 void
@@ -366,9 +361,9 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   unsigned int cluster;
 
   if (buffer->out_string != buffer->in_string ||
-      buffer->out_pos + num_out > buffer->in_pos + num_in)
+      buffer->out_length + num_out > buffer->in_pos + num_in)
   {
-    hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out);
+    hb_buffer_ensure_separate (buffer, buffer->out_length + num_out);
   }
 
   mask = buffer->in_string[buffer->in_pos].mask;
@@ -380,7 +375,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
 
   for (i = 0; i < num_out; i++)
   {
-    hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_pos + i];
+    hb_internal_glyph_info_t *info = &buffer->out_string[buffer->out_length + i];
     info->codepoint = hb_be_uint16 (glyph_data_be[i]);
     info->mask = mask;
     info->cluster = cluster;
@@ -390,8 +385,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
   }
 
   buffer->in_pos  += num_in;
-  buffer->out_pos += num_out;
-  buffer->out_length = buffer->out_pos;
+  buffer->out_length += num_out;
 }
 
 void
@@ -404,13 +398,13 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
 
   if (buffer->out_string != buffer->in_string)
   {
-    hb_buffer_ensure (buffer, buffer->out_pos + 1);
-    buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
+    hb_buffer_ensure (buffer, buffer->out_length + 1);
+    buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
   }
-  else if (buffer->out_pos != buffer->in_pos)
-    buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
+  else if (buffer->out_length != buffer->in_pos)
+    buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
 
-  info = &buffer->out_string[buffer->out_pos];
+  info = &buffer->out_string[buffer->out_length];
   info->codepoint = glyph_index;
   if (component != 0xFFFF)
     info->component = component;
@@ -419,8 +413,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
   info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
 
   buffer->in_pos++;
-  buffer->out_pos++;
-  buffer->out_length = buffer->out_pos;
+  buffer->out_length++;
 }
 
 void
@@ -430,14 +423,13 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
   {
     if (buffer->out_string != buffer->in_string)
     {
-      hb_buffer_ensure (buffer, buffer->out_pos + 1);
-      buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
+      hb_buffer_ensure (buffer, buffer->out_length + 1);
+      buffer->out_string[buffer->out_length] = buffer->in_string[buffer->in_pos];
     }
-    else if (buffer->out_pos != buffer->in_pos)
-      buffer->out_string[buffer->out_pos] = buffer->in_string[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_pos++;
-    buffer->out_length = buffer->out_pos;
+    buffer->out_length++;
   }
 
   buffer->in_pos++;
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 59c498e..965d199 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -289,7 +289,7 @@ struct AlternateSubstFormat1
     /* XXX callback to user to choose alternate
     if (c->layout->face->altfunc)
       alt_index = (c->layout->face->altfunc)(c->layout->layout, c->buffer,
-				    c->buffer->out_pos, glyph_id,
+				    c->buffer->out_length, glyph_id,
 				    alt_set.len, alt_set.array);
 				   */
 
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index f11080e..5c22797 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -116,10 +116,10 @@ static inline bool match_backtrack (hb_apply_context_t *c,
 				    match_func_t match_func,
 				    const void *match_data)
 {
-  if (unlikely (c->buffer->out_pos < count))
+  if (unlikely (c->buffer->out_length < count))
     return false;
 
-  for (unsigned int i = 0, j = c->buffer->out_pos - 1; i < count; i++, j--)
+  for (unsigned int i = 0, j = c->buffer->out_length - 1; i < count; i++, j--)
   {
     while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_string[j], c->lookup_flag, NULL))
     {
@@ -519,7 +519,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
 					 ChainContextLookupContext &lookup_context)
 {
   /* First guess */
-  if (unlikely (c->buffer->out_pos < backtrackCount ||
+  if (unlikely (c->buffer->out_length < backtrackCount ||
 		c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->in_length ||
 		inputCount + lookaheadCount > c->context_length))
     return false;
commit 22f668eb9ad5f62d9fcd2e0c826ea78977687e5c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:41:04 2010 -0400

    Remove the unused BUFFER macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 03cc697..fabfbd4 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -62,7 +62,6 @@ ASSERT_STATIC (sizeof (hb_glyph_position_t) == sizeof (hb_internal_glyph_positio
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
 
 
-
 HB_INTERNAL void
 _hb_buffer_swap (hb_buffer_t *buffer);
 
@@ -150,11 +149,6 @@ struct _hb_buffer_t {
 };
 
 
-
-#ifndef BUFFER
-#define BUFFER buffer
-#endif
-
 HB_END_DECLS
 
 #endif /* HB_BUFFER_PRIVATE_H */
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 72817a0..e021b09 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -30,10 +30,6 @@
 #include "hb-ot-layout-gsubgpos-private.hh"
 
 
-#undef BUFFER
-#define BUFFER c->buffer
-
-
 #define HB_OT_LAYOUT_GPOS_NO_LAST ((unsigned int) -1)
 
 /* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
@@ -1531,8 +1527,6 @@ struct PosLookup : Lookup
 			     hb_buffer_t *buffer,
 			     hb_mask_t    mask) const
   {
-#undef BUFFER
-#define BUFFER buffer
     bool ret = false;
 
     if (unlikely (!buffer->in_length))
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 75ce90e..59c498e 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -30,10 +30,6 @@
 #include "hb-ot-layout-gsubgpos-private.hh"
 
 
-#undef BUFFER
-#define BUFFER c->buffer
-
-
 struct SingleSubstFormat1
 {
   friend struct SingleSubst;
@@ -822,8 +818,6 @@ struct SubstLookup : Lookup
 			    hb_buffer_t *buffer,
 			    hb_mask_t    mask) const
   {
-#undef BUFFER
-#define BUFFER buffer
     bool ret = false;
 
     if (unlikely (!buffer->in_length))
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 4957bfb..f11080e 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -52,11 +52,6 @@ struct hb_apply_context_t
 
 
 
-
-#undef BUFFER
-#define BUFFER c->buffer
-
-
 typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
 typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
 
commit 7e53ebe478597778c25c197ff9f0cb379f1d0043
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:38:13 2010 -0400

    Remove the IN_CURGLYPH() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index fa5ac55..03cc697 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -155,9 +155,6 @@ struct _hb_buffer_t {
 #define BUFFER buffer
 #endif
 
-/* convenience macros */
-#define IN_CURGLYPH()		(BUFFER->in_string[BUFFER->in_pos].codepoint)
-
 HB_END_DECLS
 
 #endif /* HB_BUFFER_PRIVATE_H */
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 0e97d93..72817a0 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -403,7 +403,7 @@ struct MarkArray : ArrayOf<MarkRecord>	/* Array of MarkRecords--in Coverage orde
 
     hb_position_t mark_x, mark_y, base_x, base_y;
 
-    mark_anchor.get_anchor (c->layout, IN_CURGLYPH (), &mark_x, &mark_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);
 
     hb_internal_glyph_position_t &o = c->buffer->positions[c->buffer->in_pos];
@@ -434,7 +434,7 @@ struct SinglePosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -473,7 +473,7 @@ struct SinglePosFormat2
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -627,7 +627,7 @@ struct PairPosFormat1
     if (unlikely (c->buffer->in_pos + 2 > end))
       return false;
 
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -689,7 +689,7 @@ struct PairPosFormat2
     if (unlikely (c->buffer->in_pos + 2 > end))
       return false;
 
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -705,7 +705,7 @@ struct PairPosFormat2
     unsigned int len2 = valueFormat2.get_len ();
     unsigned int record_len = len1 + len2;
 
-    unsigned int klass1 = (this+classDef1) (IN_CURGLYPH ());
+    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);
     if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
       return false;
@@ -958,7 +958,7 @@ struct CursivePosFormat1
     if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
       return false;
 
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -968,7 +968,7 @@ struct CursivePosFormat1
       goto end;
 
     hb_position_t entry_x, entry_y;
-    (this+record.entryAnchor).get_anchor (c->layout, IN_CURGLYPH (), &entry_x, &entry_y);
+    (this+record.entryAnchor).get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &entry_x, &entry_y);
 
     /* TODO vertical */
 
@@ -998,7 +998,7 @@ struct CursivePosFormat1
     if (record.exitAnchor)
     {
       gpi->last = c->buffer->in_pos;
-      (this+record.exitAnchor).get_anchor (c->layout, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
+      (this+record.exitAnchor).get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y);
     }
 
     c->buffer->in_pos++;
@@ -1067,7 +1067,7 @@ struct MarkBasePosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
+    unsigned int mark_index = (this+markCoverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (mark_index == NOT_COVERED))
       return false;
 
@@ -1169,7 +1169,7 @@ struct MarkLigPosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
+    unsigned int mark_index = (this+markCoverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (mark_index == NOT_COVERED))
       return false;
 
@@ -1288,7 +1288,7 @@ struct MarkMarkPosFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    unsigned int mark1_index = (this+mark1Coverage) (IN_CURGLYPH ());
+    unsigned int mark1_index = (this+mark1Coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (mark1_index == NOT_COVERED))
       return false;
 
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 90d5b58..75ce90e 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -43,7 +43,7 @@ struct SingleSubstFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = IN_CURGLYPH ();
+    hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
     unsigned int index = (this+coverage) (glyph_id);
     if (likely (index == NOT_COVERED))
       return false;
@@ -84,7 +84,7 @@ struct SingleSubstFormat2
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = IN_CURGLYPH ();
+    hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
     unsigned int index = (this+coverage) (glyph_id);
     if (likely (index == NOT_COVERED))
       return false;
@@ -208,7 +208,7 @@ struct MultipleSubstFormat1
   {
     TRACE_APPLY ();
 
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -277,7 +277,7 @@ struct AlternateSubstFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = IN_CURGLYPH ();
+    hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
 
     unsigned int index = (this+coverage) (glyph_id);
     if (likely (index == NOT_COVERED))
@@ -420,7 +420,7 @@ 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 (IN_CURGLYPH (), i, lig_id);
+	  c->buffer->add_output_glyph (c->buffer->in_string[c->buffer->in_pos].codepoint, i, lig_id);
 
 	(c->buffer->in_pos)++;
       }
@@ -487,7 +487,7 @@ struct LigatureSubstFormat1
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY ();
-    hb_codepoint_t glyph_id = IN_CURGLYPH ();
+    hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
 
     bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
 
@@ -608,7 +608,7 @@ struct ReverseChainSingleSubstFormat1
     if (unlikely (c->context_length != NO_CONTEXT))
       return false; /* No chaining to this type */
 
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -623,7 +623,7 @@ struct ReverseChainSingleSubstFormat1
 			 match_coverage, this,
 			 1))
     {
-      IN_CURGLYPH () = substitute[index];
+      c->buffer->in_string[c->buffer->in_pos].codepoint = substitute[index];
       c->buffer->in_pos--; /* Reverse! */
       return true;
     }
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 14e769d..4957bfb 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -342,7 +342,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) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -381,12 +381,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) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
     const ClassDef &class_def = this+classDef;
-    index = class_def (IN_CURGLYPH ());
+    index = class_def (c->buffer->in_string[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.
@@ -429,7 +429,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]) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage[0]) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -633,7 +633,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) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -671,7 +671,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) (IN_CURGLYPH ());
+    unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
     if (likely (index == NOT_COVERED))
       return false;
 
@@ -679,7 +679,7 @@ struct ChainContextFormat2
     const ClassDef &input_class_def = this+inputClassDef;
     const ClassDef &lookahead_class_def = this+lookaheadClassDef;
 
-    index = input_class_def (IN_CURGLYPH ());
+    index = input_class_def (c->buffer->in_string[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.
@@ -737,7 +737,7 @@ struct ChainContextFormat3
     TRACE_APPLY ();
     const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
 
-    unsigned int index = (this+input[0]) (IN_CURGLYPH ());
+    unsigned int index = (this+input[0]) (c->buffer->in_string[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 df49e60..de3780c 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -50,7 +50,7 @@ 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 (IN_CURGLYPH()) == HB_CATEGORY_NON_SPACING_MARK)
+    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;
 }
 
@@ -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++) {
-      IN_CURGLYPH() = get_mirroring (IN_CURGLYPH());
+      buffer->in_string[buffer->in_pos].codepoint = get_mirroring (buffer->in_string[buffer->in_pos].codepoint);
   }
 }
 
@@ -100,13 +100,13 @@ hb_map_glyphs (hb_font_t    *font,
   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))) {
-      IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 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);
       buffer->in_pos++;
     } else {
-      IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
+      buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, 0);
     }
   }
-  IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
+  buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[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, IN_CURGLYPH(), &metrics);
+    hb_font_get_glyph_metrics (font, face, buffer->in_string[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, IN_CURGLYPH());
+    kern = hb_font_get_kerning (font, face, buffer->in_string[buffer->in_pos - 1].codepoint, buffer->in_string[buffer->in_pos].codepoint);
     kern1 = kern >> 1;
     kern2 = kern - kern1;
     buffer->positions[buffer->in_pos - 1].x_advance += kern1;
commit d784da1923ff2ca093f8b0210449731d376b7513
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:37:18 2010 -0400

    Remove the IN_CURINFO() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 223f935..fa5ac55 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -157,7 +157,6 @@ struct _hb_buffer_t {
 
 /* convenience macros */
 #define IN_CURGLYPH()		(BUFFER->in_string[BUFFER->in_pos].codepoint)
-#define IN_CURINFO()		(&BUFFER->in_string[BUFFER->in_pos])
 
 HB_END_DECLS
 
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index d0a01da..0e97d93 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1517,7 +1517,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, IN_CURINFO (), c->lookup_flag, &c->property))
+    if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, &c->property))
       return false;
 
     for (unsigned int i = 0; i < get_subtable_count (); i++)
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index ff3a82e..90d5b58 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -419,7 +419,7 @@ struct Ligature
 
       for ( i = 1; i < count; i++ )
       {
-	while (_hb_ot_layout_skip_mark (c->layout->face, IN_CURINFO (), c->lookup_flag, NULL))
+	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 (IN_CURGLYPH (), i, lig_id);
 
 	(c->buffer->in_pos)++;
@@ -793,7 +793,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, IN_CURINFO (), c->lookup_flag, &c->property))
+    if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, &c->property))
       return false;
 
     if (unlikely (lookup_type == SubstLookupSubTable::Extension))
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 7340206..14e769d 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -203,7 +203,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, IN_CURINFO (), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, NULL))
     {
       if (unlikely (c->buffer->in_pos == end))
 	return true;
commit 281f59b4fb16f7c73767eb042a91f70f4c109b3a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:34:22 2010 -0400

    Remove IN_INFO() and IN_NEXTGLYPH() macros

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 6f05767..223f935 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -156,9 +156,7 @@ struct _hb_buffer_t {
 #endif
 
 /* convenience macros */
-#define IN_INFO(pos)		(&BUFFER->in_string[(pos)])
 #define IN_CURGLYPH()		(BUFFER->in_string[BUFFER->in_pos].codepoint)
-#define IN_NEXTGLYPH()		(BUFFER->in_string[BUFFER->in_pos + 1].codepoint)
 #define IN_CURINFO()		(&BUFFER->in_string[BUFFER->in_pos])
 
 HB_END_DECLS
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 56be98f..d0a01da 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -632,7 +632,7 @@ struct PairPosFormat1
       return false;
 
     unsigned int j = c->buffer->in_pos + 1;
-    while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, NULL))
     {
       if (unlikely (j == end))
 	return false;
@@ -694,7 +694,7 @@ struct PairPosFormat2
       return false;
 
     unsigned int j = c->buffer->in_pos + 1;
-    while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, NULL))
     {
       if (unlikely (j == end))
 	return false;
@@ -1079,7 +1079,7 @@ struct MarkBasePosFormat1
       if (unlikely (!j))
 	return false;
       j--;
-    } while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
+    } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[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))
@@ -1181,7 +1181,7 @@ struct MarkLigPosFormat1
       if (unlikely (!j))
 	return false;
       j--;
-    } while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), LookupFlag::IgnoreMarks, &property));
+    } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], LookupFlag::IgnoreMarks, &property));
 
     /* The following assertion is too strong, so we've disabled it. */
     if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE))
@@ -1300,7 +1300,7 @@ struct MarkMarkPosFormat1
       if (unlikely (!j))
 	return false;
       j--;
-    } while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), c->lookup_flag, &property));
+    } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, &property));
 
     if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
       return false;
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 51892aa..ff3a82e 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -378,7 +378,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, IN_INFO (j), c->lookup_flag, &property))
+      while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, &property))
       {
 	if (unlikely (j + count - i == end))
 	  return false;
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 59a2d20..7340206 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -99,7 +99,7 @@ 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, IN_INFO (j), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, NULL))
     {
       if (unlikely (j + count - i == end))
 	return false;
@@ -154,7 +154,7 @@ 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, IN_INFO (j), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, NULL))
     {
       if (unlikely (j + count - i == end))
 	return false;
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index ef2b0ac..df49e60 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -99,8 +99,8 @@ 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 (IN_NEXTGLYPH()))) {
-      IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), IN_NEXTGLYPH());
+    if (unlikely (is_variation_selector (buffer->in_string[buffer->in_pos + 1].codepoint))) {
+      IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), buffer->in_string[buffer->in_pos + 1].codepoint);
       buffer->in_pos++;
     } else {
       IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
commit 6e489cdf7623ac627d06d59a80ecea03ca97dc1b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:07:35 2010 -0400

    Remove the IN_GLYPH() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 86e30de..6f05767 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -156,7 +156,6 @@ struct _hb_buffer_t {
 #endif
 
 /* convenience macros */
-#define IN_GLYPH(pos)		(BUFFER->in_string[(pos)].codepoint)
 #define IN_INFO(pos)		(&BUFFER->in_string[(pos)])
 #define IN_CURGLYPH()		(BUFFER->in_string[BUFFER->in_pos].codepoint)
 #define IN_NEXTGLYPH()		(BUFFER->in_string[BUFFER->in_pos + 1].codepoint)
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 3b77f60..56be98f 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -404,7 +404,7 @@ struct MarkArray : ArrayOf<MarkRecord>	/* Array of MarkRecords--in Coverage orde
     hb_position_t mark_x, mark_y, base_x, base_y;
 
     mark_anchor.get_anchor (c->layout, IN_CURGLYPH (), &mark_x, &mark_y);
-    glyph_anchor.get_anchor (c->layout, IN_GLYPH (glyph_pos), &base_x, &base_y);
+    glyph_anchor.get_anchor (c->layout, c->buffer->in_string[glyph_pos].codepoint, &base_x, &base_y);
 
     hb_internal_glyph_position_t &o = c->buffer->positions[c->buffer->in_pos];
     o.x_advance = 0;
@@ -574,7 +574,7 @@ struct PairSet
     const PairValueRecord *record = CastP<PairValueRecord> (array);
     for (unsigned int i = 0; i < count; i++)
     {
-      if (IN_GLYPH (pos) == record->secondGlyph)
+      if (c->buffer->in_string[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]);
@@ -706,7 +706,7 @@ struct PairPosFormat2
     unsigned int record_len = len1 + len2;
 
     unsigned int klass1 = (this+classDef1) (IN_CURGLYPH ());
-    unsigned int klass2 = (this+classDef2) (IN_GLYPH (j));
+    unsigned int klass2 = (this+classDef2) (c->buffer->in_string[j].codepoint);
     if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
       return false;
 
@@ -1085,7 +1085,7 @@ struct MarkBasePosFormat1
     if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH))
       return false;
 
-    unsigned int base_index = (this+baseCoverage) (IN_GLYPH (j));
+    unsigned int base_index = (this+baseCoverage) (c->buffer->in_string[j].codepoint);
     if (base_index == NOT_COVERED)
       return false;
 
@@ -1187,7 +1187,7 @@ struct MarkLigPosFormat1
     if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE))
       return false;
 
-    unsigned int lig_index = (this+ligatureCoverage) (IN_GLYPH (j));
+    unsigned int lig_index = (this+ligatureCoverage) (c->buffer->in_string[j].codepoint);
     if (lig_index == NOT_COVERED)
       return false;
 
@@ -1312,7 +1312,7 @@ struct MarkMarkPosFormat1
 	(c->buffer->in_string[j].component && c->buffer->in_string[j].lig_id != c->buffer->in_string[c->buffer->in_pos].lig_id))
       return false;
 
-    unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j));
+    unsigned int mark2_index = (this+mark2Coverage) (c->buffer->in_string[j].codepoint);
     if (mark2_index == NOT_COVERED)
       return false;
 
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index e57eb97..51892aa 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -388,7 +388,7 @@ struct Ligature
       if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
 	is_mark = false;
 
-      if (likely (IN_GLYPH (j) != component[i]))
+      if (likely (c->buffer->in_string[j].codepoint != component[i]))
         return false;
     }
     /* This is just a guess ... */
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index d8aa252..59a2d20 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -106,7 +106,7 @@ static inline bool match_input (hb_apply_context_t *c,
       j++;
     }
 
-    if (likely (!match_func (IN_GLYPH (j), input[i - 1], match_data)))
+    if (likely (!match_func (c->buffer->in_string[j].codepoint, input[i - 1], match_data)))
       return false;
   }
 
@@ -161,7 +161,7 @@ static inline bool match_lookahead (hb_apply_context_t *c,
       j++;
     }
 
-    if (likely (!match_func (IN_GLYPH (j), lookahead[i], match_data)))
+    if (likely (!match_func (c->buffer->in_string[j].codepoint, lookahead[i], match_data)))
       return false;
   }
 
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index e8ebf70..ef2b0ac 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -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, IN_GLYPH(buffer->in_pos - 1), IN_CURGLYPH());
+    kern = hb_font_get_kerning (font, face, buffer->in_string[buffer->in_pos - 1].codepoint, IN_CURGLYPH());
     kern1 = kern >> 1;
     kern2 = kern - kern1;
     buffer->positions[buffer->in_pos - 1].x_advance += kern1;
commit 01feb74c78a3a302fa3472a0be7b2a1d52fd1ba3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 21:00:08 2010 -0400

    Remove the IN_CLUSTER() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index bc08a25..86e30de 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -161,7 +161,6 @@ struct _hb_buffer_t {
 #define IN_CURGLYPH()		(BUFFER->in_string[BUFFER->in_pos].codepoint)
 #define IN_NEXTGLYPH()		(BUFFER->in_string[BUFFER->in_pos + 1].codepoint)
 #define IN_CURINFO()		(&BUFFER->in_string[BUFFER->in_pos])
-#define IN_CLUSTER(pos)		(BUFFER->in_string[(pos)].cluster)
 
 HB_END_DECLS
 
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index f458db2..e8ebf70 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -51,7 +51,7 @@ 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 (IN_CURGLYPH()) == HB_CATEGORY_NON_SPACING_MARK)
-      IN_CLUSTER (buffer->in_pos) = IN_CLUSTER (buffer->in_pos - 1);
+      buffer->in_string[buffer->in_pos].cluster = buffer->in_string[buffer->in_pos - 1].cluster;
 }
 
 static hb_direction_t
commit d63a1e089acad9ab9f80addd936d36b6d38fb46a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 20:30:07 2010 -0400

    Remove the IN_MASK() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 008c90e..bc08a25 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -161,7 +161,6 @@ struct _hb_buffer_t {
 #define IN_CURGLYPH()		(BUFFER->in_string[BUFFER->in_pos].codepoint)
 #define IN_NEXTGLYPH()		(BUFFER->in_string[BUFFER->in_pos + 1].codepoint)
 #define IN_CURINFO()		(&BUFFER->in_string[BUFFER->in_pos])
-#define IN_MASK(pos)		(BUFFER->in_string[(pos)].mask)
 #define IN_CLUSTER(pos)		(BUFFER->in_string[(pos)].cluster)
 
 HB_END_DECLS
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 4e8ba56..3b77f60 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1544,7 +1544,7 @@ struct PosLookup : Lookup
     while (buffer->in_pos < buffer->in_length)
     {
       bool done;
-      if (~IN_MASK (buffer->in_pos) & mask)
+      if (~buffer->in_string[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 54c057d..e57eb97 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -836,7 +836,7 @@ struct SubstLookup : Lookup
 	buffer->in_pos = 0;
 	while (buffer->in_pos < buffer->in_length)
 	{
-	  if ((~IN_MASK (buffer->in_pos) & mask) &&
+	  if ((~buffer->in_string[buffer->in_pos].mask & mask) &&
 	      apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
 	    ret = true;
 	  else
@@ -852,7 +852,7 @@ struct SubstLookup : Lookup
 	buffer->in_pos = buffer->in_length - 1;
 	do
 	{
-	  if ((~IN_MASK (buffer->in_pos) & mask) &&
+	  if ((~buffer->in_string[buffer->in_pos].mask & mask) &&
 	      apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
 	    ret = true;
 	  else
commit 89e2834dabd2d17f2823c51fe3a7fcadeaba7a59
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 20:25:55 2010 -0400

    Remove the IN_LIGID() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 8a6da2e..008c90e 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -163,7 +163,6 @@ struct _hb_buffer_t {
 #define IN_CURINFO()		(&BUFFER->in_string[BUFFER->in_pos])
 #define IN_MASK(pos)		(BUFFER->in_string[(pos)].mask)
 #define IN_CLUSTER(pos)		(BUFFER->in_string[(pos)].cluster)
-#define IN_LIGID(pos)		(BUFFER->in_string[(pos)].lig_id)
 
 HB_END_DECLS
 
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 5fb3fd3..4e8ba56 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1203,7 +1203,7 @@ 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 (IN_LIGID (j) && IN_LIGID (j) == IN_LIGID (c->buffer->in_pos) && c->buffer->in_string[c->buffer->in_pos].component)
+    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)
     {
       comp_index = c->buffer->in_string[c->buffer->in_pos].component - 1;
       if (comp_index >= comp_count)
@@ -1309,7 +1309,7 @@ struct MarkMarkPosFormat1
      * 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 && IN_LIGID (j) != IN_LIGID (c->buffer->in_pos)))
+	(c->buffer->in_string[j].component && c->buffer->in_string[j].lig_id != c->buffer->in_string[c->buffer->in_pos].lig_id))
       return false;
 
     unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j));
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 2c86ecd..54c057d 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -403,7 +403,7 @@ struct Ligature
       c->buffer->add_output_glyphs_be16 (i,
 					       1, (const uint16_t *) &ligGlyph,
 					       0,
-					       IN_LIGID (c->buffer->in_pos) && !c->buffer->in_string[c->buffer->in_pos].component ?
+					       c->buffer->in_string[c->buffer->in_pos].lig_id && !c->buffer->in_string[c->buffer->in_pos].component ?
 					       0xFFFF : c->buffer->allocate_lig_id ());
     else
     {
commit 4a871041f4718834afa312ed17cdd157603468b7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 20:25:04 2010 -0400

    Remove IN_COMPONENT() macro

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 42d2476..8a6da2e 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -164,7 +164,6 @@ struct _hb_buffer_t {
 #define IN_MASK(pos)		(BUFFER->in_string[(pos)].mask)
 #define IN_CLUSTER(pos)		(BUFFER->in_string[(pos)].cluster)
 #define IN_LIGID(pos)		(BUFFER->in_string[(pos)].lig_id)
-#define IN_COMPONENT(pos)	(BUFFER->in_string[(pos)].component)
 
 HB_END_DECLS
 
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index d7f8427..5fb3fd3 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1203,9 +1203,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 (IN_LIGID (j) && IN_LIGID (j) == IN_LIGID (c->buffer->in_pos) && IN_COMPONENT (c->buffer->in_pos))
+    if (IN_LIGID (j) && IN_LIGID (j) == IN_LIGID (c->buffer->in_pos) && c->buffer->in_string[c->buffer->in_pos].component)
     {
-      comp_index = IN_COMPONENT (c->buffer->in_pos) - 1;
+      comp_index = c->buffer->in_string[c->buffer->in_pos].component - 1;
       if (comp_index >= comp_count)
 	comp_index = comp_count - 1;
     }
@@ -1308,8 +1308,8 @@ 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 ((IN_COMPONENT (j) != IN_COMPONENT (c->buffer->in_pos)) ||
-	(IN_COMPONENT (j) && IN_LIGID (j) != IN_LIGID (c->buffer->in_pos)))
+    if ((c->buffer->in_string[j].component != c->buffer->in_string[c->buffer->in_pos].component) ||
+	(c->buffer->in_string[j].component && IN_LIGID (j) != IN_LIGID (c->buffer->in_pos)))
       return false;
 
     unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j));
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 766bae9..2c86ecd 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -403,7 +403,7 @@ struct Ligature
       c->buffer->add_output_glyphs_be16 (i,
 					       1, (const uint16_t *) &ligGlyph,
 					       0,
-					       IN_LIGID (c->buffer->in_pos) && !IN_COMPONENT (c->buffer->in_pos) ?
+					       IN_LIGID (c->buffer->in_pos) && !c->buffer->in_string[c->buffer->in_pos].component ?
 					       0xFFFF : c->buffer->allocate_lig_id ());
     else
     {
commit 27da6dd89a359f7ef340c646c4cb79373782261d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 20:17:50 2010 -0400

    Remove OUT_GLYPH() and OUT_INFO() macros

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 6d2eec0..42d2476 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -165,8 +165,6 @@ struct _hb_buffer_t {
 #define IN_CLUSTER(pos)		(BUFFER->in_string[(pos)].cluster)
 #define IN_LIGID(pos)		(BUFFER->in_string[(pos)].lig_id)
 #define IN_COMPONENT(pos)	(BUFFER->in_string[(pos)].component)
-#define OUT_GLYPH(pos)		(BUFFER->out_string[(pos)].codepoint)
-#define OUT_INFO(pos)		(&BUFFER->out_string[(pos)])
 
 HB_END_DECLS
 
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 8f33988..d8aa252 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -126,14 +126,14 @@ static inline bool match_backtrack (hb_apply_context_t *c,
 
   for (unsigned int i = 0, j = c->buffer->out_pos - 1; i < count; i++, j--)
   {
-    while (_hb_ot_layout_skip_mark (c->layout->face, OUT_INFO (j), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_string[j], c->lookup_flag, NULL))
     {
       if (unlikely (j + 1 == count - i))
 	return false;
       j--;
     }
 
-    if (likely (!match_func (OUT_GLYPH (j), backtrack[i], match_data)))
+    if (likely (!match_func (c->buffer->out_string[j].codepoint, backtrack[i], match_data)))
       return false;
   }
 
commit cc6ae7ff91eeb93bef153f331ed02b500062f90e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 20:09:48 2010 -0400

    Fix lookahead matching.  Oops!

diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 71c2975..8f33988 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -154,7 +154,7 @@ 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, OUT_INFO (j), c->lookup_flag, NULL))
+    while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), c->lookup_flag, NULL))
     {
       if (unlikely (j + count - i == end))
 	return false;
commit 3109375b849f340b4807724218010c53dea58082
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 14 19:55:27 2010 -0400

    Remove POSITION() and CURPOSITION() macros

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index db67f81..6d2eec0 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -165,8 +165,6 @@ struct _hb_buffer_t {
 #define IN_CLUSTER(pos)		(BUFFER->in_string[(pos)].cluster)
 #define IN_LIGID(pos)		(BUFFER->in_string[(pos)].lig_id)
 #define IN_COMPONENT(pos)	(BUFFER->in_string[(pos)].component)
-#define POSITION(pos)		(&BUFFER->positions[(pos)])
-#define CURPOSITION()		(&BUFFER->positions[BUFFER->in_pos])
 #define OUT_GLYPH(pos)		(BUFFER->out_string[(pos)].codepoint)
 #define OUT_INFO(pos)		(&BUFFER->out_string[(pos)])
 
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index b072ca9..d7f8427 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -94,7 +94,7 @@ struct ValueFormat : USHORT
   void apply_value (hb_ot_layout_context_t       *layout,
 		    const void                   *base,
 		    const Value                  *values,
-		    hb_internal_glyph_position_t *glyph_pos) const
+		    hb_internal_glyph_position_t &glyph_pos) const
   {
     unsigned int x_ppem, y_ppem;
     hb_16dot16_t x_scale, y_scale;
@@ -105,10 +105,10 @@ struct ValueFormat : USHORT
     x_scale = layout->font->x_scale;
     y_scale = layout->font->y_scale;
     /* design units -> fractional pixel */
-    if (format & xPlacement) glyph_pos->x_offset  += _hb_16dot16_mul_round (x_scale, get_short (values++));
-    if (format & yPlacement) glyph_pos->y_offset  += _hb_16dot16_mul_round (y_scale, get_short (values++));
-    if (format & xAdvance)   glyph_pos->x_advance += _hb_16dot16_mul_round (x_scale, get_short (values++));
-    if (format & yAdvance)   glyph_pos->y_advance += _hb_16dot16_mul_round (y_scale, get_short (values++));
+    if (format & xPlacement) glyph_pos.x_offset  += _hb_16dot16_mul_round (x_scale, get_short (values++));
+    if (format & yPlacement) glyph_pos.y_offset  += _hb_16dot16_mul_round (y_scale, get_short (values++));
+    if (format & xAdvance)   glyph_pos.x_advance += _hb_16dot16_mul_round (x_scale, get_short (values++));
+    if (format & yAdvance)   glyph_pos.y_advance += _hb_16dot16_mul_round (y_scale, get_short (values++));
 
     if (!has_device ()) return;
 
@@ -119,16 +119,16 @@ struct ValueFormat : USHORT
 
     /* pixel -> fractional pixel */
     if (format & xPlaDevice) {
-      if (x_ppem) glyph_pos->x_offset  += (base + get_device (values++)).get_delta (x_ppem) << 16; else values++;
+      if (x_ppem) glyph_pos.x_offset  += (base + get_device (values++)).get_delta (x_ppem) << 16; else values++;
     }
     if (format & yPlaDevice) {
-      if (y_ppem) glyph_pos->y_offset  += (base + get_device (values++)).get_delta (y_ppem) << 16; else values++;
+      if (y_ppem) glyph_pos.y_offset  += (base + get_device (values++)).get_delta (y_ppem) << 16; else values++;
     }
     if (format & xAdvDevice) {
-      if (x_ppem) glyph_pos->x_advance += (base + get_device (values++)).get_delta (x_ppem) << 16; else values++;
+      if (x_ppem) glyph_pos.x_advance += (base + get_device (values++)).get_delta (x_ppem) << 16; else values++;
     }
     if (format & yAdvDevice) {
-      if (y_ppem) glyph_pos->y_advance += (base + get_device (values++)).get_delta (y_ppem) << 16; else values++;
+      if (y_ppem) glyph_pos.y_advance += (base + get_device (values++)).get_delta (y_ppem) << 16; else values++;
     }
   }
 
@@ -406,12 +406,12 @@ struct MarkArray : ArrayOf<MarkRecord>	/* Array of MarkRecords--in Coverage orde
     mark_anchor.get_anchor (c->layout, IN_CURGLYPH (), &mark_x, &mark_y);
     glyph_anchor.get_anchor (c->layout, IN_GLYPH (glyph_pos), &base_x, &base_y);
 
-    hb_internal_glyph_position_t *o = POSITION (c->buffer->in_pos);
-    o->x_advance = 0;
-    o->y_advance = 0;
-    o->x_offset  = base_x - mark_x;
-    o->y_offset  = base_y - mark_y;
-    o->back      = c->buffer->in_pos - glyph_pos;
+    hb_internal_glyph_position_t &o = c->buffer->positions[c->buffer->in_pos];
+    o.x_advance = 0;
+    o.y_advance = 0;
+    o.x_offset  = base_x - mark_x;
+    o.y_offset  = base_y - mark_y;
+    o.back      = c->buffer->in_pos - glyph_pos;
 
     c->buffer->in_pos++;
     return true;
@@ -438,7 +438,7 @@ struct SinglePosFormat1
     if (likely (index == NOT_COVERED))
       return false;
 
-    valueFormat.apply_value (c->layout, this, values, CURPOSITION ());
+    valueFormat.apply_value (c->layout, this, values, c->buffer->positions[c->buffer->in_pos]);
 
     c->buffer->in_pos++;
     return true;
@@ -482,7 +482,7 @@ struct SinglePosFormat2
 
     valueFormat.apply_value (c->layout, this,
 			     &values[index * valueFormat.get_len ()],
-			     CURPOSITION ());
+			     c->buffer->positions[c->buffer->in_pos]);
 
     c->buffer->in_pos++;
     return true;
@@ -576,8 +576,8 @@ struct PairSet
     {
       if (IN_GLYPH (pos) == record->secondGlyph)
       {
-	valueFormats[0].apply_value (c->layout, this, &record->values[0], CURPOSITION ());
-	valueFormats[1].apply_value (c->layout, this, &record->values[len1], POSITION (pos));
+	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]);
 	if (len2)
 	  pos++;
 	c->buffer->in_pos = pos;
@@ -711,8 +711,8 @@ struct PairPosFormat2
       return false;
 
     const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
-    valueFormat1.apply_value (c->layout, this, v, CURPOSITION ());
-    valueFormat2.apply_value (c->layout, this, v + len1, POSITION (j));
+    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]);
 
     if (len2)
       j++;
@@ -975,23 +975,23 @@ struct CursivePosFormat1
     if (c->buffer->direction == HB_DIRECTION_RTL)
     {
       /* advance is absolute, not relative */
-      POSITION (c->buffer->in_pos)->x_advance = entry_x - gpi->anchor_x;
+      c->buffer->positions[c->buffer->in_pos].x_advance = entry_x - gpi->anchor_x;
     }
     else
     {
       /* advance is absolute, not relative */
-      POSITION (last_pos)->x_advance = gpi->anchor_x - entry_x;
+      c->buffer->positions[last_pos].x_advance = gpi->anchor_x - entry_x;
     }
 
     if  (c->lookup_flag & LookupFlag::RightToLeft)
     {
-      POSITION (last_pos)->cursive_chain = last_pos - c->buffer->in_pos;
-      POSITION (last_pos)->y_offset = entry_y - gpi->anchor_y;
+      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;
     }
     else
     {
-      POSITION (c->buffer->in_pos)->cursive_chain = c->buffer->in_pos - last_pos;
-      POSITION (c->buffer->in_pos)->y_offset = gpi->anchor_y - entry_y;
+      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;
     }
 
   end:
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index ef10375..f458db2 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -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, IN_CURGLYPH(), &metrics);
-    CURPOSITION()->x_advance = metrics.x_advance;
-    CURPOSITION()->y_advance = metrics.y_advance;
+    buffer->positions[buffer->in_pos].x_advance = metrics.x_advance;
+    buffer->positions[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, IN_GLYPH(buffer->in_pos - 1), IN_CURGLYPH());
     kern1 = kern >> 1;
     kern2 = kern - kern1;
-    POSITION(buffer->in_pos - 1)->x_advance += kern1;
-    CURPOSITION()->x_advance += kern2;
-    CURPOSITION()->x_offset += kern2;
+    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;
   }
 }
 



More information about the HarfBuzz mailing list