From d0a477766dfa024f121e05c0de22fbb6833a113c Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 13 Jun 2008 12:29:55 +0000 Subject: [PATCH] (font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0. --- src/ChangeLog | 2 +- src/font.c | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2aa8145d2e1..88aa859b8e0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -39,7 +39,7 @@ (font_update_lface): Don't parse "foundry-family" form here. Handle FONT_FOUNDRY_INDEX. (font_find_for_lface): Likewise. Handle alternate families here. - If registry is NULL, try iso8859-1 and ascii-0. + If registry is nil, try iso8859-1 and ascii-0. (font_open_for_lface): Pay attention to size in ENTITY. (font_open_by_name): Simplify by calling font_load_for_lface. (free_font_driver_list): Delete it. diff --git a/src/font.c b/src/font.c index 47eeac3175c..ee1f7e4dd10 100644 --- a/src/font.c +++ b/src/font.c @@ -2896,9 +2896,19 @@ font_find_for_lface (f, attrs, spec, c) { Lisp_Object work; Lisp_Object frame, entities, val, props[FONT_REGISTRY_INDEX + 1] ; - Lisp_Object size, foundry[3], *family; + Lisp_Object size, foundry[3], *family, registry[3]; int pixel_size; - int i, j, result; + int i, j, k, result; + + registry[0] = AREF (spec, FONT_REGISTRY_INDEX); + if (NILP (registry[0])) + { + registry[0] = Qiso8859_1; + registry[1] = Qascii_0; + registry[2] = null_vector; + } + else + registry[1] = null_vector; if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX))) { @@ -2978,21 +2988,23 @@ font_find_for_lface (f, attrs, spec, c) } } - for (j = 0; SYMBOLP (family[j]); j++) + for (i = 0; SYMBOLP (family[i]); i++) { - ASET (work, FONT_FAMILY_INDEX, family[j]); - for (i = 0; SYMBOLP (foundry[i]); i++) + ASET (work, FONT_FAMILY_INDEX, family[i]); + for (j = 0; SYMBOLP (foundry[j]); j++) { - ASET (work, FONT_FOUNDRY_INDEX, foundry[i]); - entities = font_list_entities (frame, work); - if (ASIZE (entities) > 0) - break; + ASET (work, FONT_FOUNDRY_INDEX, foundry[j]); + for (k = 0; SYMBOLP (registry[k]); k++) + { + ASET (work, FONT_REGISTRY_INDEX, registry[j]); + entities = font_list_entities (frame, work); + if (ASIZE (entities) > 0) + goto found; + } } - if (ASIZE (entities) > 0) - break; } - if (ASIZE (entities) == 0) - return Qnil; + return Qnil; + found: if (ASIZE (entities) == 1) { if (c < 0) -- 2.39.2