/[emacs]/emacs/src/fontset.c
ViewVC logotype

Diff of /emacs/src/fontset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.67.2.7 by miles, Tue Jul 6 10:27:00 2004 UTC revision 1.67.2.8 by miles, Mon Oct 25 04:22:26 2004 UTC
# Line 654  fs_load_font (f, c, fontname, id, face) Line 654  fs_load_font (f, c, fontname, id, face)
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);
# Line 700  fs_load_font (f, c, fontname, id, face) Line 700  fs_load_font (f, c, fontname, id, face)
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      {      {
# Line 720  fs_load_font (f, c, fontname, id, face) Line 721  fs_load_font (f, c, fontname, id, face)
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;
# Line 732  fs_load_font (f, c, fontname, id, face) Line 732  fs_load_font (f, c, fontname, id, face)
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    
# Line 790  fontset_pattern_regexp (pattern) Line 789  fontset_pattern_regexp (pattern)
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 == '?')
# Line 847  fs_query_fontset (name, regexpp) Line 864  fs_query_fontset (name, regexpp)
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;
# Line 912  list_fontsets (f, pattern, size) Line 928  list_fontsets (f, pattern, size)
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)

Legend:
Removed from v.1.67.2.7  
changed lines
  Added in v.1.67.2.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26