From: handa Date: Mon, 9 Jul 2007 12:27:01 +0000 (+0000) Subject: (gstring_subst): Remove a glyph if it is ignored X-Git-Tag: REL-0-9-7~17 X-Git-Url: http://git.chise.org/gitweb/?p=m17n%2Flibotf.git;a=commitdiff_plain;h=b68e7fd5a397b4968280646110d16c2d9d6e3143 (gstring_subst): Remove a glyph if it is ignored because of 0 glyph ID. --- diff --git a/src/otfdrive.c b/src/otfdrive.c index f917838..44ec9e5 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -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));