#ifndef _XFTINT_H_
#define _XFTINT_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define HAVE_STDLIB_H 1
#include <X11/Xosdefs.h>
#endif
#include <stdio.h>
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_STRING_H
#include <string.h>
#else
#if HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#include <ctype.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xmd.h>
#include <X11/Xlibint.h>
#define _XFT_NO_COMPAT_
#include "Xft.h"
#include <fontconfig/fcprivate.h>
#include <fontconfig/fcfreetype.h>
#ifndef _X_HIDDEN
# define _X_HIDDEN
#endif
#ifndef _X_EXPORT
# define _X_EXPORT
#endif
#ifndef HAVE_CONFIG_H
# if (FREETYPE_MAJOR > 2 || \
(FREETYPE_MAJOR == 2 && (FREETYPE_MINOR > 1 || \
(FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 5))))
# define HAVE_FT_BITMAP_SIZE_Y_PPEM 1
# else
# define HAVE_FT_BITMAP_SIZE_Y_PPEM 0
# endif
#endif
typedef struct _XftMatcher {
char *object;
double (*compare) (char *object, FcValue value1, FcValue value2);
} XftMatcher;
typedef struct _XftSymbolic {
const char *name;
int value;
} XftSymbolic;
typedef struct _XftGlyph {
XGlyphInfo metrics;
void *bitmap;
unsigned long glyph_memory;
} XftGlyph;
typedef struct _XftUcsHash {
FcChar32 ucs4;
FT_UInt glyph;
} XftUcsHash;
typedef struct _XftFtFile {
struct _XftFtFile *next;
int ref;
char *file;
int id;
FT_F26Dot6 xsize;
FT_F26Dot6 ysize;
FT_Matrix matrix;
int lock;
FT_Face face;
} XftFtFile;
struct _XftFontInfo {
FcChar32 hash;
XftFtFile *file;
FT_F26Dot6 xsize, ysize;
FcBool antialias;
FcBool embolden;
int rgba;
FT_Matrix matrix;
FcBool transform;
FT_Int load_flags;
FcBool render;
int spacing;
FcBool minspace;
int char_width;
};
typedef struct _XftFontInt {
XftFont public;
XftFont *next;
XftFont *hash_next;
XftFontInfo info;
int ref;
XftGlyph **glyphs;
int num_glyphs;
XftUcsHash *hash_table;
int hash_value;
int rehash_value;
GlyphSet glyphset;
XRenderPictFormat *format;
unsigned long glyph_memory;
unsigned long max_glyph_memory;
FcBool use_free_glyphs;
} XftFontInt;
typedef enum _XftClipType {
XftClipTypeNone, XftClipTypeRegion, XftClipTypeRectangles
} XftClipType;
typedef struct _XftClipRect {
int xOrigin;
int yOrigin;
int n;
} XftClipRect;
#define XftClipRects(cr) ((XRectangle *) ((cr) + 1))
typedef union _XftClip {
XftClipRect *rect;
Region region;
} XftClip;
struct _XftDraw {
Display *dpy;
int screen;
unsigned int bits_per_pixel;
unsigned int depth;
Drawable drawable;
Visual *visual;
Colormap colormap;
XftClipType clip_type;
XftClip clip;
int subwindow_mode;
struct {
Picture pict;
} render;
struct {
GC gc;
int use_pixmap;
} core;
};
#define XFT_ASSUME_PIXMAP 20
typedef struct _XftSolidColor {
XRenderColor color;
int screen;
Picture pict;
} XftSolidColor;
#define XFT_NUM_SOLID_COLOR 16
#define XFT_NUM_FONT_HASH 127
typedef struct _XftDisplayInfo {
struct _XftDisplayInfo *next;
Display *display;
XExtCodes *codes;
FcPattern *defaults;
FcBool hasRender;
XftFont *fonts;
XRenderPictFormat *solidFormat;
unsigned long glyph_memory;
unsigned long max_glyph_memory;
FcBool use_free_glyphs;
int num_unref_fonts;
int max_unref_fonts;
XftSolidColor colors[XFT_NUM_SOLID_COLOR];
XftFont *fontHash[XFT_NUM_FONT_HASH];
} XftDisplayInfo;
#define XFT_DPY_MAX_GLYPH_MEMORY (4 * 1024 * 1024)
#define XFT_FONT_MAX_GLYPH_MEMORY (1024 * 1024)
#define XFT_DPY_MAX_UNREF_FONTS 16
extern XftDisplayInfo *_XftDisplayInfo;
#define XFT_DBG_OPEN 1
#define XFT_DBG_OPENV 2
#define XFT_DBG_RENDER 4
#define XFT_DBG_DRAW 8
#define XFT_DBG_REF 16
#define XFT_DBG_GLYPH 32
#define XFT_DBG_GLYPHV 64
#define XFT_DBG_CACHE 128
#define XFT_DBG_CACHEV 256
#define XFT_DBG_MEMORY 512
#define XFT_MEM_DRAW 0
#define XFT_MEM_FONT 1
#define XFT_MEM_FILE 2
#define XFT_MEM_GLYPH 3
#define XFT_MEM_NUM 4
void XftFontSetDestroy (FcFontSet *s);
FcBool XftMatrixEqual (_Xconst FcMatrix *mat1, _Xconst FcMatrix *mat2);
void XftMatrixMultiply (FcMatrix *result, FcMatrix *a, FcMatrix *b);
void XftMatrixRotate (FcMatrix *m, double c, double s);
void XftMatrixScale (FcMatrix *m, double sx, double sy);
void XftMatrixShear (FcMatrix *m, double sh, double sv);
FcPattern *XftPatternCreate (void);
void XftValueDestroy (FcValue v);
void XftPatternDestroy (FcPattern *p);
FcBool XftPatternAdd (FcPattern *p, _Xconst char *object, FcValue value, FcBool append);
FcBool XftPatternDel (FcPattern *p, _Xconst char *object);
FcBool XftPatternAddInteger (FcPattern *p, _Xconst char *object, int i);
FcBool XftPatternAddDouble (FcPattern *p, _Xconst char *object, double i);
FcBool XftPatternAddMatrix (FcPattern *p, _Xconst char *object, FcMatrix *i);
FcBool XftPatternAddString (FcPattern *p, _Xconst char *object, char *i);
FcBool XftPatternAddBool (FcPattern *p, _Xconst char *object, FcBool i);
FcResult XftPatternGet (FcPattern *p, _Xconst char *object, int id, FcValue *v);
FcResult XftPatternGetInteger (FcPattern *p, _Xconst char *object, int id, int *i);
FcResult XftPatternGetDouble (FcPattern *p, _Xconst char *object, int id, double *i);
FcResult XftPatternGetString (FcPattern *p, _Xconst char *object, int id, char **i);
FcResult XftPatternGetMatrix (FcPattern *p, _Xconst char *object, int id, FcMatrix **i);
FcResult XftPatternGetBool (FcPattern *p, _Xconst char *object, int id, FcBool *i);
FcPattern *XftPatternDuplicate (FcPattern *orig);
FcPattern *XftPatternVaBuild (FcPattern *orig, va_list va);
FcPattern *XftPatternBuild (FcPattern *orig, ...);
FcBool XftNameUnparse (FcPattern *pat, char *dest, int len);
FcBool XftGlyphExists (Display *dpy, XftFont *font, FcChar32 ucs4);
FcObjectSet *XftObjectSetCreate (void);
Bool XftObjectSetAdd (FcObjectSet *os, _Xconst char *object);
void XftObjectSetDestroy (FcObjectSet *os);
FcObjectSet *XftObjectSetVaBuild (_Xconst char *first, va_list va);
FcObjectSet *XftObjectSetBuild (_Xconst char *first, ...);
FcFontSet *XftListFontSets (FcFontSet **sets, int nsets, FcPattern *p, FcObjectSet *os);
void
XftRectCore (XftDraw *draw,
_Xconst XftColor *color,
int x,
int y,
unsigned int width,
unsigned int height);
void
XftGlyphCore (XftDraw *draw,
_Xconst XftColor *color,
XftFont *public,
int x,
int y,
_Xconst FT_UInt *glyphs,
int nglyphs);
void
XftGlyphSpecCore (XftDraw *draw,
_Xconst XftColor *color,
XftFont *public,
_Xconst XftGlyphSpec *glyphs,
int nglyphs);
void
XftGlyphFontSpecCore (XftDraw *draw,
_Xconst XftColor *color,
_Xconst XftGlyphFontSpec *glyphs,
int nglyphs);
int
XftDebug (void);
XftDisplayInfo *
_XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary);
void
_XftDisplayManageMemory (Display *dpy);
int
XftDefaultParseBool (char *v);
FcBool
XftDefaultGetBool (Display *dpy, const char *object, int screen, FcBool def);
int
XftDefaultGetInteger (Display *dpy, const char *object, int screen, int def);
double
XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def);
FcFontSet *
XftDisplayGetFontSet (Display *dpy);
unsigned int
XftDrawDepth (XftDraw *draw);
unsigned int
XftDrawBitsPerPixel (XftDraw *draw);
FcBool
XftDrawRenderPrepare (XftDraw *draw);
FcBool
_XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix);
void
XftFontManageMemory (Display *dpy);
void
_XftFontUncacheGlyph (Display *dpy, XftFont *public);
void
_XftFontManageMemory (Display *dpy, XftFont *public);
void
XftMemReport (void);
void
XftMemAlloc (int kind, int size);
void
XftMemFree (int kind, int size);
FcFontSet *
XftListFontsPatternObjects (Display *dpy,
int screen,
FcPattern *pattern,
FcObjectSet *os);
void
_XftNameInit (void);
int
_XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def);
int
XftNativeByteOrder (void);
void
XftSwapCARD32 (CARD32 *data, int n);
void
XftSwapCARD24 (CARD8 *data, int width, int height);
void
XftSwapCARD16 (CARD16 *data, int n);
void
XftSwapImage (XImage *image);
#endif