From: handa Date: Thu, 18 Mar 2004 06:40:13 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Funlabeled-1.1.2;p=m17n%2Fm17n-lib.git *** empty log message *** --- diff --git a/src/face.c b/src/face.c index 14d5cd0..7c7df8b 100644 --- a/src/face.c +++ b/src/face.c @@ -551,6 +551,8 @@ mface__fini () M17N_OBJECT_UNREF (mface_cyan); M17N_OBJECT_UNREF (mface_yellow); M17N_OBJECT_UNREF (mface_magenta); + free (work_gstring.glyphs); + mdebug__report_object ("Face", &face_table); } diff --git a/src/font.c b/src/font.c index 2cc4f55..fa39508 100644 --- a/src/font.c +++ b/src/font.c @@ -776,11 +776,12 @@ mfont__set_spec_from_plist (MFont *spec, MPlist *plist) } MRealizedFont * -mfont__select (MFrame *frame, MFont *spec, MFont *request, int limited_size) +mfont__select (MFrame *frame, MFont *spec, MFont *request, int limited_size, + MSymbol layouter) { MSymbol registry = FONT_PROPERTY (spec, MFONT_REGISTRY); MPlist *realized_font_list; - MRealizedFont *best_font[MFONT_TYPE_MAX]; + MRealizedFont *best_font[MFONT_TYPE_MAX], *best; int best_index; int i; int mdebug_mask = MDEBUG_FONT; @@ -790,15 +791,29 @@ mfont__select (MFrame *frame, MFont *spec, MFont *request, int limited_size) MPLIST_DO (realized_font_list, frame->realized_font_list) { - MRealizedFont *best = MPLIST_VAL (realized_font_list); - + best = MPLIST_VAL (realized_font_list); if (MPLIST_KEY (realized_font_list) == registry && ! memcmp (&best->spec, spec, sizeof (MFont)) && ! memcmp (&best->request, request, sizeof (MFont))) - return best; + { + if (best->layouter != layouter) + { + MRealizedFont *copy; + + MSTRUCT_MALLOC (copy, MERROR_FONT); + *copy = *best; + copy->layouter = layouter; + if (copy->info) + M17N_OBJECT_REF (copy->info); + mplist_add (frame->realized_font_list, registry, copy); + best = copy; + } + return best; + } } MDEBUG_PUSH_TIME (); + best = NULL; best_index = -1; for (i = 0; i < MFONT_TYPE_MAX; i++) { @@ -809,13 +824,13 @@ mfont__select (MFrame *frame, MFont *spec, MFont *request, int limited_size) : NULL); if (best_font[i] && (best_index < 0 - || best_font[best_index]->score > best_font[i]->score)) + || best_font[best_index]->score < best_font[i]->score)) best_index = i; } for (i = 0; i < MFONT_TYPE_MAX; i++) { if (i == best_index) - mplist_add (frame->realized_font_list, registry, best_font[i]); + best = best_font[i]; else if (best_font[i]) free (best_font[i]); } @@ -830,18 +845,21 @@ mfont__select (MFrame *frame, MFont *spec, MFont *request, int limited_size) font.property[i] = request->property[i]; gen_font_name (buf2, &font); - if (best_index >= 0) + if (best) MDEBUG_PRINT_TIME ("FONT", (stderr, " to select <%s> from <%s>.", - gen_font_name (buf1, - &best_font[best_index]->font), + gen_font_name (buf1, &best->font), buf2)); else MDEBUG_PRINT_TIME ("FONT", (stderr, " to fail to find <%s>.", buf2)); MDEBUG_POP_TIME (); } - return (best_index >= 0 ? best_font[best_index] : NULL); + if (! best) + return NULL; + best->layouter = layouter; + mplist_add (frame->realized_font_list, registry, best); + return best; } @@ -1555,7 +1573,7 @@ mfont_find (MFrame *frame, MFont *spec, int *score, int limited_size) MFONT_INIT (&spec_copy); spec_copy.property[MFONT_REGISTRY] = spec->property[MFONT_REGISTRY]; - rfont = mfont__select (frame, &spec_copy, spec, limited_size); + rfont = mfont__select (frame, &spec_copy, spec, limited_size, Mnil); if (!rfont) return NULL; if (score) diff --git a/src/font.h b/src/font.h index 2053328..b61dc78 100644 --- a/src/font.h +++ b/src/font.h @@ -229,7 +229,8 @@ extern int mfont__encodable_p (MRealizedFont *rfont, MSymbol layouter_name, extern unsigned mfont__encode_char (MRealizedFont *rfont, int c); extern MRealizedFont *mfont__select (MFrame *frame, MFont *spec, - MFont *request, int limitted_size); + MFont *request, int limitted_size, + MSymbol layouter); extern int mfont__open (MRealizedFont *rfont); diff --git a/src/fontset.c b/src/fontset.c index af938ae..6f922ec 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -307,14 +307,13 @@ realize_font_group (MFrame *frame, MFont *request, MPlist *font_group, mplist_set (font_group, Mnil, NULL); MPLIST_DO (pl, plist) { + MSymbol layouter = MPLIST_KEY (pl); MRealizedFont *rfont = mfont__select (frame, MPLIST_VAL (pl), request, - size); + size, + layouter == Mt ? Mnil : layouter); if (rfont) { - rfont->layouter = MPLIST_KEY (pl); - if (rfont->layouter == Mt) - rfont->layouter = Mnil; MPLIST_DO (p, font_group) if (((MRealizedFont *) (MPLIST_VAL (p)))->score > rfont->score) break; @@ -323,28 +322,6 @@ realize_font_group (MFrame *frame, MFont *request, MPlist *font_group, } } -int -check_fontset_element (MFrame *frame, MPlist *element, MGlyph *g, int size) -{ - MRealizedFont *rfont = (MRealizedFont *) MPLIST_VAL (element); - - if (! rfont) - /* We have already failed to select this font. */ - return 0; - if (! rfont->frame) - { - rfont = mfont__select (frame, &rfont->spec, &rfont->request, size); - free (MPLIST_VAL (element)); - MPLIST_VAL (element) = rfont; - if (! rfont) - /* No font matches this spec. */ - return 0; - } - - g->code = mfont__encode_char (rfont, g->c); - return (g->code != MCHAR_INVALID_CODE); -} - /* Internal API */