/* xfaces.c -- "Face" primitives.
-Copyright (C) 1993-1994, 1998-2015 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 1998-2016 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
specs overwrite the font-spec in the 14th attribute.
- Faces are frame-local by nature because Emacs allows to define the
+ Faces are frame-local by nature because Emacs allows you to define the
same named face (face names are symbols) differently for different
frames. Each frame has an alist of face definitions for all named
faces. The value of a named face in such an alist is a Lisp vector
#include TERM_HEADER
#include "fontset.h"
#ifdef HAVE_NTGUI
-#define x_display_info w32_display_info
#define GCGraphicsExposures 0
#endif /* HAVE_NTGUI */
DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0,
doc: /* Value is non-nil if OBJECT is a valid bitmap specification.
A bitmap specification is either a string, a file name, or a list
-(WIDTH HEIGHT DATA) where WIDTH is the pixel width of the bitmap,
+\(WIDTH HEIGHT DATA) where WIDTH is the pixel width of the bitmap,
HEIGHT is its height, and DATA is a string containing the bits of
the pixmap. Bits are stored row by row, each row occupies
-(WIDTH + 7)/8 bytes. */)
+\(WIDTH + 7)/8 bytes. */)
(Lisp_Object object)
{
bool pixmap_p = false;
Lisp_Object maximum, Lisp_Object width)
{
struct frame *f;
- int size, avgwidth IF_LINT (= 0);
+ int size, avgwidth;
check_window_system (NULL);
CHECK_STRING (pattern);
{
if (NILP (frame))
frame = selected_frame;
- f = XFRAME (frame);
CHECK_LIVE_FRAME (frame);
+ f = XFRAME (frame);
+
lface = lface_from_face_name (f, face, false);
/* If a frame-local face doesn't exist yet, create one. */
if (EQ (face, Qdefault))
{
struct face_cache *c = FRAME_FACE_CACHE (f);
- struct face *newface, *oldface = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ struct face *newface, *oldface = FACE_OPT_FROM_ID (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_FROM_ID (f, face_id);
+ struct face *fface = FACE_OPT_FROM_ID (f, face_id);
if (! fface)
return Qnil;
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
- struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ struct face *default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
if (default_face == NULL)
{
if (!realize_basic_faces (f))
return -1;
default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- if (default_face == NULL)
- emacs_abort (); /* realize_basic_faces must have set it up */
}
if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
struct face *default_face = FACE_FROM_ID (f, face_id);
- if (!default_face)
- emacs_abort ();
-
if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1;
merge_face_vectors (f, attrs, merged_attrs, 0);
face_id = lookup_face (f, merged_attrs);
- face = FACE_FROM_ID (f, face_id);
+ face = FACE_OPT_FROM_ID (f, face_id);
if (! face)
error ("Cannot make face");
attrs[i] = Qunspecified;
merge_face_ref (f, attributes, attrs, true, 0);
- def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ def_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
if (def_face == NULL)
{
if (! realize_basic_faces (f))
error ("Cannot realize default face");
def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- if (def_face == NULL)
- emacs_abort (); /* realize_basic_faces must have set it up */
}
/* Dispatch to the appropriate handler. */
/* 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_FROM_ID (f, DEFAULT_FACE_ID);
+ default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
if (default_face
&& lface_same_font_attributes_p (default_face->lface, attrs))
{
*endptr = -1;
base_face = FACE_FROM_ID (f, base_face_id);
- eassert (base_face);
/* Optimize the default case that there is no face property. */
if (NILP (prop)
Lisp_Object attrs[LFACE_VECTOR_SIZE];
struct face *base_face;
- base_face = FACE_FROM_ID (f, base_face_id);
+ base_face = FACE_OPT_FROM_ID (f, base_face_id);
if (!base_face)
return base_face_id;
struct face *face;
if (face_id < 0)
return base_face_id;
- face = FACE_FROM_ID (f, face_id);
+ face = FACE_OPT_FROM_ID (f, face_id);
if (!face)
return base_face_id;
merge_face_vectors (f, face->lface, attrs, 0);
int num;
while (fgets (buf, sizeof (buf), fp) != NULL) {
- if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3)
+ if (sscanf (buf, "%d %d %d %n", &red, &green, &blue, &num) == 3)
{
#ifdef HAVE_NTGUI
int color = RGB (red, green, blue);
{
struct face *face;
CHECK_NUMBER (n);
- face = FACE_FROM_ID (SELECTED_FRAME (), XINT (n));
+ face = FACE_OPT_FROM_ID (SELECTED_FRAME (), XINT (n));
if (face == NULL)
error ("Not a valid face");
dump_realized_face (face);
Each element is a cons (FONT-PATTERN . RESCALE-RATIO), where
FONT-PATTERN is a font-spec or a regular expression matching a font name, and
RESCALE-RATIO is a floating point number to specify how much larger
-(or smaller) font we should use. For instance, if a face requests
+\(or smaller) font we should use. For instance, if a face requests
a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */);
Vface_font_rescale_alist = Qnil;