Commit 24ce6a02 authored by Dmitry Antipov's avatar Dmitry Antipov

* dispextern.h (struct face) [HAVE_XFT]: Ifdef 'extra' member.

* font.c (font_done_for_face):
* xface.c (realize_non_ascii_face): Adjust user.
* font.h (struct font_driver): Convert 'prepare_face' to return
void because its return value is never used anyway.
* xfont.c (xfont_prepare_face): Return void.
* xftfont.c (xftfont_prepare_face): Likewise.  Use xmalloc.
(xftfont_done_face): Use xfree.
parent 2e120be4
......@@ -5,6 +5,15 @@
function. Also adjust comment.
* fringe.c, w32term.c, xdisp.c, xterm.c: All users changed.
* dispextern.h (struct face) [HAVE_XFT]: Ifdef 'extra' member.
* font.c (font_done_for_face):
* xface.c (realize_non_ascii_face): Adjust user.
* font.h (struct font_driver): Convert 'prepare_face' to return
void because its return value is never used anyway.
* xfont.c (xfont_prepare_face): Return void.
* xftfont.c (xftfont_prepare_face): Likewise. Use xmalloc.
(xftfont_done_face): Use xfree.
2014-06-09 Paul Eggert <eggert@cs.ucla.edu>
Say (accept-process-output P)'s result pertains to P if P is non-nil.
......
......@@ -1716,8 +1716,10 @@ struct face
attributes except the font. */
struct face *ascii_face;
#ifdef HAVE_XFT
/* Extra member that a font-driver uses privately. */
void *extra;
#endif
};
......
......@@ -3337,7 +3337,6 @@ font_done_for_face (struct frame *f, struct face *face)
{
if (face->font->driver->done_face)
face->font->driver->done_face (f, face);
face->extra = NULL;
}
......
......@@ -564,11 +564,9 @@ struct font_driver
/* Close FONT. NOTE: this can be called by GC. */
void (*close) (struct font *font);
/* Optional (if FACE->extra is not used).
Prepare FACE for displaying characters by FONT on frame F by
storing some data in FACE->extra. If successful, return 0.
Otherwise, return -1. */
int (*prepare_face) (struct frame *f, struct face *face);
/* Prepare FACE for displaying characters by FONT on frame F by
storing some data in FACE->extra. */
void (*prepare_face) (struct frame *f, struct face *face);
/* Optional.
Done FACE for displaying characters by FACE->font on frame F. */
......
......@@ -5483,7 +5483,6 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
face = xmalloc (sizeof *face);
*face = *base_face;
face->gc = 0;
face->extra = NULL;
face->overstrike
= (! NILP (font_object)
&& FONT_WEIGHT_NAME_NUMERIC (face->lface[LFACE_WEIGHT_INDEX]) > 100
......
......@@ -121,7 +121,7 @@ static Lisp_Object xfont_match (struct frame *, Lisp_Object);
static Lisp_Object xfont_list_family (struct frame *);
static Lisp_Object xfont_open (struct frame *, Lisp_Object, int);
static void xfont_close (struct font *);
static int xfont_prepare_face (struct frame *, struct face *);
static void xfont_prepare_face (struct frame *, struct face *);
static int xfont_has_char (Lisp_Object, int);
static unsigned xfont_encode_char (struct font *, int);
static int xfont_text_extents (struct font *, unsigned *, int,
......@@ -916,15 +916,13 @@ xfont_close (struct font *font)
}
}
static int
static void
xfont_prepare_face (struct frame *f, struct face *face)
{
block_input ();
XSetFont (FRAME_X_DISPLAY (f), face->gc,
((struct xfont_info *) face->font)->xfont->fid);
unblock_input ();
return 0;
}
static int
......
......@@ -507,7 +507,7 @@ xftfont_close (struct font *font)
}
}
static int
static void
xftfont_prepare_face (struct frame *f, struct face *face)
{
struct xftface_info *xftface_info;
......@@ -517,17 +517,14 @@ xftfont_prepare_face (struct frame *f, struct face *face)
if (face != face->ascii_face)
{
face->extra = face->ascii_face->extra;
return 0;
return;
}
#endif
xftface_info = malloc (sizeof *xftface_info);
if (! xftface_info)
return -1;
xftface_info = xmalloc (sizeof *xftface_info);
xftfont_get_colors (f, face, face->gc, NULL,
&xftface_info->xft_fg, &xftface_info->xft_bg);
face->extra = xftface_info;
return 0;
}
static void
......@@ -545,7 +542,7 @@ xftfont_done_face (struct frame *f, struct face *face)
xftface_info = (struct xftface_info *) face->extra;
if (xftface_info)
{
free (xftface_info);
xfree (xftface_info);
face->extra = NULL;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment