]> git.wh0rd.org Git - fontconfig.git/commitdiff
Ensure weight/slant values present even when style is supplied (bug 9313).
authorKeith Packard <keithp@koto.keithp.com>
Thu, 25 Oct 2007 08:35:32 +0000 (01:35 -0700)
committerKeith Packard <keithp@koto.keithp.com>
Thu, 25 Oct 2007 08:35:32 +0000 (01:35 -0700)
If the provided style value doesn't match any available font, fall back to
using the weight and slant values by ensuring that those are in the pattern.

src/fcdefault.c

index 4e5823bb13406762b5c9fc3e2e5a2bf8a5fd6405..e654dc49c84c65859c04f2edf08906f3c5139a2c 100644 (file)
@@ -122,17 +122,11 @@ FcDefaultSubstitute (FcPattern *pattern)
     FcValue v;
     int            i;
 
-    if (FcPatternObjectGet (pattern, FC_STYLE_OBJECT, 0, &v) == FcResultNoMatch)
-    {
-       if (FcPatternObjectGet (pattern, FC_WEIGHT_OBJECT, 0, &v) == FcResultNoMatch )
-       {
-           FcPatternObjectAddInteger (pattern, FC_WEIGHT_OBJECT, FC_WEIGHT_MEDIUM);
-       }
-       if (FcPatternObjectGet (pattern, FC_SLANT_OBJECT, 0, &v) == FcResultNoMatch)
-       {
-           FcPatternObjectAddInteger (pattern, FC_SLANT_OBJECT, FC_SLANT_ROMAN);
-       }
-    }
+    if (FcPatternObjectGet (pattern, FC_WEIGHT_OBJECT, 0, &v) == FcResultNoMatch )
+       FcPatternObjectAddInteger (pattern, FC_WEIGHT_OBJECT, FC_WEIGHT_MEDIUM);
+
+    if (FcPatternObjectGet (pattern, FC_SLANT_OBJECT, 0, &v) == FcResultNoMatch)
+       FcPatternObjectAddInteger (pattern, FC_SLANT_OBJECT, FC_SLANT_ROMAN);
 
     if (FcPatternObjectGet (pattern, FC_WIDTH_OBJECT, 0, &v) == FcResultNoMatch)
        FcPatternObjectAddInteger (pattern, FC_WIDTH_OBJECT, FC_WIDTH_NORMAL);