diff options
author | marha <marha@users.sourceforge.net> | 2014-03-28 17:43:20 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-28 17:43:20 +0100 |
commit | f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd (patch) | |
tree | afbeb028495328a2817aedbac7aae484a2c71a83 /fontconfig/src/fcmatch.c | |
parent | bf0cbcc1d00962ef2221cb4ceae87cc5ae737454 (diff) | |
parent | cbfb19790917d271b8ca6156554b16acc802719f (diff) | |
download | vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.tar.gz vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.tar.bz2 vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
X11/xtrans/Xtrans.c
Diffstat (limited to 'fontconfig/src/fcmatch.c')
-rw-r--r-- | fontconfig/src/fcmatch.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c index 93e013f9b..0c0a0670e 100644 --- a/fontconfig/src/fcmatch.c +++ b/fontconfig/src/fcmatch.c @@ -189,6 +189,49 @@ FcCompareSize (FcValue *value1, FcValue *value2) } static double +FcCompareSizeRange (FcValue *v1, FcValue *v2) +{ + FcValue value1 = FcValueCanonicalize (v1); + FcValue value2 = FcValueCanonicalize (v2); + FcRange *r1 = NULL, *r2 = NULL; + double ret = -1.0; + + switch ((int) value1.type) { + case FcTypeDouble: + r1 = FcRangeCreateDouble (value1.u.d, value1.u.d); + break; + case FcTypeRange: + r1 = FcRangeCopy (value1.u.r); + break; + default: + goto bail; + } + switch ((int) value2.type) { + case FcTypeDouble: + r2 = FcRangeCreateDouble (value2.u.d, value2.u.d); + break; + case FcTypeRange: + r2 = FcRangeCopy (value2.u.r); + break; + default: + goto bail; + } + + if (FcRangeIsInRange (r1, r2)) + ret = 0.0; + else + ret = FC_MIN (fabs (r1->u.d.end - r2->u.d.begin), fabs (r1->u.d.begin - r2->u.d.end)); + +bail: + if (r1) + FcRangeDestroy (r1); + if (r2) + FcRangeDestroy (r2); + + return ret; +} + +static double FcCompareFilename (FcValue *v1, FcValue *v2) { const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2); @@ -227,6 +270,7 @@ FcCompareHash (FcValue *v1, FcValue *v2) #define PRI_FcCompareLang(n) PRI1(n) #define PRI_FcComparePostScript(n) PRI1(n) #define PRI_FcCompareHash(n) PRI1(n) +#define PRI_FcCompareSizeRange(n) PRI1(n) #define FC_OBJECT(NAME, Type, Cmp) PRI_##Cmp(NAME) @@ -255,6 +299,7 @@ typedef enum _FcMatcherPriority { PRI_FAMILY_WEAK, PRI_POSTSCRIPT_NAME_WEAK, PRI1(SPACING), + PRI1(SIZE), PRI1(PIXEL_SIZE), PRI1(STYLE), PRI1(SLANT), |