2 * fontconfig/src/fcdbg.c
4 * Copyright © 2000 Keith Packard
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
30 FcValuePrint (const FcValue v)
37 printf (" %d(i)", v.u.i);
40 printf (" %g(f)", v.u.d);
43 printf (" \"%s\"", v.u.s);
46 printf (" %s", v.u.b ? "FcTrue" : "FcFalse");
49 printf (" (%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
51 case FcTypeCharSet: /* XXX */
53 FcCharSetPrint (v.u.c);
57 FcLangSetPrint (v.u.l);
66 FcValueListPrint (FcValueListPtr l)
68 for (; l != NULL; l = FcValueListNext(l))
70 FcValuePrint (FcValueCanonicalize(&l->value));
72 case FcValueBindingWeak:
75 case FcValueBindingStrong:
78 case FcValueBindingSame:
86 FcLangSetPrint (const FcLangSet *ls)
89 FcChar8 init_buf[1024];
91 FcStrBufInit (&buf, init_buf, sizeof (init_buf));
92 if (FcNameUnparseLangSet (&buf, ls) && FcStrBufChar (&buf,'\0'))
93 printf ("%s", buf.buf);
95 printf ("langset (alloc error)");
96 FcStrBufDestroy (&buf);
100 FcCharSetPrint (const FcCharSet *c)
103 intptr_t *leaves = FcCharSetLeaves (c);
104 FcChar16 *numbers = FcCharSetNumbers (c);
107 printf ("CharSet 0x%x\n", (intptr_t) c);
108 printf ("Leaves: +%d = 0x%x\n", c->leaves_offset, (intptr_t) leaves);
109 printf ("Numbers: +%d = 0x%x\n", c->numbers_offset, (intptr_t) numbers);
111 for (i = 0; i < c->num; i++)
113 printf ("Page %d: %04x +%d = 0x%x\n",
114 i, numbers[i], leaves[i],
115 (intptr_t) FcOffsetToPtr (leaves, leaves[i], FcCharLeaf));
119 for (i = 0; i < c->num; i++)
121 intptr_t leaf_offset = leaves[i];
122 FcCharLeaf *leaf = FcOffsetToPtr (leaves, leaf_offset, FcCharLeaf);
126 printf ("%04x:", numbers[i]);
127 for (j = 0; j < 256/32; j++)
128 printf (" %08x", leaf->map[j]);
134 FcPatternPrint (const FcPattern *p)
141 printf ("Null pattern\n");
144 printf ("Pattern has %d elts (size %d)\n", p->num, p->size);
145 for (i = 0; i < p->num; i++)
147 e = &FcPatternElts(p)[i];
148 printf ("\t%s:", FcObjectName(e->object));
149 /* so that fc-match properly displays file: foo... */
150 if (e->object == FC_FILE_OBJECT)
153 FcPatternObjectGetString (p, FC_FILE_OBJECT, 0, &s);
154 printf (" \"%s\"", s);
155 switch (FcPatternEltValues(e)->binding) {
156 case FcValueBindingWeak:
159 case FcValueBindingStrong:
162 case FcValueBindingSame:
168 FcValueListPrint (FcPatternEltValues(e));
178 case FcOpInteger: printf ("Integer"); break;
179 case FcOpDouble: printf ("Double"); break;
180 case FcOpString: printf ("String"); break;
181 case FcOpMatrix: printf ("Matrix"); break;
182 case FcOpBool: printf ("Bool"); break;
183 case FcOpCharSet: printf ("CharSet"); break;
184 case FcOpField: printf ("Field"); break;
185 case FcOpConst: printf ("Const"); break;
186 case FcOpAssign: printf ("Assign"); break;
187 case FcOpAssignReplace: printf ("AssignReplace"); break;
188 case FcOpPrepend: printf ("Prepend"); break;
189 case FcOpPrependFirst: printf ("PrependFirst"); break;
190 case FcOpAppend: printf ("Append"); break;
191 case FcOpAppendLast: printf ("AppendLast"); break;
192 case FcOpQuest: printf ("Quest"); break;
193 case FcOpOr: printf ("Or"); break;
194 case FcOpAnd: printf ("And"); break;
195 case FcOpEqual: printf ("Equal"); break;
196 case FcOpNotEqual: printf ("NotEqual"); break;
197 case FcOpLess: printf ("Less"); break;
198 case FcOpLessEqual: printf ("LessEqual"); break;
199 case FcOpMore: printf ("More"); break;
200 case FcOpMoreEqual: printf ("MoreEqual"); break;
201 case FcOpContains: printf ("Contains"); break;
202 case FcOpNotContains: printf ("NotContains"); break;
203 case FcOpPlus: printf ("Plus"); break;
204 case FcOpMinus: printf ("Minus"); break;
205 case FcOpTimes: printf ("Times"); break;
206 case FcOpDivide: printf ("Divide"); break;
207 case FcOpNot: printf ("Not"); break;
208 case FcOpNil: printf ("Nil"); break;
209 case FcOpComma: printf ("Comma"); break;
210 case FcOpFloor: printf ("Floor"); break;
211 case FcOpCeil: printf ("Ceil"); break;
212 case FcOpRound: printf ("Round"); break;
213 case FcOpTrunc: printf ("Trunc"); break;
214 case FcOpListing: printf ("Listing"); break;
215 case FcOpInvalid: printf ("Invalid"); break;
220 FcExprPrint (const FcExpr *expr)
222 if (!expr) printf ("none");
223 else switch (expr->op) {
224 case FcOpInteger: printf ("%d", expr->u.ival); break;
225 case FcOpDouble: printf ("%g", expr->u.dval); break;
226 case FcOpString: printf ("\"%s\"", expr->u.sval); break;
227 case FcOpMatrix: printf ("[%g %g %g %g]",
231 expr->u.mval->yy); break;
232 case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
233 case FcOpCharSet: printf ("charset\n"); break;
234 case FcOpNil: printf ("nil\n"); break;
235 case FcOpField: printf ("%s", FcObjectName(expr->u.object)); break;
236 case FcOpConst: printf ("%s", expr->u.constant); break;
238 FcExprPrint (expr->u.tree.left);
240 FcExprPrint (expr->u.tree.right->u.tree.left);
242 FcExprPrint (expr->u.tree.right->u.tree.right);
245 case FcOpAssignReplace:
246 case FcOpPrependFirst:
260 case FcOpNotContains:
266 FcExprPrint (expr->u.tree.left);
269 case FcOpAssign: printf ("Assign"); break;
270 case FcOpAssignReplace: printf ("AssignReplace"); break;
271 case FcOpPrependFirst: printf ("PrependFirst"); break;
272 case FcOpPrepend: printf ("Prepend"); break;
273 case FcOpAppend: printf ("Append"); break;
274 case FcOpAppendLast: printf ("AppendLast"); break;
275 case FcOpOr: printf ("Or"); break;
276 case FcOpAnd: printf ("And"); break;
277 case FcOpEqual: printf ("Equal"); break;
278 case FcOpNotEqual: printf ("NotEqual"); break;
279 case FcOpLess: printf ("Less"); break;
280 case FcOpLessEqual: printf ("LessEqual"); break;
281 case FcOpMore: printf ("More"); break;
282 case FcOpMoreEqual: printf ("MoreEqual"); break;
283 case FcOpContains: printf ("Contains"); break;
284 case FcOpListing: printf ("Listing"); break;
285 case FcOpNotContains: printf ("NotContains"); break;
286 case FcOpPlus: printf ("Plus"); break;
287 case FcOpMinus: printf ("Minus"); break;
288 case FcOpTimes: printf ("Times"); break;
289 case FcOpDivide: printf ("Divide"); break;
290 case FcOpComma: printf ("Comma"); break;
294 FcExprPrint (expr->u.tree.right);
298 FcExprPrint (expr->u.tree.left);
302 FcExprPrint (expr->u.tree.left);
306 FcExprPrint (expr->u.tree.left);
310 FcExprPrint (expr->u.tree.left);
314 FcExprPrint (expr->u.tree.left);
316 case FcOpInvalid: printf ("Invalid"); break;
321 FcTestPrint (const FcTest *test)
323 switch (test->kind) {
334 switch (test->qual) {
345 printf ("not_first ");
348 printf ("%s ", FcObjectName (test->object));
349 FcOpPrint (test->op);
351 FcExprPrint (test->expr);
356 FcEditPrint (const FcEdit *edit)
358 printf ("Edit %s ", FcObjectName (edit->object));
359 FcOpPrint (edit->op);
361 FcExprPrint (edit->expr);
365 FcSubstPrint (const FcSubst *subst)
371 for (t = subst->test; t; t = t->next)
377 for (e = subst->edit; e; e = e->next)
387 FcFontSetPrint (const FcFontSet *s)
391 printf ("FontSet %d of %d\n", s->nfont, s->sfont);
392 for (i = 0; i < s->nfont; i++)
394 printf ("Font %d ", i);
395 FcPatternPrint (s->fonts[i]);
406 e = getenv ("FC_DEBUG");
409 printf ("FC_DEBUG=%s\n", e);
410 FcDebugVal = atoi (e);
416 #include "fcaliastail.h"