From: handa Date: Fri, 9 Nov 2007 07:45:18 +0000 (+0000) Subject: (run_stages): Fix handing of off_x and off_y. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37557dc44e1a2e17e3b541a8dfd199daa6295c9a;p=m17n%2Fm17n-lib.git (run_stages): Fix handing of off_x and off_y. (setup_combining_coverage): New function. (setup_combining_flt): New function. (mflt_get): If flt is not found, return NULL. If name if Mt, call setup_combining_flt. (mflt_run): For debugging, print font family name. --- diff --git a/src/m17n-flt.c b/src/m17n-flt.c index 4f4c147..50372da 100644 --- a/src/m17n-flt.c +++ b/src/m17n-flt.c @@ -1944,7 +1944,7 @@ run_stages (MFLTGlyphString *gstring, int from, int to, if (ctx->out->used > 0) { int *g_indices; - int x_ppem = ctx->font->x_ppem, y_ppem = ctx->font->y_ppem; + int x_ppem = ctx->font->x_ppem << 6, y_ppem = ctx->font->y_ppem << 6; /* Remove separator glyphs. */ for (i = 0; i < ctx->out->used;) @@ -2142,6 +2142,46 @@ combining_code_from_class (int class) return code; } +static void +setup_combining_coverage (int from, int to, void *val, void *arg) +{ + int combining_class = (int) val; + int category = 0; + + if (combining_class < 200) + category = 'a'; + else if (combining_class <= 204) + { + if ((combining_class % 2) == 0) + category = "bcd"[(combining_class - 200) / 2]; + } + else if (combining_class <= 232) + { + if ((combining_class % 2) == 0) + category = "efghijklmnopq"[(combining_class - 208) / 2]; + } + else if (combining_class == 233) + category = 'r'; + else if (combining_class == 234) + category = 's'; + else if (combining_class == 240) + category = 't'; + mchartable_set_range ((MCharTable *) arg, from, to, (void *) category); +} + +static void +setup_combining_flt (MFLT *flt) +{ + MSymbol type; + MCharTable *combininig_class_table + = mchar_get_prop_table (Mcombining_class, &type); + + mchartable_set_range (flt->coverage, 0, 0x10FFFF, (void *) 'u'); + if (combininig_class_table) + mchartable_map (combininig_class_table, (void *) 0, + setup_combining_coverage, flt->coverage); +} + #define CHECK_FLT_STAGES(flt) ((flt)->stages || load_flt (flt, NULL) == 0) @@ -2225,8 +2265,12 @@ mflt_get (MSymbol name) if (! flt_list && list_flt () < 0) return NULL; flt = mplist_get (flt_list, name); - if (flt && ! CHECK_FLT_STAGES (flt)) + if (! flt || ! CHECK_FLT_STAGES (flt)) return NULL; + if (flt->name == Mt + && ! mchartable_lookup (flt->coverage, 0)) + setup_combining_flt (flt); + return flt; } @@ -2435,6 +2479,8 @@ mflt_run (MFLTGlyphString *gstring, int from, int to, if (MDEBUG_FLAG ()) { + if (font->family) + MDEBUG_PRINT1 (" (%s)", MSYMBOL_NAME (font->family)); MDEBUG_PRINT ("\n [FLT] (SOURCE"); for (i = this_from, j = 0; i < this_to; i++, j++) {