[util/main-font-text] Move eol from template arg to main() arg

This commit is contained in:
Behdad Esfahbod 2021-08-05 13:24:59 -06:00
parent 463411a1de
commit e014c6fa2d
3 changed files with 12 additions and 14 deletions

View File

@ -152,12 +152,11 @@ struct output_buffer_t
hb_buffer_serialize_flags_t format_flags = HB_BUFFER_SERIALIZE_FLAG_DEFAULT; hb_buffer_serialize_flags_t format_flags = HB_BUFFER_SERIALIZE_FLAG_DEFAULT;
}; };
template <int eol = '\n'>
using driver_t = main_font_text_t<shape_consumer_t<output_buffer_t>, FONT_SIZE_UPEM, 0, eol>;
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
using driver_t = main_font_text_t<shape_consumer_t<output_buffer_t>, FONT_SIZE_UPEM, 0>;
if (argc == 2 && !strcmp (argv[1], "--batch")) if (argc == 2 && !strcmp (argv[1], "--batch"))
{ {
unsigned int ret = 0; unsigned int ret = 0;
@ -182,13 +181,13 @@ main (int argc, char **argv)
start_offset = argc == 2 && p[0] != '\0' && p[0] != ':' && p[1] == ':' && (p[2] == '\\' || p[2] == '/') ? 2 : 0; start_offset = argc == 2 && p[0] != '\0' && p[0] != ':' && p[1] == ':' && (p[2] == '\\' || p[2] == '/') ? 2 : 0;
} }
driver_t<EOF> driver; driver_t driver;
ret |= driver.main (argc, args); ret |= driver.main (argc, args, EOF);
fflush (stdout); fflush (stdout);
} }
return ret; return ret;
} }
driver_t<> driver; driver_t driver;
return driver.main (argc, argv); return driver.main (argc, argv);
} }

View File

@ -129,12 +129,11 @@ struct subset_consumer_t
hb_subset_input_t *input = nullptr; hb_subset_input_t *input = nullptr;
}; };
template <int eol = '\n'>
using driver_t = main_font_text_t<subset_consumer_t, FONT_SIZE_UPEM, 0, eol>;
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
using driver_t = main_font_text_t<subset_consumer_t, FONT_SIZE_UPEM, 0>;
if (argc == 2 && !strcmp (argv[1], "--batch")) if (argc == 2 && !strcmp (argv[1], "--batch"))
{ {
unsigned int ret = 0; unsigned int ret = 0;
@ -157,8 +156,8 @@ main (int argc, char **argv)
args[argc++] = p = e; args[argc++] = p = e;
} }
driver_t<EOF> driver; driver_t driver;
int result = driver.main (argc, args); int result = driver.main (argc, args, EOF);
fprintf (stdout, result == 0 ? "success\n" : "failure\n"); fprintf (stdout, result == 0 ? "success\n" : "failure\n");
fflush (stdout); fflush (stdout);
ret |= result; ret |= result;
@ -166,6 +165,6 @@ main (int argc, char **argv)
return ret; return ret;
} }
driver_t<> driver; driver_t driver;
return driver.main (argc, argv); return driver.main (argc, argv);
} }

View File

@ -47,7 +47,7 @@ locale_to_utf8 (char *s)
return t; return t;
} }
template <typename consumer_t, int default_font_size, int subpixel_bits, int eol = '\n'> template <typename consumer_t, int default_font_size, int subpixel_bits>
struct main_font_text_t struct main_font_text_t
{ {
main_font_text_t () main_font_text_t ()
@ -62,7 +62,7 @@ struct main_font_text_t
} }
int int
main (int argc, char **argv) main (int argc, char **argv, int eol = '\n')
{ {
option_parser_t options ("[FONT-FILE] [TEXT]"); option_parser_t options ("[FONT-FILE] [TEXT]");
add_options (&options); add_options (&options);