Change charset enumeration functions to more sensible API
This commit is contained in:
parent
c9f55ecb06
commit
3673201215
|
@ -347,8 +347,19 @@ FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
|
|||
FcChar32
|
||||
FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
|
||||
|
||||
#define FC_CHARSET_MAP_SIZE (256/32)
|
||||
#define FC_CHARSET_DONE ((FcChar32) -1)
|
||||
|
||||
FcChar32
|
||||
FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result);
|
||||
FcCharSetFirstPage (const FcCharSet *a,
|
||||
FcChar32 map[FC_CHARSET_MAP_SIZE],
|
||||
FcChar32 *next);
|
||||
|
||||
FcChar32
|
||||
FcCharSetNextPage (const FcCharSet *a,
|
||||
FcChar32 map[FC_CHARSET_MAP_SIZE],
|
||||
FcChar32 *next);
|
||||
|
||||
|
||||
/* fcdbg.c */
|
||||
void
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.3 2002/02/18 22:29:28 keithp Exp $
|
||||
* $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.6 2002/03/27 04:33:55 keithp Exp $
|
||||
*
|
||||
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
|
@ -557,27 +557,47 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
|
|||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* These two functions efficiently walk the entire charmap for
|
||||
* other software (like pango) that want their own copy
|
||||
*/
|
||||
|
||||
FcChar32
|
||||
FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result)
|
||||
FcCharSetNextPage (const FcCharSet *a,
|
||||
FcChar32 map[FC_CHARSET_MAP_SIZE],
|
||||
FcChar32 *next)
|
||||
{
|
||||
FcCharSetIter ai;
|
||||
FcChar32 page;
|
||||
|
||||
ai.ucs4 = page;
|
||||
ai.ucs4 = *next;
|
||||
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 FC_CHARSET_DONE;
|
||||
|
||||
/*
|
||||
* Save current information
|
||||
*/
|
||||
page = ai.ucs4;
|
||||
memcpy (map, ai.leaf->map, sizeof (ai.leaf->map));
|
||||
/*
|
||||
* Step to next page
|
||||
*/
|
||||
FcCharSetIterNext (a, &ai);
|
||||
*next = ai.ucs4;
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
FcChar32
|
||||
FcCharSetFirstPage (const FcCharSet *a,
|
||||
FcChar32 map[FC_CHARSET_MAP_SIZE],
|
||||
FcChar32 *next)
|
||||
{
|
||||
*next = 0;
|
||||
return FcCharSetNextPage (a, map, next);
|
||||
}
|
||||
|
||||
/*
|
||||
* ASCII representation of charsets.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue