[subset] For option "--unicodes", add support for "*" to retain all code points
diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.default.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.retain-all-codepoint.ttf
new file mode 100644
index 0000000..5de8d89
--- /dev/null
+++ b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..e3c0727
--- /dev/null
+++ b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.retain-all-codepoint.ttf
new file mode 100644
index 0000000..6425ecf
--- /dev/null
+++ b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..fbb8c33
--- /dev/null
+++ b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..cc2805a
--- /dev/null
+++ b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.default.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.default.retain-all-codepoint.ttf
new file mode 100644
index 0000000..12d9208
--- /dev/null
+++ b/test/subset/data/expected/basics/Roboto-Regular.abc.default.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.drop-hints-retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.drop-hints-retain-gids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..52dc474
--- /dev/null
+++ b/test/subset/data/expected/basics/Roboto-Regular.abc.drop-hints-retain-gids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.drop-hints.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.drop-hints.retain-all-codepoint.ttf
new file mode 100644
index 0000000..52dc474
--- /dev/null
+++ b/test/subset/data/expected/basics/Roboto-Regular.abc.drop-hints.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..12d9208
--- /dev/null
+++ b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.retain-gids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..12d9208
--- /dev/null
+++ b/test/subset/data/expected/basics/Roboto-Regular.abc.retain-gids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/tests/basics.tests b/test/subset/data/tests/basics.tests
index c310722..772f33c 100644
--- a/test/subset/data/tests/basics.tests
+++ b/test/subset/data/tests/basics.tests
@@ -15,3 +15,4 @@
c
ac
a
+*
diff --git a/test/subset/subset_test_suite.py b/test/subset/subset_test_suite.py
index ad438ee..47664d0 100644
--- a/test/subset/subset_test_suite.py
+++ b/test/subset/subset_test_suite.py
@@ -12,7 +12,10 @@
self.subset = subset
def unicodes(self):
- return ",".join("%X" % ord(c) for (i, c) in enumerate(self.subset))
+ 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):
with io.open(self.profile_path, mode="r", encoding="utf-8") as f:
@@ -23,7 +26,12 @@
font_base_name_parts = os.path.splitext(font_base_name)
profile_name = os.path.splitext(os.path.basename(self.profile_path))[0]
- return "%s.%s.%s%s" % (font_base_name_parts[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(),
font_base_name_parts[1])
@@ -39,9 +47,9 @@
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 @@
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.")
diff --git a/util/hb-subset.cc b/util/hb-subset.cc
index 4b7af8e..6d87c56 100644
--- a/util/hb-subset.cc
+++ b/util/hb-subset.cc
@@ -53,6 +53,13 @@
{
// 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);
diff --git a/util/options.cc b/util/options.cc
index 4e6ca57..42dfa95 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -349,28 +349,36 @@
}
GString *gs = g_string_new (nullptr);
- char *s = (char *) arg;
- char *p;
-
- while (s && *s)
+ if (0 == strcmp (arg, "*"))
{
- while (*s && strchr (DELIMITERS, *s))
- s++;
- if (!*s)
- break;
+ g_string_append_c (gs, '*');
+ }
+ else
+ {
- errno = 0;
- hb_codepoint_t u = strtoul (s, &p, 16);
- if (errno || s == p)
+ char *s = (char *) arg;
+ char *p;
+
+ while (s && *s)
{
- g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
- "Failed parsing Unicode values at: '%s'", s);
- return false;
+ while (*s && strchr (DELIMITERS, *s))
+ s++;
+ if (!*s)
+ break;
+
+ errno = 0;
+ hb_codepoint_t u = strtoul (s, &p, 16);
+ if (errno || s == p)
+ {
+ g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
+ "Failed parsing Unicode values at: '%s'", s);
+ return false;
+ }
+
+ g_string_append_unichar (gs, u);
+
+ s = p;
}
-
- g_string_append_unichar (gs, u);
-
- s = p;
}
text_opts->text_len = gs->len;