[hb-view] Add --face-index to choose a face in a TrueType Collection

This commit is contained in:
Behdad Esfahbod 2011-05-31 12:59:17 -04:00
parent 4f28fbdd80
commit 0c6a9767c8
1 changed files with 6 additions and 1 deletions

View File

@ -51,6 +51,7 @@ static int margin_b = 10;
static int margin_l = 10;
static int margin_r = 10;
static int line_space = 0;
static int face_index = 0;
static double font_size = 18;
static const char *fore = "#000000";
static const char *back = "#ffffff";
@ -106,6 +107,7 @@ parse_opts (int argc, char **argv)
{"direction", 1, 0, 'd'},
{"features", 1, 0, 'f'},
{"font-size", 1, 0, 's'},
{"face-index", 1, 0, 'i'},
{"foreground", 1, 0, 'F'},
{"help", 0, 0, 'h'},
{"language", 1, 0, 'L'},
@ -131,6 +133,9 @@ parse_opts (int argc, char **argv)
case 'v':
version ();
break;
case 'i':
face_index = atoi (optarg);
break;
case 'l':
line_space = atoi (optarg);
break;
@ -528,7 +533,7 @@ main (int argc, char **argv)
parse_opts (argc, argv);
FT_Init_FreeType (&ft_library);
if (FT_New_Face (ft_library, font_file, 0, &ft_face)) {
if (FT_New_Face (ft_library, font_file, face_index, &ft_face)) {
fprintf (stderr, "Failed to open font file `%s'\n", font_file);
exit (1);
}