/* xfaces.c -- "Face" primitives.
Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Emacs.
(family, frame)
Lisp_Object family, frame;
{
- Lisp_Object font_spec, vec;
- int i, nfonts;
+ Lisp_Object font_spec, list, *drivers, vec;
+ int i, nfonts, ndrivers;
Lisp_Object result;
if (NILP (frame))
CHECK_STRING (family);
font_parse_family_registry (family, Qnil, font_spec);
}
- vec = font_list_entities (frame, font_spec);
- nfonts = ASIZE (vec);
- if (nfonts == 0)
+
+ list = font_list_entities (frame, font_spec);
+ if (NILP (list))
return Qnil;
- if (nfonts > 1)
- {
- for (i = 0; i < 4; i++)
- switch (font_sort_order[i])
- {
- case XLFD_SWIDTH:
- font_props_for_sorting[i] = FONT_WIDTH_INDEX; break;
- case XLFD_POINT_SIZE:
- font_props_for_sorting[i] = FONT_SIZE_INDEX; break;
- case XLFD_WEIGHT:
- font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break;
- default:
- font_props_for_sorting[i] = FONT_SLANT_INDEX; break;
- }
- font_props_for_sorting[i++] = FONT_FAMILY_INDEX;
- font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX;
- font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX;
- font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
- qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object),
- compare_fonts_by_sort_order);
- }
+ /* Sort the font entities. */
+ for (i = 0; i < 4; i++)
+ switch (font_sort_order[i])
+ {
+ case XLFD_SWIDTH:
+ font_props_for_sorting[i] = FONT_WIDTH_INDEX; break;
+ case XLFD_POINT_SIZE:
+ font_props_for_sorting[i] = FONT_SIZE_INDEX; break;
+ case XLFD_WEIGHT:
+ font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break;
+ default:
+ font_props_for_sorting[i] = FONT_SLANT_INDEX; break;
+ }
+ font_props_for_sorting[i++] = FONT_FAMILY_INDEX;
+ font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX;
+ font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX;
+ font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
+
+ ndrivers = XINT (Flength (list));
+ drivers = alloca (sizeof (Lisp_Object) * ndrivers);
+ for (i = 0; i < ndrivers; i++, list = XCDR (list))
+ drivers[i] = XCAR (list);
+ vec = Fvconcat (ndrivers, drivers);
+ nfonts = ASIZE (vec);
+
+ qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object),
+ compare_fonts_by_sort_order);
result = Qnil;
for (i = nfonts - 1; i >= 0; --i)
DEFUN ("internal-lisp-face-p", Finternal_lisp_face_p,
Sinternal_lisp_face_p, 1, 2, 0,
doc: /* Return non-nil if FACE names a face.
+FACE should be a symbol or string.
If optional second argument FRAME is non-nil, check for the
existence of a frame-local face with name FACE on that frame.
Otherwise check for the existence of a global face. */)
return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
- case Lisp_Int:
+ case_Lisp_Int:
case Lisp_Symbol:
return 0;
This stipple pattern is used on monochrome displays
instead of shades of gray for a face background color.
See `set-face-stipple' for possible values for this variable. */);
- Vface_default_stipple = build_string ("gray3");
+ Vface_default_stipple = make_pure_c_string ("gray3");
DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist,
doc: /* An alist of defined terminal colors and their RGB values. */);