Eliminate const in FcPatternGetString; too hard. Add FcCharSetCoverage to

enumarate Unicode coverage efficiently
This commit is contained in:
Keith Packard 2002-02-19 07:50:44 +00:00
parent c2e7c611cb
commit aae6f7d487
4 changed files with 32 additions and 8 deletions

View 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);

View 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)

View 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.
*

View 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;
}