]> git.wh0rd.org - fontconfig.git/commitdiff
Add new public API: FcCharSetDelChar()
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 21 Sep 2010 17:14:41 +0000 (13:14 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 21 Sep 2010 17:14:41 +0000 (13:14 -0400)
doc/fccharset.fncs
fontconfig/fontconfig.h
src/fccharset.c

index b12064a5533eac3a326860b6be5156e80eba5bf9..004fdc3a0b9f67a550354d2b9b5a562054d9f2c7 100644 (file)
@@ -51,6 +51,17 @@ returning FcFalse on failure, either as a result of a constant set or from
 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 *
 @FUNC@         FcCharSetCopy
 @TYPE1@                FcCharSet *             @ARG1@          src
index c9f20cc0074067333acd43a05f50752207919636..6a6d511a9e7b7369858f77576993837075df904b 100644 (file)
@@ -423,6 +423,9 @@ FcCharSetDestroy (FcCharSet *fcs);
 FcPublic FcBool
 FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
 
+FcPublic FcBool
+FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4);
+
 FcPublic FcCharSet*
 FcCharSetCopy (FcCharSet *src);
 
index 9228b0904bfbb5330b20bf32f20c8a52a06e9b1e..14e4c3c02641cfbbf39ff07fc4f7cda7db0dd05f 100644 (file)
@@ -262,6 +262,23 @@ FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4)
     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
  */