diff --git a/util/hb-shape.cc b/util/hb-shape.cc index 337cd4319083ad50364c4d610bb771ebfac6dd83..6c727d01975f12091b841198b873f175d2ea63c6 100644 --- a/util/hb-shape.cc +++ b/util/hb-shape.cc @@ -160,6 +160,36 @@ struct output_buffer_t int main (int argc, char **argv) { + if (argc == 2 && !strcmp (argv[1], "--batch")) + { + unsigned int ret = 0; + char *buf = nullptr; + size_t len; + while (getline (&buf, &len, stdin) > 0) + { + size_t l = strlen (buf); + if (l && buf[l - 1] == '\n') buf[l - 1] = '\0'; + main_font_text_t, FONT_SIZE_UPEM, 0> driver; + char *args[32]; + argc = 0; + char *p = buf, *e; + args[argc++] = p; + while ((e = strchr (p, ' ')) && argc < (int) (int) ARRAY_LENGTH (args)) + { + *e++ = '\0'; + while (*e == ' ') + e++; + args[argc++] = p = e; + } + ret |= driver.main (argc, args); + fflush (stdout); + + if (ret) + break; + } + free (buf); + return ret; + } main_font_text_t, FONT_SIZE_UPEM, 0> driver; return driver.main (argc, argv); }