From 0ef01c0b2bef3d07b0dd8ff1e64d8ba14ff112b1 Mon Sep 17 00:00:00 2001 From: handa Date: Tue, 15 Jun 2004 13:02:05 +0000 Subject: [PATCH] (mfont__lookup_fontset): Fix selection of font groups by language. --- src/fontset.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/fontset.c b/src/fontset.c index f525d68..2e045cc 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -496,16 +496,33 @@ mfont__lookup_fontset (MRealizedFontset *realized, MGlyph *g, int *num, && ((per_script = mplist_find_by_key (realized->per_script, script)) != NULL)) { - /* The first loop is for matching language (if any), and the second - loop is for non-matching languages. */ + /* We prefer font groups in this order: + (1) group matching LANGUAGE + (2) group for generic LANGUAGE + (3) group non-matching LANGUAGE */ if (language == Mnil) language = Mt; - for (i = 0; i < 2; i++) + per_lang = mplist_find_by_key (MPLIST_PLIST (per_script), language); + if (per_lang) { - MPLIST_DO (per_lang, MPLIST_PLIST (per_script)) - if ((MPLIST_KEY (per_lang) == language) != i) - font_groups[n_font_group++] = MPLIST_PLIST (per_lang); + font_groups[n_font_group++] = MPLIST_PLIST (per_lang); + if (language == Mt) + { + MPLIST_DO (per_lang, MPLIST_PLIST (per_script)) + if (MPLIST_KEY (per_lang) != language) + font_groups[n_font_group++] = MPLIST_PLIST (per_lang); + } } + if (language != Mt) + { + plist = mplist_get (MPLIST_PLIST (per_script), Mt); + if (plist) + font_groups[n_font_group++] = plist; + } + MPLIST_DO (per_lang, MPLIST_PLIST (per_script)) + if (MPLIST_KEY (per_lang) != language + && MPLIST_KEY (per_lang) != Mt) + font_groups[n_font_group++] = MPLIST_PLIST (per_lang); } font_groups[n_font_group++] = realized->fallback; -- 1.7.10.4