]> git.wh0rd.org - fontconfig.git/commitdiff
Fix comparison of family names to ignore leading space properly
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 31 Dec 2008 23:06:07 +0000 (18:06 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 14 Feb 2009 00:54:04 +0000 (16:54 -0800)
Previously fc-match "xxx,nazli" matched Nazli, but "xxx, nazli" didn't.
This was because of a bug in FcCompareFamily's short-circuit check
that forgot to ignore spaces.

src/fcmatch.c

index a1814968403595990824ea202bbb0b72571b7172..e46eefe87766e36535dbcfc077d1028101cae492 100644 (file)
@@ -72,7 +72,8 @@ FcCompareFamily (FcValue *v1, FcValue *v2)
     const FcChar8* v1_string = fc_value_string(v1);
     const FcChar8* v2_string = fc_value_string(v2);
 
-    if (FcToLower(*v1_string) != FcToLower(*v2_string))
+    if (FcToLower(*v1_string) != FcToLower(*v2_string) &&
+       *v1_string != ' ' && *v2_string != ' ')
        return 1.0;
 
     return (double) FcStrCmpIgnoreBlanksAndCase (v1_string, v2_string) != 0;