mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-04 21:15:06 +00:00
[util] List available shapers in --help-all
Remove it from --version. Part of https://github.com/harfbuzz/harfbuzz/issues/5208
This commit is contained in:
parent
29c800bd8d
commit
75643768de
4 changed files with 30 additions and 44 deletions
|
@ -141,14 +141,11 @@ face_options_t::add_options (option_parser_t *parser)
|
|||
g_string_printf (s, "Set face loader to use (default: none)\n No supported face loaders found");
|
||||
else
|
||||
{
|
||||
char *supported_str = g_strjoinv ("/", (char **) supported_face_loaders);
|
||||
g_string_printf (s, "Set face loader to use (default: %s)\n Supported face loaders are: %s",
|
||||
supported_face_loaders[0],
|
||||
supported_face_loaders[0]);
|
||||
for (unsigned i = 1; supported_face_loaders[i]; i++)
|
||||
{
|
||||
g_string_append_c (s, '/');
|
||||
g_string_append (s, supported_face_loaders[i]);
|
||||
}
|
||||
supported_str);
|
||||
g_free (supported_str);
|
||||
}
|
||||
face_loaders_text = g_string_free (s, FALSE);
|
||||
parser->free_later (face_loaders_text);
|
||||
|
|
|
@ -119,20 +119,13 @@ font_options_t::post_parse (GError **error)
|
|||
font_funcs);
|
||||
return;
|
||||
}
|
||||
GString *s = g_string_new (nullptr);
|
||||
for (unsigned i = 0; supported_font_funcs[i]; i++)
|
||||
{
|
||||
if (i)
|
||||
g_string_append_c (s, '/');
|
||||
g_string_append (s, supported_font_funcs[i]);
|
||||
}
|
||||
char *p = g_string_free (s, FALSE);
|
||||
char *supported_str = g_strjoinv ("/", (char **) supported_font_funcs);
|
||||
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
|
||||
"Unknown font function implementation `%s'; supported values are: %s; default is %s",
|
||||
font_funcs,
|
||||
p,
|
||||
supported_str,
|
||||
supported_font_funcs[0]);
|
||||
free (p);
|
||||
g_free (supported_str);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -300,14 +293,11 @@ font_options_t::add_options (option_parser_t *parser)
|
|||
g_string_printf (s, "Set font functions implementation to use (default: none)\n No supported font function implementations found");
|
||||
else
|
||||
{
|
||||
char *supported_str = g_strjoinv ("/", (char **) supported_font_funcs);
|
||||
g_string_printf (s, "Set font functions implementation to use (default: %s)\n Supported font function implementations are: %s",
|
||||
supported_font_funcs[0],
|
||||
supported_font_funcs[0]);
|
||||
for (unsigned i = 1; supported_font_funcs[i]; i++)
|
||||
{
|
||||
g_string_append_c (s, '/');
|
||||
g_string_append (s, supported_font_funcs[i]);
|
||||
}
|
||||
supported_str);
|
||||
g_free (supported_str);
|
||||
}
|
||||
font_funcs_text = g_string_free (s, FALSE);
|
||||
parser->free_later (font_funcs_text);
|
||||
|
|
|
@ -168,22 +168,6 @@ struct option_parser_t
|
|||
GPtrArray *to_free;
|
||||
};
|
||||
|
||||
|
||||
static inline gchar *
|
||||
shapers_to_string ()
|
||||
{
|
||||
GString *shapers = g_string_new (nullptr);
|
||||
const char **shaper_list = hb_shape_list_shapers ();
|
||||
|
||||
for (; *shaper_list; shaper_list++) {
|
||||
g_string_append (shapers, *shaper_list);
|
||||
g_string_append_c (shapers, ',');
|
||||
}
|
||||
g_string_truncate (shapers, MAX (0, (gint)shapers->len - 1));
|
||||
|
||||
return g_string_free (shapers, false);
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN gboolean
|
||||
show_version (const char *name G_GNUC_UNUSED,
|
||||
const char *arg G_GNUC_UNUSED,
|
||||
|
@ -192,9 +176,6 @@ show_version (const char *name G_GNUC_UNUSED,
|
|||
{
|
||||
g_printf ("%s (%s) %s\n", g_get_prgname (), PACKAGE_NAME, PACKAGE_VERSION);
|
||||
|
||||
char *shapers = shapers_to_string ();
|
||||
g_printf ("Available shapers: %s\n", shapers);
|
||||
g_free (shapers);
|
||||
if (strcmp (HB_VERSION_STRING, hb_version_string ()))
|
||||
g_printf ("Linked HarfBuzz library has a different version: %s\n", hb_version_string ());
|
||||
|
||||
|
|
|
@ -359,13 +359,31 @@ parse_features (const char *name G_GNUC_UNUSED,
|
|||
void
|
||||
shape_options_t::add_options (option_parser_t *parser)
|
||||
{
|
||||
char *shapers_text = nullptr;
|
||||
{
|
||||
const char **supported_shapers = hb_shape_list_shapers ();
|
||||
GString *s = g_string_new (nullptr);
|
||||
if (unlikely (!supported_shapers))
|
||||
g_string_printf (s, "Set shapers to use (default: none)\n No supported shapers found");
|
||||
else
|
||||
{
|
||||
char *supported_str = g_strjoinv ("/", (char **) supported_shapers);
|
||||
g_string_printf (s, "Set shapers to use (default: %s)\n Supported shapers are: %s",
|
||||
supported_shapers[0],
|
||||
supported_str);
|
||||
g_free (supported_str);
|
||||
}
|
||||
shapers_text = g_string_free (s, FALSE);
|
||||
parser->free_later (shapers_text);
|
||||
}
|
||||
|
||||
GOptionEntry entries[] =
|
||||
{
|
||||
{"list-shapers", 0, G_OPTION_FLAG_NO_ARG,
|
||||
G_OPTION_ARG_CALLBACK, (gpointer) &list_shapers, "List available shapers and quit", nullptr},
|
||||
{"shaper", 0, G_OPTION_FLAG_HIDDEN,
|
||||
G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Hidden duplicate of --shapers", nullptr},
|
||||
{"shapers", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Set comma-separated list of shapers to try","list"},
|
||||
{"shapers", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, shapers_text,"comma-separated list"},
|
||||
{"list-shapers", 0, G_OPTION_FLAG_NO_ARG,
|
||||
G_OPTION_ARG_CALLBACK, (gpointer) &list_shapers, "List available shapers and quit", nullptr},
|
||||
{"direction", 0, 0, G_OPTION_ARG_STRING, &this->direction, "Set text direction (default: auto)", "ltr/rtl/ttb/btt"},
|
||||
{"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "BCP 47 tag"},
|
||||
{"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"},
|
||||
|
|
Loading…
Add table
Reference in a new issue