From: handa Date: Fri, 14 Sep 2007 05:01:34 +0000 (+0000) Subject: (UPDATE_CLUSTER_RANGE): ctx->cluster_begin_idx is X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4a8eb3010153727c4be4b681c8d5bc35fda9583b;p=m17n%2Fm17n-lib.git (UPDATE_CLUSTER_RANGE): ctx->cluster_begin_idx is invalid only when it's negative. (run_otf): Likewise. (run_command): Likewise. (mflt_run): Initialize ctx.cluster_begin_idx to -1. --- diff --git a/src/m17n-flt.c b/src/m17n-flt.c index 11cc63c..76a908f 100644 --- a/src/m17n-flt.c +++ b/src/m17n-flt.c @@ -356,7 +356,7 @@ static MSymbol Mcond, Mrange; #define UPDATE_CLUSTER_RANGE(ctx, g) \ do { \ - if ((ctx)->cluster_begin_idx) \ + if ((ctx)->cluster_begin_idx >= 0) \ { \ if (ctx->cluster_begin_pos > (g)->from) \ ctx->cluster_begin_pos = (g)->from; \ @@ -1497,7 +1497,7 @@ run_otf (int depth, } } - if (ctx->cluster_begin_idx) + if (ctx->cluster_begin_idx >= 0) for (; from_idx < ctx->out->used; from_idx++) { MFLTGlyph *g = GREF (ctx->out, from_idx); @@ -1622,13 +1622,18 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) SET_LEFT_PADDING (g, ctx, LeftPaddingMask); UPDATE_CLUSTER_RANGE (ctx, g); if (MDEBUG_FLAG () > 2) - MDEBUG_PRINT3 ("\n [FLT] %*s(COPY 0x%X)", depth, "", g->code); + { + if (g->c < 0) + MDEBUG_PRINT2 ("\n [FLT] %*s(COPY |)", depth, ""); + else + MDEBUG_PRINT3 ("\n [FLT] %*s(COPY 0x%X)", depth, "", g->code); + } ctx->code_offset = ctx->combining_code = ctx->left_padding = 0; return (from + 1); } case CMD_ID_CLUSTER_BEGIN: - if (! ctx->cluster_begin_idx) + if (ctx->cluster_begin_idx < 0) { if (MDEBUG_FLAG () > 2) MDEBUG_PRINT3 ("\n [FLT] %*s<%d", depth, "", @@ -1640,18 +1645,19 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) return from; case CMD_ID_CLUSTER_END: - if (ctx->cluster_begin_idx && ctx->cluster_begin_idx < ctx->out->used) + if (ctx->cluster_begin_idx >= 0 + && ctx->cluster_begin_idx < ctx->out->used) { int i; if (MDEBUG_FLAG () > 2) - MDEBUG_PRINT1 (" %d>", ctx->cluster_end_pos); + MDEBUG_PRINT1 (" %d>", ctx->cluster_end_pos + 1); for (i = ctx->cluster_begin_idx; i < ctx->out->used; i++) { GREF (ctx->out, i)->from = ctx->cluster_begin_pos; GREF (ctx->out, i)->to = ctx->cluster_end_pos; } - ctx->cluster_begin_idx = 0; + ctx->cluster_begin_idx = -1; } return from; @@ -2117,6 +2123,7 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, /* Setup CTX. */ memset (&ctx, 0, sizeof ctx); + ctx.cluster_begin_idx = -1; /* Find previous glyphs that are also supported by the layouter. */ for (i = from; i > 0 && (g = GREF (gstring, i - 1))