Invert the mask logic
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 20 May 2010 13:00:57 +0000 (14:00 +0100)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 20 May 2010 13:00:57 +0000 (14:00 +0100)
Before, the mask in the buffer was inverted.  That is, a 0 bit meant
feature should be applied and 1 meant not applied, whereas in the
lookups, the logic was positive.

Now both are in sync.  When calling hb_buffer_add_glyph() manually,
the mask should be 1 instead of 0.

src/hb-buffer.cc
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gsub-private.hh

index a384d1f..0b77919 100644 (file)
@@ -551,7 +551,7 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer)
            hb_codepoint_t u; \
            const T *old_next = next; \
            next = UTF_NEXT (next, end, u); \
-           hb_buffer_add_glyph (buffer, u, 0,  old_next - (const T *) text); \
+           hb_buffer_add_glyph (buffer, u, 1,  old_next - (const T *) text); \
          } \
        } HB_STMT_END
 
index 81e18d4..cb66aec 100644 (file)
@@ -1535,7 +1535,7 @@ struct PosLookup : Lookup
     while (buffer->i < buffer->len)
     {
       bool done;
-      if (~buffer->info[buffer->i].mask & mask)
+      if (buffer->info[buffer->i].mask & mask)
       {
          done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL);
          ret |= done;
index 828c458..96c1c9c 100644 (file)
@@ -830,7 +830,7 @@ struct SubstLookup : Lookup
        buffer->i = 0;
        while (buffer->i < buffer->len)
        {
-         if ((~buffer->info[buffer->i].mask & mask) &&
+         if ((buffer->info[buffer->i].mask & mask) &&
              apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
            ret = true;
          else
@@ -846,7 +846,7 @@ struct SubstLookup : Lookup
        buffer->i = buffer->len - 1;
        do
        {
-         if ((~buffer->info[buffer->i].mask & mask) &&
+         if ((buffer->info[buffer->i].mask & mask) &&
              apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL))
            ret = true;
          else