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

Diff of /emacs/src/xfaces.c

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

revision 1.225.4.3 by gerd, Thu Nov 1 10:14:28 2001 UTC revision 1.225.4.4 by lektu, Mon Nov 11 07:34:18 2002 UTC
# Line 321  x_free_gc (f, gc) Line 321  x_free_gc (f, gc)
321    
322  #define FACE_CACHE_BUCKETS_SIZE 1001  #define FACE_CACHE_BUCKETS_SIZE 1001
323    
 /* A definition of XColor for non-X frames.  */  
   
 #ifndef HAVE_X_WINDOWS  
   
 typedef struct  
 {  
   unsigned long pixel;  
   unsigned short red, green, blue;  
   char flags;  
   char pad;  
 }  
 XColor;  
   
 #endif /* not HAVE_X_WINDOWS */  
   
324  /* Keyword symbols used for face attribute names.  */  /* Keyword symbols used for face attribute names.  */
325    
326  Lisp_Object QCfamily, QCheight, QCweight, QCslant, QCunderline;  Lisp_Object QCfamily, QCheight, QCweight, QCslant, QCunderline;
# Line 532  static int font_list_1 P_ ((struct frame Line 517  static int font_list_1 P_ ((struct frame
517                              Lisp_Object, struct font_name **));                              Lisp_Object, struct font_name **));
518  static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object,  static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object,
519                            Lisp_Object, struct font_name **));                            Lisp_Object, struct font_name **));
520  static int try_font_list P_ ((struct frame *, Lisp_Object *,  static int try_font_list P_ ((struct frame *, Lisp_Object *,
521                                Lisp_Object, Lisp_Object, struct font_name **));                                Lisp_Object, Lisp_Object, struct font_name **));
522  static int try_alternative_families P_ ((struct frame *f, Lisp_Object,  static int try_alternative_families P_ ((struct frame *f, Lisp_Object,
523                                           Lisp_Object, struct font_name **));                                           Lisp_Object, struct font_name **));
# Line 980  clear_face_cache (clear_fonts_p) Line 965  clear_face_cache (clear_fonts_p)
965        || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT)        || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT)
966      {      {
967        struct x_display_info *dpyinfo;        struct x_display_info *dpyinfo;
968          
969        /* Fonts are common for frames on one display, i.e. on        /* Fonts are common for frames on one display, i.e. on
970           one X screen.  */           one X screen.  */
971        for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)        for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
972          if (dpyinfo->n_fonts > CLEAR_FONT_TABLE_NFONTS)          if (dpyinfo->n_fonts > CLEAR_FONT_TABLE_NFONTS)
973            clear_font_table (dpyinfo);            clear_font_table (dpyinfo);
974          
975        /* From time to time see if we can unload some fonts.  This also        /* From time to time see if we can unload some fonts.  This also
976           frees all realized faces on all frames.  Fonts needed by           frees all realized faces on all frames.  Fonts needed by
977           faces will be loaded again when faces are realized again.  */           faces will be loaded again when faces are realized again.  */
# Line 2174  xlfd_point_size (f, font) Line 2159  xlfd_point_size (f, font)
2159      }      }
2160    else    else
2161      pixel = atoi (pixel_field);      pixel = atoi (pixel_field);
2162      
2163    if (pixel == 0)    if (pixel == 0)
2164      real_pt = 0;      real_pt = 0;
2165    else    else
# Line 2242  split_font_name (f, font, numeric_p) Line 2227  split_font_name (f, font, numeric_p)
2227              {              {
2228                char *start, *end;                char *start, *end;
2229                int j;                int j;
2230                  
2231                for (++p; *p && *p != ']'; ++p)                for (++p; *p && *p != ']'; ++p)
2232                  if (*p == '~')                  if (*p == '~')
2233                    *p = '-';                    *p = '-';
# Line 2625  concat_font_list (fonts1, nfonts1, fonts Line 2610  concat_font_list (fonts1, nfonts1, fonts
2610    
2611     If REGISTRY is non-nil, return fonts with that registry and the     If REGISTRY is non-nil, return fonts with that registry and the
2612     alternative registries from Vface_alternative_font_registry_alist.     alternative registries from Vface_alternative_font_registry_alist.
2613      
2614     If REGISTRY is nil return fonts of any registry.     If REGISTRY is nil return fonts of any registry.
2615    
2616     Set *FONTS to a vector of font_name structures allocated from the     Set *FONTS to a vector of font_name structures allocated from the
# Line 2639  font_list (f, pattern, family, registry, Line 2624  font_list (f, pattern, family, registry,
2624       struct font_name **fonts;       struct font_name **fonts;
2625  {  {
2626    int nfonts = font_list_1 (f, pattern, family, registry, fonts);    int nfonts = font_list_1 (f, pattern, family, registry, fonts);
2627      
2628    if (!NILP (registry)    if (!NILP (registry)
2629        && CONSP (Vface_alternative_font_registry_alist))        && CONSP (Vface_alternative_font_registry_alist))
2630      {      {
# Line 3103  lface_fully_specified_p (attrs) Line 3088  lface_fully_specified_p (attrs)
3088    for (i = 1; i < LFACE_VECTOR_SIZE; ++i)    for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
3089      if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX      if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX
3090          && i != LFACE_AVGWIDTH_INDEX)          && i != LFACE_AVGWIDTH_INDEX)
3091        if (UNSPECIFIEDP (attrs[i]))        if (UNSPECIFIEDP (attrs[i]))
3092          break;          break;
3093    
3094    return i == LFACE_VECTOR_SIZE;    return i == LFACE_VECTOR_SIZE;
# Line 4231  set_font_frame_param (frame, lface) Line 4216  set_font_frame_param (frame, lface)
4216      {      {
4217        Lisp_Object font_name;        Lisp_Object font_name;
4218        char *font;        char *font;
4219          
4220        if (STRINGP (LFACE_FONT (lface)))        if (STRINGP (LFACE_FONT (lface)))
4221          font_name = LFACE_FONT (lface);          font_name = LFACE_FONT (lface);
4222        else        else
# Line 4245  set_font_frame_param (frame, lface) Line 4230  set_font_frame_param (frame, lface)
4230            font_name = build_string (font);            font_name = build_string (font);
4231            xfree (font);            xfree (font);
4232          }          }
4233      
4234        Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font_name), Qnil));        Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font_name), Qnil));
4235      }      }
4236  }  }
# Line 4439  x_update_menu_appearance (f) Line 4424  x_update_menu_appearance (f)
4424  #else  #else
4425        const char *popup_path = "menu.popup";        const char *popup_path = "menu.popup";
4426  #endif  #endif
4427          
4428        if (STRINGP (LFACE_FOREGROUND (lface)))        if (STRINGP (LFACE_FOREGROUND (lface)))
4429          {          {
4430            sprintf (line, "%s.%s*foreground: %s",            sprintf (line, "%s.%s*foreground: %s",
# Line 4463  x_update_menu_appearance (f) Line 4448  x_update_menu_appearance (f)
4448            XrmPutLineResource (&rdb, line);            XrmPutLineResource (&rdb, line);
4449            changed_p = 1;            changed_p = 1;
4450          }          }
4451              
4452        if (face->font_name        if (face->font_name
4453            && (!UNSPECIFIEDP (LFACE_FAMILY (lface))            && (!UNSPECIFIEDP (LFACE_FAMILY (lface))
4454                || !UNSPECIFIEDP (LFACE_SWIDTH (lface))                || !UNSPECIFIEDP (LFACE_SWIDTH (lface))
# Line 5887  best_matching_font (f, attrs, fonts, nfo Line 5872  best_matching_font (f, attrs, fonts, nfo
5872     REGISTRY, if a string, specifies a font registry and encoding to     REGISTRY, if a string, specifies a font registry and encoding to
5873     match.  A value of nil means include fonts of any registry and     match.  A value of nil means include fonts of any registry and
5874     encoding.     encoding.
5875      
5876     Return in *FONTS a pointer to a vector of font_name structures for     Return in *FONTS a pointer to a vector of font_name structures for
5877     the fonts matched.  Value is the number of fonts found.  */     the fonts matched.  Value is the number of fonts found.  */
5878    
# Line 5915  try_alternative_families (f, family, reg Line 5900  try_alternative_families (f, family, reg
5900                  nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts);                  nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts);
5901              }              }
5902          }          }
5903          
5904        /* Try scalable fonts before giving up.  */        /* Try scalable fonts before giving up.  */
5905        if (nfonts == 0 && NILP (Vscalable_fonts_allowed))        if (nfonts == 0 && NILP (Vscalable_fonts_allowed))
5906          {          {
# Line 5938  try_alternative_families (f, family, reg Line 5923  try_alternative_families (f, family, reg
5923     REGISTRY, if a string, specifies a font registry and encoding to     REGISTRY, if a string, specifies a font registry and encoding to
5924     match.  A value of nil means include fonts of any registry and     match.  A value of nil means include fonts of any registry and
5925     encoding.     encoding.
5926      
5927     Return in *FONTS a pointer to a vector of font_name structures for     Return in *FONTS a pointer to a vector of font_name structures for
5928     the fonts matched.  Value is the number of fonts found.  */     the fonts matched.  Value is the number of fonts found.  */
5929    
# Line 5968  try_font_list (f, attrs, family, registr Line 5953  try_font_list (f, attrs, family, registr
5953          family = build_string ("fixed");          family = build_string ("fixed");
5954        nfonts = font_list (f, Qnil, family, registry, fonts);        nfonts = font_list (f, Qnil, family, registry, fonts);
5955      }      }
5956          
5957    /* Try any family with the given registry.  */    /* Try any family with the given registry.  */
5958    if (nfonts == 0)    if (nfonts == 0)
5959      nfonts = font_list (f, Qnil, Qnil, registry, fonts);      nfonts = font_list (f, Qnil, Qnil, registry, fonts);
# Line 6022  choose_face_font (f, attrs, fontset, c) Line 6007  choose_face_font (f, attrs, fontset, c)
6007        xassert (!SINGLE_BYTE_CHAR_P (c));        xassert (!SINGLE_BYTE_CHAR_P (c));
6008        return NULL;        return NULL;
6009      }      }
6010      
6011    /* If what we got is a name pattern, return it.  */    /* If what we got is a name pattern, return it.  */
6012    if (STRINGP (pattern))    if (STRINGP (pattern))
6013      return xstrdup (XSTRING (pattern)->data);      return xstrdup (XSTRING (pattern)->data);
# Line 6081  realize_basic_faces (f) Line 6066  realize_basic_faces (f)
6066            x_update_menu_appearance (f);            x_update_menu_appearance (f);
6067  #endif  #endif
6068          }          }
6069          
6070        success_p = 1;        success_p = 1;
6071      }      }
6072    
# Line 6535  map_tty_color (f, face, idx, defaulted) Line 6520  map_tty_color (f, face, idx, defaulted)
6520        pixel = default_pixel = FACE_TTY_DEFAULT_BG_COLOR;        pixel = default_pixel = FACE_TTY_DEFAULT_BG_COLOR;
6521        default_other_pixel = FACE_TTY_DEFAULT_FG_COLOR;        default_other_pixel = FACE_TTY_DEFAULT_FG_COLOR;
6522      }      }
6523      
6524    XSETFRAME (frame, f);    XSETFRAME (frame, f);
6525    color = face->lface[idx];    color = face->lface[idx];
6526      
6527    if (STRINGP (color)    if (STRINGP (color)
6528        && XSTRING (color)->size        && XSTRING (color)->size
6529        && CONSP (Vtty_defined_color_alist)        && CONSP (Vtty_defined_color_alist)
# Line 6633  realize_tty_face (cache, attrs, c) Line 6618  realize_tty_face (cache, attrs, c)
6618    /* Map color names to color indices.  */    /* Map color names to color indices.  */
6619    map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted);    map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted);
6620    map_tty_color (f, face, LFACE_BACKGROUND_INDEX, &face_colors_defaulted);    map_tty_color (f, face, LFACE_BACKGROUND_INDEX, &face_colors_defaulted);
6621      
6622    /* Swap colors if face is inverse-video.  If the colors are taken    /* Swap colors if face is inverse-video.  If the colors are taken
6623       from the frame colors, they are already inverted, since the       from the frame colors, they are already inverted, since the
6624       frame-creation function calls x-handle-reverse-video.  */       frame-creation function calls x-handle-reverse-video.  */

Legend:
Removed from v.1.225.4.3  
changed lines
  Added in v.1.225.4.4

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