]> git.wh0rd.org - fontconfig.git/commitdiff
Eliminate const in FcPatternGetString; too hard. Add FcCharSetCoverage to
authorKeith Packard <keithp@keithp.com>
Tue, 19 Feb 2002 07:50:44 +0000 (07:50 +0000)
committerKeith Packard <keithp@keithp.com>
Tue, 19 Feb 2002 07:50:44 +0000 (07:50 +0000)
    enumarate Unicode coverage efficiently

fontconfig/fontconfig.h
src/fccache.c
src/fccharset.c
src/fcpat.c

index 86b9c79c87a1d2db2bba42eca5251a2f20b2652d..05399c2debac2623aaa266f2c76c11781c643818 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.2 2002/02/15 06:01:27 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -329,6 +329,9 @@ FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
 FcChar32
 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
 
+FcChar32
+FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result);
+
 /* fcdbg.c */
 void
 FcPatternPrint (FcPattern *p);
@@ -505,7 +508,7 @@ FcResult
 FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
 
 FcResult
-FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 const** s);
+FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 ** s);
 
 FcResult
 FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
index 477714652949ce713d388b28c75806ff2e5ae1a1..aba1284bf388269c960fc7a23e8978819ddb143b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.2 2002/02/15 06:01:27 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -590,7 +590,7 @@ FcFileCacheWriteDir (FcFontSet *set, const FcChar8 *cache_file)
     for (n = 0; n < set->nfont; n++)
     {
        font = set->fonts[n];
-       if (FcPatternGetString (font, FC_FILE, 0, &file) != FcResultMatch)
+       if (FcPatternGetString (font, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch)
            goto bail1;
        base = (FcChar8 *) strrchr ((char *) file, '/');
        if (base)
index 4652309a273d628c869b9e4781a4b0ca942f74a9..c764c43ecad807821993e0b84500185ac0e76056 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.2 2002/02/15 06:01:28 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.3 2002/02/18 22:29:28 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -557,6 +557,27 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
     return count;
 }
 
+FcChar32
+FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result)
+{
+    FcCharSetIter   ai;
+
+    ai.ucs4 = page;
+    FcCharSetIterSet (a, &ai);
+    if (!ai.leaf)
+    {
+       memset (result, '\0', 256 / 8);
+       page = 0;
+    }
+    else
+    {
+       memcpy (result, ai.leaf->map, sizeof (ai.leaf->map));
+       FcCharSetIterNext (a, &ai);
+       page = ai.ucs4;
+    }
+    return page;
+}
+
 /*
  * ASCII representation of charsets.
  * 
index 88bca9160d8b7ba4dd7fb16f1527dc9cb6fa19cf..55b1e71abe02008bd2930c0d249d0b695a8ef3d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.2 2002/02/15 06:01:28 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -384,7 +384,7 @@ FcPatternGetDouble (FcPattern *p, const char *object, int id, double *d)
 }
 
 FcResult
-FcPatternGetString (FcPattern *p, const char *object, int id, FcChar8 const ** s)
+FcPatternGetString (FcPattern *p, const char *object, int id, FcChar8 ** s)
 {
     FcValue    v;
     FcResult   r;
@@ -394,7 +394,7 @@ FcPatternGetString (FcPattern *p, const char *object, int id, FcChar8 const ** s
        return r;
     if (v.type != FcTypeString)
         return FcResultTypeMismatch;
-    *s = v.u.s;
+    *s = (FcChar8 *) v.u.s;
     return FcResultMatch;
 }