# HG changeset patch # User Kenichi Handa # Date 1201503907 0 # Node ID b93ade1a36024f5792dc0949eeb5826bebb4491b # Parent b6befec471b8a8d4c62e70694b53fb58e90676c7 (font_find_for_lface): Check if the character C is supported or not only for the first font. diff -r b6befec471b8 -r b93ade1a3602 src/font.c --- a/src/font.c Mon Jan 28 07:03:27 2008 +0000 +++ b/src/font.c Mon Jan 28 07:05:07 2008 +0000 @@ -2603,8 +2603,8 @@ Lisp_Object spec; int c; { - Lisp_Object frame, entities; - int i; + Lisp_Object frame, entities, val; + int i, result; XSETFRAME (frame, f); @@ -2646,9 +2646,9 @@ if (c >= 0) { - struct charset *repertory; - - if (font_registry_charsets (registry, NULL, &repertory) < 0) + struct charset *encoding, *repertory; + + if (font_registry_charsets (registry, &encoding, &repertory) < 0) return Qnil; if (repertory) { @@ -2659,7 +2659,7 @@ suppress the further checking. */ c = -1; } - else if (c > MAX_UNICODE_CHAR) + else if (c > encoding->max_char) return Qnil; } for (i = 0; i < FONT_SPEC_MAX; i++) @@ -2692,23 +2692,19 @@ if (c < 0) return AREF (entities, 0); - for (i = 0; i < ASIZE (entities); i++) - { - int result = font_has_char (f, AREF (entities, i), c); - Lisp_Object font_object; - - if (result > 0) - return AREF (entities, i); - if (result == 0) - continue; - font_object = font_open_for_lface (f, AREF (entities, i), lface, spec); - if (NILP (font_object)) - continue; - result = font_has_char (f, font_object, c); - font_close_object (f, font_object); - if (result > 0) - return AREF (entities, i); - } + + val = AREF (entities, 0); + result = font_has_char (f, val, c); + if (result > 0) + return val; + if (result == 0) + return Qnil; + val = font_open_for_lface (f, val, lface, spec); + if (NILP (val)) + return Qnil; + result = font_has_char (f, val, c); + if (result > 0) + return val; return Qnil; } @@ -3101,7 +3097,7 @@ /* Lisp API */ DEFUN ("fontp", Ffontp, Sfontp, 1, 1, 0, - doc: /* Return t if OBJECT is a font-spec or font-entity. + doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. Return nil otherwise. */) (object) Lisp_Object object;