Simplify CVT macros.
[ttfautohint.git] / src / hint.c
blob02fb928f58dd9963109843d2520e49e1cf43df14
1 /* hint.c */
3 /* written 2011 by Werner Lemberg <wl@gnu.org> */
6 /* This test program is a wrapper for `TTF_autohint'. */
8 #include <config.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <errno.h>
13 #include <string.h>
15 #include "ttfautohint.h"
18 int
19 main(int argc,
20 char *argv[])
22 FILE *in;
23 FILE *out;
24 TA_Error error;
27 if (argc != 3)
29 fprintf(stderr, "Usage: %s <in-font> <out-font>\n", argv[0]);
30 exit(EXIT_FAILURE);
33 in = fopen(argv[1], "rb");
34 if (!in)
36 fprintf(stderr, "The following error occurred while opening font `%s':\n"
37 "\n"
38 " %s\n",
39 argv[1], strerror(errno));
40 exit(EXIT_FAILURE);
43 out = fopen(argv[2], "wb");
44 if (!out)
46 fprintf(stderr, "The following error occurred while opening font `%s':\n"
47 "\n"
48 " %s\n",
49 argv[2], strerror(errno));
50 exit(EXIT_FAILURE);
53 error = TTF_autohint(in, out);
54 if (error)
56 fprintf(stderr, "Error code `0x%02x' while autohinting font\n", error);
57 exit(EXIT_FAILURE);
60 exit(EXIT_SUCCESS);
63 /* end of hint.c */