diff --git a/util/gpu-output.hh b/util/gpu-output.hh index d8251e217..9521f079d 100644 --- a/util/gpu-output.hh +++ b/util/gpu-output.hh @@ -46,12 +46,14 @@ struct gpu_output_t hb_bool_t use_metal = false; hb_bool_t use_d3d11 = false; hb_bool_t demo = false; + char *type_text = nullptr; void add_options (option_parser_t *parser) { GOptionEntry entries[] = { {"demo", 0, 0, G_OPTION_ARG_NONE, &this->demo, "Use built-in demo font and text", nullptr}, + {"type", 'T', 0, G_OPTION_ARG_STRING, &this->type_text, "Type these keystrokes on start", "keys"}, #ifdef __APPLE__ {"metal", 0, 0, G_OPTION_ARG_NONE, &this->use_metal, "Use Metal renderer", nullptr}, #endif @@ -244,6 +246,9 @@ struct gpu_output_t demo_view_print_help (vu); demo_view_setup (vu); + if (type_text) + demo_view_type (vu, type_text); + demo_view_display (vu, buf); glfwPollEvents (); demo_view_display (vu, buf); diff --git a/util/gpu/demo-view.cc b/util/gpu/demo-view.cc index b71c6b97c..650d18c7a 100644 --- a/util/gpu/demo-view.cc +++ b/util/gpu/demo-view.cc @@ -815,6 +815,17 @@ demo_view_setup (demo_view_t *vu) vu->renderer->set_stem_darkening (true); } +void +demo_view_type (demo_view_t *vu, const char *keys) +{ + for (const char *p = keys; *p; p++) + { + int key = (unsigned char) *p; + demo_view_key_func (vu, key >= 'a' && key <= 'z' ? key - 32 : key, 0, GLFW_PRESS, 0); + demo_view_char_func (vu, key); + } +} + void demo_view_request_redraw (demo_view_t *vu) { diff --git a/util/gpu/demo-view.h b/util/gpu/demo-view.h index 0df3a4d69..c09533fa1 100644 --- a/util/gpu/demo-view.h +++ b/util/gpu/demo-view.h @@ -81,6 +81,9 @@ demo_view_display (demo_view_t *vu, demo_buffer_t *buffer); void demo_view_setup (demo_view_t *vu); +void +demo_view_type (demo_view_t *vu, const char *keys); + void demo_view_request_redraw (demo_view_t *vu);