]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcpat.c
Fix weird first/not-first lameness in font matches, replacing with target
[fontconfig.git] / src / fcpat.c
index 62d779babb1ab90726d1d5a8e712aa4802fbc310..a12414b25006ec94ffc22b35b83436fba9a7e542 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.11 2002/07/06 23:47:44 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.12 2002/08/07 01:45:59 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -55,6 +55,9 @@ FcValueDestroy (FcValue v)
     case FcTypeCharSet:
        FcCharSetDestroy ((FcCharSet *) v.u.c);
        break;
+    case FcTypePattern:
+       FcPatternDestroy ((FcPattern *) v.u.p);
+       break;
     default:
        break;
     }
@@ -79,6 +82,9 @@ FcValueSave (FcValue v)
        if (!v.u.c)
            v.type = FcTypeVoid;
        break;
+    case FcTypePattern:
+       FcPatternReference ((FcPattern *) v.u.p);
+       break;
     default:
        break;
     }
@@ -101,6 +107,9 @@ FcValueListDestroy (FcValueList *l)
        case FcTypeCharSet:
            FcCharSetDestroy ((FcCharSet *) l->value.u.c);
            break;
+       case FcTypePattern:
+           FcPatternDestroy ((FcPattern *) l->value.u.p);
+           break;
        default:
            break;
        }
@@ -145,6 +154,8 @@ FcValueEqual (FcValue va, FcValue vb)
        return FcCharSetEqual (va.u.c, vb.u.c);
     case FcTypeFTFace:
        return va.u.f == vb.u.f;
+    case FcTypePattern:
+       return FcPatternEqual (va.u.p, vb.u.p);
     }
     return FcFalse;
 }
@@ -195,6 +206,8 @@ FcValueHash (FcValue v)
     case FcTypeFTFace:
        return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^
               FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name);
+    case FcTypePattern:
+       return (FcChar32) v.u.p->num;
     }
     return FcFalse;
 }
@@ -446,6 +459,9 @@ bail2:
     case FcTypeCharSet:
        FcCharSetDestroy ((FcCharSet *) value.u.c);
        break;
+    case FcTypePattern:
+       FcPatternDestroy ((FcPattern *) value.u.p);
+       break;
     default:
        break;
     }
@@ -563,6 +579,16 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f)
     return FcPatternAdd (p, object, v, FcTrue);
 }
 
+FcBool
+FcPatternAddPattern (FcPattern *p, const char *object, const FcPattern *pp)
+{
+    FcValue    v;
+
+    v.type = FcTypePattern;
+    v.u.p = pp;
+    return FcPatternAdd (p, object, v, FcTrue);
+}
+
 FcResult
 FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
 {
@@ -704,6 +730,21 @@ FcPatternGetFTFace (FcPattern *p, const char *object, int id, FT_Face *f)
     return FcResultMatch;
 }
 
+FcResult
+FcPatternGetPattern (FcPattern *p, const char *object, int id, FcPattern **pp)
+{
+    FcValue    v;
+    FcResult   r;
+
+    r = FcPatternGet (p, object, id, &v);
+    if (r != FcResultMatch)
+       return r;
+    if (v.type != FcTypePattern)
+        return FcResultTypeMismatch;
+    *pp = (FcPattern *) v.u.p;
+    return FcResultMatch;
+}
+
 FcPattern *
 FcPatternDuplicate (FcPattern *orig)
 {