654 |
struct face *face; |
struct face *face; |
655 |
{ |
{ |
656 |
Lisp_Object fontset; |
Lisp_Object fontset; |
657 |
Lisp_Object list, elt; |
Lisp_Object list, elt, fullname; |
658 |
int size = 0; |
int size = 0; |
659 |
struct font_info *fontp; |
struct font_info *fontp; |
660 |
int charset = CHAR_CHARSET (c); |
int charset = CHAR_CHARSET (c); |
700 |
font_info structure that are not set by (*load_font_func). */ |
font_info structure that are not set by (*load_font_func). */ |
701 |
fontp->charset = charset; |
fontp->charset = charset; |
702 |
|
|
703 |
|
fullname = build_string (fontp->full_name); |
704 |
fontp->vertical_centering |
fontp->vertical_centering |
705 |
= (STRINGP (Vvertical_centering_font_regexp) |
= (STRINGP (Vvertical_centering_font_regexp) |
706 |
&& (fast_c_string_match_ignore_case |
&& (fast_string_match_ignore_case |
707 |
(Vvertical_centering_font_regexp, fontp->full_name) >= 0)); |
(Vvertical_centering_font_regexp, fullname) >= 0)); |
708 |
|
|
709 |
if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED) |
if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED) |
710 |
{ |
{ |
721 |
/* The font itself doesn't have information about encoding. */ |
/* The font itself doesn't have information about encoding. */ |
722 |
int i; |
int i; |
723 |
|
|
|
fontname = fontp->full_name; |
|
724 |
/* By default, encoding of ASCII chars is 0 (i.e. 0x00..0x7F), |
/* By default, encoding of ASCII chars is 0 (i.e. 0x00..0x7F), |
725 |
others is 1 (i.e. 0x80..0xFF). */ |
others is 1 (i.e. 0x80..0xFF). */ |
726 |
fontp->encoding[0] = 0; |
fontp->encoding[0] = 0; |
732 |
elt = XCAR (list); |
elt = XCAR (list); |
733 |
if (CONSP (elt) |
if (CONSP (elt) |
734 |
&& STRINGP (XCAR (elt)) && CONSP (XCDR (elt)) |
&& STRINGP (XCAR (elt)) && CONSP (XCDR (elt)) |
735 |
&& (fast_c_string_match_ignore_case (XCAR (elt), fontname) |
&& (fast_string_match_ignore_case (XCAR (elt), fullname) >= 0)) |
|
>= 0)) |
|
736 |
{ |
{ |
737 |
Lisp_Object tmp; |
Lisp_Object tmp; |
738 |
|
|
789 |
|| strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) |
|| strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) |
790 |
{ |
{ |
791 |
/* We must at first update the cached data. */ |
/* We must at first update the cached data. */ |
792 |
char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3); |
char *regex, *p0, *p1; |
793 |
char *p0, *p1 = regex; |
int ndashes = 0, nstars = 0; |
794 |
|
|
795 |
|
for (p0 = SDATA (pattern); *p0; p0++) |
796 |
|
{ |
797 |
|
if (*p0 == '-') |
798 |
|
ndashes++; |
799 |
|
else if (*p0 == '*') |
800 |
|
nstars++; |
801 |
|
} |
802 |
|
|
803 |
|
/* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise |
804 |
|
we convert "*" to "[^-]*" which is much faster in regular |
805 |
|
expression matching. */ |
806 |
|
if (ndashes < 14) |
807 |
|
p1 = regex = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1); |
808 |
|
else |
809 |
|
p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1); |
810 |
|
|
|
/* Convert "*" to ".*", "?" to ".". */ |
|
811 |
*p1++ = '^'; |
*p1++ = '^'; |
812 |
for (p0 = (char *) SDATA (pattern); *p0; p0++) |
for (p0 = (char *) SDATA (pattern); *p0; p0++) |
813 |
{ |
{ |
814 |
if (*p0 == '*') |
if (*p0 == '*') |
815 |
{ |
{ |
816 |
*p1++ = '.'; |
if (ndashes < 14) |
817 |
|
*p1++ = '.'; |
818 |
|
else |
819 |
|
*p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']'; |
820 |
*p1++ = '*'; |
*p1++ = '*'; |
821 |
} |
} |
822 |
else if (*p0 == '?') |
else if (*p0 == '?') |
864 |
|
|
865 |
for (i = 0; i < ASIZE (Vfontset_table); i++) |
for (i = 0; i < ASIZE (Vfontset_table); i++) |
866 |
{ |
{ |
867 |
Lisp_Object fontset; |
Lisp_Object fontset, this_name; |
|
const unsigned char *this_name; |
|
868 |
|
|
869 |
fontset = FONTSET_FROM_ID (i); |
fontset = FONTSET_FROM_ID (i); |
870 |
if (NILP (fontset) |
if (NILP (fontset) |
871 |
|| !BASE_FONTSET_P (fontset)) |
|| !BASE_FONTSET_P (fontset)) |
872 |
continue; |
continue; |
873 |
|
|
874 |
this_name = SDATA (FONTSET_NAME (fontset)); |
this_name = FONTSET_NAME (fontset); |
875 |
if (regexpp |
if (regexpp |
876 |
? fast_c_string_match_ignore_case (name, this_name) >= 0 |
? fast_string_match (name, this_name) >= 0 |
877 |
: !strcmp (SDATA (name), this_name)) |
: !strcmp (SDATA (name), SDATA (this_name))) |
878 |
return i; |
return i; |
879 |
} |
} |
880 |
return -1; |
return -1; |
928 |
|
|
929 |
for (id = 0; id < ASIZE (Vfontset_table); id++) |
for (id = 0; id < ASIZE (Vfontset_table); id++) |
930 |
{ |
{ |
931 |
Lisp_Object fontset; |
Lisp_Object fontset, name; |
|
const unsigned char *name; |
|
932 |
|
|
933 |
fontset = FONTSET_FROM_ID (id); |
fontset = FONTSET_FROM_ID (id); |
934 |
if (NILP (fontset) |
if (NILP (fontset) |
935 |
|| !BASE_FONTSET_P (fontset) |
|| !BASE_FONTSET_P (fontset) |
936 |
|| !EQ (frame, FONTSET_FRAME (fontset))) |
|| !EQ (frame, FONTSET_FRAME (fontset))) |
937 |
continue; |
continue; |
938 |
name = SDATA (FONTSET_NAME (fontset)); |
name = FONTSET_NAME (fontset); |
939 |
|
|
940 |
if (!NILP (regexp) |
if (!NILP (regexp) |
941 |
? (fast_c_string_match_ignore_case (regexp, name) < 0) |
? (fast_string_match (regexp, name) < 0) |
942 |
: strcmp (SDATA (pattern), name)) |
: strcmp (SDATA (pattern), SDATA (name))) |
943 |
continue; |
continue; |
944 |
|
|
945 |
if (size) |
if (size) |