[subset] For option "--unicodes", add support for "*" to retain all code points
This commit is contained in:
parent
4730b350b7
commit
1da1b4dc94
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -15,3 +15,4 @@ b
|
|||
c
|
||||
ac
|
||||
a
|
||||
*
|
||||
|
|
|
@ -12,6 +12,9 @@ class Test:
|
|||
self.subset = subset
|
||||
|
||||
def unicodes(self):
|
||||
if self.subset == '*':
|
||||
return self.subset[0]
|
||||
else:
|
||||
return ",".join("%X" % ord(c) for (i, c) in enumerate(self.subset))
|
||||
|
||||
def get_profile_flags(self):
|
||||
|
@ -23,6 +26,11 @@ class Test:
|
|||
font_base_name_parts = os.path.splitext(font_base_name)
|
||||
profile_name = os.path.splitext(os.path.basename(self.profile_path))[0]
|
||||
|
||||
if self.unicodes() == "*":
|
||||
return "%s.%s.retain-all-codepoint%s" % (font_base_name_parts[0],
|
||||
profile_name,
|
||||
font_base_name_parts[1])
|
||||
else:
|
||||
return "%s.%s.%s%s" % (font_base_name_parts[0],
|
||||
profile_name,
|
||||
self.unicodes(),
|
||||
|
@ -39,9 +47,9 @@ class SubsetTestSuite:
|
|||
|
||||
def __init__(self, test_path, definition):
|
||||
self.test_path = test_path
|
||||
self.fonts = set()
|
||||
self.profiles = set()
|
||||
self.subsets = set()
|
||||
self.fonts = []
|
||||
self.profiles = []
|
||||
self.subsets = []
|
||||
self._parse(definition)
|
||||
|
||||
def get_output_directory(self):
|
||||
|
@ -87,6 +95,6 @@ class SubsetTestSuite:
|
|||
if line in destinations:
|
||||
current_destination = destinations[line]
|
||||
elif current_destination is not None:
|
||||
current_destination.add(line)
|
||||
current_destination.append(line)
|
||||
else:
|
||||
raise Exception("Failed to parse test suite file.")
|
||||
|
|
|
@ -53,6 +53,13 @@ struct subset_consumer_t
|
|||
{
|
||||
// TODO(Q1) does this only get called with at least 1 codepoint?
|
||||
hb_set_t *codepoints = hb_subset_input_unicode_set (input);
|
||||
if (0 == strcmp (text, "*"))
|
||||
{
|
||||
hb_face_t *face = hb_font_get_face (font);
|
||||
hb_face_collect_unicodes (face, codepoints);
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *c = (gchar *)text;
|
||||
do {
|
||||
gunichar cp = g_utf8_get_char(c);
|
||||
|
|
|
@ -349,6 +349,13 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
|
|||
}
|
||||
|
||||
GString *gs = g_string_new (nullptr);
|
||||
if (0 == strcmp (arg, "*"))
|
||||
{
|
||||
g_string_append_c (gs, '*');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
char *s = (char *) arg;
|
||||
char *p;
|
||||
|
||||
|
@ -372,6 +379,7 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
|
|||
|
||||
s = p;
|
||||
}
|
||||
}
|
||||
|
||||
text_opts->text_len = gs->len;
|
||||
text_opts->text = g_string_free (gs, FALSE);
|
||||
|
|
Loading…
Reference in New Issue