summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-05-25 04:04:24 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-05-25 04:25:15 -0400
commit7b3f038ada310ac1f113d898a637df188177f8bb (patch)
tree75bbbf4fcdcc4a442babd5411679ca7997ed8566 /pango
parent76d05e87fb34a3f6cc5d914e91f755e964c690dc (diff)
downloadpango-7b3f038ada310ac1f113d898a637df188177f8bb.tar.gz
[HB] More buffer cleanup
Diffstat (limited to 'pango')
-rw-r--r--pango/opentype/hb-buffer-private.h39
-rw-r--r--pango/opentype/hb-buffer.c138
-rw-r--r--pango/opentype/hb-buffer.h22
-rw-r--r--pango/opentype/hb-ot-layout-gpos-private.h29
-rw-r--r--pango/opentype/hb-ot-layout-gsub-private.h10
-rw-r--r--pango/opentype/hb-ot-layout-gsubgpos-private.h8
-rw-r--r--pango/opentype/hb-ot-layout-private.h13
-rw-r--r--pango/opentype/hb-ot-layout.cc16
-rw-r--r--pango/opentype/hb-private.h29
-rw-r--r--pango/pango-ot-buffer.c18
-rw-r--r--pango/pango-ot-info.c3
-rw-r--r--pango/pango-ot.h2
12 files changed, 138 insertions, 189 deletions
diff --git a/pango/opentype/hb-buffer-private.h b/pango/opentype/hb-buffer-private.h
index 13bbe129..5f64bc1e 100644
--- a/pango/opentype/hb-buffer-private.h
+++ b/pango/opentype/hb-buffer-private.h
@@ -33,7 +33,7 @@
HB_BEGIN_DECLS
-#define HB_GLYPH_PROPERTY_UNKNOWN 0xFFFF
+#define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
HB_INTERNAL void
_hb_buffer_swap (hb_buffer_t *buffer);
@@ -41,10 +41,10 @@ _hb_buffer_swap (hb_buffer_t *buffer);
HB_INTERNAL void
_hb_buffer_clear_output (hb_buffer_t *buffer);
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_clear_positions (hb_buffer_t *buffer);
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
unsigned int num_in,
unsigned int num_out,
@@ -52,54 +52,35 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
unsigned short component,
unsigned short ligID);
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_add_output_glyph (hb_buffer_t *buffer,
hb_codepoint_t glyph_index,
unsigned short component,
unsigned short ligID);
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_next_glyph (hb_buffer_t *buffer);
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_replace_glyph (hb_buffer_t *buffer,
hb_codepoint_t glyph_index);
HB_INTERNAL unsigned short
-_hb_buffer_allocate_ligid (hb_buffer_t *buffer);
+_hb_buffer_allocate_lig_id (hb_buffer_t *buffer);
/* convenience macros */
-
#define IN_GLYPH(pos) (buffer->in_string[(pos)].gindex)
-#define IN_ITEM(pos) (&buffer->in_string[(pos)])
+#define IN_INFO(pos) (&buffer->in_string[(pos)])
#define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].gindex)
-#define IN_CURITEM() (&buffer->in_string[buffer->in_pos])
+#define IN_CURINFO() (&buffer->in_string[buffer->in_pos])
#define IN_PROPERTIES(pos) (buffer->in_string[(pos)].properties)
#define IN_LIGID(pos) (buffer->in_string[(pos)].ligID)
#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)].gindex)
-#define OUT_ITEM(pos) (&buffer->out_string[(pos)])
-
-#define CHECK_Property (layout, index, flags, properties) \
- ({unsigned int _p; error = _hb_ot_layout_check_glyph_property((layout), (index), (flags), (&_p)) \
- ? HB_Err_Ok : HB_Err_Not_Covered, *(properties) = _p; error;})
-
-#define ADD_String (buffer, num_in, num_out, glyph_data, component, ligID) \
- ((error = _hb_buffer_add_output_glyphs ((buffer), \
- (num_in), (num_out), \
- (glyph_data), (component), (ligID) \
- )) != HB_Err_Ok)
-#define ADD_Glyph (buffer, glyph_index, component, ligID) \
- ((error = _hb_buffer_add_output_glyph ((buffer), \
- (glyph_index), (component), (ligID) \
- )) != HB_Err_Ok)
-#define REPLACE_Glyph (buffer, glyph_index) \
- ((error = _hb_buffer_replace_glyph ((buffer), (glyph_index))) != HB_Err_Ok)
-#define COPY_Glyph (buffer) \
- ((error = _hb_buffer_next_glyph (buffer)) != HB_Err_Ok)
+#define OUT_INFO(pos) (&buffer->out_string[(pos)])
HB_END_DECLS
diff --git a/pango/opentype/hb-buffer.c b/pango/opentype/hb-buffer.c
index f8bc8882..0fec18c7 100644
--- a/pango/opentype/hb-buffer.c
+++ b/pango/opentype/hb-buffer.c
@@ -56,19 +56,17 @@
* to in_string (FALSE) or alt_string (TRUE).
*/
+/* XXX err handling */
+
/* Internal API */
static void
-hb_buffer_ensure (hb_buffer_t *buffer,
- unsigned int size)
+hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
{
unsigned int new_allocated = buffer->allocated;
- /* XXX err handling */
if (size > new_allocated)
{
- HB_Error error;
-
while (size > new_allocated)
new_allocated += (new_allocated >> 1) + 8;
@@ -97,8 +95,8 @@ hb_buffer_ensure (hb_buffer_t *buffer,
}
}
-static HB_Error
-hb_buffer_duplicate_out_buffer (HB_Buffer buffer)
+static void
+hb_buffer_duplicate_out_buffer (hb_buffer_t *buffer)
{
if (!buffer->alt_string)
buffer->alt_string = malloc (buffer->allocated * sizeof (buffer->alt_string[0]));
@@ -106,8 +104,14 @@ hb_buffer_duplicate_out_buffer (HB_Buffer buffer)
buffer->out_string = buffer->alt_string;
memcpy (buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]));
buffer->separate_out = TRUE;
+}
- return HB_Err_Ok;
+static void
+hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
+{
+ hb_buffer_ensure (buffer, size);
+ if ( !buffer->separate_out )
+ hb_buffer_duplicate_out_buffer (buffer);
}
/* Public API */
@@ -132,7 +136,7 @@ hb_buffer_new (void)
}
void
-hb_buffer_free (HB_Buffer buffer)
+hb_buffer_free (hb_buffer_t *buffer)
{
free (buffer->in_string);
free (buffer->alt_string);
@@ -141,7 +145,7 @@ hb_buffer_free (HB_Buffer buffer)
}
void
-hb_buffer_clear (HB_Buffer buffer)
+hb_buffer_clear (hb_buffer_t *buffer)
{
buffer->in_length = 0;
buffer->out_length = 0;
@@ -149,7 +153,7 @@ hb_buffer_clear (HB_Buffer buffer)
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
buffer->separate_out = FALSE;
- buffer->max_ligID = 0;
+ buffer->max_lig_id = 0;
}
void
@@ -158,9 +162,8 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
unsigned int properties,
unsigned int cluster)
{
- HB_Error error;
- HB_GlyphItem glyph;
-
+ hb_glyph_info_t *glyph;
+
hb_buffer_ensure (buffer, buffer->in_length + 1);
glyph = &buffer->in_string[buffer->in_length];
@@ -169,7 +172,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
glyph->cluster = cluster;
glyph->component = 0;
glyph->ligID = 0;
- glyph->gproperty = HB_GLYPH_PROPERTY_UNKNOWN;
+ glyph->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
buffer->in_length++;
}
@@ -177,7 +180,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
/* HarfBuzz-Internal API */
HB_INTERNAL void
-_hb_buffer_clear_output (HB_Buffer buffer)
+_hb_buffer_clear_output (hb_buffer_t *buffer)
{
buffer->out_length = 0;
buffer->out_pos = 0;
@@ -185,41 +188,41 @@ _hb_buffer_clear_output (HB_Buffer buffer)
buffer->separate_out = FALSE;
}
-HB_INTERNAL HB_Error
-_hb_buffer_clear_positions (HB_Buffer buffer)
+HB_INTERNAL void
+_hb_buffer_clear_positions (hb_buffer_t *buffer)
{
_hb_buffer_clear_output (buffer);
- if (!buffer->positions)
- buffer->positions = malloc (buffer->allocated * sizeof (buffer->positions[0]));
+ if (HB_UNLIKELY (!buffer->positions))
+ {
+ buffer->positions = calloc (buffer->allocated, sizeof (buffer->positions[0]));
+ return;
+ }
memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length);
-
- return HB_Err_Ok;
}
HB_INTERNAL void
-_hb_buffer_swap (HB_Buffer buffer)
+_hb_buffer_swap (hb_buffer_t *buffer)
{
- HB_GlyphItem tmp_string;
- int tmp_length;
- int tmp_pos;
+ unsigned int tmp;
if (buffer->separate_out)
{
+ hb_glyph_info_t *tmp_string;
tmp_string = buffer->in_string;
buffer->in_string = buffer->out_string;
buffer->out_string = tmp_string;
buffer->alt_string = buffer->out_string;
}
- tmp_length = buffer->in_length;
+ tmp = buffer->in_length;
buffer->in_length = buffer->out_length;
- buffer->out_length = tmp_length;
+ buffer->out_length = tmp;
- tmp_pos = buffer->in_pos;
+ tmp = buffer->in_pos;
buffer->in_pos = buffer->out_pos;
- buffer->out_pos = tmp_pos;
+ buffer->out_pos = tmp;
}
/* The following function copies `num_out' elements from `glyph_data'
@@ -241,7 +244,7 @@ _hb_buffer_swap (HB_Buffer buffer)
The cluster value for the glyph at position buffer->in_pos is used
for all replacement glyphs */
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
unsigned int num_in,
unsigned int num_out,
@@ -249,66 +252,67 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
unsigned short component,
unsigned short ligID)
{
- HB_Error error;
unsigned int i;
unsigned int properties;
unsigned int cluster;
- hb_buffer_ensure( buffer, buffer->out_pos + num_out );
- /* XXX */
-
- if ( !buffer->separate_out )
- {
- error = hb_buffer_duplicate_out_buffer( buffer );
- if ( error )
- return error;
- }
+ hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out);
properties = buffer->in_string[buffer->in_pos].properties;
cluster = buffer->in_string[buffer->in_pos].cluster;
- if ( component == 0xFFFF )
+ if (component == 0xFFFF)
component = buffer->in_string[buffer->in_pos].component;
- if ( ligID == 0xFFFF )
+ if (ligID == 0xFFFF)
ligID = buffer->in_string[buffer->in_pos].ligID;
- for ( i = 0; i < num_out; i++ )
+ for (i = 0; i < num_out; i++)
{
- HB_GlyphItem item = &buffer->out_string[buffer->out_pos + i];
-
- item->gindex = hb_be_uint16_t (glyph_data_be[i]);
- item->properties = properties;
- item->cluster = cluster;
- item->component = component;
- item->ligID = ligID;
- item->gproperty = HB_GLYPH_PROPERTY_UNKNOWN;
+ hb_glyph_info_t *info = &buffer->out_string[buffer->out_pos + i];
+
+ info->gindex = hb_be_uint16_t (glyph_data_be[i]);
+ info->properties = properties;
+ info->cluster = cluster;
+ info->component = component;
+ info->ligID = ligID;
+ info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
}
buffer->in_pos += num_in;
buffer->out_pos += num_out;
buffer->out_length = buffer->out_pos;
-
- return HB_Err_Ok;
}
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_add_output_glyph (hb_buffer_t *buffer,
hb_codepoint_t glyph_index,
unsigned short component,
unsigned short ligID)
{
- uint16_t glyph_data = hb_be_uint16_t (glyph_index);
+ hb_glyph_info_t *info;
+
+ hb_buffer_ensure_separate (buffer, buffer->out_pos + 1);
- return _hb_buffer_add_output_glyphs (buffer, 1, 1,
- &glyph_data, component, ligID);
+ info = &buffer->out_string[buffer->out_pos];
+ *info = buffer->in_string[buffer->in_pos];
+
+ info->gindex = glyph_index;
+ if (component != 0xFFFF)
+ info->component = component;
+ if (ligID != 0xFFFF)
+ info->ligID = ligID;
+ info->gproperty = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
+
+ buffer->in_pos++;
+ buffer->out_pos++;
+
+ buffer->out_length = buffer->out_pos;
}
-HB_INTERNAL HB_Error
-_hb_buffer_next_glyph (HB_Buffer buffer)
+HB_INTERNAL void
+_hb_buffer_next_glyph (hb_buffer_t *buffer)
{
- HB_Error error;
-
if (buffer->separate_out)
{
hb_buffer_ensure (buffer, buffer->out_pos + 1);
@@ -319,11 +323,9 @@ _hb_buffer_next_glyph (HB_Buffer buffer)
buffer->in_pos++;
buffer->out_pos++;
buffer->out_length = buffer->out_pos;
-
- return HB_Err_Ok;
}
-HB_INTERNAL HB_Error
+HB_INTERNAL void
_hb_buffer_replace_glyph (hb_buffer_t *buffer,
hb_codepoint_t glyph_index)
{
@@ -339,12 +341,10 @@ _hb_buffer_replace_glyph (hb_buffer_t *buffer,
{
return _hb_buffer_add_output_glyph (buffer, glyph_index, 0xFFFF, 0xFFFF);
}
-
- return HB_Err_Ok;
}
HB_INTERNAL unsigned short
-_hb_buffer_allocate_ligid (hb_buffer_t *buffer)
+_hb_buffer_allocate_lig_id (hb_buffer_t *buffer)
{
- return ++buffer->max_ligID;
+ return ++buffer->max_lig_id;
}
diff --git a/pango/opentype/hb-buffer.h b/pango/opentype/hb-buffer.h
index ca45ba5d..ff3666fa 100644
--- a/pango/opentype/hb-buffer.h
+++ b/pango/opentype/hb-buffer.h
@@ -34,16 +34,16 @@ HB_BEGIN_DECLS
/* XXX Hide structs? */
-typedef struct HB_GlyphItemRec_ {
+typedef struct _hb_glyph_info_t {
hb_codepoint_t gindex;
unsigned int properties;
unsigned int cluster;
unsigned short component;
unsigned short ligID;
unsigned short gproperty;
-} HB_GlyphItemRec, *HB_GlyphItem;
+} hb_glyph_info_t;
-typedef struct HB_PositionRec_ {
+typedef struct _hb_glyph_position_t {
hb_position_t x_pos;
hb_position_t y_pos;
hb_position_t x_advance;
@@ -57,7 +57,7 @@ typedef struct HB_PositionRec_ {
short cursive_chain; /* character to which this connects,
may be positive or negative; used
only internally */
-} HB_PositionRec, *HB_Position;
+} hb_glyph_position_t;
typedef struct _hb_buffer_t {
@@ -68,13 +68,13 @@ typedef struct _hb_buffer_t {
unsigned int in_pos;
unsigned int out_pos;
- hb_bool_t separate_out;
- HB_GlyphItem in_string;
- HB_GlyphItem out_string;
- HB_GlyphItem alt_string;
- HB_Position positions;
- unsigned int max_ligID;
-} HB_BufferRec, *HB_Buffer, hb_buffer_t;
+ hb_bool_t separate_out;
+ hb_glyph_info_t *in_string;
+ hb_glyph_info_t *out_string;
+ hb_glyph_info_t *alt_string;
+ hb_glyph_position_t *positions;
+ unsigned int max_lig_id;
+} hb_buffer_t;
hb_buffer_t *
hb_buffer_new (void);
diff --git a/pango/opentype/hb-ot-layout-gpos-private.h b/pango/opentype/hb-ot-layout-gpos-private.h
index 3854aeb9..be192b5c 100644
--- a/pango/opentype/hb-ot-layout-gpos-private.h
+++ b/pango/opentype/hb-ot-layout-gpos-private.h
@@ -29,6 +29,7 @@
#include "hb-ot-layout-gsubgpos-private.h"
+#define HB_OT_LAYOUT_GPOS_NO_LAST ((unsigned int) -1)
/* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
@@ -55,10 +56,10 @@ struct ValueFormat : USHORT
return _hb_popcount32 ((unsigned int) *this);
}
- const void apply_value (hb_ot_layout_t *layout,
- const char *base,
- const Value *values,
- HB_Position glyph_pos) const
+ const void apply_value (hb_ot_layout_t *layout,
+ const char *base,
+ const Value *values,
+ hb_glyph_position_t *glyph_pos) const
{
unsigned int x_ppem, y_ppem;
hb_16dot16_t x_scale, y_scale;
@@ -379,7 +380,7 @@ struct PairPosFormat1
return false;
unsigned int j = buffer->in_pos + 1;
- while (!_hb_ot_layout_check_glyph_property (layout, IN_ITEM (j), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j == end))
return false;
@@ -444,7 +445,7 @@ struct PairPosFormat2
return false;
unsigned int j = buffer->in_pos + 1;
- while (!_hb_ot_layout_check_glyph_property (layout, IN_ITEM (j), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j == end))
return false;
@@ -664,7 +665,7 @@ struct CursivePosFormat1
struct hb_ot_layout_t::gpos_info_t *gpi = &layout->gpos_info;
hb_codepoint_t last_pos = gpi->last;
- gpi->last = HB_OT_GPOS_NO_LAST;
+ gpi->last = HB_OT_LAYOUT_GPOS_NO_LAST;
/* We don't handle mark glyphs here. */
if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
@@ -678,7 +679,7 @@ struct CursivePosFormat1
hb_position_t entry_x, entry_y, exit_x, exit_y;
- if (last_pos == HB_OT_GPOS_NO_LAST || !record.entryAnchor)
+ if (last_pos == HB_OT_LAYOUT_GPOS_NO_LAST || !record.entryAnchor)
goto end;
(this+record.entryAnchor).get_anchor (layout, IN_CURGLYPH (), &entry_x, &entry_y);
@@ -816,7 +817,7 @@ struct MarkBasePosFormat1
unsigned int index = base_index * classCount + mark_class;
(&base_array+base_array.matrix[index]).get_anchor (layout, IN_GLYPH (j), &base_x, &base_y);
- HB_Position o = POSITION (buffer->in_pos);
+ hb_glyph_position_t *o = POSITION (buffer->in_pos);
o->x_pos = base_x - mark_x;
o->y_pos = base_y - mark_y;
o->x_advance = 0;
@@ -960,7 +961,7 @@ struct MarkLigPosFormat1
unsigned int index = comp_index * classCount + mark_class;
(&lig_attach+lig_attach.matrix[index]).get_anchor (layout, IN_GLYPH (j), &lig_x, &lig_y);
- HB_Position o = POSITION (buffer->in_pos);
+ hb_glyph_position_t *o = POSITION (buffer->in_pos);
o->x_pos = lig_x - mark_x;
o->y_pos = lig_y - mark_y;
o->x_advance = 0;
@@ -1076,7 +1077,7 @@ struct MarkMarkPosFormat1
unsigned int index = mark2_index * classCount + mark1_class;
(&mark2_array+mark2_array.matrix[index]).get_anchor (layout, IN_GLYPH (j), &mark2_x, &mark2_y);
- HB_Position o = POSITION (buffer->in_pos);
+ hb_glyph_position_t *o = POSITION (buffer->in_pos);
o->x_pos = mark2_x - mark1_x;
o->y_pos = mark2_y - mark1_y;
o->x_advance = 0;
@@ -1257,7 +1258,7 @@ struct PosLookup : Lookup
unsigned int lookup_flag = get_flag ();
unsigned int property;
- if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
+ if (!_hb_ot_layout_check_glyph_property (layout, IN_CURINFO (), lookup_flag, &property))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++)
@@ -1276,7 +1277,7 @@ struct PosLookup : Lookup
if (HB_UNLIKELY (!buffer->in_length))
return false;
- layout->gpos_info.last = HB_OT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */
+ layout->gpos_info.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)
@@ -1292,7 +1293,7 @@ struct PosLookup : Lookup
done = false;
/* Contrary to properties defined in GDEF, user-defined properties
will always stop a possible cursive positioning. */
- layout->gpos_info.last = HB_OT_GPOS_NO_LAST;
+ layout->gpos_info.last = HB_OT_LAYOUT_GPOS_NO_LAST;
}
if (!done)
diff --git a/pango/opentype/hb-ot-layout-gsub-private.h b/pango/opentype/hb-ot-layout-gsub-private.h
index 6a2d4335..fc69a27c 100644
--- a/pango/opentype/hb-ot-layout-gsub-private.h
+++ b/pango/opentype/hb-ot-layout-gsub-private.h
@@ -303,7 +303,7 @@ struct Ligature
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_ITEM (j), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
@@ -330,10 +330,10 @@ struct Ligature
1, (const uint16_t *) &ligGlyph,
0xFFFF,
IN_LIGID (buffer->in_pos) ?
- 0xFFFF : _hb_buffer_allocate_ligid (buffer));
+ 0xFFFF : _hb_buffer_allocate_lig_id (buffer));
else
{
- unsigned int lig_id = _hb_buffer_allocate_ligid (buffer);
+ unsigned int lig_id = _hb_buffer_allocate_lig_id (buffer);
_hb_buffer_add_output_glyph (buffer, ligGlyph, 0xFFFF, lig_id);
/* Now we must do a second loop to copy the skipped glyphs to
@@ -345,7 +345,7 @@ struct Ligature
for ( i = 1; i < count; i++ )
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM(), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, IN_CURINFO(), lookup_flag, &property))
_hb_buffer_add_output_glyph (buffer, IN_CURGLYPH(), i - 1, lig_id);
(buffer->in_pos)++;
@@ -652,7 +652,7 @@ struct SubstLookup : Lookup
unsigned int lookup_flag = get_flag ();
unsigned int property;
- if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
+ if (!_hb_ot_layout_check_glyph_property (layout, IN_CURINFO (), lookup_flag, &property))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++)
diff --git a/pango/opentype/hb-ot-layout-gsubgpos-private.h b/pango/opentype/hb-ot-layout-gsubgpos-private.h
index f1c16e7a..b205fc59 100644
--- a/pango/opentype/hb-ot-layout-gsubgpos-private.h
+++ b/pango/opentype/hb-ot-layout-gsubgpos-private.h
@@ -89,7 +89,7 @@ static inline bool match_input (APPLY_ARG_DEF,
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_ITEM (j), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
@@ -116,7 +116,7 @@ static inline bool match_backtrack (APPLY_ARG_DEF,
for (unsigned int i = 0, j = buffer->out_pos - 1; i < count; i++, j--)
{
- while (!_hb_ot_layout_check_glyph_property (layout, OUT_ITEM (j), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, OUT_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j + 1 == count - i))
return false;
@@ -144,7 +144,7 @@ static inline bool match_lookahead (APPLY_ARG_DEF,
for (i = 0, j = buffer->in_pos + offset; i < count; i++, j++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, OUT_ITEM (j), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, OUT_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
@@ -182,7 +182,7 @@ static inline bool apply_lookup (APPLY_ARG_DEF,
* Should be easy for in_place ones at least. */
for (unsigned int i = 0; i < count; i++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
+ while (!_hb_ot_layout_check_glyph_property (layout, IN_CURINFO (), lookup_flag, &property))
{
if (HB_UNLIKELY (buffer->in_pos == end))
return true;
diff --git a/pango/opentype/hb-ot-layout-private.h b/pango/opentype/hb-ot-layout-private.h
index e8ef86bb..42c26889 100644
--- a/pango/opentype/hb-ot-layout-private.h
+++ b/pango/opentype/hb-ot-layout-private.h
@@ -83,15 +83,10 @@ _hb_ot_layout_set_glyph_property (hb_ot_layout_t *layout,
unsigned int property);
HB_INTERNAL hb_bool_t
-_hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
- HB_GlyphItem gitem,
- unsigned int lookup_flags,
- unsigned int *property);
-
-/* XXX */
-void
-hb_buffer_ensure (hb_buffer_t *buffer,
- unsigned int size);
+_hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
+ hb_glyph_info_t *ginfo,
+ unsigned int lookup_flags,
+ unsigned int *property);
HB_END_DECLS
diff --git a/pango/opentype/hb-ot-layout.cc b/pango/opentype/hb-ot-layout.cc
index fbb9eba6..3cabde36 100644
--- a/pango/opentype/hb-ot-layout.cc
+++ b/pango/opentype/hb-ot-layout.cc
@@ -160,22 +160,22 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
}
HB_INTERNAL hb_bool_t
-_hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
- HB_GlyphItem gitem,
- unsigned int lookup_flags,
- unsigned int *property)
+_hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
+ hb_glyph_info_t *ginfo,
+ unsigned int lookup_flags,
+ unsigned int *property)
{
hb_ot_layout_glyph_class_t basic_glyph_class;
unsigned int desired_attachment_class;
- if (gitem->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
+ if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
{
- gitem->gproperty = *property = _hb_ot_layout_get_glyph_property (layout, gitem->gindex);
- if (gitem->gproperty == HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED)
+ ginfo->gproperty = *property = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
+ if (ginfo->gproperty == HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED)
return false;
}
- *property = gitem->gproperty;
+ *property = ginfo->gproperty;
/* If the glyph was found in the MarkAttachmentClass table,
* then that class value is the high byte of the result,
diff --git a/pango/opentype/hb-private.h b/pango/opentype/hb-private.h
index 99976ebe..0d1e1a70 100644
--- a/pango/opentype/hb-private.h
+++ b/pango/opentype/hb-private.h
@@ -100,33 +100,4 @@ _hb_popcount32 (uint32_t mask)
#endif
}
-/*
- * buffer
- */
-
-/* XXX */
-#define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
-#define HB_OT_GPOS_NO_LAST ((unsigned int) -1)
-
-/* XXX */
-typedef enum {
- /* no error */
- HB_Err_Ok = 0x0000,
- HB_Err_Not_Covered = 0xFFFF,
-
- /* _hb_err() is called whenever returning the following errors,
- * and in a couple places for HB_Err_Not_Covered too. */
-
- /* programmer error */
- HB_Err_Invalid_Argument = 0x1A66,
-
- /* font error */
- HB_Err_Invalid_SubTable_Format = 0x157F,
- HB_Err_Invalid_SubTable = 0x1570,
- HB_Err_Read_Error = 0x6EAD,
-
- /* system error */
- HB_Err_Out_Of_Memory = 0xDEAD
-} HB_Error;
-
#endif /* HB_PRIVATE_H */
diff --git a/pango/pango-ot-buffer.c b/pango/pango-ot-buffer.c
index 10c455ee..49a1e1df 100644
--- a/pango/pango-ot-buffer.c
+++ b/pango/pango-ot-buffer.c
@@ -222,9 +222,9 @@ swap_range (PangoGlyphString *glyphs, int start, int end)
}
static void
-apply_gpos_ltr (PangoGlyphString *glyphs,
- HB_Position positions,
- gboolean is_hinted)
+apply_gpos_ltr (PangoGlyphString *glyphs,
+ hb_glyph_position_t *positions,
+ gboolean is_hinted)
{
int i;
@@ -264,9 +264,9 @@ apply_gpos_ltr (PangoGlyphString *glyphs,
}
static void
-apply_gpos_rtl (PangoGlyphString *glyphs,
- HB_Position positions,
- gboolean is_hinted)
+apply_gpos_rtl (PangoGlyphString *glyphs,
+ hb_glyph_position_t *positions,
+ gboolean is_hinted)
{
int i;
@@ -338,11 +338,11 @@ pango_ot_buffer_output (const PangoOTBuffer *buffer,
last_cluster = -1;
for (i = 0; i < buffer->buffer->in_length; i++)
{
- HB_GlyphItem item = &buffer->buffer->in_string[i];
+ hb_glyph_info_t *ginfo = &buffer->buffer->in_string[i];
- glyphs->glyphs[i].glyph = item->gindex;
+ glyphs->glyphs[i].glyph = ginfo->gindex;
- glyphs->log_clusters[i] = item->cluster;
+ glyphs->log_clusters[i] = ginfo->cluster;
if (glyphs->log_clusters[i] != last_cluster)
glyphs->glyphs[i].attr.is_cluster_start = 1;
else
diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c
index ea3e6f9c..fb00bb83 100644
--- a/pango/pango-ot-info.c
+++ b/pango/pango-ot-info.c
@@ -555,6 +555,7 @@ _pango_ot_info_position (const PangoOTInfo *info,
{
unsigned int i;
+ /* XXX */
_hb_buffer_clear_positions (buffer->buffer);
hb_ot_layout_set_direction (info->layout,
@@ -600,7 +601,7 @@ _pango_ot_info_position (const PangoOTInfo *info,
{
unsigned int i, j;
- HB_Position positions = buffer->buffer->positions;
+ hb_glyph_position_t *positions = buffer->buffer->positions;
/* First handle all left-to-right connections */
for (j = 0; j < buffer->buffer->in_length; j++)
diff --git a/pango/pango-ot.h b/pango/pango-ot.h
index f9d787a8..8b9d0a24 100644
--- a/pango/pango-ot.h
+++ b/pango/pango-ot.h
@@ -61,7 +61,7 @@ typedef enum
#define PANGO_OT_TAG_DEFAULT_SCRIPT PANGO_OT_TAG_MAKE ('D', 'F', 'L', 'T')
#define PANGO_OT_TAG_DEFAULT_LANGUAGE PANGO_OT_TAG_MAKE ('d', 'f', 'l', 't')
-/* Note that this must match HB_GlyphItem */
+/* Note that this must match hb_glyph_info_t */
struct _PangoOTGlyph
{
guint glyph;