aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcname.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-28 17:35:36 +0100
committermarha <marha@users.sourceforge.net>2014-03-28 17:35:36 +0100
commitcbfb19790917d271b8ca6156554b16acc802719f (patch)
tree830af0dc6e08b5d0c7124fec143e90255f3feee3 /fontconfig/src/fcname.c
parentd02e6760412c7a96abbc4d0add5dd8d5e83bbe27 (diff)
downloadvcxsrv-cbfb19790917d271b8ca6156554b16acc802719f.tar.gz
vcxsrv-cbfb19790917d271b8ca6156554b16acc802719f.tar.bz2
vcxsrv-cbfb19790917d271b8ca6156554b16acc802719f.zip
libxtrans fontconfig mesa xserver git update 28 Mar 2014
xserver commit a2880699e8f1f576e1a48ebf25e8982463323f84 libxtrans commit 68f60238c4224f954ff6556ae778c72e420175f0 fontconfig commit fcba9ef01c978323fc71c17e455d3cd6ae35edcc mesa commit 029ccd773d01a5f801c809c499516d7b0c4cc3f8
Diffstat (limited to 'fontconfig/src/fcname.c')
-rw-r--r--fontconfig/src/fcname.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/fontconfig/src/fcname.c b/fontconfig/src/fcname.c
index f302948dd..466617872 100644
--- a/fontconfig/src/fcname.c
+++ b/fontconfig/src/fcname.c
@@ -87,6 +87,10 @@ FcObjectValidType (FcObject object, FcType type)
if (type == FcTypeLangSet || type == FcTypeString)
return FcTrue;
break;
+ case FcTypeRange:
+ if (type == FcTypeRange || type == FcTypeDouble)
+ return FcTrue;
+ break;
default:
if (type == t->type)
return FcTrue;
@@ -273,6 +277,8 @@ FcNameConvert (FcType type, FcChar8 *string)
{
FcValue v;
FcMatrix m;
+ double b, e;
+ char *p;
v.type = type;
switch ((int) v.type) {
@@ -307,6 +313,20 @@ FcNameConvert (FcType type, FcChar8 *string)
if (!v.u.l)
v.type = FcTypeVoid;
break;
+ case FcTypeRange:
+ if (sscanf ((char *) string, "(%lg %lg)", &b, &e) != 2)
+ {
+ v.u.d = strtod ((char *) string, &p);
+ if (p != NULL && p[0] != 0)
+ {
+ v.type = FcTypeVoid;
+ break;
+ }
+ v.type = FcTypeDouble;
+ }
+ else
+ v.u.r = FcRangeCreateDouble (b, e);
+ break;
default:
break;
}
@@ -476,6 +496,7 @@ FcNameUnparseValue (FcStrBuf *buf,
{
FcChar8 temp[1024];
FcValue v = FcValueCanonicalize(v0);
+ FcRange r;
switch (v.type) {
case FcTypeUnknown:
@@ -501,6 +522,18 @@ FcNameUnparseValue (FcStrBuf *buf,
return FcNameUnparseLangSet (buf, v.u.l);
case FcTypeFTFace:
return FcTrue;
+ case FcTypeRange:
+ r = FcRangeCanonicalize (v.u.r);
+ if (!FcDoubleIsZero (r.u.d.begin) || !FcDoubleIsZero (r.u.d.end))
+ {
+ if (FcDoubleCmpEQ (r.u.d.begin, r.u.d.end))
+ sprintf ((char *) temp, "%g", r.u.d.begin);
+ else
+ sprintf ((char *) temp, "(%g %g)", r.u.d.begin, r.u.d.end);
+ return FcNameUnparseString (buf, temp, 0);
+ }
+ else
+ return FcTrue;
}
return FcFalse;
}
@@ -533,12 +566,13 @@ FcNameUnparse (FcPattern *pat)
FcChar8 *
FcNameUnparseEscaped (FcPattern *pat, FcBool escape)
{
- FcStrBuf buf;
- FcChar8 buf_static[8192];
+ FcStrBuf buf, buf2;
+ FcChar8 buf_static[8192], buf2_static[256];
int i;
FcPatternElt *e;
FcStrBufInit (&buf, buf_static, sizeof (buf_static));
+ FcStrBufInit (&buf2, buf2_static, sizeof (buf2_static));
e = FcPatternObjectFindElt (pat, FC_FAMILY_OBJECT);
if (e)
{
@@ -548,10 +582,17 @@ FcNameUnparseEscaped (FcPattern *pat, FcBool escape)
e = FcPatternObjectFindElt (pat, FC_SIZE_OBJECT);
if (e)
{
- if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0))
+ FcChar8 *p;
+
+ if (!FcNameUnparseString (&buf2, (FcChar8 *) "-", 0))
goto bail0;
- if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0))
+ if (!FcNameUnparseValueList (&buf2, FcPatternEltValues(e), escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0))
goto bail0;
+ p = FcStrBufDoneStatic (&buf2);
+ FcStrBufDestroy (&buf2);
+ if (strlen ((const char *)p) > 1)
+ if (!FcStrBufString (&buf, p))
+ goto bail0;
}
for (i = 0; i < NUM_OBJECT_TYPES; i++)
{