Commit 41fc0fe6 authored by Behdad Esfahbod's avatar Behdad Esfahbod
Browse files

Add FcPatternFilter() (#13016)

parent e6f14d3c
......@@ -77,6 +77,18 @@ Returns whether <parameter>pa</parameter> and <parameter>pb</parameter> have exa
objects in <parameter>os</parameter>.
@RET@ FcPattern *
@FUNC@ FcPatternFilter
@TYPE1@ FcPattern * @ARG1@ p
@TYPE2@ const FcObjectSet * @ARG1@ os
@PURPOSE@ Filter the objects of pattern
Returns a new pattern that only has those objects from
<parameter>p</parameter> that are in <parameter>os</parameter>.
If <parameter>os</parameter> is NULL, a duplicate of
<parameter>p</parameter> is returned.
@RET@ FcChar32
@FUNC@ FcPatternHash
@TYPE1@ const FcPattern * @ARG1@ p
......@@ -740,6 +740,9 @@ FcPatternDuplicate (const FcPattern *p);
FcPublic void
FcPatternReference (FcPattern *p);
FcPublic FcPattern *
FcPatternFilter (FcPattern *p, const FcObjectSet *os);
FcPublic void
FcValueDestroy (FcValue v);
......@@ -997,6 +997,43 @@ FcPatternAppend (FcPattern *p, FcPattern *s)
return FcTrue;
FcPattern *
FcPatternFilter (FcPattern *p, const FcObjectSet *os)
int i;
FcPattern *ret;
FcPatternElt *e;
FcValueListPtr v;
if (!os)
return FcPatternDuplicate (p);
ret = FcPatternCreate ();
if (!ret)
return NULL;
for (i = 0; i < os->nobject; i++)
FcObject object = FcObjectFromName (os->objects[i]);
e = FcPatternObjectFindElt (p, object);
if (e)
for (v = FcPatternEltValues(e); v; v = FcValueListNext(v))
if (!FcPatternObjectAddWithBinding (ret, e->object,
v->binding, FcTrue))
goto bail0;
return p;
FcPatternDestroy (ret);
return NULL;
static struct objectBucket {
struct objectBucket *next;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment