summaryrefslogtreecommitdiff
path: root/src/fontset.c
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2004-11-13 18:34:40 +0000
committerKaroly Lorentey <lorentey@elte.hu>2004-11-13 18:34:40 +0000
commite417405015c93c81641f5c4a33ec898b5c353772 (patch)
tree017a980c35c8a71c372304418d151e3826f88636 /src/fontset.c
parentf590a2a442d19f3a74d7bbd02bbcb4e3239f2327 (diff)
parent68d1b30d251b4771f739d20f507cd9523ae3919b (diff)
downloademacs-e417405015c93c81641f5c4a33ec898b5c353772.tar.gz
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)
{
if (*p0 == '-')
ndashes++;
- else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
+ else if (*p0 == '*')
nstars++;
}
@@ -812,7 +812,7 @@ fontset_pattern_regexp (pattern)
*p1++ = '^';
for (p0 = SDATA (pattern); *p0; p0++)
{
- if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
+ if (*p0 == '*')
{
if (ndashes < 14)
*p1++ = '.';
@@ -836,29 +836,33 @@ fontset_pattern_regexp (pattern)
}
/* Return ID of the base fontset named NAME. If there's no such
- fontset, return -1. */
+ fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
+ 0: pattern containing '*' and '?' as wildcards
+ 1: regular expression
+ 2: literal fontset name
+*/
int
-fs_query_fontset (name, regexpp)
+fs_query_fontset (name, name_pattern)
Lisp_Object name;
- int regexpp;
+ int name_pattern;
{
Lisp_Object tem;
int i;
name = Fdowncase (name);
- if (!regexpp)
+ if (name_pattern != 1)
{
tem = Frassoc (name, Vfontset_alias_alist);
if (CONSP (tem) && STRINGP (XCAR (tem)))
name = XCAR (tem);
- else
+ else if (name_pattern == 0)
{
tem = fontset_pattern_regexp (name);
if (STRINGP (tem))
{
name = tem;
- regexpp = 1;
+ name_pattern = 1;
}
}
}
@@ -873,7 +877,7 @@ fs_query_fontset (name, regexpp)
continue;
this_name = FONTSET_NAME (fontset);
- if (regexpp
+ if (name_pattern == 1
? fast_string_match (name, this_name) >= 0
: !strcmp (SDATA (name), SDATA (this_name)))
return i;
@@ -964,6 +968,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
{
Lisp_Object fontset, elements, ascii_font;
Lisp_Object tem, tail, elt;
+ int id;
(*check_window_system_func) ();
@@ -971,10 +976,14 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
CHECK_LIST (fontlist);
name = Fdowncase (name);
- tem = Fquery_fontset (name, Qnil);
- if (!NILP (tem))
- error ("Fontset `%s' matches the existing fontset `%s'",
- SDATA (name), SDATA (tem));
+ id = fs_query_fontset (name, 2);
+ if (id >= 0)
+ {
+ fontset = FONTSET_FROM_ID (id);
+ tem = FONTSET_NAME (fontset);
+ error ("Fontset `%s' matches the existing fontset `%s'",
+ SDATA (name), SDATA (tem));
+ }
/* Check the validity of FONTLIST while creating a template for
fontset elements. */
@@ -1049,7 +1058,11 @@ check_fontset_name (name)
return Vdefault_fontset;
CHECK_STRING (name);
- id = fs_query_fontset (name, 0);
+ /* First try NAME as literal. */
+ id = fs_query_fontset (name, 2);
+ if (id < 0)
+ /* For backward compatibility, try again NAME as pattern. */
+ id = fs_query_fontset (name, 0);
if (id < 0)
error ("Fontset `%s' does not exist", SDATA (name));
return FONTSET_FROM_ID (id);