(gstring_subst): Remove a glyph if it is ignored
authorhanda <handa>
Mon, 9 Jul 2007 12:27:01 +0000 (12:27 +0000)
committerhanda <handa>
Mon, 9 Jul 2007 12:27:01 +0000 (12:27 +0000)
because of 0 glyph ID.

src/otfdrive.c

index f917838..44ec9e5 100644 (file)
@@ -29,14 +29,14 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite
 #include "otf.h"
 #include "otferror.h"
 
-/* Return nonzero if OTF_Glyph *G should be ignored according to
-   LookupFlag FLAG.  */
-#define IGNORED_GLYPH(g, flag)                 \
-  ((g)->glyph_id == 0                          \
-   || ((flag) & (1 << (g)->GlyphClass))                \
-   || (((flag) & OTF_MarkAttachmentType)       \
-       && (g)->GlyphClass == OTF_GlyphClassMark        \
-       && ((flag) >> 8) != (g)->MarkAttachClass))
+/* Return nonzero (-1 if ID is zero, 1 otherwise) if OTF_Glyph *G
+   should be ignored according to LookupFlag FLAG.  */
+#define IGNORED_GLYPH(g, flag)                         \
+  ((g)->glyph_id == 0 ? -1                             \
+   : (((flag) & (1 << (g)->GlyphClass))                        \
+      || (((flag) & OTF_MarkAttachmentType)            \
+         && (g)->GlyphClass == OTF_GlyphClassMark      \
+         && ((flag) >> 8) != (g)->MarkAttachClass)))
 
 #define GSTRING_DELETE(gstring, from, len)                             \
   do {                                                                 \
@@ -81,8 +81,11 @@ gstring_subst (OTF *otf, OTF_GlyphString *gstring, int from, int to, int flag,
   for (i = non_ignored_idx = to - 1; i >= from; i--)
     {
       OTF_Glyph *g = gstring->glyphs + i;
-      if (IGNORED_GLYPH (g, flag))
+
+      if (IGNORED_GLYPH (g, flag) == 1)
        {
+         /* Move this glyph to the next of the current target of
+            substitution.  */
          OTF_Glyph temp = *g;
 
          memmove (g, g + 1, sizeof (OTF_Glyph) * (non_ignored_idx - i));