aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fontset.c68
1 files changed, 55 insertions, 13 deletions
diff --git a/src/fontset.c b/src/fontset.c
index 7f428ee77c2..4212a40541e 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -435,7 +435,7 @@ static void
435reorder_font_vector (fontset_element) 435reorder_font_vector (fontset_element)
436 Lisp_Object fontset_element; 436 Lisp_Object fontset_element;
437{ 437{
438 Lisp_Object vec, list, *new_vec; 438 Lisp_Object list, *new_vec;
439 Lisp_Object font_def; 439 Lisp_Object font_def;
440 int size; 440 int size;
441 int *charset_id_table; 441 int *charset_id_table;
@@ -1366,12 +1366,10 @@ characters in the charset.
1366TARGET may be nil. In that case, use FONT-SPEC for any characters for 1366TARGET may be nil. In that case, use FONT-SPEC for any characters for
1367that no FONT-SPEC is specified. 1367that no FONT-SPEC is specified.
1368 1368
1369FONT-SPEC may be: 1369FONT-SPEC may one of these:
1370 * A vector [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ].
1371 See the documentation of `set-face-attribute' for the detail of
1372 these vector elements;
1373 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and 1370 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and
1374 REGISTRY is a font registry name; 1371 REGISTRY is a font registry name. FAMILY may contains foundry
1372 name, and REGISTRY may contains encoding name.
1375 * A font name string. 1373 * A font name string.
1376 1374
1377Optional 4th argument FRAME, if non-nil, is a frame. This argument is 1375Optional 4th argument FRAME, if non-nil, is a frame. This argument is
@@ -1399,6 +1397,10 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1399 1397
1400 if (VECTORP (font_spec)) 1398 if (VECTORP (font_spec))
1401 { 1399 {
1400 /* FONT_SPEC should have this form:
1401 [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ]
1402 This is a feature not yet documented because WEIGHT thru
1403 ADSTYLE are ignored for the moment. */
1402 int j; 1404 int j;
1403 1405
1404 if (ASIZE (font_spec) != FONT_SPEC_MAX_INDEX) 1406 if (ASIZE (font_spec) != FONT_SPEC_MAX_INDEX)
@@ -1933,21 +1935,61 @@ fontset. The format is the same as abobe. */)
1933} 1935}
1934 1936
1935 1937
1936DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 2, 0, 1938DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 3, 0,
1937 doc: /* Return a font name pattern for character CH in fontset NAME. 1939 doc: /* Return a font name pattern for character CH in fontset NAME.
1938If NAME is t, find a font name pattern in the default fontset. */) 1940If NAME is t, find a pattern in the default fontset.
1939 (name, ch) 1941
1940 Lisp_Object name, ch; 1942The value has the form (FAMILY . REGISTRY), where FAMILY is a font
1943family name and REGISTRY is a font registry name. This is actually
1944the first font name pattern for CH in the fontset or in the default
1945fontset.
1946
1947If the 2nd optional arg ALL is non-nil, return a list of all font name
1948patterns. */)
1949 (name, ch, all)
1950 Lisp_Object name, ch, all;
1941{ 1951{
1942 int c; 1952 int c;
1943 Lisp_Object fontset, elt; 1953 Lisp_Object fontset, elt, list, repertory, val;
1954 int i, j;
1944 1955
1945 fontset = check_fontset_name (name); 1956 fontset = check_fontset_name (name);
1946 1957
1947 CHECK_CHARACTER (ch); 1958 CHECK_CHARACTER (ch);
1948 c = XINT (ch); 1959 c = XINT (ch);
1949 elt = FONTSET_REF (fontset, c); 1960 list = Qnil;
1950 return Fcopy_sequence (elt); 1961 while (1)
1962 {
1963 for (i = 0, elt = FONTSET_REF (fontset, c); i < 2;
1964 i++, elt = FONTSET_FALLBACK (fontset))
1965 if (VECTORP (elt))
1966 for (j = 0; j < ASIZE (elt); j++)
1967 {
1968 val = AREF (elt, j);
1969 repertory = AREF (val, 1);
1970 if (INTEGERP (repertory))
1971 {
1972 struct charset *charset = CHARSET_FROM_ID (XINT (repertory));
1973
1974 if (! CHAR_CHARSET_P (c, charset))
1975 continue;
1976 }
1977 else if (CHAR_TABLE_P (repertory))
1978 {
1979 if (NILP (CHAR_TABLE_REF (repertory, c)))
1980 continue;
1981 }
1982 val = AREF (val, 0);
1983 val = Fcons (AREF (val, 0), AREF (val, 5));
1984 if (NILP (all))
1985 return val;
1986 list = Fcons (val, list);
1987 }
1988 if (EQ (fontset, Vdefault_fontset))
1989 break;
1990 fontset = Vdefault_fontset;
1991 }
1992 return (Fnreverse (list));
1951} 1993}
1952 1994
1953DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0, 1995DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,