aboutsummaryrefslogtreecommitdiffstats
path: root/src/fontset.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-11-13 18:34:40 +0000
committerKaroly Lorentey2004-11-13 18:34:40 +0000
commite417405015c93c81641f5c4a33ec898b5c353772 (patch)
tree017a980c35c8a71c372304418d151e3826f88636 /src/fontset.c
parentf590a2a442d19f3a74d7bbd02bbcb4e3239f2327 (diff)
parent68d1b30d251b4771f739d20f507cd9523ae3919b (diff)
downloademacs-e417405015c93c81641f5c4a33ec898b5c353772.tar.gz
emacs-e417405015c93c81641f5c4a33ec898b5c353772.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-673 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-674 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-675 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-676 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-677 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-681 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-682 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-683 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-684 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-685 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-686 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-687 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-692 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-693 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-267
Diffstat (limited to 'src/fontset.c')
-rw-r--r--src/fontset.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/fontset.c b/src/fontset.c
index f370f2ae981..7dff29f3ed8 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -797,7 +797,7 @@ fontset_pattern_regexp (pattern)
797 { 797 {
798 if (*p0 == '-') 798 if (*p0 == '-')
799 ndashes++; 799 ndashes++;
800 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 800 else if (*p0 == '*')
801 nstars++; 801 nstars++;
802 } 802 }
803 803
@@ -812,7 +812,7 @@ fontset_pattern_regexp (pattern)
812 *p1++ = '^'; 812 *p1++ = '^';
813 for (p0 = SDATA (pattern); *p0; p0++) 813 for (p0 = SDATA (pattern); *p0; p0++)
814 { 814 {
815 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 815 if (*p0 == '*')
816 { 816 {
817 if (ndashes < 14) 817 if (ndashes < 14)
818 *p1++ = '.'; 818 *p1++ = '.';
@@ -836,29 +836,33 @@ fontset_pattern_regexp (pattern)
836} 836}
837 837
838/* Return ID of the base fontset named NAME. If there's no such 838/* Return ID of the base fontset named NAME. If there's no such
839 fontset, return -1. */ 839 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
840 0: pattern containing '*' and '?' as wildcards
841 1: regular expression
842 2: literal fontset name
843*/
840 844
841int 845int
842fs_query_fontset (name, regexpp) 846fs_query_fontset (name, name_pattern)
843 Lisp_Object name; 847 Lisp_Object name;
844 int regexpp; 848 int name_pattern;
845{ 849{
846 Lisp_Object tem; 850 Lisp_Object tem;
847 int i; 851 int i;
848 852
849 name = Fdowncase (name); 853 name = Fdowncase (name);
850 if (!regexpp) 854 if (name_pattern != 1)
851 { 855 {
852 tem = Frassoc (name, Vfontset_alias_alist); 856 tem = Frassoc (name, Vfontset_alias_alist);
853 if (CONSP (tem) && STRINGP (XCAR (tem))) 857 if (CONSP (tem) && STRINGP (XCAR (tem)))
854 name = XCAR (tem); 858 name = XCAR (tem);
855 else 859 else if (name_pattern == 0)
856 { 860 {
857 tem = fontset_pattern_regexp (name); 861 tem = fontset_pattern_regexp (name);
858 if (STRINGP (tem)) 862 if (STRINGP (tem))
859 { 863 {
860 name = tem; 864 name = tem;
861 regexpp = 1; 865 name_pattern = 1;
862 } 866 }
863 } 867 }
864 } 868 }
@@ -873,7 +877,7 @@ fs_query_fontset (name, regexpp)
873 continue; 877 continue;
874 878
875 this_name = FONTSET_NAME (fontset); 879 this_name = FONTSET_NAME (fontset);
876 if (regexpp 880 if (name_pattern == 1
877 ? fast_string_match (name, this_name) >= 0 881 ? fast_string_match (name, this_name) >= 0
878 : !strcmp (SDATA (name), SDATA (this_name))) 882 : !strcmp (SDATA (name), SDATA (this_name)))
879 return i; 883 return i;
@@ -964,6 +968,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
964{ 968{
965 Lisp_Object fontset, elements, ascii_font; 969 Lisp_Object fontset, elements, ascii_font;
966 Lisp_Object tem, tail, elt; 970 Lisp_Object tem, tail, elt;
971 int id;
967 972
968 (*check_window_system_func) (); 973 (*check_window_system_func) ();
969 974
@@ -971,10 +976,14 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
971 CHECK_LIST (fontlist); 976 CHECK_LIST (fontlist);
972 977
973 name = Fdowncase (name); 978 name = Fdowncase (name);
974 tem = Fquery_fontset (name, Qnil); 979 id = fs_query_fontset (name, 2);
975 if (!NILP (tem)) 980 if (id >= 0)
976 error ("Fontset `%s' matches the existing fontset `%s'", 981 {
977 SDATA (name), SDATA (tem)); 982 fontset = FONTSET_FROM_ID (id);
983 tem = FONTSET_NAME (fontset);
984 error ("Fontset `%s' matches the existing fontset `%s'",
985 SDATA (name), SDATA (tem));
986 }
978 987
979 /* Check the validity of FONTLIST while creating a template for 988 /* Check the validity of FONTLIST while creating a template for
980 fontset elements. */ 989 fontset elements. */
@@ -1049,7 +1058,11 @@ check_fontset_name (name)
1049 return Vdefault_fontset; 1058 return Vdefault_fontset;
1050 1059
1051 CHECK_STRING (name); 1060 CHECK_STRING (name);
1052 id = fs_query_fontset (name, 0); 1061 /* First try NAME as literal. */
1062 id = fs_query_fontset (name, 2);
1063 if (id < 0)
1064 /* For backward compatibility, try again NAME as pattern. */
1065 id = fs_query_fontset (name, 0);
1053 if (id < 0) 1066 if (id < 0)
1054 error ("Fontset `%s' does not exist", SDATA (name)); 1067 error ("Fontset `%s' does not exist", SDATA (name));
1055 return FONTSET_FROM_ID (id); 1068 return FONTSET_FROM_ID (id);