Commit 48c8b793 authored by Akira TAGOH's avatar Akira TAGOH

Allow the modification on FcTypeVoid with FcTypeLangSet and FcTypeCharSet

FcTypeVoid is likely to happen when 'lang' and 'charset'
is deleted by 'delete' or 'delete_all' mode in edit.
Without this change, any modification on them are simply
ignored.

This is useful to make a lot of changes, particularly
when one wants to add a few and delete a lot say.
parent 81664fe5
......@@ -722,6 +722,16 @@ FcConfigPromote (FcValue v, FcValue u, FcValuePromotionBuffer *buf)
v.u.l = FcLangSetPromote (v.u.s, buf);
v.type = FcTypeLangSet;
}
else if (v.type == FcTypeVoid && u.type == FcTypeLangSet)
{
v.u.l = FcLangSetPromote (NULL, buf);
v.type = FcTypeLangSet;
}
else if (v.type == FcTypeVoid && u.type == FcTypeCharSet)
{
v.u.c = FcCharSetPromote (buf);
v.type = FcTypeCharSet;
}
if (buf && v.type == FcTypeDouble && u.type == FcTypeRange)
{
v.u.r = FcRangePromote (v.u.d, buf);
......
......@@ -42,6 +42,21 @@ FcCharSetCreate (void)
return fcs;
}
FcCharSet *
FcCharSetPromote (FcValuePromotionBuffer *vbuf)
{
FcCharSet *fcs = (FcCharSet *) vbuf;
FC_ASSERT_STATIC (sizeof (FcCharSet) <= sizeof (FcValuePromotionBuffer));
FcRefSetConst (&fcs->ref);
fcs->num = 0;
fcs->leaves_offset = 0;
fcs->numbers_offset = 0;
return fcs;
}
FcCharSet *
FcCharSetNew (void)
{
......
......@@ -720,6 +720,9 @@ FcPrivate FcLangSet *
FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);
/* fccharset.c */
FcPrivate FcCharSet *
FcCharSetPromote (FcValuePromotionBuffer *vbuf);
FcPrivate void
FcLangCharSetPopulate (void);
......
......@@ -720,19 +720,22 @@ FcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *vbuf)
memset (buf->ls.map, '\0', sizeof (buf->ls.map));
buf->ls.map_size = NUM_LANG_SET_MAP;
buf->ls.extra = 0;
id = FcLangSetIndex (lang);
if (id > 0)
if (lang)
{
FcLangSetBitSet (&buf->ls, id);
}
else
{
buf->ls.extra = &buf->strs;
buf->strs.num = 1;
buf->strs.size = 1;
buf->strs.strs = &buf->str;
FcRefInit (&buf->strs.ref, 1);
buf->str = (FcChar8 *) lang;
id = FcLangSetIndex (lang);
if (id > 0)
{
FcLangSetBitSet (&buf->ls, id);
}
else
{
buf->ls.extra = &buf->strs;
buf->strs.num = 1;
buf->strs.size = 1;
buf->strs.strs = &buf->str;
FcRefInit (&buf->strs.ref, 1);
buf->str = (FcChar8 *) lang;
}
}
return &buf->ls;
}
......
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