# HG changeset patch # User Kenichi Handa # Date 1085792536 0 # Node ID 713a4f4140ca98f5f9d4918c93955fb17ec74ac5 # Parent d16398ce9a6f9125180dc5dcad0f90dabac2059f (Fset_fontset_font): Docstring fixed. (Ffontset_info): Make it backward compatible. New arg ALL. diff -r d16398ce9a6f -r 713a4f4140ca src/fontset.c --- a/src/fontset.c Thu May 13 12:52:44 2004 +0000 +++ b/src/fontset.c Sat May 29 01:02:16 2004 +0000 @@ -435,7 +435,7 @@ reorder_font_vector (fontset_element) Lisp_Object fontset_element; { - Lisp_Object vec, list, *new_vec; + Lisp_Object list, *new_vec; Lisp_Object font_def; int size; int *charset_id_table; @@ -1366,12 +1366,10 @@ TARGET may be nil. In that case, use FONT-SPEC for any characters for that no FONT-SPEC is specified. -FONT-SPEC may be: - * A vector [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ]. - See the documentation of `set-face-attribute' for the detail of - these vector elements; +FONT-SPEC may one of these: * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and - REGISTRY is a font registry name; + REGISTRY is a font registry name. FAMILY may contains foundry + name, and REGISTRY may contains encoding name. * A font name string. Optional 4th argument FRAME, if non-nil, is a frame. This argument is @@ -1399,6 +1397,10 @@ if (VECTORP (font_spec)) { + /* FONT_SPEC should have this form: + [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ] + This is a feature not yet documented because WEIGHT thru + ADSTYLE are ignored for the moment. */ int j; if (ASIZE (font_spec) != FONT_SPEC_MAX_INDEX) @@ -1933,21 +1935,61 @@ } -DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 2, 0, +DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 3, 0, doc: /* Return a font name pattern for character CH in fontset NAME. -If NAME is t, find a font name pattern in the default fontset. */) - (name, ch) - Lisp_Object name, ch; +If NAME is t, find a pattern in the default fontset. + +The value has the form (FAMILY . REGISTRY), where FAMILY is a font +family name and REGISTRY is a font registry name. This is actually +the first font name pattern for CH in the fontset or in the default +fontset. + +If the 2nd optional arg ALL is non-nil, return a list of all font name +patterns. */) + (name, ch, all) + Lisp_Object name, ch, all; { int c; - Lisp_Object fontset, elt; + Lisp_Object fontset, elt, list, repertory, val; + int i, j; fontset = check_fontset_name (name); CHECK_CHARACTER (ch); c = XINT (ch); - elt = FONTSET_REF (fontset, c); - return Fcopy_sequence (elt); + list = Qnil; + while (1) + { + for (i = 0, elt = FONTSET_REF (fontset, c); i < 2; + i++, elt = FONTSET_FALLBACK (fontset)) + if (VECTORP (elt)) + for (j = 0; j < ASIZE (elt); j++) + { + val = AREF (elt, j); + repertory = AREF (val, 1); + if (INTEGERP (repertory)) + { + struct charset *charset = CHARSET_FROM_ID (XINT (repertory)); + + if (! CHAR_CHARSET_P (c, charset)) + continue; + } + else if (CHAR_TABLE_P (repertory)) + { + if (NILP (CHAR_TABLE_REF (repertory, c))) + continue; + } + val = AREF (val, 0); + val = Fcons (AREF (val, 0), AREF (val, 5)); + if (NILP (all)) + return val; + list = Fcons (val, list); + } + if (EQ (fontset, Vdefault_fontset)) + break; + fontset = Vdefault_fontset; + } + return (Fnreverse (list)); } DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,