[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 int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int id = -1; unsigned int id = (unsigned int) -1;
int ignore_blanks = 0; int ignore_blanks = 0;
FcFontSet *fs; FcFontSet *fs;
FcChar8 *format = NULL; FcChar8 *format = NULL;
@ -119,7 +119,7 @@ main (int argc, char **argv)
ignore_blanks = 1; ignore_blanks = 1;
break; break;
case 'i': case 'i':
id = atoi (optarg); id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */
break; break;
case 'f': case 'f':
format = (FcChar8 *) strdup (optarg); format = (FcChar8 *) strdup (optarg);
@ -150,7 +150,7 @@ main (int argc, char **argv)
{ {
if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, blanks, NULL, fs)) 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; err = 1;
} }
} }

View File

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

View File

@ -577,10 +577,10 @@ FcDirCacheUnload (FcCache *cache);
/* fcfreetype.c */ /* fcfreetype.c */
FcPublic FcPattern * 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 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 */ /* fcfs.c */

View File

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