FcBool
FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os);
+FcChar32
+FcPatternHash (const FcPattern *p);
+
FcBool
FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
FcValueListPrint (v2orig);
printf ("\n");
}
- value[i] += best;
+ if (value)
+ value[i] += best;
return FcTrue;
}
int i;
FcPatternElt *fe, *pe;
FcValue v;
- double score[NUM_MATCHER];
FcResult result;
new = FcPatternCreate ();
if (pe)
{
if (!FcCompareValueList (pe->object, pe->values,
- fe->values, &v, score, &result))
+ fe->values, &v, 0, &result))
{
FcPatternDestroy (new);
return 0;
if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim))
goto bail2;
- *csp = cs;
+ if (csp)
+ *csp = cs;
+ else
+ FcCharSetDestroy (cs);
free (nodes);
return FcFalse;
}
+static FcChar32
+FcDoubleHash (double d)
+{
+ if (d < 0)
+ d = -d;
+ if (d > 0xffffffff)
+ d = 0xffffffff;
+ return (FcChar32) d;
+}
+
+static FcChar32
+FcStringHash (const FcChar8 *s)
+{
+ FcChar8 c;
+ FcChar32 h = 0;
+
+ if (s)
+ while ((c = *s++))
+ h = ((h << 1) | (h >> 31)) ^ c;
+ return h;
+}
+
+static FcChar32
+FcValueHash (FcValue v)
+{
+ switch (v.type) {
+ case FcTypeVoid:
+ return 0;
+ case FcTypeInteger:
+ return (FcChar32) v.u.i;
+ case FcTypeDouble:
+ return FcDoubleHash (v.u.d);
+ case FcTypeString:
+ return FcStringHash (v.u.s);
+ case FcTypeBool:
+ return (FcChar32) v.u.b;
+ case FcTypeMatrix:
+ return (FcDoubleHash (v.u.m->xx) ^
+ FcDoubleHash (v.u.m->xy) ^
+ FcDoubleHash (v.u.m->yx) ^
+ FcDoubleHash (v.u.m->yy));
+ case FcTypeCharSet:
+ return (FcChar32) v.u.c->num;
+ case FcTypeFTFace:
+ return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^
+ FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name);
+ }
+ return FcFalse;
+}
+
static FcBool
FcValueListEqual (FcValueList *la, FcValueList *lb)
{
return FcTrue;
}
+static FcChar32
+FcValueListHash (FcValueList *l)
+{
+ FcChar32 hash = 0;
+
+ while (l)
+ {
+ hash = ((hash << 1) | (hash >> 31)) ^ FcValueHash (l->value);
+ l = l->next;
+ }
+ return hash;
+}
+
void
FcPatternDestroy (FcPattern *p)
{
return FcTrue;
}
+FcChar32
+FcPatternHash (const FcPattern *p)
+{
+ int i;
+ FcChar32 h = 0;
+
+ for (i = 0; i < p->num; i++)
+ {
+ h = (((h << 1) | (h >> 31)) ^
+ FcStringHash ((const FcChar8 *) p->elts[i].object) ^
+ FcValueListHash (p->elts[i].values));
+ }
+ return h;
+}
+
FcBool
FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os)
{
#include <stdarg.h>
#include "fcint.h"
+#ifndef HAVE_EXPAT
+#define HAVE_EXPAT 1
+#endif
+
+#ifndef HAVE_XML2
+#define HAVE_XML2 0
+#endif
+
#if HAVE_EXPAT
+#ifndef HAVE_XMLPARSE_H
+#define HAVE_XMLPARSE_H 0
+#endif
#if HAVE_XMLPARSE_H
#include <xmlparse.h>
#else
if (edit)
{
test = FcTestCreate (FcQualAny,
- FcStrCopy ((FcChar8 *) "family"),
+ FC_FAMILY,
FcOpEqual,
family);
if (test)