From: Keith Packard Date: Tue, 19 Feb 2002 07:50:44 +0000 (+0000) Subject: Eliminate const in FcPatternGetString; too hard. Add FcCharSetCoverage to X-Git-Tag: before-mesa-4_0-import~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=aae6f7d48744a25899cac28d47458f394defa02a;p=fontconfig.git Eliminate const in FcPatternGetString; too hard. Add FcCharSetCoverage to enumarate Unicode coverage efficiently --- diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 86b9c79..05399c2 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -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); diff --git a/src/fccache.c b/src/fccache.c index 4777146..aba1284 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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) diff --git a/src/fccharset.c b/src/fccharset.c index 4652309..c764c43 100644 --- a/src/fccharset.c +++ b/src/fccharset.c @@ -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. * diff --git a/src/fcpat.c b/src/fcpat.c index 88bca91..55b1e71 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -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; }