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 FcValueListPrint (FcPatternEltValues(e));
159 case FcOpInteger: printf ("Integer"); break;
160 case FcOpDouble: printf ("Double"); break;
161 case FcOpString: printf ("String"); break;
162 case FcOpMatrix: printf ("Matrix"); break;
163 case FcOpBool: printf ("Bool"); break;
164 case FcOpCharSet: printf ("CharSet"); break;
165 case FcOpField: printf ("Field"); break;
166 case FcOpConst: printf ("Const"); break;
167 case FcOpAssign: printf ("Assign"); break;
168 case FcOpAssignReplace: printf ("AssignReplace"); break;
169 case FcOpPrepend: printf ("Prepend"); break;
170 case FcOpPrependFirst: printf ("PrependFirst"); break;
171 case FcOpAppend: printf ("Append"); break;
172 case FcOpAppendLast: printf ("AppendLast"); break;
173 case FcOpQuest: printf ("Quest"); break;
174 case FcOpOr: printf ("Or"); break;
175 case FcOpAnd: printf ("And"); break;
176 case FcOpEqual: printf ("Equal"); break;
177 case FcOpNotEqual: printf ("NotEqual"); break;
178 case FcOpLess: printf ("Less"); break;
179 case FcOpLessEqual: printf ("LessEqual"); break;
180 case FcOpMore: printf ("More"); break;
181 case FcOpMoreEqual: printf ("MoreEqual"); break;
182 case FcOpContains: printf ("Contains"); break;
183 case FcOpNotContains: printf ("NotContains"); break;
184 case FcOpPlus: printf ("Plus"); break;
185 case FcOpMinus: printf ("Minus"); break;
186 case FcOpTimes: printf ("Times"); break;
187 case FcOpDivide: printf ("Divide"); break;
188 case FcOpNot: printf ("Not"); break;
189 case FcOpNil: printf ("Nil"); break;
190 case FcOpComma: printf ("Comma"); break;
191 case FcOpFloor: printf ("Floor"); break;
192 case FcOpCeil: printf ("Ceil"); break;
193 case FcOpRound: printf ("Round"); break;
194 case FcOpTrunc: printf ("Trunc"); break;
195 case FcOpListing: printf ("Listing"); break;
196 case FcOpInvalid: printf ("Invalid"); break;
201 FcExprPrint (const FcExpr *expr)
203 if (!expr) printf ("none");
204 else switch (expr->op) {
205 case FcOpInteger: printf ("%d", expr->u.ival); break;
206 case FcOpDouble: printf ("%g", expr->u.dval); break;
207 case FcOpString: printf ("\"%s\"", expr->u.sval); break;
208 case FcOpMatrix: printf ("[%g %g %g %g]",
212 expr->u.mval->yy); break;
213 case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
214 case FcOpCharSet: printf ("charset\n"); break;
215 case FcOpNil: printf ("nil\n"); break;
216 case FcOpField: printf ("%s", FcObjectName(expr->u.object)); break;
217 case FcOpConst: printf ("%s", expr->u.constant); break;
219 FcExprPrint (expr->u.tree.left);
221 FcExprPrint (expr->u.tree.right->u.tree.left);
223 FcExprPrint (expr->u.tree.right->u.tree.right);
226 case FcOpAssignReplace:
227 case FcOpPrependFirst:
241 case FcOpNotContains:
247 FcExprPrint (expr->u.tree.left);
250 case FcOpAssign: printf ("Assign"); break;
251 case FcOpAssignReplace: printf ("AssignReplace"); break;
252 case FcOpPrependFirst: printf ("PrependFirst"); break;
253 case FcOpPrepend: printf ("Prepend"); break;
254 case FcOpAppend: printf ("Append"); break;
255 case FcOpAppendLast: printf ("AppendLast"); break;
256 case FcOpOr: printf ("Or"); break;
257 case FcOpAnd: printf ("And"); break;
258 case FcOpEqual: printf ("Equal"); break;
259 case FcOpNotEqual: printf ("NotEqual"); break;
260 case FcOpLess: printf ("Less"); break;
261 case FcOpLessEqual: printf ("LessEqual"); break;
262 case FcOpMore: printf ("More"); break;
263 case FcOpMoreEqual: printf ("MoreEqual"); break;
264 case FcOpContains: printf ("Contains"); break;
265 case FcOpListing: printf ("Listing"); break;
266 case FcOpNotContains: printf ("NotContains"); break;
267 case FcOpPlus: printf ("Plus"); break;
268 case FcOpMinus: printf ("Minus"); break;
269 case FcOpTimes: printf ("Times"); break;
270 case FcOpDivide: printf ("Divide"); break;
271 case FcOpComma: printf ("Comma"); break;
275 FcExprPrint (expr->u.tree.right);
279 FcExprPrint (expr->u.tree.left);
283 FcExprPrint (expr->u.tree.left);
287 FcExprPrint (expr->u.tree.left);
291 FcExprPrint (expr->u.tree.left);
295 FcExprPrint (expr->u.tree.left);
297 case FcOpInvalid: printf ("Invalid"); break;
302 FcTestPrint (const FcTest *test)
304 switch (test->kind) {
315 switch (test->qual) {
326 printf ("not_first ");
329 printf ("%s ", FcObjectName (test->object));
330 FcOpPrint (test->op);
332 FcExprPrint (test->expr);
337 FcEditPrint (const FcEdit *edit)
339 printf ("Edit %s ", FcObjectName (edit->object));
340 FcOpPrint (edit->op);
342 FcExprPrint (edit->expr);
346 FcSubstPrint (const FcSubst *subst)
352 for (t = subst->test; t; t = t->next)
358 for (e = subst->edit; e; e = e->next)
368 FcFontSetPrint (const FcFontSet *s)
372 printf ("FontSet %d of %d\n", s->nfont, s->sfont);
373 for (i = 0; i < s->nfont; i++)
375 printf ("Font %d ", i);
376 FcPatternPrint (s->fonts[i]);
387 e = getenv ("FC_DEBUG");
390 printf ("FC_DEBUG=%s\n", e);
391 FcDebugVal = atoi (e);
397 #include "fcaliastail.h"