/* This is of limited utility since it works with character
widths. Keep it for compatibility. --gerd. */
int face_id = lookup_named_face (f, face, false);
- struct face *width_face = (face_id < 0
- ? NULL
- : FACE_FROM_ID (f, face_id));
+ struct face *width_face = FACE_FROM_ID_OR_NULL (f, face_id);
if (width_face && width_face->font)
{
if (EQ (face, Qdefault))
{
struct face_cache *c = FRAME_FACE_CACHE (f);
- struct face *newface, *oldface = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+ struct face *newface, *oldface = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
Lisp_Object attrs[LFACE_VECTOR_SIZE];
/* This can be NULL (e.g., in batch mode). */
{
struct frame *f = decode_live_frame (frame);
int face_id = lookup_named_face (f, face, true);
- struct face *fface = FACE_OPT_FROM_ID (f, face_id);
+ struct face *fface = FACE_FROM_ID_OR_NULL (f, face_id);
if (! fface)
return Qnil;
{
CHECK_CHARACTER (character);
face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil);
- fface = FACE_FROM_ID (f, face_id);
+ fface = FACE_FROM_ID_OR_NULL (f, face_id);
}
- return (fface->font
+ return ((fface && fface->font)
? fface->font->props[FONT_NAME_INDEX]
: Qnil);
#else /* !HAVE_WINDOW_SYSTEM */
face = realize_face (cache, attr, -1);
#ifdef GLYPH_DEBUG
- eassert (face == FACE_FROM_ID (f, face->id));
+ eassert (face == FACE_FROM_ID_OR_NULL (f, face->id));
#endif /* GLYPH_DEBUG */
return face->id;
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
- struct face *default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+ struct face *default_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
if (default_face == NULL)
{
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
- struct face *default_face = FACE_FROM_ID (f, face_id);
+ struct face *default_face;
if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1;
+ default_face = FACE_FROM_ID (f, face_id);
memcpy (attrs, default_face->lface, sizeof attrs);
merge_face_vectors (f, symbol_attrs, attrs, 0);
return lookup_face (f, attrs);
merge_face_vectors (f, attrs, merged_attrs, 0);
face_id = lookup_face (f, merged_attrs);
- face = FACE_OPT_FROM_ID (f, face_id);
+ face = FACE_FROM_ID_OR_NULL (f, face_id);
if (! face)
error ("Cannot make face");
attrs[i] = Qunspecified;
merge_face_ref (f, attributes, attrs, true, 0);
- def_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+ def_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
if (def_face == NULL)
{
if (! realize_basic_faces (f))
struct face_cache *c = FRAME_FACE_CACHE (f);
Lisp_Object lface;
Lisp_Object attrs[LFACE_VECTOR_SIZE];
- struct face *face;
/* If the `default' face is not yet known, create it. */
lface = lface_from_face_name (f, Qdefault, false);
eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
check_lface (lface);
memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
- face = realize_face (c, attrs, DEFAULT_FACE_ID);
+ struct face *face = realize_face (c, attrs, DEFAULT_FACE_ID);
-#ifdef HAVE_WINDOW_SYSTEM
-#ifdef HAVE_X_WINDOWS
+#ifndef HAVE_WINDOW_SYSTEM
+ (void) face;
+#else
if (FRAME_X_P (f) && face->font != FRAME_FONT (f))
{
/* This can happen when making a frame on a display that does
font. */
x_set_font (f, LFACE_FONT (lface), Qnil);
}
-#endif /* HAVE_X_WINDOWS */
-#endif /* HAVE_WINDOW_SYSTEM */
+#endif
return true;
}
/* Determine the font to use. Most of the time, the font will be
the same as the font of the default face, so try that first. */
- default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+ default_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
if (default_face
&& lface_same_font_attributes_p (default_face->lface, attrs))
{
if we don't have fonts, so we can stop here if not working
on a window-system frame. */
|| !FRAME_WINDOW_P (f)
- || FACE_SUITABLE_FOR_ASCII_CHAR_P (base_face, 0)))
+ || FACE_SUITABLE_FOR_ASCII_CHAR_P (base_face)))
return base_face->id;
/* Begin with attributes from the base face. */
Lisp_Object attrs[LFACE_VECTOR_SIZE];
struct face *base_face;
- base_face = FACE_OPT_FROM_ID (f, base_face_id);
+ base_face = FACE_FROM_ID_OR_NULL (f, base_face_id);
if (!base_face)
return base_face_id;
struct face *face;
if (face_id < 0)
return base_face_id;
- face = FACE_OPT_FROM_ID (f, face_id);
+ face = FACE_FROM_ID_OR_NULL (f, face_id);
if (!face)
return base_face_id;
merge_face_vectors (f, face->lface, attrs, 0);
{
struct face *face;
CHECK_NUMBER (n);
- face = FACE_OPT_FROM_ID (SELECTED_FRAME (), XINT (n));
+ face = FACE_FROM_ID_OR_NULL (SELECTED_FRAME (), XINT (n));
if (face == NULL)
error ("Not a valid face");
dump_realized_face (face);