summaryrefslogtreecommitdiff
path: root/xc/lib/Xft/xftint.h
blob: b4c305e602f8da01a4526192f63e9f5d63f17479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
/*
 * $XFree86: xc/lib/Xft/xftint.h,v 1.3 2000/11/29 08:39:23 keithp Exp $
 *
 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Keith Packard not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Keith Packard makes no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _XFTINT_H_
#define _XFTINT_H_

#include <X11/Xlib.h>
#include "XftFreetype.h"

typedef struct _XftMatcher {
    char    *object;
    double  (*compare) (char *object, XftValue value1, XftValue value2);
} XftMatcher;

typedef struct _XftSymbolic {
    const char	*name;
    int		value;
} XftSymbolic;

#define CACHE_SIZE  3

struct _XftDraw {
    Display	    *dpy;
    Drawable	    drawable;
    Visual	    *visual;
    Colormap	    colormap;
    Bool	    core_set;
    Bool	    render_set;
    Bool	    render_able;
    struct {
	Picture	    pict;
	Pixmap	    fg_pix;
	Picture	    fg_pict;
	XRenderColor	fg_color;
    } render;
    struct {
	GC	    draw_gc;
	union {
	    struct {
		unsigned long   pixel;
		XRenderColor	color;
		int		use;
	    } cache[CACHE_SIZE];
	    struct {
		short	red_shift, red_len;
		short	green_shift, green_len;
		short	blue_shift, blue_len;
	    } truecolor;
	} u;
    } core;
};

typedef struct _XftDisplayInfo {
    struct _XftDisplayInfo  *next;
    Display		    *display;
    XExtCodes		    *codes;
    XftPattern		    *defaults;
    XftFontSet		    *coreFonts;
    Bool		    hasRender;
} XftDisplayInfo;

#ifdef FREETYPE2
extern FT_Library	_XftFTlibrary;
#endif
extern XftFontSet	*_XftGlobalFontSet;
extern XftDisplayInfo	*_XftDisplayInfo;
extern char		**XftConfigDirs;
extern XftFontSet	*_XftFontSet;

#define XFT_NMISSING	256

#ifndef XFT_DEFAULT_PATH
#define XFT_DEFAULT_PATH "/usr/X11R6/lib/X11/XftConfig"
#endif

typedef enum _XftOp {
    XftOpInteger, XftOpDouble, XftOpString, XftOpBool, XftOpNil,
    XftOpField,
    XftOpAssign, XftOpPrepend, XftOpAppend,
    XftOpQuest,
    XftOpOr, XftOpAnd, XftOpEqual, XftOpNotEqual,
    XftOpLess, XftOpLessEqual, XftOpMore, XftOpMoreEqual,
    XftOpPlus, XftOpMinus, XftOpTimes, XftOpDivide,
    XftOpNot
} XftOp;

typedef struct _XftExpr {
    XftOp   op;
    union {
	int	ival;
	double	dval;
	char	*sval;
	Bool	bval;
	char	*field;
	struct {
	    struct _XftExpr *left, *right;
	} tree;
    } u;
} XftExpr;

typedef enum _XftQual {
    XftQualAny, XftQualAll
} XftQual;

typedef struct _XftTest {
    struct _XftTest	*next;
    XftQual		qual;
    char		*field;
    XftOp		op;
    XftValue		value;
} XftTest;

typedef struct _XftEdit {
    struct _XftEdit *next;
    const char	    *field;
    XftOp	    op;
    XftExpr	    *expr;
} XftEdit;

typedef struct _XftSubst {
    struct _XftSubst	*next;
    XftTest		*test;
    XftEdit		*edit;
} XftSubst;

/* xftcfg.c */
Bool
XftConfigAddDir (char *d);

Bool
XftConfigAddEdit (XftTest *test, XftEdit *edit);

Bool
XftConfigSubstitute (XftPattern *p);

/* xftcore.c */

#define XFT_CORE_N16LOCAL	256

XChar2b *
XftCoreConvert16 (unsigned short    *string,
		  int		    len,
		  XChar2b	    xcloc[XFT_CORE_N16LOCAL]);

XChar2b *
XftCoreConvert32 (unsigned long	    *string,
		  int		    len,
		  XChar2b	    xcloc[XFT_CORE_N16LOCAL]);

void
XftCoreExtents8 (Display	*dpy,
		 XFontStruct	*fs,
		 unsigned char  *string, 
		 int		len,
		 XGlyphInfo	*extents);

void
XftCoreExtents16 (Display	    *dpy,
		  XFontStruct	    *fs,
		  unsigned short    *string, 
		  int		    len,
		  XGlyphInfo	    *extents);

void
XftCoreExtents32 (Display	    *dpy,
		  XFontStruct	    *fs,
		  unsigned long	    *string, 
		  int		    len,
		  XGlyphInfo	    *extents);

/* xftdbg.c */
void
XftOpPrint (XftOp op);

void
XftTestPrint (XftTest *test);

void
XftExprPrint (XftExpr *expr);

void
XftEditPrint (XftEdit *edit);

void
XftSubstPrint (XftSubst *subst);

/* xftdir.c */
Bool
XftDirScan (XftFontSet *set, const char *dir);

/* xftdpy.c */
Bool
XftDefaultHasRender (Display *dpy);

Bool
XftDefaultSet (Display *dpy, XftPattern *defaults);

int
XftDefaultParseBool (char *v);

Bool
XftDefaultGetBool (Display *dpy, const char *object, int screen, Bool def);

int
XftDefaultGetInteger (Display *dpy, const char *object, int screen, int def);

double
XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def);

XftFontSet *
XftDisplayGetFontSet (Display *dpy);

void
XftDefaultSubstitute (Display *dpy, int screen, XftPattern *pattern);
    
/* xftdraw.c */
Bool
XftDrawRenderPrepare (XftDraw	    *draw,
		      XRenderColor  *color,
		      XftFont	    *font);

Bool
XftDrawCorePrepare (XftDraw	    *draw,
		    XRenderColor    *color,
		    XftFont	    *font);

/* xftextent.c */
/* xftfont.c */
/* xftfreetype.c */
XftPattern *
XftFreeTypeQuery (const char *file, int id, int *count);

XftFontStruct *
XftFreeTypeOpen (Display *dpy, XftPattern *pattern);

void
XftFreeTypeClose (Display *dpy, XftFontStruct *font);
    
/* xftfs.c */
XftFontSet *
XftFontSetCreate (void);

void
XftFontSetDestroy (XftFontSet *s);

Bool
XftFontSetAdd (XftFontSet *s, XftPattern *font);

/* xftglyphs.c */
void
XftGlyphLoad (Display		*dpy,
	      XftFontStruct	*font,
	      unsigned long	*glyphs,
	      int		nglyph);

void
XftGlyphCheck (Display		*dpy,
	       XftFontStruct	*font,
	       unsigned long	glyph,
	       unsigned long	*missing,
	       int		*nmissing);
/* xftgram.y */
int
XftConfigparse (void);

int
XftConfigwrap (void);
    
void
XftConfigerror (char *fmt, ...);
    
char *
XftConfigSaveField (const char *field);

XftTest *
XftTestCreate (XftQual qual, const char *field, XftOp compare, XftValue value);

XftExpr *
XftExprCreateInteger (int i);

XftExpr *
XftExprCreateDouble (double d);

XftExpr *
XftExprCreateString (const char *s);

XftExpr *
XftExprCreateBool (Bool b);

XftExpr *
XftExprCreateNil (void);

XftExpr *
XftExprCreateField (const char *field);

XftExpr *
XftExprCreateOp (XftExpr *left, XftOp op, XftExpr *right);

void
XftExprDestroy (XftExpr *e);

XftEdit *
XftEditCreate (const char *field, XftOp op, XftExpr *expr);

void
XftEditDestroy (XftEdit *e);

/* xftinit.c */
Bool
XftInitFtLibrary (void);

Bool
XftInit (char *config);

/* xftlex.l */
extern int	XftConfigLineno;
extern char	*XftConfigFile;

int
XftConfiglex (void);

Bool
XftConfigLexFile(char *s);

Bool
XftConfigPushInput (char *s, Bool complain);

/* xftmatch.c */
XftPattern *
XftFontSetMatch (XftFontSet	**sets, 
		 int		nsets, 
		 XftPattern	*p, 
		 XftResult	*result);

/* xftname.c */
Bool
XftNameConstant (char *string, int *result);

XftPattern *
XftNameParse (const char *name);

/* xftpat.c */

void
XftValueDestroy (XftValue v);

void
XftValueListDestroy (XftValueList *l);

XftPatternElt *
XftPatternFind (XftPattern *p, const char *object, Bool insert);

/* xftrender.c */

/* xftstr.c */
char *
_XftSaveString (const char *s);

const char *
_XftGetInt(const char *ptr, int *val);

char *
_XftSplitStr (const char *field, char *save);

char *
_XftDownStr (const char *field, char *save);

const char *
_XftSplitField (const char *field, char *save);

const char *
_XftSplitValue (const char *field, char *save);

int
_XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def);

/* xftxlfd.c */
XftPattern *
XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable);

Bool
XftCoreAddFonts (XftFontSet *set, Display *dpy, Bool ignore_scalable);

XFontStruct *
XftCoreOpen (Display *dpy, XftPattern *pattern);

#endif /* _XFT_INT_H_ */