aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcmatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig/src/fcmatch.c')
-rw-r--r--fontconfig/src/fcmatch.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c
index 2d7b79840..10976d6e8 100644
--- a/fontconfig/src/fcmatch.c
+++ b/fontconfig/src/fcmatch.c
@@ -191,17 +191,26 @@ FcCompareSize (FcValue *value1, FcValue *value2)
static double
FcCompareFilename (FcValue *v1, FcValue *v2)
{
- const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2);
- if (FcStrCmp (s1, s2) == 0)
- return 0.0;
- else if (FcStrCmpIgnoreCase (s1, s2) == 0)
- return 1.0;
- else if (FcStrRegexCmp (s2, s1))
- return 2.0;
- else if (FcStrRegexCmpIgnoreCase (s2, s1))
- return 3.0;
- else
- return 4.0;
+ const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2);
+ if (FcStrCmp (s1, s2) == 0)
+ return 0.0;
+ else if (FcStrCmpIgnoreCase (s1, s2) == 0)
+ return 1.0;
+ else if (FcStrGlobMatch (s1, s2))
+ return 2.0;
+ else
+ return 3.0;
+}
+
+static double
+FcCompareHash (FcValue *v1, FcValue *v2)
+{
+ const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2);
+
+ /* Do not match an empty string */
+ if (!s1 || !s2 || !s1[0] || !s2[0])
+ return 1.0;
+ return FcCompareString (v1, v2);
}
#define PRI_NULL(n) \
@@ -217,6 +226,7 @@ FcCompareFilename (FcValue *v1, FcValue *v2)
#define PRI_FcCompareCharSet(n) PRI1(n)
#define PRI_FcCompareLang(n) PRI1(n)
#define PRI_FcComparePostScript(n) PRI1(n)
+#define PRI_FcCompareHash(n) PRI1(n)
#define FC_OBJECT(NAME, Type, Cmp) PRI_##Cmp(NAME)