From: handa Date: Mon, 10 Sep 2007 04:49:47 +0000 (+0000) Subject: (enum GlyphInfoMask): Delete EncodedMask and X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=c4594c97030345ab7e77a7137d96f7e3906f2691;p=m17n%2Fm17n-lib.git (enum GlyphInfoMask): Delete EncodedMask and PositionedMask. (GAPPEND): Delete this macro. (GET_ENCODED, SET_ENCODED, GET_MEASURED, SET_MEASURED): Adjusted for the change of MFLTGlyph. Caller changed. (run_otf): Simply calls font->get_glyph_id. (run_command): Reset g->encoded and g->measured for direct code. (positioning): Delete this function. (run_stages): Simply calls font->get_glyph_id and font->get_metric. --- diff --git a/src/m17n-flt.c b/src/m17n-flt.c index b6425ee..11cc63c 100644 --- a/src/m17n-flt.c +++ b/src/m17n-flt.c @@ -245,9 +245,7 @@ enum GlyphInfoMask { CombiningCodeMask = 0xFFFFFFF, LeftPaddingMask = 1 << 28, - RightPaddingMask = 1 << 29, - EncodedMask = 1 << 30, - PositionedMask = 1 << 31 + RightPaddingMask = 1 << 29 }; #define SET_GLYPH_INFO(g, mask, ctx, info) \ @@ -263,12 +261,10 @@ enum GlyphInfoMask #define GET_RIGHT_PADDING(g) ((g)->internal & RightPaddingMask) #define SET_RIGHT_PADDING(g, ctx, flag) \ SET_GLYPH_INFO (g, RightPaddingMask, ctx, flag) -#define GET_ENCODED(g) ((g)->internal & EncodedMask) -#define SET_ENCODED(g, ctx, flag) \ - SET_GLYPH_INFO (g, EncodedMask, ctx, flag) -#define GET_POSITIONED(g) ((g)->internal & PositionedMask) -#define SET_POSITIONED(g, ctx, flag) \ - SET_GLYPH_INFO (g, PositionedMask, ctx, flag) +#define GET_ENCODED(g) ((g)->encoded) +#define SET_ENCODED(g, flag) ((g)->encoded = (flag)) +#define GET_MEASURED(g) ((g)->measured) +#define SET_MEASURED(g, flag) ((g)->measured = (flag)) #define GINIT(gstring, n) \ do { \ @@ -288,15 +284,6 @@ enum GlyphInfoMask #define GREF(gstring, idx) \ ((MFLTGlyph *) ((char *) ((gstring)->glyphs) + (gstring)->glyph_size * (idx))) -#define GAPPEND(gstring, g) \ - do { \ - if ((gstring)->allocated <= (gstring)->used) \ - return -2; \ - memcpy ((char *) (((gstring)->glyphs) \ - + (gstring)->glyph_size * (gstring)->used), \ - (char *) g, (gstring)->glyph_size); \ - } while (0) - #define GDUP(ctx, idx) \ do { \ MFLTGlyphString *src = ctx->in; \ @@ -1449,16 +1436,8 @@ run_otf (int depth, if (MDEBUG_FLAG () > 2) MDEBUG_PRINT3 ("\n [FLT] %*s%s", depth, "", MSYMBOL_NAME (otf_spec->sym)); - for (i = from; i < to; i++) - { - MFLTGlyph *g = GREF (ctx->in, i); - if (! (GET_ENCODED (g))) - { - font->get_glyph_id (font, g); - SET_ENCODED (g, ctx, EncodedMask); - } - } + font->get_glyph_id (font, ctx->in, from, to); adjustment = alloca ((sizeof *adjustment) * (ctx->out->allocated - ctx->out->used)); if (! adjustment) @@ -1483,7 +1462,7 @@ run_otf (int depth, { MFLTGlyph *g = GREF (ctx->out, from_idx + i); - SET_POSITIONED (g, ctx, PositionedMask); + SET_MEASURED (g, 1); if (a->xadv || a->yadv) { if (a->advance_is_absolute) @@ -1579,6 +1558,8 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) GDUP (ctx, i); g = GREF (ctx->out, ctx->out->used - 1); g->code = ctx->code_offset + id; + SET_ENCODED (g, 0); + SET_MEASURED (g, 0); if (ctx->combining_code) SET_COMBINING_CODE (g, ctx, ctx->combining_code); if (ctx->left_padding) @@ -1683,7 +1664,8 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) g = GREF (ctx->out, ctx->out->used - 1); g->c = -1, g->code = 0; g->xadv = g->yadv = 0; - SET_ENCODED (g, ctx, 0); + SET_ENCODED (g, 0); + SET_MEASURED (g, 0); return from; } @@ -1707,26 +1689,6 @@ run_command (int depth, int id, int from, int to, FontLayoutContext *ctx) MERROR (MERROR_DRAW, -1); } -static void -positioning (MFLTFont *font, MFLTGlyphString *gstring, int from, int to) -{ - int i, j; - - for (i = j = from; i < to; i++) - { - MFLTGlyph *g = GREF (gstring, i); - - if (GET_POSITIONED (g)) - { - if (j < i) - font->get_metric (font, gstring, j, i); - j = i + 1; - } - } - if (j < i) - font->get_metric (font, gstring, j, i); -} - static int run_stages (MFLTGlyphString *gstring, int from, int to, MFLT *flt, FontLayoutContext *ctx) @@ -1846,12 +1808,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, } /* Get actual glyph IDs of glyphs. */ - for (i = 0; i < ctx->out->used; i++) - { - g = GREF (ctx->out, i); - if (! GET_ENCODED (g)) - ctx->font->get_glyph_id (ctx->font, g); - } + ctx->font->get_glyph_id (ctx->font, ctx->out, 0, ctx->out->used); /* Check if all characters in the range are covered by some glyph(s). If not, change and of glyphs to cover @@ -1901,8 +1858,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, } } - if (ctx->font->get_metric) - positioning (ctx->font, ctx->out, 0, ctx->out->used); + ctx->font->get_metric (ctx->font, ctx->out, 0, ctx->out->used); /* Handle combining. */ if (ctx->check_mask & CombiningCodeMask)