2002-02-15 00:34:13 +01:00
|
|
|
/*
|
2008-08-12 22:34:24 +02:00
|
|
|
* fontconfig/src/fcdbg.c
|
2002-02-15 00:34:13 +01:00
|
|
|
*
|
2004-12-07 02:14:46 +01:00
|
|
|
* Copyright © 2000 Keith Packard
|
2002-02-15 00:34:13 +01:00
|
|
|
*
|
|
|
|
* 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
|
2010-11-10 22:45:42 +01:00
|
|
|
* documentation, and that the name of the author(s) not be used in
|
2002-02-15 00:34:13 +01:00
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
2010-11-10 22:45:42 +01:00
|
|
|
* specific, written prior permission. The authors make no
|
2002-02-15 00:34:13 +01:00
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
2009-03-12 21:00:08 +01:00
|
|
|
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
2002-02-15 00:34:13 +01:00
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
2009-03-12 21:00:08 +01:00
|
|
|
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
2002-02-15 00:34:13 +01:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2006-04-25 07:57:41 +02:00
|
|
|
#include "fcint.h"
|
2002-02-15 00:34:13 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2012-05-01 13:18:41 +02:00
|
|
|
static void
|
2013-01-02 02:52:14 +01:00
|
|
|
_FcValuePrintFile (FILE *f, const FcValue v)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
|
|
|
switch (v.type) {
|
2013-06-28 08:04:11 +02:00
|
|
|
case FcTypeUnknown:
|
|
|
|
fprintf (f, "<unknown>");
|
|
|
|
break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcTypeVoid:
|
2013-01-02 02:52:14 +01:00
|
|
|
fprintf (f, "<void>");
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
|
|
|
case FcTypeInteger:
|
2013-01-02 02:52:14 +01:00
|
|
|
fprintf (f, "%d(i)", v.u.i);
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
|
|
|
case FcTypeDouble:
|
2013-01-02 02:52:14 +01:00
|
|
|
fprintf (f, "%g(f)", v.u.d);
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
|
|
|
case FcTypeString:
|
2013-01-02 02:52:14 +01:00
|
|
|
fprintf (f, "\"%s\"", v.u.s);
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
|
|
|
case FcTypeBool:
|
2017-09-16 19:45:02 +02:00
|
|
|
fprintf (f,
|
2017-09-29 07:33:17 +02:00
|
|
|
v.u.b == FcTrue ? "True" :
|
|
|
|
v.u.b == FcFalse ? "False" :
|
|
|
|
"DontCare");
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
|
|
|
case FcTypeMatrix:
|
2013-01-02 02:52:14 +01:00
|
|
|
fprintf (f, "[%g %g; %g %g]", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
|
|
|
case FcTypeCharSet: /* XXX */
|
2013-01-02 02:52:14 +01:00
|
|
|
if (f == stdout)
|
|
|
|
FcCharSetPrint (v.u.c);
|
2002-08-22 09:36:45 +02:00
|
|
|
break;
|
|
|
|
case FcTypeLangSet:
|
2005-08-24 08:21:30 +02:00
|
|
|
FcLangSetPrint (v.u.l);
|
2002-02-15 00:34:13 +01:00
|
|
|
break;
|
2002-06-02 23:07:57 +02:00
|
|
|
case FcTypeFTFace:
|
2013-01-02 02:52:14 +01:00
|
|
|
fprintf (f, "face");
|
2012-05-01 13:18:41 +02:00
|
|
|
break;
|
2013-11-20 10:44:59 +01:00
|
|
|
case FcTypeRange:
|
2017-09-13 09:29:20 +02:00
|
|
|
fprintf (f, "[%g %g]", v.u.r->begin, v.u.r->end);
|
2013-11-20 10:44:59 +01:00
|
|
|
break;
|
2012-05-01 13:18:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-02 02:52:14 +01:00
|
|
|
void
|
|
|
|
FcValuePrintFile (FILE *f, const FcValue v)
|
|
|
|
{
|
|
|
|
fprintf (f, " ");
|
|
|
|
_FcValuePrintFile (f, v);
|
|
|
|
}
|
|
|
|
|
2012-05-01 13:18:41 +02:00
|
|
|
void
|
|
|
|
FcValuePrint (const FcValue v)
|
|
|
|
{
|
|
|
|
printf (" ");
|
2013-01-02 02:52:14 +01:00
|
|
|
_FcValuePrintFile (stdout, v);
|
2012-05-01 13:18:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark)
|
|
|
|
{
|
|
|
|
if (show_pos_mark)
|
2013-01-29 12:19:36 +01:00
|
|
|
printf (" [marker] ");
|
2012-05-01 13:18:41 +02:00
|
|
|
else
|
|
|
|
printf (" ");
|
2013-01-02 02:52:14 +01:00
|
|
|
_FcValuePrintFile (stdout, v);
|
2012-05-01 13:18:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
FcValueBindingPrint (const FcValueListPtr l)
|
|
|
|
{
|
|
|
|
switch (l->binding) {
|
|
|
|
case FcValueBindingWeak:
|
|
|
|
printf ("(w)");
|
|
|
|
break;
|
|
|
|
case FcValueBindingStrong:
|
|
|
|
printf ("(s)");
|
|
|
|
break;
|
|
|
|
case FcValueBindingSame:
|
|
|
|
printf ("(=)");
|
2002-06-02 23:07:57 +02:00
|
|
|
break;
|
2013-06-28 08:04:11 +02:00
|
|
|
default:
|
|
|
|
/* shouldn't be reached */
|
|
|
|
printf ("(?)");
|
|
|
|
break;
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-01 13:18:41 +02:00
|
|
|
void
|
|
|
|
FcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos)
|
|
|
|
{
|
|
|
|
for (; l != NULL; l = FcValueListNext(l))
|
|
|
|
{
|
|
|
|
FcValuePrintWithPosition (FcValueCanonicalize (&l->value), pos != NULL && l == pos);
|
|
|
|
FcValueBindingPrint (l);
|
|
|
|
}
|
|
|
|
if (!pos)
|
2013-01-29 12:19:36 +01:00
|
|
|
printf (" [marker]");
|
2012-05-01 13:18:41 +02:00
|
|
|
}
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
void
|
2005-06-28 05:41:02 +02:00
|
|
|
FcValueListPrint (FcValueListPtr l)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2006-08-30 13:16:22 +02:00
|
|
|
for (; l != NULL; l = FcValueListNext(l))
|
2002-11-22 03:12:16 +01:00
|
|
|
{
|
2012-05-01 13:18:41 +02:00
|
|
|
FcValuePrint (FcValueCanonicalize (&l->value));
|
|
|
|
FcValueBindingPrint (l);
|
2002-11-22 03:12:16 +01:00
|
|
|
}
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-03-05 06:52:51 +01:00
|
|
|
FcLangSetPrint (const FcLangSet *ls)
|
|
|
|
{
|
|
|
|
FcStrBuf buf;
|
|
|
|
FcChar8 init_buf[1024];
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2003-03-05 06:52:51 +01:00
|
|
|
FcStrBufInit (&buf, init_buf, sizeof (init_buf));
|
|
|
|
if (FcNameUnparseLangSet (&buf, ls) && FcStrBufChar (&buf,'\0'))
|
2005-06-28 05:41:02 +02:00
|
|
|
printf ("%s", buf.buf);
|
2003-03-05 06:52:51 +01:00
|
|
|
else
|
2005-06-28 05:41:02 +02:00
|
|
|
printf ("langset (alloc error)");
|
2003-03-05 06:52:51 +01:00
|
|
|
FcStrBufDestroy (&buf);
|
|
|
|
}
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
void
|
|
|
|
FcCharSetPrint (const FcCharSet *c)
|
|
|
|
{
|
|
|
|
int i, j;
|
2006-08-30 22:51:03 +02:00
|
|
|
intptr_t *leaves = FcCharSetLeaves (c);
|
|
|
|
FcChar16 *numbers = FcCharSetNumbers (c);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-09-03 02:52:12 +02:00
|
|
|
#if 0
|
2006-08-30 22:51:03 +02:00
|
|
|
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);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-08-30 22:51:03 +02:00
|
|
|
for (i = 0; i < c->num; i++)
|
|
|
|
{
|
2010-04-12 18:18:50 +02:00
|
|
|
printf ("Page %d: %04x +%d = 0x%x\n",
|
|
|
|
i, numbers[i], leaves[i],
|
2006-08-30 22:51:03 +02:00
|
|
|
(intptr_t) FcOffsetToPtr (leaves, leaves[i], FcCharLeaf));
|
|
|
|
}
|
2006-09-03 02:52:12 +02:00
|
|
|
#endif
|
2006-08-30 22:51:03 +02:00
|
|
|
|
2009-07-28 20:23:10 +02:00
|
|
|
printf ("\n");
|
2006-08-30 13:16:22 +02:00
|
|
|
for (i = 0; i < c->num; i++)
|
|
|
|
{
|
2006-08-30 22:51:03 +02:00
|
|
|
intptr_t leaf_offset = leaves[i];
|
|
|
|
FcCharLeaf *leaf = FcOffsetToPtr (leaves, leaf_offset, FcCharLeaf);
|
2006-08-30 13:16:22 +02:00
|
|
|
|
2009-07-28 20:23:10 +02:00
|
|
|
printf ("\t");
|
2006-08-30 22:51:03 +02:00
|
|
|
printf ("%04x:", numbers[i]);
|
2006-08-30 13:16:22 +02:00
|
|
|
for (j = 0; j < 256/32; j++)
|
|
|
|
printf (" %08x", leaf->map[j]);
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-05 06:52:51 +01:00
|
|
|
void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcPatternPrint (const FcPattern *p)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2018-05-11 13:48:30 +02:00
|
|
|
FcPatternIter iter;
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
printf ("Null pattern\n");
|
|
|
|
return;
|
|
|
|
}
|
2018-05-11 13:48:30 +02:00
|
|
|
printf ("Pattern has %d elts (size %d)\n", FcPatternObjectCount (p), p->size);
|
|
|
|
FcPatternIterStart (p, &iter);
|
|
|
|
do
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2018-05-11 13:48:30 +02:00
|
|
|
printf ("\t%s:", FcPatternIterGetObject (p, &iter));
|
|
|
|
FcValueListPrint (FcPatternIterGetValues (p, &iter));
|
2002-02-15 00:34:13 +01:00
|
|
|
printf ("\n");
|
2018-05-11 13:48:30 +02:00
|
|
|
} while (FcPatternIterNext (p, &iter));
|
2002-02-15 00:34:13 +01:00
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
|
2012-04-11 12:52:35 +02:00
|
|
|
#define FcOpFlagsPrint(_o_) \
|
|
|
|
{ \
|
|
|
|
int f = FC_OP_GET_FLAGS (_o_); \
|
|
|
|
if (f & FcOpFlagIgnoreBlanks) \
|
|
|
|
printf ("(ignore blanks)"); \
|
|
|
|
}
|
|
|
|
|
2015-06-08 10:38:02 +02:00
|
|
|
void
|
|
|
|
FcPatternPrint2 (FcPattern *pp1,
|
|
|
|
FcPattern *pp2,
|
|
|
|
const FcObjectSet *os)
|
|
|
|
{
|
|
|
|
int i, j, k, pos;
|
|
|
|
FcPatternElt *e1, *e2;
|
|
|
|
FcPattern *p1, *p2;
|
|
|
|
|
|
|
|
if (os)
|
|
|
|
{
|
|
|
|
p1 = FcPatternFilter (pp1, os);
|
|
|
|
p2 = FcPatternFilter (pp2, os);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p1 = pp1;
|
|
|
|
p2 = pp2;
|
|
|
|
}
|
|
|
|
printf ("Pattern has %d elts (size %d), %d elts (size %d)\n",
|
|
|
|
p1->num, p1->size, p2->num, p2->size);
|
|
|
|
for (i = 0, j = 0; i < p1->num; i++)
|
|
|
|
{
|
|
|
|
e1 = &FcPatternElts(p1)[i];
|
|
|
|
e2 = &FcPatternElts(p2)[j];
|
2015-06-09 04:15:06 +02:00
|
|
|
if (!e2 || e1->object != e2->object)
|
2015-06-08 10:38:02 +02:00
|
|
|
{
|
|
|
|
pos = FcPatternPosition (p2, FcObjectName (e1->object));
|
|
|
|
if (pos >= 0)
|
|
|
|
{
|
|
|
|
for (k = j; k < pos; k++)
|
|
|
|
{
|
|
|
|
e2 = &FcPatternElts(p2)[k];
|
|
|
|
printf ("\t%s: (None) -> ", FcObjectName (e2->object));
|
|
|
|
FcValueListPrint (FcPatternEltValues (e2));
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
j = pos;
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf ("\t%s:", FcObjectName (e1->object));
|
|
|
|
FcValueListPrint (FcPatternEltValues (e1));
|
|
|
|
printf (" -> (None)\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cont:
|
|
|
|
printf ("\t%s:", FcObjectName (e1->object));
|
|
|
|
FcValueListPrint (FcPatternEltValues (e1));
|
|
|
|
printf (" -> ");
|
|
|
|
e2 = &FcPatternElts(p2)[j];
|
|
|
|
FcValueListPrint (FcPatternEltValues (e2));
|
|
|
|
printf ("\n");
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (j < p2->num)
|
|
|
|
{
|
|
|
|
for (k = j; k < p2->num; k++)
|
|
|
|
{
|
|
|
|
e2 = &FcPatternElts(p2)[k];
|
|
|
|
if (FcObjectName (e2->object))
|
|
|
|
{
|
|
|
|
printf ("\t%s: (None) -> ", FcObjectName (e2->object));
|
|
|
|
FcValueListPrint (FcPatternEltValues (e2));
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p1 != pp1)
|
|
|
|
FcPatternDestroy (p1);
|
|
|
|
if (p2 != pp2)
|
|
|
|
FcPatternDestroy (p2);
|
|
|
|
}
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
void
|
2012-04-11 12:52:35 +02:00
|
|
|
FcOpPrint (FcOp op_)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2012-04-11 12:52:35 +02:00
|
|
|
FcOp op = FC_OP_GET_OP (op_);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
switch (op) {
|
|
|
|
case FcOpInteger: printf ("Integer"); break;
|
|
|
|
case FcOpDouble: printf ("Double"); break;
|
|
|
|
case FcOpString: printf ("String"); break;
|
|
|
|
case FcOpMatrix: printf ("Matrix"); break;
|
2010-12-06 04:10:17 +01:00
|
|
|
case FcOpRange: printf ("Range"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpBool: printf ("Bool"); break;
|
|
|
|
case FcOpCharSet: printf ("CharSet"); break;
|
2010-12-06 04:38:18 +01:00
|
|
|
case FcOpLangSet: printf ("LangSet"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
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;
|
2013-01-29 12:19:36 +01:00
|
|
|
case FcOpDelete: printf ("Delete"); break;
|
|
|
|
case FcOpDeleteAll: printf ("DeleteAll"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpQuest: printf ("Quest"); break;
|
|
|
|
case FcOpOr: printf ("Or"); break;
|
|
|
|
case FcOpAnd: printf ("And"); break;
|
2012-04-11 12:52:35 +02:00
|
|
|
case FcOpEqual: printf ("Equal"); FcOpFlagsPrint (op_); break;
|
|
|
|
case FcOpNotEqual: printf ("NotEqual"); FcOpFlagsPrint (op_); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpLess: printf ("Less"); break;
|
|
|
|
case FcOpLessEqual: printf ("LessEqual"); break;
|
|
|
|
case FcOpMore: printf ("More"); break;
|
|
|
|
case FcOpMoreEqual: printf ("MoreEqual"); break;
|
2002-08-22 20:53:22 +02:00
|
|
|
case FcOpContains: printf ("Contains"); break;
|
|
|
|
case FcOpNotContains: printf ("NotContains"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
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;
|
2003-04-16 01:38:06 +02:00
|
|
|
case FcOpFloor: printf ("Floor"); break;
|
|
|
|
case FcOpCeil: printf ("Ceil"); break;
|
|
|
|
case FcOpRound: printf ("Round"); break;
|
|
|
|
case FcOpTrunc: printf ("Trunc"); break;
|
2012-04-11 12:52:35 +02:00
|
|
|
case FcOpListing: printf ("Listing"); FcOpFlagsPrint (op_); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpInvalid: printf ("Invalid"); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcExprPrint (const FcExpr *expr)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2003-02-27 08:04:31 +01:00
|
|
|
if (!expr) printf ("none");
|
2012-04-11 12:52:35 +02:00
|
|
|
else switch (FC_OP_GET_OP (expr->op)) {
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpInteger: printf ("%d", expr->u.ival); break;
|
|
|
|
case FcOpDouble: printf ("%g", expr->u.dval); break;
|
|
|
|
case FcOpString: printf ("\"%s\"", expr->u.sval); break;
|
2012-12-30 03:39:06 +01:00
|
|
|
case FcOpMatrix:
|
|
|
|
printf ("[");
|
|
|
|
FcExprPrint (expr->u.mexpr->xx);
|
|
|
|
printf (" ");
|
|
|
|
FcExprPrint (expr->u.mexpr->xy);
|
2012-12-30 05:58:38 +01:00
|
|
|
printf ("; ");
|
2012-12-30 03:39:06 +01:00
|
|
|
FcExprPrint (expr->u.mexpr->yx);
|
|
|
|
printf (" ");
|
2012-12-30 05:58:38 +01:00
|
|
|
FcExprPrint (expr->u.mexpr->yy);
|
2012-12-30 03:39:06 +01:00
|
|
|
printf ("]");
|
|
|
|
break;
|
2013-11-20 10:44:59 +01:00
|
|
|
case FcOpRange:
|
2014-08-20 22:07:26 +02:00
|
|
|
printf ("(%g, %g)", expr->u.rval->begin, expr->u.rval->end);
|
2013-11-20 10:44:59 +01:00
|
|
|
break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
|
2002-02-18 23:29:28 +01:00
|
|
|
case FcOpCharSet: printf ("charset\n"); break;
|
2010-12-06 04:38:18 +01:00
|
|
|
case FcOpLangSet:
|
|
|
|
printf ("langset:");
|
|
|
|
FcLangSetPrint(expr->u.lval);
|
|
|
|
printf ("\n");
|
|
|
|
break;
|
2002-06-20 05:43:09 +02:00
|
|
|
case FcOpNil: printf ("nil\n"); break;
|
2012-12-30 05:58:38 +01:00
|
|
|
case FcOpField: printf ("%s ", FcObjectName(expr->u.name.object));
|
|
|
|
switch ((int) expr->u.name.kind) {
|
|
|
|
case FcMatchPattern:
|
|
|
|
printf ("(pattern) ");
|
|
|
|
break;
|
|
|
|
case FcMatchFont:
|
|
|
|
printf ("(font) ");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2002-02-18 23:29:28 +01:00
|
|
|
case FcOpConst: printf ("%s", expr->u.constant); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
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;
|
2002-02-18 23:29:28 +01:00
|
|
|
case FcOpAssign:
|
|
|
|
case FcOpAssignReplace:
|
|
|
|
case FcOpPrependFirst:
|
|
|
|
case FcOpPrepend:
|
|
|
|
case FcOpAppend:
|
|
|
|
case FcOpAppendLast:
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpOr:
|
|
|
|
case FcOpAnd:
|
|
|
|
case FcOpEqual:
|
|
|
|
case FcOpNotEqual:
|
|
|
|
case FcOpLess:
|
|
|
|
case FcOpLessEqual:
|
|
|
|
case FcOpMore:
|
|
|
|
case FcOpMoreEqual:
|
2002-08-22 20:53:22 +02:00
|
|
|
case FcOpContains:
|
2003-07-20 18:06:18 +02:00
|
|
|
case FcOpListing:
|
2002-08-22 20:53:22 +02:00
|
|
|
case FcOpNotContains:
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpPlus:
|
|
|
|
case FcOpMinus:
|
|
|
|
case FcOpTimes:
|
|
|
|
case FcOpDivide:
|
2002-02-18 23:29:28 +01:00
|
|
|
case FcOpComma:
|
2002-02-15 00:34:13 +01:00
|
|
|
FcExprPrint (expr->u.tree.left);
|
|
|
|
printf (" ");
|
2012-04-11 12:52:35 +02:00
|
|
|
switch (FC_OP_GET_OP (expr->op)) {
|
2002-02-18 23:29:28 +01:00
|
|
|
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;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpOr: printf ("Or"); break;
|
|
|
|
case FcOpAnd: printf ("And"); break;
|
2012-04-11 12:52:35 +02:00
|
|
|
case FcOpEqual: printf ("Equal"); FcOpFlagsPrint (expr->op); break;
|
|
|
|
case FcOpNotEqual: printf ("NotEqual"); FcOpFlagsPrint (expr->op); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpLess: printf ("Less"); break;
|
|
|
|
case FcOpLessEqual: printf ("LessEqual"); break;
|
|
|
|
case FcOpMore: printf ("More"); break;
|
|
|
|
case FcOpMoreEqual: printf ("MoreEqual"); break;
|
2002-08-22 20:53:22 +02:00
|
|
|
case FcOpContains: printf ("Contains"); break;
|
2012-04-11 12:52:35 +02:00
|
|
|
case FcOpListing: printf ("Listing"); FcOpFlagsPrint (expr->op); break;
|
2002-08-22 20:53:22 +02:00
|
|
|
case FcOpNotContains: printf ("NotContains"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
case FcOpPlus: printf ("Plus"); break;
|
|
|
|
case FcOpMinus: printf ("Minus"); break;
|
|
|
|
case FcOpTimes: printf ("Times"); break;
|
|
|
|
case FcOpDivide: printf ("Divide"); break;
|
2002-02-18 23:29:28 +01:00
|
|
|
case FcOpComma: printf ("Comma"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
printf (" ");
|
|
|
|
FcExprPrint (expr->u.tree.right);
|
|
|
|
break;
|
|
|
|
case FcOpNot:
|
|
|
|
printf ("Not ");
|
|
|
|
FcExprPrint (expr->u.tree.left);
|
|
|
|
break;
|
2003-04-16 01:38:06 +02:00
|
|
|
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;
|
2002-02-18 23:29:28 +01:00
|
|
|
case FcOpInvalid: printf ("Invalid"); break;
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcTestPrint (const FcTest *test)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2002-08-11 20:11:04 +02:00
|
|
|
switch (test->kind) {
|
|
|
|
case FcMatchPattern:
|
|
|
|
printf ("pattern ");
|
|
|
|
break;
|
|
|
|
case FcMatchFont:
|
|
|
|
printf ("font ");
|
|
|
|
break;
|
2006-09-03 02:52:12 +02:00
|
|
|
case FcMatchScan:
|
|
|
|
printf ("scan ");
|
|
|
|
break;
|
2014-03-27 07:10:44 +01:00
|
|
|
case FcMatchKindEnd:
|
|
|
|
/* shouldn't be reached */
|
|
|
|
return;
|
2002-08-11 20:11:04 +02:00
|
|
|
}
|
2002-02-15 00:34:13 +01:00
|
|
|
switch (test->qual) {
|
|
|
|
case FcQualAny:
|
|
|
|
printf ("any ");
|
|
|
|
break;
|
|
|
|
case FcQualAll:
|
|
|
|
printf ("all ");
|
|
|
|
break;
|
2002-06-19 22:08:22 +02:00
|
|
|
case FcQualFirst:
|
|
|
|
printf ("first ");
|
|
|
|
break;
|
|
|
|
case FcQualNotFirst:
|
|
|
|
printf ("not_first ");
|
|
|
|
break;
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
2006-08-30 13:16:22 +02:00
|
|
|
printf ("%s ", FcObjectName (test->object));
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpPrint (test->op);
|
|
|
|
printf (" ");
|
|
|
|
FcExprPrint (test->expr);
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcEditPrint (const FcEdit *edit)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2006-08-30 13:16:22 +02:00
|
|
|
printf ("Edit %s ", FcObjectName (edit->object));
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpPrint (edit->op);
|
|
|
|
printf (" ");
|
|
|
|
FcExprPrint (edit->expr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-03-27 07:10:44 +01:00
|
|
|
FcRulePrint (const FcRule *rule)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2013-07-04 12:51:03 +02:00
|
|
|
FcRuleType last_type = FcRuleUnknown;
|
2014-03-27 07:10:44 +01:00
|
|
|
const FcRule *r;
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
for (r = rule; r; r = r->next)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2013-07-04 12:51:03 +02:00
|
|
|
if (last_type != r->type)
|
|
|
|
{
|
|
|
|
switch (r->type) {
|
|
|
|
case FcRuleTest:
|
|
|
|
printf ("[test]\n");
|
|
|
|
break;
|
|
|
|
case FcRuleEdit:
|
|
|
|
printf ("[edit]\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
last_type = r->type;
|
|
|
|
}
|
2002-02-15 00:34:13 +01:00
|
|
|
printf ("\t");
|
2013-07-04 12:51:03 +02:00
|
|
|
switch (r->type) {
|
|
|
|
case FcRuleTest:
|
|
|
|
FcTestPrint (r->u.test);
|
|
|
|
break;
|
|
|
|
case FcRuleEdit:
|
|
|
|
FcEditPrint (r->u.edit);
|
|
|
|
printf (";\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcFontSetPrint (const FcFontSet *s)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-24 20:38:05 +01:00
|
|
|
int FcDebugVal;
|
|
|
|
|
|
|
|
void
|
|
|
|
FcInitDebug (void)
|
2002-02-15 00:34:13 +01:00
|
|
|
{
|
2012-10-07 22:09:35 +02:00
|
|
|
if (!FcDebugVal) {
|
|
|
|
char *e;
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2012-10-07 22:09:35 +02:00
|
|
|
e = getenv ("FC_DEBUG");
|
|
|
|
if (e)
|
|
|
|
{
|
|
|
|
printf ("FC_DEBUG=%s\n", e);
|
|
|
|
FcDebugVal = atoi (e);
|
|
|
|
if (FcDebugVal < 0)
|
|
|
|
FcDebugVal = 0;
|
|
|
|
}
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
|
|
|
}
|
2006-09-05 11:24:01 +02:00
|
|
|
#define __fcdbg__
|
|
|
|
#include "fcaliastail.h"
|
|
|
|
#undef __fcdbg__
|