#ifdef HAVE_NS
#undef FRAME_X_DISPLAY_INFO
#define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO
-#define x_display_info ns_display_info
#define GCGraphicsExposures 0
#endif /* HAVE_NS */
+
+/* Number of pt per inch (from the TeXbook). */
+
+#define PT_PER_INCH 72.27
+
#endif /* HAVE_WINDOW_SYSTEM */
#include "buffer.h"
#include <c-ctype.h>
-/* Number of pt per inch (from the TeXbook). */
-
-#define PT_PER_INCH 72.27
-
/* Non-zero if face attribute ATTR is unspecified. */
#define UNSPECIFIEDP(ATTR) EQ ((ATTR), Qunspecified)
static Lisp_Object Qtty_color_alist;
+#ifdef HAVE_WINDOW_SYSTEM
+
/* Counter for calls to clear_face_cache. If this counter reaches
CLEAR_FONT_TABLE_COUNT, and a frame has more than
CLEAR_FONT_TABLE_NFONTS load, unused fonts are freed. */
#define CLEAR_FONT_TABLE_COUNT 100
#define CLEAR_FONT_TABLE_NFONTS 10
+#endif /* HAVE_WINDOW_SYSTEM */
+
/* Non-zero means face attributes have been changed since the last
redisplay. Used in redisplay_internal. */
static int menu_face_changed_default;
-\f
-/* Function prototypes. */
-
-struct table_entry;
struct named_merge_point;
-static void set_font_frame_param (Lisp_Object, Lisp_Object);
static struct face *realize_face (struct face_cache *, Lisp_Object *,
int);
-static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
- struct face *);
static struct face *realize_x_face (struct face_cache *, Lisp_Object *);
static struct face *realize_tty_face (struct face_cache *, Lisp_Object *);
static bool realize_basic_faces (struct frame *);
static bool realize_default_face (struct frame *);
static void realize_named_face (struct frame *, Lisp_Object, int);
static struct face_cache *make_face_cache (struct frame *);
-static void clear_face_gcs (struct face_cache *);
static void free_face_cache (struct face_cache *);
static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
int, struct named_merge_point *);
-\f
+#ifdef HAVE_WINDOW_SYSTEM
+static void set_font_frame_param (Lisp_Object, Lisp_Object);
+static void clear_face_gcs (struct face_cache *);
+static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
+ struct face *);
+#endif /* HAVE_WINDOW_SYSTEM */
+
/***********************************************************************
Utilities
***********************************************************************/
if (clear_fonts_p
|| ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT)
{
-#if 0
- /* Not yet implemented. */
- clear_font_cache (frame);
-#endif
-
/* From time to time see if we can unload some fonts. This also
frees all realized faces on all frames. Fonts needed by
faces will be loaded again when faces are realized again. */
struct frame *f = XFRAME (frame);
if (FRAME_WINDOW_P (f)
&& FRAME_X_DISPLAY_INFO (f)->n_fonts > CLEAR_FONT_TABLE_NFONTS)
- free_all_realized_faces (frame);
+ {
+ clear_font_cache (f);
+ free_all_realized_faces (frame);
+ }
}
}
else
if these pointers are not null. */
static ptrdiff_t
-load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
+load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr,
unsigned int *h_ptr)
{
ptrdiff_t bitmap_id;
(Lisp_Object family, Lisp_Object frame)
{
Lisp_Object font_spec, list, *drivers, vec;
+ struct frame *f = decode_live_frame (frame);
ptrdiff_t i, nfonts;
EMACS_INT ndrivers;
Lisp_Object result;
USE_SAFE_ALLOCA;
- if (NILP (frame))
- frame = selected_frame;
- CHECK_LIVE_FRAME (frame);
-
font_spec = Ffont_spec (0, NULL);
if (!NILP (family))
{
font_parse_family_registry (family, Qnil, font_spec);
}
- list = font_list_entities (frame, font_spec);
+ list = font_list_entities (f, font_spec);
if (NILP (list))
return Qnil;
ASET (v, 0, AREF (font, FONT_FAMILY_INDEX));
ASET (v, 1, FONT_WIDTH_SYMBOLIC (font));
point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10,
- FRAME_RES_Y (XFRAME (frame)));
+ FRAME_RES_Y (f));
ASET (v, 2, make_number (point));
ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font));
ASET (v, 4, FONT_SLANT_SYMBOLIC (font));
{
if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
{
- FRAME_PTR f;
+ struct frame *f;
old_value = LFACE_FONT (lface);
if (! FONTP (value))
#endif /* HAVE_WINDOW_SYSTEM */
else if (EQ (face, Qmenu))
{
- /* Indicate that we have to update the menu bar when
- realizing faces on FRAME. FRAME t change the
- default for new frames. We do this by setting
- setting the flag in new face caches */
+ /* Indicate that we have to update the menu bar when realizing
+ faces on FRAME. FRAME t change the default for new frames.
+ We do this by setting the flag in new face caches. */
if (FRAMEP (frame))
{
struct frame *f = XFRAME (frame);
^ XHASH (v[LFACE_HEIGHT_INDEX]));
}
+#ifdef HAVE_WINDOW_SYSTEM
/* Return non-zero if LFACE1 and LFACE2 specify the same font (without
considering charsets/registries). They do if they specify the same
);
}
+#endif /* HAVE_WINDOW_SYSTEM */
-\f
/***********************************************************************
Realized Faces
***********************************************************************/
static struct face_cache *
make_face_cache (struct frame *f)
{
- struct face_cache *c;
- int size;
+ struct face_cache *c = xmalloc (sizeof *c);
- c = xzalloc (sizeof *c);
- size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
- c->buckets = xzalloc (size);
+ c->buckets = xzalloc (FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets);
c->size = 50;
+ c->used = 0;
c->faces_by_id = xmalloc (c->size * sizeof *c->faces_by_id);
c->f = f;
c->menu_face_changed_p = menu_face_changed_default;
return c;
}
+#ifdef HAVE_WINDOW_SYSTEM
/* Clear out all graphics contexts for all realized faces, except for
the basic faces. This should be done from time to time just to avoid
{
if (c && FRAME_WINDOW_P (c->f))
{
-#ifdef HAVE_WINDOW_SYSTEM
int i;
for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i)
{
unblock_input ();
}
}
-#endif /* HAVE_WINDOW_SYSTEM */
}
}
+#endif /* HAVE_WINDOW_SYSTEM */
/* Free all realized faces in face cache C, including basic faces.
C may be null. If faces are freed, make sure the frame's current