src/hb-ot-map-private.hh | 2 +- test/shaping/README.md | 4 ++-- test/shaping/hb_test_tools.py | 13 ++++++++++++- test/shaping/record-test.sh | 12 ++++++------ 4 files changed, 21 insertions(+), 10 deletions(-)
New commits: commit 740fdbcd0e6d25c1d6f12537ca2aa559650b9d52 Author: jfkthame <jfkth...@gmail.com> Date: Mon Apr 3 12:22:39 2017 +0100 avoid UBSan warning in get_stage_lookups (#450) See https://bugzilla.mozilla.org/show_bug.cgi?id=1336600 diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh index 0395c9c2..b69e5344 100644 --- a/src/hb-ot-map-private.hh +++ b/src/hb-ot-map-private.hh @@ -113,7 +113,7 @@ struct hb_ot_map_t assert (stage <= stages[table_index].len); unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0; unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].last_lookup : lookups[table_index].len; - *plookups = &lookups[table_index][start]; + *plookups = end == start ? NULL : &lookups[table_index][start]; *lookup_count = end - start; } commit 8d256841ca7462fd596329abf6f71bafb56fd621 Author: Dominik Schloesser <d...@dosc.net> Date: Sun Mar 26 09:22:34 2017 +0200 Current fonttools (3.9.1) generate subset-file called font.subset.ttf instead of older font.ttf.subset diff --git a/test/shaping/record-test.sh b/test/shaping/record-test.sh index b2a74f7b..cf17c542 100755 --- a/test/shaping/record-test.sh +++ b/test/shaping/record-test.sh @@ -48,20 +48,20 @@ pyftsubset \ --no-hinting \ "$dir/font.ttf" \ --text="$text" -if ! test -s "$dir/font.ttf.subset"; then - echo "Subsetter didn't produce nonempty subset font in $dir/font.ttf.subset" >&2 +if ! test -s "$dir/font.subset.ttf"; then + echo "Subsetter didn't produce nonempty subset font in $dir/font.subset.ttf" >&2 exit 2 fi # Verify that subset font produces same glyphs! -glyphs_subset=`echo "$text" | $hb_shape $options "$dir/font.ttf.subset"` +glyphs_subset=`echo "$text" | $hb_shape $options "$dir/font.subset.ttf"` if ! test "x$glyphs" = "x$glyphs_subset"; then echo "Subset font produced different glyphs!" >&2 echo "Perhaps font doesn't have glyph names; checking visually..." >&2 hb_view=${hb_shape/shape/view} echo "$text" | $hb_view $options "$dir/font.ttf" --output-format=png --output-file="$dir/orig.png" - echo "$text" | $hb_view $options "$dir/font.ttf.subset" --output-format=png --output-file="$dir/subset.png" + echo "$text" | $hb_view $options "$dir/font.subset.ttf" --output-format=png --output-file="$dir/subset.png" if ! cmp "$dir/orig.png" "$dir/subset.png"; then echo "Images differ. Please inspect $dir/*.png." >&2 echo "$glyphs" @@ -74,9 +74,9 @@ if ! test "x$glyphs" = "x$glyphs_subset"; then glyphs=$glyphs_subset fi -sha1sum=`sha1sum "$dir/font.ttf.subset" | cut -d' ' -f1` +sha1sum=`sha1sum "$dir/font.subset.ttf" | cut -d' ' -f1` subset="fonts/sha1sum/$sha1sum.ttf" -mv "$dir/font.ttf.subset" "$subset" +mv "$dir/font.subset.ttf" "$subset" # There ought to be an easier way to do this, but it escapes me... unicodes_file=`mktemp` commit c2a9de15f5d9477c6f1c143ed8265f71fdb04584 Author: Dominik Schloesser <d...@dosc.net> Date: Sun Mar 26 09:21:13 2017 +0200 Updated samples: record-it.sh is now record-test.sh diff --git a/test/shaping/README.md b/test/shaping/README.md index bf099094..a581a343 100644 --- a/test/shaping/README.md +++ b/test/shaping/README.md @@ -14,7 +14,7 @@ FontTools from <https://github.com/behdad/fonttools>. To use `record-test.sh`, just put it right before the `hb-shape` invocation: ```sh -$ ./hb-unicode-encode 41 42 43 627 | ./record-it.sh ../../util/hb-shape font.ttf +$ ./hb-unicode-encode 41 42 43 627 | ./record-test.sh ../../util/hb-shape font.ttf ``` what this does is: * Subset the font for the sequence of Unicode characters requested, @@ -27,7 +27,7 @@ what this does is: and prints out the test case input, which you can then redirect to an existing or new test file in `tests`, eg.: ```sh -$ ./hb-unicode-encode 41 42 43 627 | ./record-it.sh ../../util/hb-shape font.ttf >> tests/test-name.test +$ ./hb-unicode-encode 41 42 43 627 | ./record-test.sh ../../util/hb-shape font.ttf >> tests/test-name.test ``` If you created a new test file, add it to `Makefile.am` so it is run. commit f2e6c7ce51283809033d08692a2dee7cf04aefc5 Author: Khaled Hosny <khaledho...@eglug.org> Date: Sun Mar 26 10:48:53 2017 +0200 [tools] Make hb-unicode-code work with Python 3 Related to https://github.com/behdad/harfbuzz/pull/445 diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py index 74739829..052974de 100644 --- a/test/shaping/hb_test_tools.py +++ b/test/shaping/hb_test_tools.py @@ -46,6 +46,17 @@ try: except NameError: unichr = chr +try: + unicode = unicode +except NameError: + unicode = str + +def tounicode(s, encoding='ascii', errors='strict'): + if not isinstance(s, unicode): + return s.decode(encoding, errors) + else: + return s + class ColorFormatter: class Null: @@ -445,7 +456,7 @@ class Unicode: @staticmethod def decode (s): - return u','.join ("U+%04X" % ord (u) for u in unicode (s, 'utf-8')).encode ('utf-8') + return u','.join ("U+%04X" % ord (u) for u in tounicode (s, 'utf-8')) @staticmethod def parse (s): _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz