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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu May 20 09:48:09 PDT 2010


 src/hb-ot-layout-gsub-private.hh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 1cdbfd944eecb58587461f57f037e47a44f39990
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 20 17:47:28 2010 +0100

    Fix alternate, again

diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 4c1b168..d64c095 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -287,12 +287,12 @@ struct AlternateSubstFormat1
       return false;
 
     unsigned int shift = _hb_ctz (lookup_mask);
-    unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift) - 1;
+    unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift);
 
-    if (unlikely (alt_index >= alt_set.len))
+    if (unlikely (alt_index > alt_set.len || alt_index == 0))
       return false;
 
-    glyph_id = alt_set[alt_index];
+    glyph_id = alt_set[alt_index - 1];
 
     c->buffer->replace_glyph (glyph_id);
 
commit fdca3d51603bd6bef6a4b0ee4a560f7dcd2f1d37
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 20 17:46:20 2010 +0100

    Fix alternate off-by-one

diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index fae99d5..4c1b168 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -287,7 +287,7 @@ struct AlternateSubstFormat1
       return false;
 
     unsigned int shift = _hb_ctz (lookup_mask);
-    unsigned int alt_index = (lookup_mask & glyph_mask) >> shift;
+    unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift) - 1;
 
     if (unlikely (alt_index >= alt_set.len))
       return false;



More information about the HarfBuzz mailing list