/* xfaces.c -- "Face" primitives.
Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "termchar.h"
#ifdef HAVE_WINDOW_SYSTEM
-#ifdef USE_FONT_BACKEND
#include "font.h"
-#endif /* USE_FONT_BACKEND */
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_X_WINDOWS
/* Make the image cache. */
if (FRAME_WINDOW_P (f))
{
- if (FRAME_X_IMAGE_CACHE (f) == NULL)
- FRAME_X_IMAGE_CACHE (f) = make_image_cache ();
- ++FRAME_X_IMAGE_CACHE (f)->refcount;
+ if (FRAME_IMAGE_CACHE (f) == NULL)
+ /* Is that ever possible?? --Stef */
+ FRAME_IMAGE_CACHE (f) = make_image_cache ();
+ ++FRAME_IMAGE_CACHE (f)->refcount;
}
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f))
{
- struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f);
+ struct image_cache *image_cache = FRAME_IMAGE_CACHE (f);
if (image_cache)
{
--image_cache->refcount;
{
f = XFRAME (frame);
if (FRAME_WINDOW_P (f))
- {
clear_face_gcs (FRAME_FACE_CACHE (f));
- clear_image_cache (f, 0);
- }
}
+ clear_image_caches (Qnil);
}
#endif /* HAVE_WINDOW_SYSTEM */
}
if (idx == FACE_TTY_DEFAULT_BG_COLOR)
return build_string (unspecified_bg);
-#ifdef WINDOWSNT
- return vga_stdcolor_name (idx);
-#endif
-
return Qunspecified;
}
LFACE_SWIDTH (lface) = ! NILP (val) ? val : width;
}
- LFACE_FONT (lface) = font_object;
+ LFACE_FONT (lface) = make_unibyte_string (font->font.full_name,
+ strlen (font->font.full_name));
LFACE_FONTSET (lface) = fontset_name (fontset);
}
#endif /* USE_FONT_BACKEND */
{
global_lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
Qunspecified);
- AREF (global_lface, 0) = Qface;
+ ASET (global_lface, 0, Qface);
Vface_new_frame_defaults = Fcons (Fcons (face, global_lface),
Vface_new_frame_defaults);
}
else if (f == NULL)
for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
- AREF (global_lface, i) = Qunspecified;
+ ASET (global_lface, i, Qunspecified);
/* Add a frame-local definition. */
if (f)
{
lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
Qunspecified);
- AREF (lface, 0) = Qface;
+ ASET (lface, 0, Qface);
f->face_alist = Fcons (Fcons (face, lface), f->face_alist);
}
else
for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
- AREF (lface, i) = Qunspecified;
+ ASET (lface, i, Qunspecified);
}
else
lface = global_lface;
if (enable_font_backend
&& !UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
{
- int fontset;
-
+ tmp = Fquery_fontset (value, Qnil);
if (EQ (attr, QCfontset))
{
- Lisp_Object fontset_name = Fquery_fontset (value, Qnil);
-
- if (NILP (fontset_name))
+ if (NILP (tmp))
signal_error ("Invalid fontset name", value);
- LFACE_FONTSET (lface) = value;
+ LFACE_FONTSET (lface) = tmp;
}
else
{
+ int fontset;
Lisp_Object font_object;
- if (FONT_OBJECT_P (value))
+ if (! NILP (tmp))
{
- font_object = value;
- fontset = FRAME_FONTSET (f);
+ fontset = fs_query_fontset (tmp, 0);
+ value = fontset_ascii (fontset);
}
else
{
- CHECK_STRING (value);
-
- fontset = fs_query_fontset (value, 0);
- if (fontset >= 0)
- value = fontset_ascii (fontset);
- else
- fontset = FRAME_FONTSET (f);
- font_object = font_open_by_name (f, SDATA (value));
- if (NILP (font_object))
- signal_error ("Invalid font", value);
+ fontset = FRAME_FONTSET (f);
}
+ font_object = font_open_by_name (f, SDATA (value));
+ if (NILP (font_object))
+ signal_error ("Invalid font", value);
set_lface_from_font_and_fontset (f, lface, font_object,
fontset, 1);
}
return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX])
^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX])
- ^ XFASTINT (v[LFACE_WEIGHT_INDEX])
- ^ XFASTINT (v[LFACE_SLANT_INDEX])
- ^ XFASTINT (v[LFACE_SWIDTH_INDEX])
- ^ XFASTINT (v[LFACE_HEIGHT_INDEX]));
+ ^ XHASH (v[LFACE_WEIGHT_INDEX])
+ ^ XHASH (v[LFACE_SLANT_INDEX])
+ ^ XHASH (v[LFACE_SWIDTH_INDEX])
+ ^ XHASH (v[LFACE_HEIGHT_INDEX]));
}
if (face->font)
{
#ifdef HAVE_X_WINDOWS
+#ifdef USE_FONT_BACKEND
+ if (enable_font_backend)
+ xgcv.font = FRAME_X_DISPLAY_INFO (f)->font->fid;
+ else
+#endif
xgcv.font = face->font->fid;
#endif
#ifdef WINDOWSNT
}
#ifdef USE_FONT_BACKEND
- font_update_sort_order (font_sort_order);
+ if (enable_font_backend)
+ font_update_sort_order (font_sort_order);
#endif /* USE_FONT_BACKEND */
return Qnil;
(if specified).
When we are choosing a font for ASCII characters, FONT-SPEC is
- always nil. Otherwise FONT-SPEC is a list
- [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ]
- or a string specifying a font name pattern.
+ always nil. Otherwise FONT-SPEC is an object created by
+ `font-spec' or a string specifying a font name pattern.
If NEEDS_OVERSTRIKE is not NULL, a boolean is returned in it to
indicate whether the resulting font should be drawn using
if (VECTORP (font_spec))
{
pattern = Qnil;
- if (STRINGP (AREF (font_spec, FONT_SPEC_FAMILY_INDEX)))
- family = Fcons (AREF (font_spec, FONT_SPEC_FAMILY_INDEX), family);
- adstyle = AREF (font_spec, FONT_SPEC_ADSTYLE_INDEX);
- registry = Fcons (AREF (font_spec, FONT_SPEC_REGISTRY_INDEX), Qnil);
+ if (! NILP (AREF (font_spec, FONT_FAMILY_INDEX)))
+ family = Fcons (SYMBOL_NAME (AREF (font_spec, FONT_FAMILY_INDEX)),
+ family);
+ adstyle = AREF (font_spec, FONT_ADSTYLE_INDEX);
+ registry = Fcons (SYMBOL_NAME (AREF (font_spec, FONT_REGISTRY_INDEX)),
+ Qnil);
}
else if (STRINGP (font_spec))
{
face->gc = 0;
#ifdef USE_FONT_BACKEND
face->extra = NULL;
-#endif
+#endif /* USE_FONT_BACKEND */
/* Don't try to free the colors copied bitwise from BASE_FACE. */
face->colors_copied_bitwise_p = 1;
face->font = default_face->font;
face->font_info_id = default_face->font_info_id;
#ifdef USE_FONT_BACKEND
- face->font_info = default_face->font_info;
+ if (enable_font_backend)
+ face->font_info = default_face->font_info;
#endif /* USE_FONT_BACKEND */
face->font_name = default_face->font_name;
face->fontset
font_load_for_face (f, face);
else
#endif /* USE_FONT_BACKEND */
- load_face_font (f, face);
+ load_face_font (f, face);
if (face->font)
face->fontset = make_fontset_for_ascii_face (f, fontset, face);
else
{
pixel = load_color (f, face, color, idx);
-#if defined (MSDOS) || defined (WINDOWSNT)
+#ifdef MSDOS
/* If the foreground of the default face is the default color,
use the foreground color defined by the frame. */
-#ifdef MSDOS
if (FRAME_MSDOS_P (f))
{
-#endif /* MSDOS */
if (pixel == default_pixel
|| pixel == FACE_TTY_DEFAULT_COLOR)
{
face->lface[idx] = tty_color_name (f, pixel);
*defaulted = 1;
}
-#ifdef MSDOS
- }
-#endif
-#endif /* MSDOS or WINDOWSNT */
+ }
+#endif /* MSDOS */
}
if (foreground_p)
/* Look at properties from overlays. */
{
- int next_overlay;
+ EMACS_INT next_overlay;
GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0);
if (next_overlay < endpos)
struct frame *f = XFRAME (w->frame);
Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object prop, position;
- int i, noverlays;
- Lisp_Object *overlay_vec;
Lisp_Object frame;
int endpos;
Lisp_Object propname = mouse ? Qmouse_face : Qface;