In FcSubstituteDefault(), handle size range

Takes the midpoint...
This commit is contained in:
Behdad Esfahbod 2017-09-12 19:18:59 -04:00
parent b4813436a3
commit b6440cbd7f
1 changed files with 8 additions and 1 deletions

View File

@ -255,7 +255,14 @@ FcDefaultSubstitute (FcPattern *pattern)
FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value); FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value);
if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch) if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch)
size = 12.0L; {
FcRange *r;
double b, e;
if (FcPatternObjectGetRange (pattern, FC_SIZE_OBJECT, 0, &r) == FcResultMatch && FcRangeGetDouble (r, &b, &e))
size = (b + e) * .5;
else
size = 12.0L;
}
if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch) if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch)
scale = 1.0; scale = 1.0;
if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch) if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch)