#include <hb-ft.h>
#endif
#ifdef HAVE_OT
-#include <hb-ot-font.h>
+#include <hb-ot.h>
#endif
struct supported_font_funcs_t {
{
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;
{"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}
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:
const char *text;
if (NULL == supported_formats)
- text = "Set output format";
+ text = "Set output serialization format";
else
{
char *items = g_strjoinv ("/", const_cast<char **> (supported_formats));
};
parser->add_group (entries,
"output",
- "Output options:",
- "Options controlling the output",
+ "Output destination & format options:",
+ "Options controlling the destination and form of the output",
this);
}
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);
}
}
+ if (debug)
+ mm = HB_MEMORY_MODE_DUPLICATE;
+
blob = hb_blob_create (font_data, len, mm, user_data, destroy);
}
else
{
for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++)
- if (0 == strcasecmp (font_funcs, supported_font_funcs[i].name))
+ if (0 == g_ascii_strcasecmp (font_funcs, supported_font_funcs[i].name))
{
set_font_funcs = supported_font_funcs[i].func;
break;
text_options_t::get_line (unsigned int *len)
{
if (text) {
- if (text_len == (unsigned int) -1)
- text_len = strlen (text);
+ if (!line) line = text;
+ if (line_len == (unsigned int) -1)
+ line_len = strlen (line);
- if (!text_len) {
+ if (!line_len) {
*len = 0;
return NULL;
}
- const char *ret = text;
- const char *p = (const char *) memchr (text, '\n', text_len);
+ const char *ret = line;
+ const char *p = (const char *) memchr (line, '\n', line_len);
unsigned int ret_len;
if (!p) {
- ret_len = text_len;
- text += ret_len;
- text_len = 0;
+ ret_len = line_len;
+ line += ret_len;
+ line_len = 0;
} else {
ret_len = p - ret;
- text += ret_len + 1;
- text_len -= ret_len + 1;
+ line += ret_len + 1;
+ line_len -= ret_len + 1;
}
*len = ret_len;
fp = fopen (output_file, "wb");
else {
#if defined(_WIN32) || defined(__CYGWIN__)
- setmode (fileno (stdout), _O_BINARY);
+ setmode (fileno (stdout), O_BINARY);
#endif
fp = stdout;
}
{
GOptionEntry entries[] =
{
- {"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},
+ {"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},
{NULL}
};
parser->add_group (entries,
- "format",
- "Format options:",
- "Options controlling the formatting of buffer contents",
+ "output-syntax",
+ "Output syntax:\n"
+ " text: [<glyph name or index>=<glyph cluster index within input>@<horizontal displacement>,<vertical displacement>+<horizontal advance>,<vertical advance>|...]\n"
+ " json: [{\"g\": <glyph name or index>, \"ax\": <horizontal advance>, \"ay\": <vertical advance>, \"dx\": <horizontal displacement>, \"dy\": <vertical displacement>, \"cl\": <glyph cluster index within input>}, ...]\n"
+ "\nOutput syntax options:",
+ "Options controlling the syntax of the output",
this);
}