summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-08-12 16:47:27 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-08-12 16:47:27 -0400
commit141dfa186403bb22e1e3875fdc263d402b2abb1d (patch)
tree982a950b23d40201d191780db682557d7f98369f
parent996eab4e5f35432692fc76939a2f586a1298c1da (diff)
downloadpango-141dfa186403bb22e1e3875fdc263d402b2abb1d.tar.gz
[HB] Fix _hb_buffer_next() when positioning
We were copying glyphs to output. This should not happen when in GPOS. Back then it was fine, then some optimizations broke then assumption.
-rw-r--r--pango/opentype/hb-buffer-private.h1
-rw-r--r--pango/opentype/hb-buffer.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/pango/opentype/hb-buffer-private.h b/pango/opentype/hb-buffer-private.h
index f33f35f7..7ed68062 100644
--- a/pango/opentype/hb-buffer-private.h
+++ b/pango/opentype/hb-buffer-private.h
@@ -71,6 +71,7 @@ struct _hb_buffer_t {
unsigned int allocated;
+ hb_bool_t have_output; /* weather we have an output buffer going on */
unsigned int in_length;
unsigned int out_length;
unsigned int in_pos;
diff --git a/pango/opentype/hb-buffer.c b/pango/opentype/hb-buffer.c
index 2a566b1c..94b8a5b7 100644
--- a/pango/opentype/hb-buffer.c
+++ b/pango/opentype/hb-buffer.c
@@ -62,6 +62,7 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
hb_buffer_ensure (buffer, size);
if (buffer->out_string == buffer->in_string)
{
+ assert (buffer->have_output);
if (!buffer->positions)
buffer->positions = calloc (buffer->allocated, sizeof (buffer->positions[0]));
@@ -112,6 +113,7 @@ hb_buffer_destroy (hb_buffer_t *buffer)
void
hb_buffer_clear (hb_buffer_t *buffer)
{
+ buffer->have_output = FALSE;
buffer->in_length = 0;
buffer->out_length = 0;
buffer->in_pos = 0;
@@ -183,6 +185,7 @@ hb_buffer_set_direction (hb_buffer_t *buffer,
void
_hb_buffer_clear_output (hb_buffer_t *buffer)
{
+ buffer->have_output = TRUE;
buffer->out_length = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
@@ -192,6 +195,7 @@ void
hb_buffer_clear_positions (hb_buffer_t *buffer)
{
_hb_buffer_clear_output (buffer);
+ buffer->have_output = FALSE;
if (HB_UNLIKELY (!buffer->positions))
{
@@ -207,6 +211,8 @@ _hb_buffer_swap (hb_buffer_t *buffer)
{
unsigned int tmp;
+ assert (buffer->have_output);
+
if (buffer->out_string != buffer->in_string)
{
hb_internal_glyph_info_t *tmp_string;
@@ -318,6 +324,12 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
void
_hb_buffer_next_glyph (hb_buffer_t *buffer)
{
+ if (!buffer->have_output)
+ {
+ buffer->in_pos++;
+ return;
+ }
+
if (buffer->out_string != buffer->in_string)
{
hb_buffer_ensure (buffer, buffer->out_pos + 1);