summaryrefslogtreecommitdiff
path: root/pango/mini-xft/minixftint.h
blob: 563c157c5f7c43b6089f1bf44b44593e357b598a (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
/*
 * $XFree86: xc/lib/MiniXft/minixftint.h,v 1.26 2001/07/13 18:16:10 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 "MiniXftFreetype.h"

typedef struct _MiniXftMatcher {
    char    *object;
    double  (*compare) (char *object, MiniXftValue value1, MiniXftValue value2);
} MiniXftMatcher;

typedef struct _MiniXftSymbolic {
    const char	*name;
    int		value;
} MiniXftSymbolic;

#define XFT_DRAW_N_SRC	    2

#define XFT_DRAW_SRC_TEXT   0
#define XFT_DRAW_SRC_RECT   1

typedef struct _MiniXftDisplayInfo {
    struct _MiniXftDisplayInfo  *next;
    Display		    *display;
	/*    XExtCodes		    *codes; */
    MiniXftPattern		    *defaults;
	/*    MiniXftFontSet		    *coreFonts; */
    Bool		    hasRender;
} MiniXftDisplayInfo;

extern MiniXftDisplayInfo	*_MiniXftDisplayInfo;
extern MiniXftFontSet	*_MiniXftGlobalFontSet;
extern char		**MiniXftConfigDirs;
extern MiniXftFontSet	*_MiniXftFontSet;

#define XFT_NMISSING	256

extern char *mini_xft_get_default_path (void);

#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_MATCH	512
#define XFT_DBG_MATCHV	1024

typedef enum _MiniXftOp {
    MiniXftOpInteger, MiniXftOpDouble, MiniXftOpString, MiniXftOpMatrix, MiniXftOpBool, MiniXftOpNil,
    MiniXftOpField,
    MiniXftOpAssign, MiniXftOpPrepend, MiniXftOpAppend,
    MiniXftOpQuest,
    MiniXftOpOr, MiniXftOpAnd, MiniXftOpEqual, MiniXftOpNotEqual,
    MiniXftOpLess, MiniXftOpLessEqual, MiniXftOpMore, MiniXftOpMoreEqual,
    MiniXftOpPlus, MiniXftOpMinus, MiniXftOpTimes, MiniXftOpDivide,
    MiniXftOpNot
} MiniXftOp;

typedef struct _MiniXftExpr {
    MiniXftOp   op;
    union {
	int	    ival;
	double	    dval;
	char	    *sval;
	MiniXftMatrix   *mval;
	Bool	    bval;
	char	    *field;
	struct {
	    struct _MiniXftExpr *left, *right;
	} tree;
    } u;
} MiniXftExpr;

typedef enum _MiniXftQual {
    MiniXftQualAny, MiniXftQualAll
} MiniXftQual;

typedef struct _MiniXftTest {
    struct _MiniXftTest	*next;
    MiniXftQual		qual;
    const char		*field;
    MiniXftOp		op;
    MiniXftValue		value;
} MiniXftTest;

typedef struct _MiniXftEdit {
    struct _MiniXftEdit *next;
    const char	    *field;
    MiniXftOp	    op;
    MiniXftExpr	    *expr;
} MiniXftEdit;

typedef struct _MiniXftSubst {
    struct _MiniXftSubst	*next;
    MiniXftTest		*test;
    MiniXftEdit		*edit;
} MiniXftSubst;

/*
 * I tried this with functions that took va_list* arguments
 * but portability concerns made me change these functions
 * into macros (sigh).
 */

#define _MiniXftPatternVapBuild(result, orig, va)			    \
{								    \
    MiniXftPattern	*__p__ = (orig);				    \
    const char	*__o__;						    \
    MiniXftValue	__v__;						    \
								    \
    if (!__p__)							    \
    {								    \
	__p__ = MiniXftPatternCreate ();				    \
	if (!__p__)		    				    \
	    goto _MiniXftPatternVapBuild_bail0;			    \
    }				    				    \
    for (;;)			    				    \
    {				    				    \
	__o__ = va_arg (va, const char *);			    \
	if (!__o__)		    				    \
	    break;		    				    \
	__v__.type = va_arg (va, MiniXftType);			    \
	switch (__v__.type) {	    				    \
	case MiniXftTypeVoid:					    \
	    goto _MiniXftPatternVapBuild_bail1;       		    \
	case MiniXftTypeInteger:	    				    \
	    __v__.u.i = va_arg (va, int);			    \
	    break;						    \
	case MiniXftTypeDouble:					    \
	    __v__.u.d = va_arg (va, double);			    \
	    break;						    \
	case MiniXftTypeString:					    \
	    __v__.u.s = va_arg (va, char *);			    \
	    break;						    \
	case MiniXftTypeBool:					    \
	    __v__.u.b = va_arg (va, Bool);			    \
	    break;						    \
	case MiniXftTypeMatrix:					    \
	    __v__.u.m = va_arg (va, MiniXftMatrix *);		    \
	    break;						    \
	}							    \
	if (!MiniXftPatternAdd (__p__, __o__, __v__, True))		    \
	    goto _MiniXftPatternVapBuild_bail1;			    \
    }								    \
    result = __p__;						    \
    goto _MiniXftPatternVapBuild_return;				    \
								    \
_MiniXftPatternVapBuild_bail1:					    \
    if (!orig)							    \
	MiniXftPatternDestroy (__p__);				    \
_MiniXftPatternVapBuild_bail0:					    \
    result = 0;							    \
								    \
_MiniXftPatternVapBuild_return:					    \
    ;								    \
}


/* xftcache.c */

char *
MiniXftFileCacheFind (char *file, int id, int *count);

void
MiniXftFileCacheDispose (void);

void
MiniXftFileCacheLoad (char *cache);

Bool
MiniXftFileCacheUpdate (char *file, int id, char *name);

Bool
MiniXftFileCacheSave (char *cache);

Bool
MiniXftFileCacheReadDir (MiniXftFontSet *set, const char *cache_file);

Bool
MiniXftFileCacheWriteDir (MiniXftFontSet *set, const char *cache_file);
    
/* xftcfg.c */
Bool
MiniXftConfigAddDir (char *d);

Bool
MiniXftConfigSetCache (char *c);

char *
MiniXftConfigGetCache (void);

Bool
MiniXftConfigAddEdit (MiniXftTest *test, MiniXftEdit *edit);

Bool
_MiniXftConfigCompareValue (MiniXftValue    m,
			MiniXftOp	    op,
			MiniXftValue    v);

/* xftdbg.c */
void
MiniXftOpPrint (MiniXftOp op);

void
MiniXftTestPrint (MiniXftTest *test);

void
MiniXftExprPrint (MiniXftExpr *expr);

void
MiniXftEditPrint (MiniXftEdit *edit);

void
MiniXftSubstPrint (MiniXftSubst *subst);

/* xftdpy.c */
int
MiniXftDefaultParseBool (char *v);

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

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

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

MiniXftFontSet *
MiniXftDisplayGetFontSet (Display *dpy);

/* xftextent.c */
/* xftfont.c */
int
_MiniXftFontDebug (void);
    
/* xftfs.c */
/* xftgram.y */
int
MiniXftConfigparse (void);

int
MiniXftConfigwrap (void);
    
void
MiniXftConfigerror (char *fmt, ...);
    
char *
MiniXftConfigSaveField (const char *field);

MiniXftTest *
MiniXftTestCreate (MiniXftQual qual, const char *field, MiniXftOp compare, MiniXftValue value);

MiniXftExpr *
MiniXftExprCreateInteger (int i);

MiniXftExpr *
MiniXftExprCreateDouble (double d);

MiniXftExpr *
MiniXftExprCreateString (const char *s);

MiniXftExpr *
MiniXftExprCreateMatrix (const MiniXftMatrix *m);

MiniXftExpr *
MiniXftExprCreateBool (Bool b);

MiniXftExpr *
MiniXftExprCreateNil (void);

MiniXftExpr *
MiniXftExprCreateField (const char *field);

MiniXftExpr *
MiniXftExprCreateOp (MiniXftExpr *left, MiniXftOp op, MiniXftExpr *right);

void
MiniXftExprDestroy (MiniXftExpr *e);

MiniXftEdit *
MiniXftEditCreate (const char *field, MiniXftOp op, MiniXftExpr *expr);

void
MiniXftEditDestroy (MiniXftEdit *e);

/* xftinit.c */

/* xftlex.l */
extern int	MiniXftConfigLineno;
extern char	*MiniXftConfigFile;

int
MiniXftConfiglex (void);

Bool
MiniXftConfigLexFile(char *s);

Bool
MiniXftConfigPushInput (char *s, Bool complain);

/* xftlist.c */
Bool
MiniXftListValueCompare (MiniXftValue	v1,
		     MiniXftValue	v2);

Bool
MiniXftListValueListCompare (MiniXftValueList	*v1orig,
			 MiniXftValueList	*v2orig,
			 MiniXftQual	qual);

Bool
MiniXftListMatch (MiniXftPattern    *p,
	      MiniXftPattern    *font,
	      MiniXftQual	    qual);

Bool
MiniXftListAppend (MiniXftFontSet   *s,
	       MiniXftPattern   *font,
	       MiniXftObjectSet *os);


/* xftmatch.c */

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

/* xftpat.c */

/* xftrender.c */

/* xftmatrix.c */
MiniXftMatrix *
_MiniXftSaveMatrix (const MiniXftMatrix *mat);

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

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

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

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

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

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

int
_MiniXftMatchSymbolic (MiniXftSymbolic *s, int n, const char *name, int def);

int
_MiniXftStrCmpIgnoreCase (const char *s1, const char *s2);
    
/* xftxlfd.c */
Bool
MiniXftCoreAddFonts (MiniXftFontSet *set, Display *dpy, Bool ignore_scalable);

#endif /* _XFT_INT_H_ */