aboutsummaryrefslogtreecommitdiffstats
path: root/text/harfbuzz-suite.py
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 16:04:05 +0100
committereunhhu <[email protected]>2026-09-28 16:04:05 +0100
commit960fa21762484d3014a6778a7673f15acf2d34bb (patch)
tree9e9a38a919b3cb8ed82c84524b7dd72b289ce49e /text/harfbuzz-suite.py
parentddbbc39cc65946f59298eab546c906ad3dea6841 (diff)
downloadvega-960fa21762484d3014a6778a7673f15acf2d34bb.tar.gz
vega-960fa21762484d3014a6778a7673f15acf2d34bb.zip
Map characters as HarfBuzz maps them, not as it lists them
The shaping section's character map came from hb_face_collect_unicodes. HarfBuzz's own suite showed where that list and its mapping part: it cuts a format 13 map short (AdobeBlank2's whole Unicode to one glyph), and a symbol map (3,0) it searches through the private use area, Latin and, in an old Arabic font, Arabic too. Now every code point is asked with hb_font_get_nominal_glyph (about 30 ms a font) and the map carried as groups: codes going to consecutive glyphs, or all to one (12 bytes each, so a format 13 map stays small). HarfBuzz's suite: 5011 of 5199 cases the same (1355 before). The installed fonts (213) and the Noto ones (21) still shape as HarfBuzz does on random runs.
Diffstat (limited to 'text/harfbuzz-suite.py')
-rw-r--r--text/harfbuzz-suite.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/text/harfbuzz-suite.py b/text/harfbuzz-suite.py
index aa25195..d132070 100644
--- a/text/harfbuzz-suite.py
+++ b/text/harfbuzz-suite.py
@@ -133,8 +133,10 @@ def main():
counts = Counter(verdict.split(' ', 1)[0] for verdict in outcome.values())
is_known = lambda case: any(fnmatch.fnmatchcase(case, pattern) for pattern in known)
unexpected = sorted(case for case, verdict in outcome.items() if verdict != 'same' and not is_known(case))
- now_same = sorted(case for case, verdict in outcome.items() if verdict == 'same' and is_known(case) and
- case in known)
+ # a listed case, or pattern, all of whose cases now agree
+ now_same = sorted(pattern for pattern in known
+ if any(fnmatch.fnmatchcase(case, pattern) for case in outcome) and
+ all(verdict == 'same' for case, verdict in outcome.items() if fnmatch.fnmatchcase(case, pattern)))
for case in unexpected[:args.show]:
print(f'{case}: {outcome[case]}', file=sys.stderr)
print(details.get(case, ''), end='', file=sys.stderr)