diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2011-08-19 20:14:33 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2011-08-19 20:14:33 +0200 |
commit | c37ae57816ac22543fd9fbcf880518406cd1457d (patch) | |
tree | 0790598567b1b627c65988ccac874332153ed770 | |
parent | b74e01cccdbc1bd89b3d5b9551110bf8b1938413 (diff) | |
download | pango-c37ae57816ac22543fd9fbcf880518406cd1457d.tar.gz |
Fix ChanContext backtrack matching with GPOS
Backported from HarfBuzz-ng:
http://cgit.freedesktop.org/harfbuzz/commit/?id=cc1a8a938b4c13e76b58825a9e1951c4134e634a
-rw-r--r-- | pango/opentype/hb-buffer-private.h | 1 | ||||
-rw-r--r-- | pango/opentype/hb-ot-layout-gsubgpos-private.hh | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/pango/opentype/hb-buffer-private.h b/pango/opentype/hb-buffer-private.h index f1947860..58185e7e 100644 --- a/pango/opentype/hb-buffer-private.h +++ b/pango/opentype/hb-buffer-private.h @@ -130,6 +130,7 @@ _hb_buffer_allocate_lig_id (hb_buffer_t *buffer); #define CURPOSITION() (&buffer->positions[buffer->in_pos]) #define OUT_GLYPH(pos) (buffer->out_string[(pos)].codepoint) #define OUT_INFO(pos) (&buffer->out_string[(pos)]) +#define BACKTRACK_LEN() ((buffer->have_output? buffer->out_length : buffer->in_pos)) HB_END_DECLS diff --git a/pango/opentype/hb-ot-layout-gsubgpos-private.hh b/pango/opentype/hb-ot-layout-gsubgpos-private.hh index 0bb96a41..f681f510 100644 --- a/pango/opentype/hb-ot-layout-gsubgpos-private.hh +++ b/pango/opentype/hb-ot-layout-gsubgpos-private.hh @@ -144,10 +144,10 @@ static inline bool match_backtrack (APPLY_ARG_DEF, match_func_t match_func, char *match_data) { - if (HB_UNLIKELY (buffer->out_pos < count)) + if (HB_UNLIKELY (BACKTRACK_LEN () < count)) return false; - for (unsigned int i = 0, j = buffer->out_pos - 1; i < count; i++, j--) + for (unsigned int i = 0, j = BACKTRACK_LEN () - 1; i < count; i++, j--) { while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), lookup_flag, NULL)) { @@ -536,7 +536,7 @@ static inline bool chain_context_lookup (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) { /* First guess */ - if (HB_UNLIKELY (buffer->out_pos < backtrackCount || + if (HB_UNLIKELY (BACKTRACK_LEN () < backtrackCount || buffer->in_pos + inputCount + lookaheadCount > buffer->in_length || inputCount + lookaheadCount > context_length)) return false; |