Imported Upstream version 2.13.0
[platform/upstream/fontconfig.git] / src / fcpat.c
index 3ef1ed2..e624aea 100644 (file)
@@ -883,7 +883,7 @@ FcPatternAddRange (FcPattern *p, const char *object, const FcRange *r)
 }
 
 FcResult
-FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
+FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b)
 {
     FcPatternElt   *e;
     FcValueListPtr l;
@@ -898,6 +898,8 @@ FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
        if (!id)
        {
            *v = FcValueCanonicalize(&l->value);
+           if (b)
+               *b = l->binding;
            return FcResultMatch;
        }
        id--;
@@ -906,9 +908,21 @@ FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
 }
 
 FcResult
+FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
+{
+    return FcPatternObjectGetWithBinding (p, object, id, v, NULL);
+}
+
+FcResult
+FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b)
+{
+    return FcPatternObjectGetWithBinding (p, FcObjectFromName (object), id, v, b);
+}
+
+FcResult
 FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v)
 {
-    return FcPatternObjectGet (p, FcObjectFromName (object), id, v);
+    return FcPatternObjectGetWithBinding (p, FcObjectFromName (object), id, v, NULL);
 }
 
 FcResult
@@ -1007,12 +1021,12 @@ FcPatternGetMatrix(const FcPattern *p, const char *object, int id, FcMatrix **m)
 
 
 FcResult
-FcPatternGetBool(const FcPattern *p, const char *object, int id, FcBool *b)
+FcPatternObjectGetBool (const FcPattern *p, FcObject object, int id, FcBool *b)
 {
     FcValue    v;
     FcResult   r;
 
-    r = FcPatternGet (p, object, id, &v);
+    r = FcPatternObjectGet (p, object, id, &v);
     if (r != FcResultMatch)
        return r;
     if (v.type != FcTypeBool)
@@ -1022,6 +1036,12 @@ FcPatternGetBool(const FcPattern *p, const char *object, int id, FcBool *b)
 }
 
 FcResult
+FcPatternGetBool(const FcPattern *p, const char *object, int id, FcBool *b)
+{
+    return FcPatternObjectGetBool (p, FcObjectFromName (object), id, b);
+}
+
+FcResult
 FcPatternGetCharSet(const FcPattern *p, const char *object, int id, FcCharSet **c)
 {
     FcValue    v;
@@ -1099,6 +1119,9 @@ FcPatternDuplicate (const FcPattern *orig)
     int                    i;
     FcValueListPtr  l;
 
+    if (!orig)
+       return NULL;
+
     new = FcPatternCreate ();
     if (!new)
        goto bail0;