summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-07-17 17:09:29 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-07-17 17:09:29 -0400
commit39b17837b4064d59c18cebb49c1c0b5b8cc0c117 (patch)
tree10ee077653f26abde1deeaf8e9908ad92e50b46f /util
parent25e302da9a712e6f1d63b0d243a8df0d326ddba3 (diff)
Add hb_buffer_normalize_glyphs() and hb-shape --normalize-glyphs
This reorders glyphs within the cluster to a nominal order. This should have no visible effect on the output, but helps with testing, for getting the same hb-shape output for visually-equal glyphs for each cluster.
Diffstat (limited to 'util')
-rw-r--r--util/options.cc1
-rw-r--r--util/options.hh7
2 files changed, 7 insertions, 1 deletions
diff --git a/util/options.cc b/util/options.cc
index db1b2447..584190e0 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -396,6 +396,7 @@ shape_options_t::add_options (option_parser_t *parser)
{"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "langstr"},
{"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"},
{"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", NULL},
+ {"normalize-glyphs",0, 0, G_OPTION_ARG_NONE, &this->normalize_glyphs, "Rearrange glyph clusters in nominal order", NULL},
{NULL}
};
parser->add_group (entries,
diff --git a/util/options.hh b/util/options.hh
index 9b7baa71..24852305 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -148,6 +148,7 @@ struct shape_options_t : option_group_t
num_features = 0;
shapers = NULL;
utf8_clusters = false;
+ normalize_glyphs = false;
add_options (parser);
}
@@ -188,7 +189,10 @@ struct shape_options_t : option_group_t
hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer)
{
- return hb_shape_full (font, buffer, features, num_features, shapers);
+ hb_bool_t res = hb_shape_full (font, buffer, features, num_features, shapers);
+ if (normalize_glyphs)
+ hb_buffer_normalize_glyphs (buffer);
+ return res;
}
void shape_closure (const char *text, int text_len,
@@ -208,6 +212,7 @@ struct shape_options_t : option_group_t
unsigned int num_features;
char **shapers;
hb_bool_t utf8_clusters;
+ hb_bool_t normalize_glyphs;
};