diff options
Diffstat (limited to 'util/hb-shape.cc')
-rw-r--r-- | util/hb-shape.cc | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/util/hb-shape.cc b/util/hb-shape.cc index 337cd43..3ae3fa1 100644 --- a/util/hb-shape.cc +++ b/util/hb-shape.cc @@ -83,10 +83,7 @@ struct output_buffer_t if (format.trace) hb_buffer_set_message_func (buffer, message_func, this, nullptr); } - void new_line (void) - { - line_no++; - } + void new_line () { line_no++; } void consume_text (hb_buffer_t *buffer, const char *text, unsigned int text_len, @@ -160,6 +157,34 @@ struct output_buffer_t int main (int argc, char **argv) { + if (argc == 2 && !strcmp (argv[1], "--batch")) + { + unsigned int ret = 0; + char buf[4092]; + while (fgets (buf, sizeof (buf), stdin)) + { + size_t l = strlen (buf); + if (l && buf[l - 1] == '\n') buf[l - 1] = '\0'; + main_font_text_t<shape_consumer_t<output_buffer_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; + } + return ret; + } main_font_text_t<shape_consumer_t<output_buffer_t>, FONT_SIZE_UPEM, 0> driver; return driver.main (argc, argv); } |