summaryrefslogtreecommitdiff
path: root/src/fcpat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fcpat.c')
-rw-r--r--src/fcpat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/fcpat.c b/src/fcpat.c
index a82fb6f..c37936f 100644
--- a/src/fcpat.c
+++ b/src/fcpat.c
@@ -872,6 +872,13 @@ FcPatternAddWithBinding (FcPattern *p,
if (value.type == FcTypeVoid)
goto bail1;
+ /* quick and dirty hack to enable FcCompareFamily speedup:
+ * only allow strings to be added under the FC_FAMILY key.
+ * a better hack would use FcBaseObjectTypes to check all objects. */
+ if (FcObjectToPtr(object) == FcObjectToPtr(FC_FAMILY) &&
+ value.type != FcTypeString)
+ goto bail1;
+
FcValueListPtrU(new)->value = value;
FcValueListPtrU(new)->binding = binding;
FcValueListPtrU(new)->next = FcValueListPtrCreateDynamic(0);