Add new public API: FcCharSetDelChar()

This commit is contained in:
Behdad Esfahbod 2010-09-21 13:14:41 -04:00
parent 9d8d0226d9
commit 52960d05eb
3 changed files with 31 additions and 0 deletions

View File

@ -51,6 +51,17 @@ returning FcFalse on failure, either as a result of a constant set or from
running out of memory. running out of memory.
@@ @@
@RET@ FcBool
@FUNC@ FcCharSetDelChar
@TYPE1@ FcCharSet * @ARG1@ fcs
@TYPE2@ FcChar32% @ARG2@ ucs4
@PURPOSE@ Add a character to a charset
@DESC@
<function>FcCharSetDelChar</function> deletes a single unicode char from the set,
returning FcFalse on failure, either as a result of a constant set or from
running out of memory.
@@
@RET@ FcCharSet * @RET@ FcCharSet *
@FUNC@ FcCharSetCopy @FUNC@ FcCharSetCopy
@TYPE1@ FcCharSet * @ARG1@ src @TYPE1@ FcCharSet * @ARG1@ src

View File

@ -423,6 +423,9 @@ FcCharSetDestroy (FcCharSet *fcs);
FcPublic FcBool FcPublic FcBool
FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4); FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
FcPublic FcBool
FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4);
FcPublic FcCharSet* FcPublic FcCharSet*
FcCharSetCopy (FcCharSet *src); FcCharSetCopy (FcCharSet *src);

View File

@ -262,6 +262,23 @@ FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4)
return FcTrue; return FcTrue;
} }
FcBool
FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4)
{
FcCharLeaf *leaf;
FcChar32 *b;
if (fcs->ref == FC_REF_CONSTANT)
return FcFalse;
leaf = FcCharSetFindLeaf (fcs, ucs4);
if (!leaf)
return FcTrue;
b = &leaf->map[(ucs4 & 0xff) >> 5];
*b &= ~(1 << (ucs4 & 0x1f));
/* We don't bother removing the leaf if it's empty */
return FcTrue;
}
/* /*
* An iterator for the leaves of a charset * An iterator for the leaves of a charset
*/ */