/* xfaces.c -- "Face" primitives.
-Copyright (C) 1993-1994, 1998-2011 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 1998-2012 Free Software Foundation, Inc.
This file is part of GNU Emacs.
1. Font family name.
- 2. Font foundary name.
+ 2. Font foundry name.
3. Relative proportionate width, aka character set width or set
width (swidth), e.g. `semi-compressed'.
attributes (1st thru 5th) are updated from the spec.
On the other hand, if one of the other font-related attributes are
- specified, the correspoinding specs in this attribute is set to nil.
+ specified, the corresponding specs in this attribute is set to nil.
15. A face name or list of face names from which to inherit attributes.
int gray_p;
if (defined_color (f, color_name, &color, 0))
- gray_p = (/* Any color sufficiently close to black counts as grey. */
+ gray_p = (/* Any color sufficiently close to black counts as gray. */
(color.red < 5000 && color.green < 5000 && color.blue < 5000)
||
((eabs (color.red - color.green)
}
else if (EQ (keyword, QCstipple))
{
-#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
Lisp_Object pixmap_p = Fbitmap_spec_p (value);
if (!NILP (pixmap_p))
to[LFACE_STIPPLE_INDEX] = value;
}
else if (EQ (attr, QCstipple))
{
-#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)
&& !NILP (value)
&& NILP (Fbitmap_spec_p (value)))
/* Changing the background color might change the background
mode, so that we have to load new defface specs.
- Call frame-update-face-colors to do that. */
+ Call frame-set-background-mode to do that. */
XSETFRAME (frame, f);
call1 (Qframe_set_background_mode, frame);
rdb != NULL))
{
char line[512];
+ char *buf = line;
+ ptrdiff_t bufsize = sizeof line;
Lisp_Object lface = lface_from_face_name (f, Qmenu, 1);
struct face *face = FACE_FROM_ID (f, MENU_FACE_ID);
const char *myname = SSDATA (Vx_resource_name);
if (STRINGP (LFACE_FOREGROUND (lface)))
{
- sprintf (line, "%s.%s*foreground: %s",
- myname, popup_path,
- SDATA (LFACE_FOREGROUND (lface)));
+ exprintf (&buf, &bufsize, line, -1, "%s.%s*foreground: %s",
+ myname, popup_path,
+ SDATA (LFACE_FOREGROUND (lface)));
XrmPutLineResource (&rdb, line);
- sprintf (line, "%s.pane.menubar*foreground: %s",
- myname, SDATA (LFACE_FOREGROUND (lface)));
+ exprintf (&buf, &bufsize, line, -1, "%s.pane.menubar*foreground: %s",
+ myname, SDATA (LFACE_FOREGROUND (lface)));
XrmPutLineResource (&rdb, line);
changed_p = 1;
}
if (STRINGP (LFACE_BACKGROUND (lface)))
{
- sprintf (line, "%s.%s*background: %s",
- myname, popup_path,
- SDATA (LFACE_BACKGROUND (lface)));
+ exprintf (&buf, &bufsize, line, -1, "%s.%s*background: %s",
+ myname, popup_path,
+ SDATA (LFACE_BACKGROUND (lface)));
XrmPutLineResource (&rdb, line);
- sprintf (line, "%s.pane.menubar*background: %s",
- myname, SDATA (LFACE_BACKGROUND (lface)));
+
+ exprintf (&buf, &bufsize, line, -1, "%s.pane.menubar*background: %s",
+ myname, SDATA (LFACE_BACKGROUND (lface)));
XrmPutLineResource (&rdb, line);
changed_p = 1;
}
#else
char *fontsetname = SSDATA (xlfd);
#endif
- sprintf (line, "%s.pane.menubar*font%s: %s",
- myname, suffix, fontsetname);
+ exprintf (&buf, &bufsize, line, -1, "%s.pane.menubar*font%s: %s",
+ myname, suffix, fontsetname);
XrmPutLineResource (&rdb, line);
- sprintf (line, "%s.%s*font%s: %s",
- myname, popup_path, suffix, fontsetname);
+
+ exprintf (&buf, &bufsize, line, -1, "%s.%s*font%s: %s",
+ myname, popup_path, suffix, fontsetname);
XrmPutLineResource (&rdb, line);
changed_p = 1;
if (fontsetname != SSDATA (xlfd))
if (changed_p && f->output_data.x->menubar_widget)
free_frame_menubar (f);
+
+ if (buf != line)
+ xfree (buf);
}
}
static int
color_distance (XColor *x, XColor *y)
{
- /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma.
+ /* This formula is from a paper titled `Colour metric' by Thiadmer Riemersma.
Quoting from that paper:
This formula has results that are very close to L*u*v* (with the
modified lightness curve) and, more importantly, it is a more even
- algorithm: it does not have a range of colours where it suddenly
+ algorithm: it does not have a range of colors where it suddenly
gives far from optimal results.
See <http://www.compuphase.com/cmetric.htm> for more info. */
doc: /* Alist of face remappings.
Each element is of the form:
- (FACE REPLACEMENT...),
+ (FACE . REPLACEMENT),
+
+which causes display of the face FACE to use REPLACEMENT instead.
+REPLACEMENT is a face specification, i.e. one of the following:
-which causes display of the face FACE to use REPLACEMENT... instead.
-REPLACEMENT... is interpreted the same way as the value of a `face'
-text property: it may be (1) A face name, (2) A list of face names,
-(3) A property-list of face attribute/value pairs, or (4) A list of
-face names or lists containing face attribute/value pairs.
+ (1) a face name
+ (2) a property list of attribute/value pairs, or
+ (3) a list in which each element has the form of (1) or (2).
-Multiple entries in REPLACEMENT... are merged together to form the final
-result, with faces or attributes earlier in the list taking precedence
-over those that are later.
+List values for REPLACEMENT are merged to form the final face
+specification, with earlier entries taking precedence, in the same as
+as in the `face' text property.
-Face-name remapping cycles are suppressed; recursive references use the
-underlying face instead of the remapped face. So a remapping of the form:
+Face-name remapping cycles are suppressed; recursive references use
+the underlying face instead of the remapped face. So a remapping of
+the form:
(FACE EXTRA-FACE... FACE)
(FACE (FACE-ATTR VAL ...) FACE)
-will cause EXTRA-FACE... or (FACE-ATTR VAL ...) to be _merged_ with the
-existing definition of FACE. Note that for the default face, this isn't
-necessary, as every face inherits from the default face.
+causes EXTRA-FACE... or (FACE-ATTR VAL ...) to be _merged_ with the
+existing definition of FACE. Note that this isn't necessary for the
+default face, since every face inherits from the default face.
-Making this variable buffer-local is a good way to allow buffer-specific
-face definitions. For instance, the mode my-mode could define a face
-`my-mode-default', and then in the mode setup function, do:
+If this variable is made buffer-local, the face remapping takes effect
+only in that buffer. For instance, the mode my-mode could define a
+face `my-mode-default', and then in the mode setup function, do:
(set (make-local-variable 'face-remapping-alist)
'((default my-mode-default)))).