Add FcRangeGetDouble()

https://bugs.freedesktop.org/show_bug.cgi?id=82876
This commit is contained in:
Akira TAGOH 2014-09-25 17:03:27 +09:00
parent 286cdc9c10
commit 1082161ea3
3 changed files with 36 additions and 0 deletions

View File

@ -62,3 +62,13 @@ integer sized value.
all memory associated with it.
@SINCE@ 2.11.91
@@
@RET@ FcBool
@FUNC@ FcRangeGetDouble
@TYPE1@ const FcRange * @ARG1@ range
@TYPE2@ double * @ARG2@ begin
@TYPE3@ double * @ARG3@ end
@PURPOSE@ Get the range in double
@DESC@
Returns in <parameter>begin</parameter> and <parameter>end</parameter> as the range.
@SINCE@ 2.11.91

View File

@ -908,6 +908,9 @@ FcRangeDestroy (FcRange *range);
FcPublic FcRange *
FcRangeCopy (const FcRange *r);
FcPublic FcBool
FcRangeGetDouble(const FcRange *range, double *begin, double *end);
/* fcweight.c */
FcPublic int

View File

@ -76,6 +76,29 @@ FcRangeCopy (const FcRange *range)
return ret;
}
FcBool
FcRangeGetDouble(const FcRange *range, double *begin, double *end)
{
if (!range)
return FcFalse;
if (range->is_double)
{
if (begin)
*begin = range->u.d.begin;
if (end)
*end = range->u.d.end;
}
else
{
if (begin)
*begin = (double)range->u.i.begin;
if (end)
*end = (double)range->u.i.end;
}
return FcTrue;
}
FcRange
FcRangeCanonicalize (const FcRange *range)
{