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
409
410
411
412
413
414
415
416
417
|
/*
* $RCSId: xc/lib/fontconfig/src/fcdbg.c,v 1.10 2002/08/22 18:53:22 keithp Exp $
*
* Copyright © 2000 Keith Packard
*
* 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.
*/
#include "fcint.h"
#include <stdio.h>
#include <stdlib.h>
void
FcValuePrint (const FcValue v)
{
switch (v.type) {
case FcTypeVoid:
printf (" <void>");
break;
case FcTypeInteger:
printf (" %d(i)", v.u.i);
break;
case FcTypeDouble:
printf (" %g(f)", v.u.d);
break;
case FcTypeString:
printf (" \"%s\"", v.u.s);
break;
case FcTypeBool:
printf (" %s", v.u.b ? "FcTrue" : "FcFalse");
break;
case FcTypeMatrix:
printf (" (%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
break;
case FcTypeCharSet: /* XXX */
printf (" ");
FcCharSetPrint (v.u.c);
break;
case FcTypeLangSet:
printf (" ");
FcLangSetPrint (v.u.l);
break;
case FcTypeFTFace:
printf (" face");
break;
}
}
void
FcValueListPrint (FcValueListPtr l)
{
for (; l != NULL; l = FcValueListNext(l))
{
FcValuePrint (FcValueCanonicalize(&l->value));
switch (l->binding) {
case FcValueBindingWeak:
printf ("(w)");
break;
case FcValueBindingStrong:
printf ("(s)");
break;
case FcValueBindingSame:
printf ("(=)");
break;
}
}
}
void
FcLangSetPrint (const FcLangSet *ls)
{
FcStrBuf buf;
FcChar8 init_buf[1024];
FcStrBufInit (&buf, init_buf, sizeof (init_buf));
if (FcNameUnparseLangSet (&buf, ls) && FcStrBufChar (&buf,'\0'))
printf ("%s", buf.buf);
else
printf ("langset (alloc error)");
FcStrBufDestroy (&buf);
}
void
FcCharSetPrint (const FcCharSet *c)
{
int i, j;
intptr_t *leaves = FcCharSetLeaves (c);
FcChar16 *numbers = FcCharSetNumbers (c);
#if 0
printf ("CharSet 0x%x\n", (intptr_t) c);
printf ("Leaves: +%d = 0x%x\n", c->leaves_offset, (intptr_t) leaves);
printf ("Numbers: +%d = 0x%x\n", c->numbers_offset, (intptr_t) numbers);
for (i = 0; i < c->num; i++)
{
printf ("Page %d: %04x +%d = 0x%x\n",
i, numbers[i], leaves[i],
(intptr_t) FcOffsetToPtr (leaves, leaves[i], FcCharLeaf));
}
#endif
for (i = 0; i < c->num; i++)
{
intptr_t leaf_offset = leaves[i];
FcCharLeaf *leaf = FcOffsetToPtr (leaves, leaf_offset, FcCharLeaf);
if (i)
printf ("\t");
printf ("%04x:", numbers[i]);
for (j = 0; j < 256/32; j++)
printf (" %08x", leaf->map[j]);
printf ("\n");
}
}
void
FcPatternPrint (const FcPattern *p)
{
int i;
FcPatternElt *e;
if (!p)
{
printf ("Null pattern\n");
return;
}
printf ("Pattern has %d elts (size %d)\n", p->num, p->size);
for (i = 0; i < p->num; i++)
{
e = &FcPatternElts(p)[i];
printf ("\t%s:", FcObjectName(e->object));
/* so that fc-match properly displays file: foo... */
if (e->object == FC_FILE_OBJECT)
{
FcChar8 * s;
FcPatternObjectGetString (p, FC_FILE_OBJECT, 0, &s);
printf (" \"%s\"", s);
switch (FcPatternEltValues(e)->binding) {
case FcValueBindingWeak:
printf ("(w)");
break;
case FcValueBindingStrong:
printf ("(s)");
break;
case FcValueBindingSame:
printf ("(=)");
break;
}
}
else
FcValueListPrint (FcPatternEltValues(e));
printf ("\n");
}
printf ("\n");
}
void
FcOpPrint (FcOp op)
{
switch (op) {
case FcOpInteger: printf ("Integer"); break;
case FcOpDouble: printf ("Double"); break;
case FcOpString: printf ("String"); break;
case FcOpMatrix: printf ("Matrix"); break;
case FcOpBool: printf ("Bool"); break;
case FcOpCharSet: printf ("CharSet"); break;
case FcOpField: printf ("Field"); break;
case FcOpConst: printf ("Const"); break;
case FcOpAssign: printf ("Assign"); break;
case FcOpAssignReplace: printf ("AssignReplace"); break;
case FcOpPrepend: printf ("Prepend"); break;
case FcOpPrependFirst: printf ("PrependFirst"); break;
case FcOpAppend: printf ("Append"); break;
case FcOpAppendLast: printf ("AppendLast"); break;
case FcOpQuest: printf ("Quest"); break;
case FcOpOr: printf ("Or"); break;
case FcOpAnd: printf ("And"); break;
case FcOpEqual: printf ("Equal"); break;
case FcOpNotEqual: printf ("NotEqual"); break;
case FcOpLess: printf ("Less"); break;
case FcOpLessEqual: printf ("LessEqual"); break;
case FcOpMore: printf ("More"); break;
case FcOpMoreEqual: printf ("MoreEqual"); break;
case FcOpContains: printf ("Contains"); break;
case FcOpNotContains: printf ("NotContains"); break;
case FcOpPlus: printf ("Plus"); break;
case FcOpMinus: printf ("Minus"); break;
case FcOpTimes: printf ("Times"); break;
case FcOpDivide: printf ("Divide"); break;
case FcOpNot: printf ("Not"); break;
case FcOpNil: printf ("Nil"); break;
case FcOpComma: printf ("Comma"); break;
case FcOpFloor: printf ("Floor"); break;
case FcOpCeil: printf ("Ceil"); break;
case FcOpRound: printf ("Round"); break;
case FcOpTrunc: printf ("Trunc"); break;
case FcOpListing: printf ("Listing"); break;
case FcOpInvalid: printf ("Invalid"); break;
}
}
void
FcExprPrint (const FcExpr *expr)
{
if (!expr) printf ("none");
else switch (expr->op) {
case FcOpInteger: printf ("%d", expr->u.ival); break;
case FcOpDouble: printf ("%g", expr->u.dval); break;
case FcOpString: printf ("\"%s\"", expr->u.sval); break;
case FcOpMatrix: printf ("[%g %g %g %g]",
expr->u.mval->xx,
expr->u.mval->xy,
expr->u.mval->yx,
expr->u.mval->yy); break;
case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
case FcOpCharSet: printf ("charset\n"); break;
case FcOpNil: printf ("nil\n"); break;
case FcOpField: printf ("%s", FcObjectName(expr->u.object)); break;
case FcOpConst: printf ("%s", expr->u.constant); break;
case FcOpQuest:
FcExprPrint (expr->u.tree.left);
printf (" quest ");
FcExprPrint (expr->u.tree.right->u.tree.left);
printf (" colon ");
FcExprPrint (expr->u.tree.right->u.tree.right);
break;
case FcOpAssign:
case FcOpAssignReplace:
case FcOpPrependFirst:
case FcOpPrepend:
case FcOpAppend:
case FcOpAppendLast:
case FcOpOr:
case FcOpAnd:
case FcOpEqual:
case FcOpNotEqual:
case FcOpLess:
case FcOpLessEqual:
case FcOpMore:
case FcOpMoreEqual:
case FcOpContains:
case FcOpListing:
case FcOpNotContains:
case FcOpPlus:
case FcOpMinus:
case FcOpTimes:
case FcOpDivide:
case FcOpComma:
FcExprPrint (expr->u.tree.left);
printf (" ");
switch (expr->op) {
case FcOpAssign: printf ("Assign"); break;
case FcOpAssignReplace: printf ("AssignReplace"); break;
case FcOpPrependFirst: printf ("PrependFirst"); break;
case FcOpPrepend: printf ("Prepend"); break;
case FcOpAppend: printf ("Append"); break;
case FcOpAppendLast: printf ("AppendLast"); break;
case FcOpOr: printf ("Or"); break;
case FcOpAnd: printf ("And"); break;
case FcOpEqual: printf ("Equal"); break;
case FcOpNotEqual: printf ("NotEqual"); break;
case FcOpLess: printf ("Less"); break;
case FcOpLessEqual: printf ("LessEqual"); break;
case FcOpMore: printf ("More"); break;
case FcOpMoreEqual: printf ("MoreEqual"); break;
case FcOpContains: printf ("Contains"); break;
case FcOpListing: printf ("Listing"); break;
case FcOpNotContains: printf ("NotContains"); break;
case FcOpPlus: printf ("Plus"); break;
case FcOpMinus: printf ("Minus"); break;
case FcOpTimes: printf ("Times"); break;
case FcOpDivide: printf ("Divide"); break;
case FcOpComma: printf ("Comma"); break;
default: break;
}
printf (" ");
FcExprPrint (expr->u.tree.right);
break;
case FcOpNot:
printf ("Not ");
FcExprPrint (expr->u.tree.left);
break;
case FcOpFloor:
printf ("Floor ");
FcExprPrint (expr->u.tree.left);
break;
case FcOpCeil:
printf ("Ceil ");
FcExprPrint (expr->u.tree.left);
break;
case FcOpRound:
printf ("Round ");
FcExprPrint (expr->u.tree.left);
break;
case FcOpTrunc:
printf ("Trunc ");
FcExprPrint (expr->u.tree.left);
break;
case FcOpInvalid: printf ("Invalid"); break;
}
}
void
FcTestPrint (const FcTest *test)
{
switch (test->kind) {
case FcMatchPattern:
printf ("pattern ");
break;
case FcMatchFont:
printf ("font ");
break;
case FcMatchScan:
printf ("scan ");
break;
}
switch (test->qual) {
case FcQualAny:
printf ("any ");
break;
case FcQualAll:
printf ("all ");
break;
case FcQualFirst:
printf ("first ");
break;
case FcQualNotFirst:
printf ("not_first ");
break;
}
printf ("%s ", FcObjectName (test->object));
FcOpPrint (test->op);
printf (" ");
FcExprPrint (test->expr);
printf ("\n");
}
void
FcEditPrint (const FcEdit *edit)
{
printf ("Edit %s ", FcObjectName (edit->object));
FcOpPrint (edit->op);
printf (" ");
FcExprPrint (edit->expr);
}
void
FcSubstPrint (const FcSubst *subst)
{
FcEdit *e;
FcTest *t;
printf ("match\n");
for (t = subst->test; t; t = t->next)
{
printf ("\t");
FcTestPrint (t);
}
printf ("edit\n");
for (e = subst->edit; e; e = e->next)
{
printf ("\t");
FcEditPrint (e);
printf (";\n");
}
printf ("\n");
}
void
FcFontSetPrint (const FcFontSet *s)
{
int i;
printf ("FontSet %d of %d\n", s->nfont, s->sfont);
for (i = 0; i < s->nfont; i++)
{
printf ("Font %d ", i);
FcPatternPrint (s->fonts[i]);
}
}
int FcDebugVal;
void
FcInitDebug (void)
{
char *e;
e = getenv ("FC_DEBUG");
if (e)
{
printf ("FC_DEBUG=%s\n", e);
FcDebugVal = atoi (e);
if (FcDebugVal < 0)
FcDebugVal = 0;
}
}
#define __fcdbg__
#include "fcaliastail.h"
#undef __fcdbg__
|