Print ranges as closed as opposed to half-open

There's nothing assymetrical about how we match them.  Previously we "considered"
them half-open because the OS/2 spec had usLowerOpticalPointSize as inclusive
and usUpperOpticalPointSize as exclusive.  But we do not respect that.

Note that the parsing code accepts both anyway, because of the way our sscanf()
usage is written...
This commit is contained in:
Behdad Esfahbod 2017-09-13 03:29:20 -04:00
parent a4bd5b7c7a
commit f034c86756
2 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@ _FcValuePrintFile (FILE *f, const FcValue v)
fprintf (f, "face"); fprintf (f, "face");
break; break;
case FcTypeRange: case FcTypeRange:
fprintf (f, "[%g %g)", v.u.r->begin, v.u.r->end); fprintf (f, "[%g %g]", v.u.r->begin, v.u.r->end);
break; break;
} }
} }

View File

@ -318,7 +318,7 @@ FcNameConvert (FcType type, FcChar8 *string)
v.type = FcTypeVoid; v.type = FcTypeVoid;
break; break;
case FcTypeRange: case FcTypeRange:
if (sscanf ((char *) string, "[%lg %lg)", &b, &e) != 2) if (sscanf ((char *) string, "[%lg %lg]", &b, &e) != 2)
{ {
v.u.d = strtod ((char *) string, &p); v.u.d = strtod ((char *) string, &p);
if (p != NULL && p[0] != 0) if (p != NULL && p[0] != 0)
@ -526,7 +526,7 @@ FcNameUnparseValue (FcStrBuf *buf,
case FcTypeFTFace: case FcTypeFTFace:
return FcTrue; return FcTrue;
case FcTypeRange: case FcTypeRange:
sprintf ((char *) temp, "[%g %g)", v.u.r->begin, v.u.r->end); sprintf ((char *) temp, "[%g %g]", v.u.r->begin, v.u.r->end);
return FcNameUnparseString (buf, temp, 0); return FcNameUnparseString (buf, temp, 0);
} }
return FcFalse; return FcFalse;