Remove FcCompareSize()

Use FcCompareNumber().  The FcCompareSize() returns 0 ("perfect match")
if v2 is zero.  I cannot think of a use-case for this.  The code has been
there from initial commit in 2002.  I suppose back then Keith had a use
for size=0 to mean scalable or something.  Anyway, remove and see.
This commit is contained in:
Behdad Esfahbod 2017-09-12 18:52:49 -04:00
parent 6eb7e5ae81
commit 7519c567e1
2 changed files with 1 additions and 35 deletions

View File

@ -155,39 +155,6 @@ FcCompareCharSet (FcValue *v1, FcValue *v2)
return (double) FcCharSetSubtractCount (FcValueCharSet(v1), FcValueCharSet(v2)); return (double) FcCharSetSubtractCount (FcValueCharSet(v1), FcValueCharSet(v2));
} }
static double
FcCompareSize (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
switch ((int) value1->type) {
case FcTypeInteger:
v1 = value1->u.i;
break;
case FcTypeDouble:
v1 = value1->u.d;
break;
default:
return -1;
}
switch ((int) value2->type) {
case FcTypeInteger:
v2 = value2->u.i;
break;
case FcTypeDouble:
v2 = value2->u.d;
break;
default:
return -1;
}
if (v2 == 0)
return 0;
v = v2 - v1;
if (v < 0)
v = -v;
return v;
}
static double static double
FcCompareSizeRange (FcValue *v1, FcValue *v2) FcCompareSizeRange (FcValue *v1, FcValue *v2)
{ {
@ -255,7 +222,6 @@ FcCompareFilename (FcValue *v1, FcValue *v2)
#define PRI_FcCompareFamily(n) PRI1(n) #define PRI_FcCompareFamily(n) PRI1(n)
#define PRI_FcCompareString(n) PRI1(n) #define PRI_FcCompareString(n) PRI1(n)
#define PRI_FcCompareNumber(n) PRI1(n) #define PRI_FcCompareNumber(n) PRI1(n)
#define PRI_FcCompareSize(n) PRI1(n)
#define PRI_FcCompareBool(n) PRI1(n) #define PRI_FcCompareBool(n) PRI1(n)
#define PRI_FcCompareFilename(n) PRI1(n) #define PRI_FcCompareFilename(n) PRI1(n)
#define PRI_FcCompareCharSet(n) PRI1(n) #define PRI_FcCompareCharSet(n) PRI1(n)

View File

@ -33,7 +33,7 @@ FC_OBJECT (WEIGHT, FcTypeInteger, FcCompareNumber)
FC_OBJECT (WIDTH, FcTypeInteger, FcCompareNumber) FC_OBJECT (WIDTH, FcTypeInteger, FcCompareNumber)
FC_OBJECT (SIZE, FcTypeRange, FcCompareSizeRange) FC_OBJECT (SIZE, FcTypeRange, FcCompareSizeRange)
FC_OBJECT (ASPECT, FcTypeDouble, NULL) FC_OBJECT (ASPECT, FcTypeDouble, NULL)
FC_OBJECT (PIXEL_SIZE, FcTypeDouble, FcCompareSize) FC_OBJECT (PIXEL_SIZE, FcTypeDouble, FcCompareNumber)
FC_OBJECT (SPACING, FcTypeInteger, FcCompareNumber) FC_OBJECT (SPACING, FcTypeInteger, FcCompareNumber)
FC_OBJECT (FOUNDRY, FcTypeString, FcCompareString) FC_OBJECT (FOUNDRY, FcTypeString, FcCompareString)
FC_OBJECT (ANTIALIAS, FcTypeBool, FcCompareBool) FC_OBJECT (ANTIALIAS, FcTypeBool, FcCompareBool)