.circleci/config.yml                                           |  133 +++---
 CMakeLists.txt                                                 |   11 
 src/hb-aat-layout-common-private.hh                            |   89 ++++
 src/hb-aat-layout-morx-table.hh                                |  194 
++++++++--
 src/hb-open-type-private.hh                                    |    2 
 src/hb-private.hh                                              |   11 
 test/shaping/data/Makefile.am                                  |    4 
 test/shaping/data/in-house/Makefile.am                         |    4 
 test/shaping/data/text-rendering-tests/COPYING                 |   13 
 test/shaping/data/text-rendering-tests/Makefile.am             |   58 --
 test/shaping/data/text-rendering-tests/Makefile.sources        |   51 ++
 test/shaping/data/text-rendering-tests/README                  |    4 
 test/shaping/data/text-rendering-tests/fonts/TestMORXEight.ttf |binary
 test/shaping/data/text-rendering-tests/fonts/TestMORXNine.ttf  |binary
 test/shaping/data/text-rendering-tests/tests/MORX-5.tests      |   25 +
 test/shaping/data/text-rendering-tests/tests/MORX-6.tests      |    1 
 test/shaping/data/text-rendering-tests/tests/MORX-7.tests      |    1 
 test/shaping/data/text-rendering-tests/tests/MORX-8.tests      |    3 
 test/shaping/data/text-rendering-tests/tests/MORX-9.tests      |    1 
 test/shaping/data/text-rendering-tests/update.sh               |   48 ++
 test/shaping/run-tests.py                                      |   18 
 21 files changed, 511 insertions(+), 160 deletions(-)

New commits:
commit a5adc5aa84c03184fd1c8a486be80ff0af1f448c
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Thu Jan 11 10:30:22 2018 +0100

    [test/text-rendering-tests] Update from upstream
    
    Also adds an update.sh script that does this automatically.

diff --git a/test/shaping/data/text-rendering-tests/Makefile.am 
b/test/shaping/data/text-rendering-tests/Makefile.am
index 56247b7b..788db1f6 100644
--- a/test/shaping/data/text-rendering-tests/Makefile.am
+++ b/test/shaping/data/text-rendering-tests/Makefile.am
@@ -6,61 +6,21 @@ NULL =
 lib:
        @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
 
+update:
+       (cd $(srcdir) && ./update.sh)
+
 EXTRA_DIST = \
        README \
        COPYING \
+       update.sh \
        extract-tests.py \
        fonts \
-       $(TESTS) \
+       tests \
        $(NULL)
 
 TEST_EXTENSIONS = .tests
 TESTS_LOG_COMPILER = $(srcdir)/../../run-tests.py 
$(top_builddir)/util/hb-shape$(EXEEXT)
 
-TESTS = \
-       tests/AVAR-1.tests \
-       tests/CFF-1.tests \
-       tests/CFF2-1.tests \
-       tests/CFF-2.tests \
-       tests/CMAP-1.tests \
-       tests/CMAP-2.tests \
-       tests/CVAR-1.tests \
-       tests/CVAR-2.tests \
-       tests/GLYF-1.tests \
-       tests/GPOS-1.tests \
-       tests/GPOS-2.tests \
-       tests/GPOS-3.tests \
-       tests/GPOS-4.tests \
-       tests/GPOS-5.tests \
-       tests/GSUB-1.tests \
-       tests/GSUB-2.tests \
-       tests/GVAR-1.tests \
-       tests/GVAR-2.tests \
-       tests/GVAR-3.tests \
-       tests/GVAR-4.tests \
-       tests/GVAR-5.tests \
-       tests/GVAR-6.tests \
-       tests/GVAR-7.tests \
-       tests/GVAR-8.tests \
-       tests/GVAR-9.tests \
-       tests/HVAR-1.tests \
-       tests/HVAR-2.tests \
-       tests/KERN-1.tests \
-       tests/KERN-2.tests \
-       tests/SHBALI-3.tests \
-       tests/SHKNDA-1.tests \
-       $(NULL)
-DISABLED_TESTS = \
-       tests/CMAP-3.tests # Non-Unicode cmap \
-       tests/MORX-1.tests # Not implemented \
-       tests/MORX-2.tests # Not implemented \
-       tests/MORX-3.tests # Not implemented \
-       tests/MORX-4.tests # Not implemented \
-       tests/SHARAN-1.tests # Rounding difference \
-       tests/SHBALI-1.tests # Rounding difference \
-       tests/SHBALI-2.tests # Rounding difference \
-       tests/SHKNDA-2.tests # Rounding difference \
-       tests/SHKNDA-3.tests # Rounding difference \
-       $(NULL)
+include Makefile.sources
 
 -include $(top_srcdir)/git.mk
diff --git a/test/shaping/data/text-rendering-tests/Makefile.sources 
b/test/shaping/data/text-rendering-tests/Makefile.sources
new file mode 100644
index 00000000..913d4195
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/Makefile.sources
@@ -0,0 +1,51 @@
+TESTS = \
+       tests/AVAR-1.tests \
+       tests/CFF-1.tests \
+       tests/CFF2-1.tests \
+       tests/CFF-2.tests \
+       tests/CMAP-1.tests \
+       tests/CMAP-2.tests \
+       tests/CVAR-1.tests \
+       tests/CVAR-2.tests \
+       tests/GLYF-1.tests \
+       tests/GPOS-1.tests \
+       tests/GPOS-2.tests \
+       tests/GPOS-3.tests \
+       tests/GPOS-4.tests \
+       tests/GPOS-5.tests \
+       tests/GSUB-1.tests \
+       tests/GSUB-2.tests \
+       tests/GVAR-1.tests \
+       tests/GVAR-2.tests \
+       tests/GVAR-3.tests \
+       tests/GVAR-4.tests \
+       tests/GVAR-5.tests \
+       tests/GVAR-6.tests \
+       tests/GVAR-7.tests \
+       tests/GVAR-8.tests \
+       tests/GVAR-9.tests \
+       tests/HVAR-1.tests \
+       tests/HVAR-2.tests \
+       tests/KERN-1.tests \
+       tests/KERN-2.tests \
+       tests/MORX-5.tests \
+       tests/MORX-6.tests \
+       tests/MORX-7.tests \
+       tests/MORX-8.tests \
+       tests/MORX-9.tests \
+       tests/SHBALI-3.tests \
+       tests/SHKNDA-1.tests \
+       $(NULL)
+
+DISBALED_TESTS = \
+       tests/CMAP-3.tests \
+       tests/MORX-1.tests \
+       tests/MORX-2.tests \
+       tests/MORX-3.tests \
+       tests/MORX-4.tests \
+       tests/SHARAN-1.tests \
+       tests/SHBALI-1.tests \
+       tests/SHBALI-2.tests \
+       tests/SHKNDA-2.tests \
+       tests/SHKNDA-3.tests \
+       $(NULL)
diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXEight.ttf 
b/test/shaping/data/text-rendering-tests/fonts/TestMORXEight.ttf
new file mode 100644
index 00000000..9255e996
Binary files /dev/null and 
b/test/shaping/data/text-rendering-tests/fonts/TestMORXEight.ttf differ
diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXNine.ttf 
b/test/shaping/data/text-rendering-tests/fonts/TestMORXNine.ttf
new file mode 100644
index 00000000..4371df45
Binary files /dev/null and 
b/test/shaping/data/text-rendering-tests/fonts/TestMORXNine.ttf differ
diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-5.tests 
b/test/shaping/data/text-rendering-tests/tests/MORX-5.tests
new file mode 100644
index 00000000..ca8d0864
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/tests/MORX-5.tests
@@ -0,0 +1,25 @@
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0033:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|three@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0034:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|four@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0035:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|five@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0036:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|six@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0037:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|seven@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0038:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|eight@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+0038:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|eight@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0039:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|nine@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+0039:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|nine@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+2793:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|one_zero@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+2793:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|one_zero@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+24EB:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|one_one@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+24EB:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|one_one@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+24EC:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|one_two@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+24EC:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|one_two@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0043,U+0058,U+0059,U+005A,U+24EC:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|C@2710,0|X@3540,0|Y@3904,0|Z@4236,0|one_two@4558,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+24ED:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|one_three@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+24ED:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|one_three@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0043,U+0058,U+0059,U+005A,U+24ED:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|C@2710,0|X@3540,0|Y@3904,0|Z@4236,0|one_three@4558,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+24EE:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|one_four@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+24EE:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|one_four@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0043,U+0058,U+0059,U+005A,U+24EE:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|C@2710,0|X@3540,0|Y@3904,0|Z@4236,0|one_four@4558,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+24EF:[P|Q@333,0|R@699,0|A@1050,0|X@1880,0|Y@2244,0|Z@2576,0|one_five@2898,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0058,U+0059,U+005A,U+24EF:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|X@2710,0|Y@3074,0|Z@3406,0|one_five@3728,0]
+../fonts/TestMORXFour.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0050,U+0051,U+0052,U+0041,U+0042,U+0043,U+0058,U+0059,U+005A,U+24EF:[P|Q@333,0|R@699,0|A@1050,0|B@1880,0|C@2710,0|X@3540,0|Y@3904,0|Z@4236,0|one_five@4558,0]
diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-6.tests 
b/test/shaping/data/text-rendering-tests/tests/MORX-6.tests
new file mode 100644
index 00000000..ff9c061a
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/tests/MORX-6.tests
@@ -0,0 +1 @@
+../fonts/TestMORXTwo.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+004F,U+004F,U+004F,U+0041,U+0042,U+0043,U+0044,U+0045,U+0046,U+0047,U+004F,U+004F,U+004F,U+0033,U+0031,U+0034,U+0031:[O|O@418,0|O@836,0|E@1254,0|F@2084,0|A@2914,0|G@3744,0|B@4574,0|C@5404,0|D@6234,0|O@7064,0|O@7482,0|O@7900,0|three@8318,0|one@9168,0|four@10018,0|one@10868,0]
diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-7.tests 
b/test/shaping/data/text-rendering-tests/tests/MORX-7.tests
new file mode 100644
index 00000000..f2508486
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/tests/MORX-7.tests
@@ -0,0 +1 @@
+../fonts/TestMORXTwo.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+004F,U+0042,U+0043,U+0044,U+0031:[B|C@830,0|D@1660,0|O@2490,0|one@2908,0]
diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-8.tests 
b/test/shaping/data/text-rendering-tests/tests/MORX-8.tests
new file mode 100644
index 00000000..aa0d28b5
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/tests/MORX-8.tests
@@ -0,0 +1,3 @@
+../fonts/TestMORXEight.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0030,U+0041,U+0042,U+0043:[zero|A@914,0|B@1552,0|C@2202,0]
+../fonts/TestMORXEight.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0031,U+0041,U+0042,U+0043:[one|B@914,0|C@1564,0|A@2196,0]
+../fonts/TestMORXEight.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0032,U+0041,U+0042,U+0043:[two|C@914,0|A@1546,0|B@2184,0]
diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-9.tests 
b/test/shaping/data/text-rendering-tests/tests/MORX-9.tests
new file mode 100644
index 00000000..a8999087
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/tests/MORX-9.tests
@@ -0,0 +1 @@
+../fonts/TestMORXNine.ttf:--font-size=1000 --ned --remove-default-ignorables 
--font-funcs=ft:U+0041,U+0042,U+0058,U+0041,U+0042:[B|A@650,0|X@1288,0|A@1874,0|B@2512,0]
diff --git a/test/shaping/data/text-rendering-tests/update.sh 
b/test/shaping/data/text-rendering-tests/update.sh
new file mode 100755
index 00000000..31960a14
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/update.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+dir=`dirname "$0"`
+
+set -ex
+if test -d text-rendering-tests; then
+       cd text-rendering-tests
+       git pull
+       cd ..
+else
+       git clone https://github.com/unicode-org/text-rendering-tests
+fi
+
+test -d fonts && git rm -rf fonts
+test -d fonts && (echo "fonts/ dir not empty; investigate."; false)
+cp -a text-rendering-tests/fonts .
+git add fonts
+
+rmdir tests || true
+test -d tests && git rm -rf tests || true
+test -d tests && (echo "tests/ dir not empty; investigate."; false)
+mkdir tests
+
+echo "NULL =" > Makefile.sources
+echo > Makefile.sources
+echo "TESTS = \\" > Makefile.sources
+
+DISABLED="DISBALED_TESTS = \\"
+for x in text-rendering-tests/testcases/*.html; do
+       test "x$x" = xtext-rendering-tests/testcases/index.html && continue
+       out=tests/`basename "$x" .html`.tests
+       "$dir"/extract-tests.py < "$x" > "$out"
+       if grep -q "^$out$" DISABLED; then
+               DISABLED="$DISABLED
+       $out \\"
+       else
+               echo "  $out \\" >> Makefile.sources
+       fi
+done
+git add tests
+
+echo ' $(NULL)' >> Makefile.sources
+echo >> Makefile.sources
+echo "$DISABLED" >> Makefile.sources
+echo ' $(NULL)' >> Makefile.sources
+git add Makefile.sources
+
+git commit -e -m "[test/text-rendering-tests] Update from upstream"
commit c861daacc4255d41d2358868b917277422949dc9
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Thu Jan 11 10:11:01 2018 +0100

    [test/text-rendering-tests] Add README and COPYING

diff --git a/test/shaping/data/text-rendering-tests/COPYING 
b/test/shaping/data/text-rendering-tests/COPYING
new file mode 100644
index 00000000..7758b2e5
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/COPYING
@@ -0,0 +1,13 @@
+Copyright 2016 Unicode Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the “License”);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an “AS IS” BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/test/shaping/data/text-rendering-tests/Makefile.am 
b/test/shaping/data/text-rendering-tests/Makefile.am
index 385270a2..56247b7b 100644
--- a/test/shaping/data/text-rendering-tests/Makefile.am
+++ b/test/shaping/data/text-rendering-tests/Makefile.am
@@ -7,6 +7,8 @@ lib:
        @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
 
 EXTRA_DIST = \
+       README \
+       COPYING \
        extract-tests.py \
        fonts \
        $(TESTS) \
diff --git a/test/shaping/data/text-rendering-tests/README 
b/test/shaping/data/text-rendering-tests/README
new file mode 100644
index 00000000..351f8301
--- /dev/null
+++ b/test/shaping/data/text-rendering-tests/README
@@ -0,0 +1,4 @@
+Tests in this directory are automatically imported from the
+text-rendering-tests repository owned by Unicode Consortium:
+
+  https://github.com/unicode-org/text-rendering-tests
commit 14b4d84eef18bd54287c10ce44eaef4f642f6238
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Thu Jan 11 10:08:25 2018 +0100

    [aat] Fix RearrangementSubtable action

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 76c9a608..cbc69d26 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -121,7 +121,7 @@ struct RearrangementSubtable
          memcpy (buf + 2, info + end - r, r * sizeof (buf[0]));
 
          if (l != r)
-           memmove (info + start + r - l, info + start + l, (end - start - l - 
r) * sizeof (buf[0]));
+           memmove (info + start + r, info + start + l, (end - start - l - r) 
* sizeof (buf[0]));
 
          memcpy (info + start, buf + 2, r * sizeof (buf[0]));
          memcpy (info + end - l, buf, l * sizeof (buf[0]));
commit ea3e86c6401d41cf54d82692eccbf44c87be2fd5
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Thu Jan 11 09:58:42 2018 +0100

    Minor

diff --git a/test/shaping/data/Makefile.am b/test/shaping/data/Makefile.am
index e76b3b87..4f2c1136 100644
--- a/test/shaping/data/Makefile.am
+++ b/test/shaping/data/Makefile.am
@@ -6,4 +6,8 @@ SUBDIRS = \
        text-rendering-tests \
        $(NULL)
 
+# Convenience targets:
+lib:
+       @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
+
 -include $(top_srcdir)/git.mk
diff --git a/test/shaping/data/in-house/Makefile.am 
b/test/shaping/data/in-house/Makefile.am
index a9893a89..2f955191 100644
--- a/test/shaping/data/in-house/Makefile.am
+++ b/test/shaping/data/in-house/Makefile.am
@@ -2,6 +2,10 @@
 
 NULL =
 
+# Convenience targets:
+lib:
+       @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
+
 EXTRA_DIST = \
        COPYING \
        fonts \
diff --git a/test/shaping/data/text-rendering-tests/Makefile.am 
b/test/shaping/data/text-rendering-tests/Makefile.am
index 2798e512..385270a2 100644
--- a/test/shaping/data/text-rendering-tests/Makefile.am
+++ b/test/shaping/data/text-rendering-tests/Makefile.am
@@ -2,6 +2,10 @@
 
 NULL =
 
+# Convenience targets:
+lib:
+       @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
+
 EXTRA_DIST = \
        extract-tests.py \
        fonts \
commit 800e4ae80232f022404be155afd497b0421a6a64
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Thu Jan 11 09:57:55 2018 +0100

    [aat] Mark state-machine-based lookup as completely unsafe-to-break
    
    To be improved later.

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index f4e5cccc..76c9a608 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -63,6 +63,8 @@ struct RearrangementSubtable
     hb_glyph_info_t *info = c->buffer->info;
     unsigned int count = c->buffer->len;
 
+    c->buffer->unsafe_to_break (0, count); /* TODO Improve. */
+
     for (unsigned int i = 0; i < count; i++)
     {
       unsigned int klass = machine.get_class (info[i].codepoint, num_glyphs);
commit ca42d961293a9e4dfd0817c1a02d454008583282
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Thu Jan 11 09:15:34 2018 +0100

    [aat] Implement RearrangementSubtable

diff --git a/src/hb-aat-layout-common-private.hh 
b/src/hb-aat-layout-common-private.hh
index 4b96ee6c..32ba6326 100644
--- a/src/hb-aat-layout-common-private.hh
+++ b/src/hb-aat-layout-common-private.hh
@@ -164,7 +164,7 @@ struct UnsizedArrayOf
     return_trace (c->check_array (arrayZ, arrayZ[0].static_size, count));
   }
 
-  protected:
+  public:
   Type arrayZ[VAR];
   public:
   DEFINE_SIZE_ARRAY (0, arrayZ);
@@ -221,7 +221,7 @@ struct LookupSegmentSingle
   GlyphID      first;          /* First GlyphID in this segment */
   T            value;          /* The lookup value (only one) */
   public:
-  DEFINE_SIZE_STATIC (4 + sizeof (T));
+  DEFINE_SIZE_STATIC (4 + T::static_size);
 };
 
 template <typename T>
@@ -323,7 +323,7 @@ struct LookupSingle
   GlyphID      glyph;          /* Last GlyphID */
   T            value;          /* The lookup value (only one) */
   public:
-  DEFINE_SIZE_STATIC (4 + sizeof (T));
+  DEFINE_SIZE_STATIC (4 + T::static_size);
 };
 
 template <typename T>
@@ -424,7 +424,7 @@ struct Lookup
 };
 
 
-struct Class
+struct ClassTable
 {
   inline unsigned int get_class (hb_codepoint_t glyph_id) const
   {
@@ -448,6 +448,87 @@ struct Class
   DEFINE_SIZE_ARRAY (4, classArrayZ);
 };
 
+
+/*
+ * (Extended) State Table
+ */
+
+template <typename T>
+struct Entry
+{
+  inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this) && data.sanitize (c));
+  }
+
+  public:
+  HBUINT16     newState;       /* Byte offset from beginning of state table to 
the new state. */
+  HBUINT16     flags;          /* Table specific. */
+  T            data;           /* Optional offsets to per-glyph tables. */
+  public:
+  DEFINE_SIZE_STATIC (4 + T::static_size);
+};
+
+template <>
+struct Entry<void>
+{
+  inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this));
+  }
+
+  public:
+  HBUINT16     newState;       /* Byte offset from beginning of state table to 
the new state. */
+  HBUINT16     flags;          /* Table specific. */
+  public:
+  DEFINE_SIZE_STATIC (4);
+};
+
+template <typename Types, typename Extra>
+struct StateTable
+{
+  typedef typename Types::HBUINT HBUINT;
+  typedef typename Types::HBUSHORT HBUSHORT;
+  typedef typename Types::ClassType ClassType;
+
+  inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int 
num_glyphs) const
+  { return (this+classTable).get_class (glyph_id, num_glyphs); }
+
+
+  inline const Entry<Extra> *get_entry (unsigned int state, unsigned int 
klass) const
+  {
+    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
+    const Entry<Extra> *entries = (this+entryTable).arrayZ;
+
+    unsigned int entry = states[state * nClasses + klass]; /* XXX bound check. 
*/
+
+    return &entries[entry]; /* XXX bound check. */
+  }
+
+  inline bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) 
const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (true);
+    return_trace (c->check_struct (this)); /* XXX */
+  }
+
+  protected:
+  HBUINT       nClasses;       /* Number of classes, which is the number of 
indices
+                                * in a single line in the state array. */
+  OffsetTo<ClassType, HBUINT>
+               classTable;     /* Offset to the class table. */
+  OffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT>
+               stateArrayTable;/* Offset to the state array. */
+  OffsetTo<UnsizedArrayOf<Entry<Extra> >, HBUINT>
+               entryTable;     /* Offset to the entry array. */
+
+  public:
+  DEFINE_SIZE_UNION (2, format);
+};
+
+
 } /* namespace AAT */
 
 
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index e7eac2b2..f4e5cccc 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -39,21 +39,124 @@ namespace AAT {
 using namespace OT;
 
 
+template <typename Types>
 struct RearrangementSubtable
 {
+  enum {
+    MarkFirst  = 0x8000,
+    DontAdvance        = 0x4000,
+    MarkLast   = 0x2000,
+    Verb       = 0x000F,
+  };
+
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY (this);
-    /* TODO */
-    return_trace (false);
+
+    bool ret = false;
+    unsigned int num_glyphs = c->face->get_num_glyphs ();
+
+    unsigned int state = 0;
+    unsigned int start = 0;
+    unsigned int end = 0;
+
+    hb_glyph_info_t *info = c->buffer->info;
+    unsigned int count = c->buffer->len;
+
+    for (unsigned int i = 0; i < count; i++)
+    {
+      unsigned int klass = machine.get_class (info[i].codepoint, num_glyphs);
+      const Entry<void> *entry = machine.get_entry (state, klass);
+      if (unlikely (!entry))
+        break;
+
+      unsigned int flags = entry->flags;
+
+      if (flags & MarkFirst)
+       start = i;
+
+      if (flags & MarkLast)
+       end = i + 1;
+
+      if ((flags & Verb) && start < end)
+      {
+       /* The following map has two nibbles, for start-side
+        * and end-side. Values of 0,1,2 mean move that many
+        * to the other side. Value of 3 means move 2 and
+        * flip them. */
+       static const unsigned char map[16] =
+       {
+         0x00, /* 0    no change */
+         0x10, /* 1    Ax => xA */
+         0x01, /* 2    xD => Dx */
+         0x11, /* 3    AxD => DxA */
+         0x20, /* 4    ABx => xAB */
+         0x30, /* 5    ABx => xBA */
+         0x02, /* 6    xCD => CDx */
+         0x03, /* 7    xCD => DCx */
+         0x12, /* 8    AxCD => CDxA */
+         0x13, /* 9    AxCD => DCxA */
+         0x21, /* 10   ABxD => DxAB */
+         0x31, /* 11   ABxD => DxBA */
+         0x22, /* 12   ABxCD => CDxAB */
+         0x32, /* 13   ABxCD => CDxBA */
+         0x23, /* 14   ABxCD => DCxAB */
+         0x33, /* 15   ABxCD => DCxBA */
+       };
+
+       unsigned int m = map[flags & Verb];
+       unsigned int l = MIN<unsigned int> (2, m >> 4);
+       unsigned int r = MIN<unsigned int> (2, m & 0x0F);
+       bool reverse_l = 3 == (m >> 4);
+       bool reverse_r = 3 == (m & 0x0F);
+
+       if (end - start >= l + r)
+       {
+         c->buffer->merge_clusters (start, end);
+
+         hb_glyph_info_t buf[4];
+         memcpy (buf, info + start, l * sizeof (buf[0]));
+         memcpy (buf + 2, info + end - r, r * sizeof (buf[0]));
+
+         if (l != r)
+           memmove (info + start + r - l, info + start + l, (end - start - l - 
r) * sizeof (buf[0]));
+
+         memcpy (info + start, buf + 2, r * sizeof (buf[0]));
+         memcpy (info + end - l, buf, l * sizeof (buf[0]));
+         if (reverse_l)
+         {
+           buf[0] = info[end - 1];
+           info[end - 1] = info[end - 2];
+           info[end - 2] = buf[0];
+         }
+         if (reverse_r)
+         {
+           buf[0] = info[start];
+           info[start] = info[start + 1];
+           info[start + 1] = buf[0];
+         }
+       }
+      }
+
+      if (false/* XXX*/ && flags & DontAdvance)
+        i--; /* XXX Detect infinite loop. */
+
+      state = entry->newState;
+    }
+
+    return_trace (ret);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    /* TODO */
-    return_trace (false);
+    return_trace (machine.sanitize (c, 0/*XXX*/));
   }
+
+  protected:
+  StateTable<Types, void>      machine;
+  public:
+  DEFINE_SIZE_MIN (2);
 };
 
 struct ContextualSubtable
@@ -95,11 +198,12 @@ struct NoncontextualSubtable
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY (this);
-    hb_buffer_t *buffer = c->buffer;
-    hb_glyph_info_t *info = buffer->info;
-    unsigned int num_glyphs = c->face->get_num_glyphs ();
+
     bool ret = false;
-    unsigned int count = buffer->len;
+    unsigned int num_glyphs = c->face->get_num_glyphs ();
+
+    hb_glyph_info_t *info = c->buffer->info;
+    unsigned int count = c->buffer->len;
     for (unsigned int i = 0; i < count; i++)
     {
       const GlyphID *replacement = substitute.get_value (info[i].codepoint, 
num_glyphs);
@@ -109,6 +213,7 @@ struct NoncontextualSubtable
        ret = true;
       }
     }
+
     return_trace (ret);
   }
 
@@ -163,11 +268,13 @@ struct Feature
 };
 
 
-template <typename HBUINT>
+template <typename Types>
 struct ChainSubtable
 {
   template <typename> struct Chain;
-  friend struct Chain<HBUINT>;
+  friend struct Chain<Types>;
+
+  typedef typename Types::HBUINT HBUINT;
 
   inline unsigned int get_size (void) const { return length; }
   inline unsigned int get_type (void) const { return coverage & 0xFF; }
@@ -214,9 +321,10 @@ struct ChainSubtable
   protected:
   HBUINT               length;         /* Total subtable length, including 
this header. */
   HBUINT               coverage;       /* Coverage flags and subtable type. */
-  HBUINT32     subFeatureFlags;/* The 32-bit mask identifying which subtable 
this is. */
+  HBUINT32             subFeatureFlags;/* The 32-bit mask identifying which 
subtable this is. */
   union {
-  RearrangementSubtable        rearrangement;
+  RearrangementSubtable<Types>
+                       rearrangement;
   ContextualSubtable   contextual;
   LigatureSubtable     ligature;
   NoncontextualSubtable        noncontextual;
@@ -226,17 +334,19 @@ struct ChainSubtable
   DEFINE_SIZE_MIN (2 * sizeof (HBUINT) + 4);
 };
 
-template <typename HBUINT>
+template <typename Types>
 struct Chain
 {
+  typedef typename Types::HBUINT HBUINT;
+
   inline void apply (hb_apply_context_t *c) const
   {
-    const ChainSubtable<HBUINT> *subtable = 
&StructAtOffset<ChainSubtable<HBUINT> > (featureZ, featureZ[0].static_size * 
featureCount);
+    const ChainSubtable<Types> *subtable = 
&StructAtOffset<ChainSubtable<Types> > (featureZ, featureZ[0].static_size * 
featureCount);
     unsigned int count = subtableCount;
     for (unsigned int i = 0; i < count; i++)
     {
       subtable->apply (c);
-      subtable = &StructAfter<ChainSubtable<HBUINT> > (*subtable);
+      subtable = &StructAfter<ChainSubtable<Types> > (*subtable);
     }
   }
 
@@ -253,13 +363,13 @@ struct Chain
     if (!c->check_array (featureZ, featureZ[0].static_size, featureCount))
       return_trace (false);
 
-    const ChainSubtable<HBUINT> *subtable = 
&StructAtOffset<ChainSubtable<HBUINT> > (featureZ, featureZ[0].static_size * 
featureCount);
+    const ChainSubtable<Types> *subtable = 
&StructAtOffset<ChainSubtable<Types> > (featureZ, featureZ[0].static_size * 
featureCount);
     unsigned int count = subtableCount;
     for (unsigned int i = 0; i < count; i++)
     {
       if (!subtable->sanitize (c))
        return_trace (false);
-      subtable = &StructAfter<ChainSubtable<HBUINT> > (*subtable);
+      subtable = &StructAfter<ChainSubtable<Types> > (*subtable);
     }
 
     return_trace (true);
@@ -272,7 +382,7 @@ struct Chain
   HBUINT               subtableCount;  /* The number of subtables in the 
chain. */
 
   Feature              featureZ[VAR];  /* Features. */
-  ChainSubtable<HBUINT>        subtableX[VAR]; /* Subtables. */
+  ChainSubtable<Types> subtableX[VAR]; /* Subtables. */
   // subtableGlyphCoverageArray if major == 3
 
   public:
@@ -284,20 +394,22 @@ struct Chain
  * The 'mort'/'morx' Tables
  */
 
-template <typename HBUINT>
+template <typename Types>
 struct mortmorx
 {
   static const hb_tag_t mortTag        = HB_AAT_TAG_MORT;
   static const hb_tag_t morxTag        = HB_AAT_TAG_MORX;
 
+  typedef typename Types::HBUINT HBUINT;
+
   inline void apply (hb_apply_context_t *c) const
   {
-    const Chain<HBUINT> *chain = chains;
+    const Chain<Types> *chain = chains;
     unsigned int count = chainCount;
     for (unsigned int i = 0; i < count; i++)
     {
       chain->apply (c);
-      chain = &StructAfter<Chain<HBUINT> > (*chain);
+      chain = &StructAfter<Chain<Types> > (*chain);
     }
   }
 
@@ -305,17 +417,17 @@ struct mortmorx
   {
     TRACE_SANITIZE (this);
     if (!version.sanitize (c) ||
-       version.major >> (sizeof (HBUINT) == 4) != 1 ||
+       (version.major >> (sizeof (HBUINT) == 4 ? 1 : 0)) != 1 ||
        !chainCount.sanitize (c))
       return_trace (false);
 
-    const Chain<HBUINT> *chain = chains;
+    const Chain<Types> *chain = chains;
     unsigned int count = chainCount;
     for (unsigned int i = 0; i < count; i++)
     {
       if (!chain->sanitize (c, version.major))
        return_trace (false);
-      chain = &StructAfter<Chain<HBUINT> > (*chain);
+      chain = &StructAfter<Chain<Types> > (*chain);
     }
 
     return_trace (true);
@@ -326,18 +438,44 @@ struct mortmorx
                                 * 1 for mort, 2 or 3 for morx. */
   HBUINT32     chainCount;     /* Number of metamorphosis chains contained in 
this
                                 * table. */
-  Chain<HBUINT>        chains[VAR];    /* Chains. */
+  Chain<Types> chains[VAR];    /* Chains. */
 
   public:
   DEFINE_SIZE_MIN (8);
 };
 
-struct mort : mortmorx<HBUINT16>
+struct MorxTypes
+{
+  typedef HBUINT32 HBUINT;
+  typedef HBUINT16 HBUSHORT;
+  struct ClassType : Lookup<HBUINT16>
+  {
+    inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int 
num_glyphs) const
+    {
+      const HBUINT16 *v = get_value (glyph_id, num_glyphs);
+      return v ? *v : 1;
+    }
+  };
+};
+struct MortTypes
+{
+  typedef HBUINT16 HBUINT;
+  typedef HBUINT8 HBUSHORT;
+  struct ClassType : ClassTable
+  {
+    inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int 
num_glyphs HB_UNUSED) const
+    {
+      return ClassTable::get_class (glyph_id);
+    }
+  };
+};
+
+struct mort : mortmorx<MortTypes>
 {
   static const hb_tag_t tableTag       = HB_AAT_TAG_MORT;
 };
 
-struct morx : mortmorx<HBUINT32>
+struct morx : mortmorx<MorxTypes>
 {
   static const hb_tag_t tableTag       = HB_AAT_TAG_MORX;
 };
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 29bf7ba2..6d8bc6cb 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -527,8 +527,6 @@ struct Supplier
 };
 
 
-
-
 /*
  *
  * The OpenType Font File: Data Types
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 9cad5685..62c9fb27 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -298,9 +298,10 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
 
 /* Misc */
 
-/* Void! */
-struct _hb_void_t {};
-typedef const _hb_void_t *hb_void_t;
+/*
+ * Void!
+ */
+typedef const struct _hb_void_t *hb_void_t;
 #define HB_VOID ((const _hb_void_t *) nullptr)
 
 /* Return the number of 1 bits in mask. */
commit 5dbbd0fdb9a343554112a846b392803f11c13197
Author: Ebrahim Byagowi <ebra...@gnu.org>
Date:   Thu Jan 11 12:33:22 2018 +0330

    Move the #define of _GNU_SOURCE to the top of hb-private.hh (#697)
    
    This fixes the build on Cygwin.

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 9a1f2c51..9cad5685 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -29,6 +29,8 @@
 #ifndef HB_PRIVATE_HH
 #define HB_PRIVATE_HH
 
+#define _GNU_SOURCE 1
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -87,8 +89,6 @@ extern "C" void  hb_free_impl(void *ptr);
 
 #endif // __cplusplus < 201103L
 
-#define _GNU_SOURCE 1
-
 #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
 #define likely(expr) (__builtin_expect (!!(expr), 1))
 #define unlikely(expr) (__builtin_expect (!!(expr), 0))
commit 90e3c9e69e93e05d9fb534fd43b5c99cf58a7cb4
Author: Ebrahim Byagowi <ebra...@gnu.org>
Date:   Thu Jan 11 12:31:05 2018 +0330

    [cmake] Fix hb-blob test (#699)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e45c5bc0..4d52668b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,10 +107,10 @@ check_include_file(unistd.h HAVE_UNIST_H)
 if (${HAVE_UNIST_H})
   add_definitions(-DHAVE_UNIST_H)
 endif ()
-check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
-if (${HAVE_SYS_MMAN_H})
-  add_definitions(-DHAVE_SYS_MMAN_H)
-endif ()
+#check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
+#if (${HAVE_SYS_MMAN_H})
+#  add_definitions(-DHAVE_SYS_MMAN_H)
+#endif ()
 check_include_file(xlocale.h HAVE_XLOCALE_H)
 if (${HAVE_XLOCALE_H})
   add_definitions(-DHAVE_XLOCALE_H)
commit 1461965c2220cd957c26b3fe5835200e426bc715
Author: Ebrahim Byagowi <ebra...@gnu.org>
Date:   Thu Jan 11 08:48:22 2018 +0330

    [test] Better tests output by converting stderr to stdout (#696)
    
    https://gitlab.kitware.com/cmake/cmake/issues/17630

diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index 36ec0657..c65e7142 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -8,8 +8,8 @@ def cmd(command):
        p = subprocess.Popen (
                command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        p.wait ()
-       print (p.stderr.read (), file=sys.stderr, end='')
-       return p.stdout.read ().decode ("utf-8").strip(), p.returncode
+       print (p.stderr.read (), end="") # file=sys.stderr
+       return p.stdout.read ().decode ("utf-8").strip (), p.returncode
 
 
 args = sys.argv[1:]
@@ -61,7 +61,7 @@ for filename in args:
                        unicodes] + (options.split (' ') if options else []))
 
                if returncode:
-                       print ("hb-shape --font-funcs=ft failed.")
+                       print ("hb-shape --font-funcs=ft failed.") # 
file=sys.stderr
                        fails = fails + 1
                        #continue
 
@@ -70,13 +70,13 @@ for filename in args:
                        unicodes] + (options.split (' ') if options else []))
 
                if returncode:
-                       print ("ERROR: hb-shape --font-funcs=ot failed.")
+                       print ("ERROR: hb-shape --font-funcs=ot failed.") # 
file=sys.stderr
                        fails = fails + 1
                        #continue
 
                if glyphs1 != glyphs2:
-                       print ("FT funcs: " + glyphs1)
-                       print ("OT funcs: " + glyphs2)
+                       print ("FT funcs: " + glyphs1) # file=sys.stderr
+                       print ("OT funcs: " + glyphs2) # file=sys.stderr
                        fails = fails + 1
 
                if reference:
@@ -84,13 +84,13 @@ for filename in args:
                        continue
 
                if glyphs1.strip() != glyphs_expected.strip():
-                       print ("Actual:   " + glyphs1, file=sys.stderr)
-                       print ("Expected: " + glyphs_expected, file=sys.stderr)
+                       print ("Actual:   " + glyphs1) # file=sys.stderr
+                       print ("Expected: " + glyphs_expected) # file=sys.stderr
                        fails = fails + 1
 
 if fails != 0:
        if not reference:
-               print (str (fails) + " tests failed.")
+               print (str (fails) + " tests failed.") # file=sys.stderr
        sys.exit (1)
 
 else:
commit ebb9b7d6335536804b50002fb83dd30da42a8ad5
Author: Ebrahim Byagowi <ebra...@gnu.org>
Date:   Thu Jan 11 08:15:06 2018 +0330

    [test] Print shaping output on CI fails (#695)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 43ddc4ac..874c587d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -46,7 +46,7 @@ jobs:
       - run: apt update && apt install -y pkg-config ragel gtk-doc-tools 
libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
       - run: cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GRAPHITE2=ON 
-DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_ICU=ON -DHB_BUILD_UTILS=ON 
-Bbuild -H. -GNinja
       - run: ninja -Cbuild
-      - run: ninja -Cbuild test
+      - run: CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test
       - run: ninja -Cbuild install
 
   cmake-oracledeveloperstudio:
@@ -58,7 +58,7 @@ jobs:
       - run: wget 
http://$ODSUSER:$odsp...@behdad.org/harfbuzz-private/OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2
 && tar xf OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 --owner root --group 
root --no-same-owner
       - run: 
CC=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/suncc
 
CXX=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/sunCC
 cmake -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON 
-DHB_HAVE_ICU=ON -DHB_HAVE_FREETYPE=ON -Bbuild -H.
       - run: make -Cbuild
-      - run: make -Cbuild test
+      - run: CTEST_OUTPUT_ON_FAILURE=1 make -Cbuild test
       - run: make -Cbuild install
 
   crosscompile-notest-djgpp:
diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index b3f5ffcd..36ec0657 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -61,7 +61,7 @@ for filename in args:
                        unicodes] + (options.split (' ') if options else []))
 
                if returncode:
-                       print ("hb-shape --font-funcs=ft failed.", 
file=sys.stderr)
+                       print ("hb-shape --font-funcs=ft failed.")
                        fails = fails + 1
                        #continue
 
@@ -70,13 +70,13 @@ for filename in args:
                        unicodes] + (options.split (' ') if options else []))
 
                if returncode:
-                       print ("ERROR: hb-shape --font-funcs=ot failed.", 
file=sys.stderr)
+                       print ("ERROR: hb-shape --font-funcs=ot failed.")
                        fails = fails + 1
                        #continue
 
                if glyphs1 != glyphs2:
-                       print ("FT funcs: " + glyphs1, file=sys.stderr)
-                       print ("OT funcs: " + glyphs2, file=sys.stderr)
+                       print ("FT funcs: " + glyphs1)
+                       print ("OT funcs: " + glyphs2)
                        fails = fails + 1
 
                if reference:
commit e24bea8e91ba9f447f1f7f252bdefacef1f83593
Author: Ebrahim Byagowi <ebra...@gnu.org>
Date:   Wed Jan 10 23:51:56 2018 +0330

    [cmake] Another try on making sure feature testing is working (#691)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8c02624e..43ddc4ac 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,26 +2,23 @@ version: 2
 
 jobs:
 
-  oracledeveloperstudio:
+  distcheck:
     docker:
-      - image: fedora
+      - image: dockcross/base
     steps:
       - checkout
-      - run: dnf install -y gcc ragel cmake make which glib2-devel 
freetype-devel cairo-devel libicu-devel graphite2-devel wget tar bzip2 python 
|| true
-      - run: wget 
http://$ODSUSER:$odsp...@behdad.org/harfbuzz-private/OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2
 && tar xf OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 --owner root --group 
root --no-same-owner
-      - run: 
CC=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/suncc
 
CXX=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/sunCC
 cmake -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON 
-DHB_HAVE_ICU=ON -DHB_HAVE_FREETYPE=ON -Bbuild -H.
-      - run: make -Cbuild
-      - run: make -Cbuild test
-      - run: make -Cbuild install
+      - run: apt update && apt install -y pkg-config ragel gtk-doc-tools 
libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
+      - run: ./autogen.sh && make distcheck
+      - run: make distdir && cd harfbuzz-* && cmake -DDHB_CHECK=ON -Bbuild -H. 
-GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && 
ninja -Cbuild install
 
-  fedora-out-of-tree:
+  alpine:
     docker:
-      - image: fedora
+      - image: alpine
     steps:
       - checkout
-      - run: dnf install -y pkg-config ragel gcc gcc-c++ automake autoconf 
libtool make which glib2-devel freetype-devel cairo-devel libicu-devel 
gobject-introspection-devel graphite2-devel redhat-rpm-config || true
-      - run: NOCONFIGURE=1 ./autogen.sh --with-freetype --with-glib 
--with-gobject --with-cairo --with-icu --with-graphite2
-      - run: mkdir build && cd build && ../configure && make && make check
+      - run: apk update && apk add ragel make pkgconfig libtool autoconf 
automake gettext gcc g++ glib-dev freetype-dev cairo-dev
+      - run: ./autogen.sh
+      - run: make && make check
 
   archlinux:
     docker:
@@ -32,16 +29,16 @@ jobs:
       - run: ./autogen.sh --with-freetype --with-glib --with-gobject 
--with-cairo --with-icu --with-graphite2
       - run: make && make check
 
-  freebsd9:
+  fedora-outoftreebuild:
     docker:
-      - image: donbowman/freebsd-cross-build
+      - image: fedora
     steps:
       - checkout
-      - run: apt update && apt install -y pkg-config ragel
-      - run: ./autogen.sh --prefix=/freebsd --host=x86_64-pc-freebsd9
-      - run: make
+      - run: dnf install -y pkg-config ragel gcc gcc-c++ automake autoconf 
libtool make which glib2-devel freetype-devel cairo-devel libicu-devel 
gobject-introspection-devel graphite2-devel redhat-rpm-config || true
+      - run: NOCONFIGURE=1 ./autogen.sh --with-freetype --with-glib 
--with-gobject --with-cairo --with-icu --with-graphite2
+      - run: mkdir build && cd build && ../configure && make && make check
 
-  base:
+  cmake-gcc:
     docker:
       - image: dockcross/base
     steps:
@@ -52,16 +49,37 @@ jobs:
       - run: ninja -Cbuild test
       - run: ninja -Cbuild install
 
-  distcheck:
+  cmake-oracledeveloperstudio:
     docker:
-      - image: dockcross/base
+      - image: fedora
     steps:
       - checkout
-      - run: apt update && apt install -y pkg-config ragel gtk-doc-tools 
libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
-      - run: ./autogen.sh && make distcheck
-      - run: make distdir && cd harfbuzz-* && cmake -DDHB_CHECK=ON -Bbuild -H. 
-GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && 
ninja -Cbuild install
+      - run: dnf install -y gcc ragel cmake make which glib2-devel 
freetype-devel cairo-devel libicu-devel graphite2-devel wget tar bzip2 python 
|| true
+      - run: wget 
http://$ODSUSER:$odsp...@behdad.org/harfbuzz-private/OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2
 && tar xf OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 --owner root --group 
root --no-same-owner
+      - run: 
CC=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/suncc
 
CXX=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/sunCC
 cmake -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON 
-DHB_HAVE_ICU=ON -DHB_HAVE_FREETYPE=ON -Bbuild -H.
+      - run: make -Cbuild
+      - run: make -Cbuild test
+      - run: make -Cbuild install
+
+  crosscompile-notest-djgpp:
+    docker:
+      - image: quay.io/ebraminio/djgpp
+    steps:
+      - checkout
+      - run: apt update && apt install -y ragel pkg-config libtool autoconf
+      - run: CFLAGS="-Wno-attributes" CXXFLAGS="-Wno-attributes" ./autogen.sh 
--prefix=/usr/local/djgpp --host=i586-pc-msdosdjgpp
+      - run: make
 
-  psvita:
+  crosscompile-notest-freebsd9:
+    docker:
+      - image: donbowman/freebsd-cross-build
+    steps:
+      - checkout
+      - run: apt update && apt install -y pkg-config ragel
+      - run: ./autogen.sh --prefix=/freebsd --host=x86_64-pc-freebsd9
+      - run: make
+
+  crosscompile-notest-psvita:
     docker:
       - image: dockcross/base
     steps:
@@ -71,7 +89,7 @@ jobs:
       - run: ./autogen.sh --prefix=/usr/local/vitasdk/arm-vita-eabi 
--host=arm-vita-eabi
       - run: make
 
-  android-arm:
+  crosscompile-cmake-notest-android-arm:
     docker:
       - image: dockcross/android-arm
     steps:
@@ -80,7 +98,7 @@ jobs:
       - run: cmake -Bbuild -H. -GNinja
       - run: ninja -Cbuild
 
-  browser-asmjs:
+  crosscompile-cmake-notest-browser-asmjs:
     docker:
       - image: dockcross/browser-asmjs
     steps:
@@ -89,7 +107,7 @@ jobs:
       - run: cmake -Bbuild -H. -GNinja
       - run: ninja -Cbuild
 
-  linux-arm64:
+  crosscompile-cmake-notest-linux-arm64:
     docker:
       - image: dockcross/linux-arm64
     steps:
@@ -98,7 +116,7 @@ jobs:
       - run: cmake -Bbuild -H. -GNinja
       - run: ninja -Cbuild
 
-  linux-mips:
+  crosscompile-cmake-notest-linux-mips:
     docker:
       - image: dockcross/linux-mips
     steps:
@@ -107,7 +125,7 @@ jobs:
       - run: cmake -Bbuild -H. -GNinja
       - run: ninja -Cbuild
 
-  windows-x64:
+  crosscompile-cmake-notest-windows-x64:
     docker:
       - image: dockcross/windows-x64
     steps:
@@ -116,39 +134,32 @@ jobs:
       - run: cmake -Bbuild -H. -GNinja
       - run: ninja -Cbuild
 
-  alpine:
-    docker:
-      - image: alpine
-    steps:
-      - checkout
-      - run: apk update && apk add ragel make pkgconfig libtool autoconf 
automake gettext gcc g++ glib-dev freetype-dev cairo-dev
-      - run: ./autogen.sh
-      - run: make && make check
-
-  dos:
-    docker:
-      - image: quay.io/ebraminio/djgpp
-    steps:
-      - checkout
-      - run: apt update && apt install -y ragel pkg-config libtool autoconf
-      - run: CFLAGS="-Wno-attributes" CXXFLAGS="-Wno-attributes" ./autogen.sh 
--prefix=/usr/local/djgpp --host=i586-pc-msdosdjgpp
-      - run: make
-
 workflows:
   version: 2
   build:
     jobs:
-      #- oracledeveloperstudio
-      #- fedora-out-of-tree
-      - archlinux
-      - freebsd9
-      - base
+      # both autotools and cmake
       - distcheck
-      - psvita
-      - android-arm
-      - browser-asmjs
-      - linux-arm64
-      - linux-mips
-      - windows-x64
+
+      # autotools based builds
       - alpine
-      - dos
+      - archlinux
+      - fedora-outoftreebuild
+
+      # cmake based builds
+      - cmake-gcc
+      - cmake-oracledeveloperstudio
+
+      # crosscompiles
+      # they can't be test thus are without tests
+      ## autotools
+      - crosscompile-notest-djgpp
+      - crosscompile-notest-freebsd9
+      - crosscompile-notest-psvita
+
+      ## cmake
+      - crosscompile-cmake-notest-android-arm
+      - crosscompile-cmake-notest-browser-asmjs
+      - crosscompile-cmake-notest-linux-arm64
+      - crosscompile-cmake-notest-linux-mips
+      - crosscompile-cmake-notest-windows-x64
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2599b54..e45c5bc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,24 +94,23 @@ include (CheckFunctionExists)
 include (CheckIncludeFile)
 macro (check_funcs) # Similar to AC_CHECK_FUNCS of autotools
   foreach (func_name ${ARGN})
-    set (RESULT OFF)
-    check_function_exists(${func_name} RESULT)
-    if (${RESULT})
-      string(TOUPPER ${func_name} definiton_to_add)
+    string(TOUPPER ${func_name} definiton_to_add)
+    check_function_exists(${func_name} HAVE_${definiton_to_add})
+    if (${HAVE_${definiton_to_add}})
       add_definitions(-DHAVE_${definiton_to_add})
     endif ()
   endforeach ()
 endmacro ()
-check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
+check_funcs(atexit mprotect sysconf mmap strtod_l) #TODO: getpagesize 
newlocale isatty
 
 check_include_file(unistd.h HAVE_UNIST_H)
 if (${HAVE_UNIST_H})
   add_definitions(-DHAVE_UNIST_H)
 endif ()
-#check_include_file(sys/mman.h HAVE_SYS_MMAN_H) enable this sometime
-#if (${HAVE_SYS_MMAN_H})
-#  add_definitions(-DHAVE_SYS_MMAN_H)
-#endif ()
+check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
+if (${HAVE_SYS_MMAN_H})
+  add_definitions(-DHAVE_SYS_MMAN_H)
+endif ()
 check_include_file(xlocale.h HAVE_XLOCALE_H)
 if (${HAVE_XLOCALE_H})
   add_definitions(-DHAVE_XLOCALE_H)
_______________________________________________
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to