[varfonts] Change id argument in FcFreeTypeQuery* to unsigned int

Going to use the top bit to query varfonts.
This commit is contained in:
Behdad Esfahbod 2017-09-13 03:27:03 -04:00
parent 819d3a5541
commit a4bd5b7c7a
4 changed files with 16 additions and 16 deletions

View File

@ -98,7 +98,7 @@ usage (char *program, int error)
int
main (int argc, char **argv)
{
int id = -1;
unsigned int id = (unsigned int) -1;
int ignore_blanks = 0;
FcFontSet *fs;
FcChar8 *format = NULL;
@ -119,7 +119,7 @@ main (int argc, char **argv)
ignore_blanks = 1;
break;
case 'i':
id = atoi (optarg);
id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */
break;
case 'f':
format = (FcChar8 *) strdup (optarg);
@ -150,7 +150,7 @@ main (int argc, char **argv)
{
if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, blanks, NULL, fs))
{
fprintf (stderr, "Can't query face %d of font file %s\n", id, argv[i]);
fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]);
err = 1;
}
}

View File

@ -51,7 +51,7 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
FcPublic FcPattern *
FcFreeTypeQueryFace (const FT_Face face,
const FcChar8 *file,
int id,
unsigned int id,
FcBlanks *blanks);
_FCFUNCPROTOEND

View File

@ -577,10 +577,10 @@ FcDirCacheUnload (FcCache *cache);
/* fcfreetype.c */
FcPublic FcPattern *
FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
FcFreeTypeQuery (const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count);
FcPublic unsigned int
FcFreeTypeQueryAll(const FcChar8 *file, int id, FcBlanks *blanks, int *count, FcFontSet *set);
FcFreeTypeQueryAll(const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count, FcFontSet *set);
/* fcfs.c */

View File

@ -1157,7 +1157,7 @@ static const FT_UShort nameid_order[] = {
FcPattern *
FcFreeTypeQueryFace (const FT_Face face,
const FcChar8 *file,
int id,
unsigned int id,
FcBlanks *blanks FC_UNUSED)
{
FcPattern *pat;
@ -1972,7 +1972,7 @@ bail0:
FcPattern *
FcFreeTypeQuery(const FcChar8 *file,
int id,
unsigned int id,
FcBlanks *blanks,
int *count)
{
@ -1999,20 +1999,20 @@ bail:
unsigned int
FcFreeTypeQueryAll(const FcChar8 *file,
int id,
unsigned int id,
FcBlanks *blanks,
int *count,
FcFontSet *set)
{
FT_Face face;
FT_Library ftLibrary = NULL;
int index_set = id != -1;
int set_face_num = index_set ? id & 0xFFFF : 0;
int set_instance_num = index_set ? id >> 16 : 0;
int face_num = set_face_num;
int instance_num = set_instance_num;
int num_faces = 0;
int num_instances = 0;
FcBool index_set = id != (unsigned int) -1;
unsigned int set_face_num = index_set ? id & 0xFFFF : 0;
unsigned int set_instance_num = index_set ? id >> 16 : 0;
unsigned int face_num = set_face_num;
unsigned int instance_num = set_instance_num;
unsigned int num_faces = 0;
unsigned int num_instances = 0;
unsigned int ret = 0;
int err = 0;