Commit 198358dd authored by Akira TAGOH's avatar Akira TAGOH

Allow the constant names in the range

https://bugs.freedesktop.org/show_bug.cgi?id=105415
parent af687139
......@@ -330,13 +330,37 @@ FcNameConvert (FcType type, FcChar8 *string)
case FcTypeRange:
if (sscanf ((char *) string, "[%lg %lg]", &b, &e) != 2)
{
v.u.d = strtod ((char *) string, &p);
if (p != NULL && p[0] != 0)
char *sc, *ec;
size_t len = strlen ((const char *) string);
int si, ei;
sc = malloc (len);
ec = malloc (len);
if (sc && ec && sscanf ((char *) string, "[%s %[^]]]", sc, ec) == 2)
{
v.type = FcTypeVoid;
break;
if (FcNameConstant ((const FcChar8 *) sc, &si) &&
FcNameConstant ((const FcChar8 *) ec, &ei))
v.u.r = FcRangeCreateDouble (si, ei);
else
goto bail1;
}
else
{
bail1:
v.type = FcTypeDouble;
if (FcNameConstant (string, &si))
{
v.u.d = (double) si;
} else {
v.u.d = strtod ((char *) string, &p);
if (p != NULL && p[0] != 0)
v.type = FcTypeVoid;
}
}
v.type = FcTypeDouble;
if (sc)
free (sc);
if (ec)
free (ec);
}
else
v.u.r = FcRangeCreateDouble (b, e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment