1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00
emacs/lwlib/lwlib-utils.h
YAMAMOTO Mitsuharu 5f4e8e2e08 Don't link libXft when using cairo
* configure.ac: Check cairo early.  Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined	USE_CAIRO || defined HAVE_XFT.
2019-04-24 12:31:37 +09:00

64 lines
1.9 KiB
C

#ifndef _LWLIB_UTILS_H_
#define _LWLIB_UTILS_H_
void XtNoClearRefreshWidget (Widget);
typedef void (*XtApplyToWidgetsProc) (Widget, XtPointer);
typedef void* (*XtApplyUntilToWidgetsProc) (Widget, XtPointer);
void XtApplyToWidgets (Widget, XtApplyToWidgetsProc, XtPointer);
void *XtApplyUntilToWidgets (Widget, XtApplyUntilToWidgetsProc, XtPointer);
Widget *XtCompositeChildren (Widget, unsigned int *);
/* returns True is the widget is being destroyed, False otherwise */
Boolean
XtWidgetBeingDestroyedP (Widget widget);
#ifdef USE_CAIRO
#include <cairo.h>
#include <fontconfig/fontconfig.h>
typedef struct {
cairo_scaled_font_t *scaled_font;
int ascent, descent, height, max_advance_width;
} XftFont;
typedef cairo_t XftDraw;
typedef struct {
unsigned long pixel;
struct {unsigned short red, green, blue, alpha;} color;
} XftColor;
#ifdef HAVE_XRENDER
#include <X11/extensions/Xrender.h>
#else
typedef struct {
unsigned short width, height;
short x, y, xOff, yOff;
} XGlyphInfo;
#endif
#define XftFontOpenName crxft_font_open_name
extern XftFont *crxft_font_open_name (Display *, int, const char *);
#define XftFontClose(dpy, pub) crxft_font_close (pub)
extern void crxft_font_close (XftFont *);
#define XftDrawCreate(dpy, drawable, visual, colormap) \
crxft_draw_create (dpy, drawable, visual)
extern cairo_t *crxft_draw_create (Display *, Drawable, Visual *);
#define XftDrawDestroy cairo_destroy
#define XftDrawRect crxft_draw_rect
extern void crxft_draw_rect (cairo_t *, const XftColor *, int, int,
unsigned int, unsigned int);
#define XftDrawStringUtf8 crxft_draw_string
extern void crxft_draw_string (cairo_t *, const XftColor *, XftFont *,
int, int, const FcChar8 *, int);
#define XftTextExtentsUtf8(dpy, pub, string, len, extents) \
crxft_text_extents (pub, string, len, extents)
extern void crxft_text_extents (XftFont *, const FcChar8 *, int, XGlyphInfo *);
#endif /* USE_CAIRO */
#endif /* _LWLIB_UTILS_H_ */