diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-04-24 01:11:10 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2015-04-24 01:11:10 -0700 |
commit | 16032d5e0f1170a493e317f3c7fe6ff2c7f2e0d5 (patch) | |
tree | 308d2a31664167060511122ecca16936b6ffdb38 /scripts/layout.py | |
parent | 426d835d159819f1d40d3c8e88ac6cdd6a937a3c (diff) |
Add test for soft-dotted characters.
The test is added to run_exhaustive_tests.py, and checks all
combinations of soft-dotted characters with combining marks above.
It's disabled for now, since the fonts fail it.
Diffstat (limited to 'scripts/layout.py')
-rw-r--r-- | scripts/layout.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/layout.py b/scripts/layout.py index f65cf01..dc85ed2 100644 --- a/scripts/layout.py +++ b/scripts/layout.py @@ -32,3 +32,16 @@ def get_advances(text, font): _advance_cache[(text, font)] = advances return advances +_shape_cache = {} +def get_shapes(text, font): + """Get a list of shaped glyphs for text rendered in a font.""" + try: + return _shape_cache[(text, font)] + except KeyError: + pass + + hb_output = render.run_harfbuzz_on_text(text, font, None) + hb_output = json.loads(hb_output) + shapes = [glyph['g'] for glyph in hb_output] + _shape_cache[(text, font)] = shapes + return shapes |