X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=util%2Foptions.cc;h=7387a5616a1c0d34cdbf64a01f05793f51957286;hb=e684182ac634596bace621b0e84dfc98d2bc82c5;hp=bc699c1d101e113b4569b3d752cee0a717036466;hpb=087e8c5d58be057cb77192932cd7fa8f7aacf1a5;p=platform%2Fupstream%2Fharfbuzz.git diff --git a/util/options.cc b/util/options.cc index bc699c1..7387a56 100644 --- a/util/options.cc +++ b/util/options.cc @@ -30,7 +30,7 @@ #include #endif #ifdef HAVE_OT -#include +#include #endif struct supported_font_funcs_t { @@ -174,7 +174,7 @@ parse_margin (const char *name G_GNUC_UNUSED, { view_options_t *view_opts = (view_options_t *) data; view_options_t::margin_t &m = view_opts->margin; - switch (sscanf (arg, "%lf%*[ ,]%lf%*[ ,]%lf%*[ ,]%lf", &m.t, &m.r, &m.b, &m.l)) { + switch (sscanf (arg, "%lf %lf %lf %lf", &m.t, &m.r, &m.b, &m.l)) { case 1: m.r = m.t; case 2: m.b = m.t; case 3: m.l = m.r; @@ -291,7 +291,6 @@ shape_options_t::add_options (option_parser_t *parser) {"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", NULL}, {"preserve-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->preserve_default_ignorables, "Preserve Default-Ignorable characters", NULL}, {"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", NULL}, - {"cluster-level", 0, 0, G_OPTION_ARG_INT, &this->cluster_level, "Cluster merging level (default: 0)", "0/1/2"}, {"normalize-glyphs",0, 0, G_OPTION_ARG_NONE, &this->normalize_glyphs, "Rearrange glyph clusters in nominal order", NULL}, {"num-iterations", 0, 0, G_OPTION_ARG_INT, &this->num_iterations, "Run shaper N times (default: 1)", "N"}, {NULL} @@ -362,7 +361,7 @@ parse_font_size (const char *name G_GNUC_UNUSED, font_opts->font_size_y = font_opts->font_size_x = FONT_SIZE_UPEM; return true; } - switch (sscanf (arg, "%lf%*[ ,]%lf", &font_opts->font_size_x, &font_opts->font_size_y)) { + switch (sscanf (arg, "%lf %lf", &font_opts->font_size_x, &font_opts->font_size_y)) { case 1: font_opts->font_size_y = font_opts->font_size_x; case 2: return true; default: @@ -441,7 +440,7 @@ output_options_t::add_options (option_parser_t *parser) const char *text; if (NULL == supported_formats) - text = "Set output serialization format"; + text = "Set output format"; else { char *items = g_strjoinv ("/", const_cast (supported_formats)); @@ -458,8 +457,8 @@ output_options_t::add_options (option_parser_t *parser) }; parser->add_group (entries, "output", - "Output destination & format options:", - "Options controlling the destination and form of the output", + "Output options:", + "Options controlling the output", this); } @@ -490,7 +489,7 @@ font_options_t::get_font (void) const GString *gs = g_string_new (NULL); char buf[BUFSIZ]; #if defined(_WIN32) || defined(__CYGWIN__) - setmode (fileno (stdin), O_BINARY); + setmode (fileno (stdin), _O_BINARY); #endif while (!feof (stdin)) { size_t ret = fread (buf, 1, sizeof (buf), stdin); @@ -538,9 +537,6 @@ font_options_t::get_font (void) const } } - if (debug) - mm = HB_MEMORY_MODE_DUPLICATE; - blob = hb_blob_create (font_data, len, mm, user_data, destroy); } @@ -569,7 +565,7 @@ font_options_t::get_font (void) const else { for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++) - if (0 == g_ascii_strcasecmp (font_funcs, supported_font_funcs[i].name)) + if (0 == strcasecmp (font_funcs, supported_font_funcs[i].name)) { set_font_funcs = supported_font_funcs[i].func; break; @@ -601,26 +597,25 @@ const char * text_options_t::get_line (unsigned int *len) { if (text) { - if (!line) line = text; - if (line_len == (unsigned int) -1) - line_len = strlen (line); + if (text_len == (unsigned int) -1) + text_len = strlen (text); - if (!line_len) { + if (!text_len) { *len = 0; return NULL; } - const char *ret = line; - const char *p = (const char *) memchr (line, '\n', line_len); + const char *ret = text; + const char *p = (const char *) memchr (text, '\n', text_len); unsigned int ret_len; if (!p) { - ret_len = line_len; - line += ret_len; - line_len = 0; + ret_len = text_len; + text += ret_len; + text_len = 0; } else { ret_len = p - ret; - line += ret_len + 1; - line_len -= ret_len + 1; + text += ret_len + 1; + text_len -= ret_len + 1; } *len = ret_len; @@ -672,7 +667,7 @@ output_options_t::get_file_handle (void) fp = fopen (output_file, "wb"); else { #if defined(_WIN32) || defined(__CYGWIN__) - setmode (fileno (stdout), O_BINARY); + setmode (fileno (stdout), _O_BINARY); #endif fp = stdout; } @@ -699,27 +694,19 @@ format_options_t::add_options (option_parser_t *parser) { GOptionEntry entries[] = { - {"show-text", 0, 0, G_OPTION_ARG_NONE, &this->show_text, "Prefix each line of output with its corresponding input text", NULL}, - {"show-unicode", 0, 0, G_OPTION_ARG_NONE, &this->show_unicode, "Prefix each line of output with its corresponding input codepoint(s)", NULL}, - {"show-line-num", 0, 0, G_OPTION_ARG_NONE, &this->show_line_num, "Prefix each line of output with its corresponding input line number", NULL}, - {"verbose", 0, G_OPTION_FLAG_NO_ARG, - G_OPTION_ARG_CALLBACK, (gpointer) &parse_verbose, "Prefix each line of output with all of the above", NULL}, - {"no-glyph-names", 0, G_OPTION_FLAG_REVERSE, - G_OPTION_ARG_NONE, &this->show_glyph_names, "Output glyph indices instead of names", NULL}, - {"no-positions", 0, G_OPTION_FLAG_REVERSE, - G_OPTION_ARG_NONE, &this->show_positions, "Do not output glyph positions", NULL}, - {"no-clusters", 0, G_OPTION_FLAG_REVERSE, - G_OPTION_ARG_NONE, &this->show_clusters, "Do not output cluster indices", NULL}, - {"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Output glyph extents", NULL}, + {"no-glyph-names", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_glyph_names, "Use glyph indices instead of names", NULL}, + {"no-positions", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_positions, "Do not show glyph positions", NULL}, + {"no-clusters", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_clusters, "Do not show cluster mapping", NULL}, + {"show-text", 0, 0, G_OPTION_ARG_NONE, &this->show_text, "Show input text", NULL}, + {"show-unicode", 0, 0, G_OPTION_ARG_NONE, &this->show_unicode, "Show input Unicode codepoints", NULL}, + {"show-line-num", 0, 0, G_OPTION_ARG_NONE, &this->show_line_num, "Show line numbers", NULL}, + {"verbose", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,(gpointer) &parse_verbose, "Show everything", NULL}, {NULL} }; parser->add_group (entries, - "output-syntax", - "Output syntax:\n" - " text: [=@,+,|...]\n" - " json: [{\"g\": , \"ax\": , \"ay\": , \"dx\": , \"dy\": , \"cl\": }, ...]\n" - "\nOutput syntax options:", - "Options controlling the syntax of the output", + "format", + "Format options:", + "Options controlling the formatting of buffer contents", this); }