Mercurial > emacs
comparison src/fontset.c @ 29233:a09ee5c15dcb
(check_registry_encoding): This function deleted.
(Fset_fontset_font): Remove the adhoc condition for the default
fontset. Allow cons in FONTNAME.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 26 May 2000 07:27:30 +0000 |
parents | 3c444d185d31 |
children | f901ec87b147 |
comparison
equal
deleted
inserted
replaced
29232:c0d6abd0b71b | 29233:a09ee5c15dcb |
---|---|
944 for (i = CHAR_TABLE_SINGLE_BYTE_SLOTS; i < CHAR_TABLE_ORDINARY_SLOTS; i++) | 944 for (i = CHAR_TABLE_SINGLE_BYTE_SLOTS; i < CHAR_TABLE_ORDINARY_SLOTS; i++) |
945 XCHAR_TABLE (fontset)->contents[i] = Qnil; | 945 XCHAR_TABLE (fontset)->contents[i] = Qnil; |
946 } | 946 } |
947 | 947 |
948 | 948 |
949 /* Return 1 iff REGISTRY is a valid string as the font registry and | |
950 encoding. It is valid if it doesn't start with `-' and the number | |
951 of `-' in the string is at most 1. */ | |
952 | |
953 static int | |
954 check_registry_encoding (registry) | |
955 Lisp_Object registry; | |
956 { | |
957 unsigned char *str = XSTRING (registry)->data; | |
958 unsigned char *p = str; | |
959 int i; | |
960 | |
961 if (!*p || *p++ == '-') | |
962 return 0; | |
963 for (i = 0; *p; p++) | |
964 if (*p == '-') i++; | |
965 return (i < 2); | |
966 } | |
967 | |
968 | |
969 /* Check validity of NAME as a fontset name and return the | 949 /* Check validity of NAME as a fontset name and return the |
970 corresponding fontset. If not valid, signal an error. | 950 corresponding fontset. If not valid, signal an error. |
971 If NAME is t, return Vdefault_fontset. */ | 951 If NAME is t, return Vdefault_fontset. */ |
972 | 952 |
973 static Lisp_Object | 953 static Lisp_Object |
991 \n\ | 971 \n\ |
992 CHARACTER may be a cons; (FROM . TO), where FROM and TO are\n\ | 972 CHARACTER may be a cons; (FROM . TO), where FROM and TO are\n\ |
993 non-generic characters. In that case, use FONTNAME\n\ | 973 non-generic characters. In that case, use FONTNAME\n\ |
994 for all characters in the range FROM and TO (inclusive).\n\ | 974 for all characters in the range FROM and TO (inclusive).\n\ |
995 \n\ | 975 \n\ |
996 If NAME is t, an entry in the default fontset is modified.\n\ | 976 FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family\n\ |
997 In that case, FONTNAME should be a registry and encoding name\n\ | 977 name of a font, REGSITRY is a registry name of a font.") |
998 of a font for CHARACTER.") | |
999 (name, character, fontname, frame) | 978 (name, character, fontname, frame) |
1000 Lisp_Object name, character, fontname, frame; | 979 Lisp_Object name, character, fontname, frame; |
1001 { | 980 { |
1002 Lisp_Object fontset, elt; | 981 Lisp_Object fontset, elt; |
1003 Lisp_Object realized; | 982 Lisp_Object realized; |
1004 int from, to; | 983 int from, to; |
1005 int id; | 984 int id; |
985 Lisp_Object family, registry; | |
1006 | 986 |
1007 fontset = check_fontset_name (name); | 987 fontset = check_fontset_name (name); |
1008 | 988 |
1009 if (CONSP (character)) | 989 if (CONSP (character)) |
1010 { | 990 { |
1036 invalid_character (to); | 1016 invalid_character (to); |
1037 if (SINGLE_BYTE_CHAR_P (to)) | 1017 if (SINGLE_BYTE_CHAR_P (to)) |
1038 error ("Can't change font for a single byte character"); | 1018 error ("Can't change font for a single byte character"); |
1039 } | 1019 } |
1040 | 1020 |
1041 CHECK_STRING (fontname, 2); | 1021 if (STRINGP (fontname)) |
1042 fontname = Fdowncase (fontname); | 1022 { |
1043 if (EQ (fontset, Vdefault_fontset)) | 1023 fontname = Fdowncase (fontname); |
1044 { | 1024 elt = Fcons (make_number (from), font_family_registry (fontname)); |
1045 if (!check_registry_encoding (fontname)) | |
1046 error ("Invalid registry and encoding name: %s", | |
1047 XSTRING (fontname)->data); | |
1048 elt = Fcons (make_number (from), Fcons (Qnil, fontname)); | |
1049 } | 1025 } |
1050 else | 1026 else |
1051 elt = Fcons (make_number (from), font_family_registry (fontname)); | 1027 { |
1028 CHECK_CONS (fontname, 2); | |
1029 family = XCAR (fontname); | |
1030 registry = XCDR (fontname); | |
1031 if (!NILP (family)) | |
1032 CHECK_STRING (family, 2); | |
1033 if (!NILP (registry)) | |
1034 CHECK_STRING (registry, 2); | |
1035 elt = Fcons (make_number (from), Fcons (family, registry)); | |
1036 } | |
1052 | 1037 |
1053 /* The arg FRAME is kept for backward compatibility. We only check | 1038 /* The arg FRAME is kept for backward compatibility. We only check |
1054 the validity. */ | 1039 the validity. */ |
1055 if (!NILP (frame)) | 1040 if (!NILP (frame)) |
1056 CHECK_LIVE_FRAME (frame, 3); | 1041 CHECK_LIVE_FRAME (frame, 3); |