From a96508cfc9bd9013d24b18547fcd9c03e08fe2f2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 12:52:42 -0400 Subject: [PATCH 01/87] [msan] Add MSAN_OPTIONS=exitcode=42 Default exit value is 77, which causes autotools to "skip" test. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7baebb1c8..9721dbb1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,7 +101,7 @@ jobs: - run: pip install fonttools - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - - run: make check || .ci/fail.sh + - run: MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh clang-tsan: docker: From d07f3111b4bc38798e16a2459b80a16d7a9f9ff1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 13:01:35 -0400 Subject: [PATCH 02/87] Link API test programs with C++ linker Needed to make ubsan work. Fixes https://github.com/harfbuzz/harfbuzz/issues/1174 --- test/api/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index a20334498..d92e96694 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -16,6 +16,8 @@ EXTRA_DIST += CMakeLists.txt EXTRA_DIST += fonts +LINK = $(CXXLINK) + if HAVE_GLIB AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS) LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS) From e45ba31dc723988150ef766758fa89fecd50ca03 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 13:04:48 -0400 Subject: [PATCH 03/87] [check-symbols.sh] Allow weak objects "V" ubsan generates these. --- src/check-symbols.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/check-symbols.sh b/src/check-symbols.sh index 6e9382b1a..cea868488 100755 --- a/src/check-symbols.sh +++ b/src/check-symbols.sh @@ -26,7 +26,7 @@ for soname in harfbuzz harfbuzz-subset harfbuzz-icu harfbuzz-gobject; do symprefix= if test $suffix = dylib; then symprefix=_; fi - EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTV] .' | grep -v " $symprefix\\($IGNORED_SYMBOLS\\>\\)" | cut -d' ' -f3 | c++filt`" + EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRST] .' | grep -v " $symprefix\\($IGNORED_SYMBOLS\\>\\)" | cut -d' ' -f3 | c++filt`" prefix=$symprefix`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'` From 4839807340cc73d5ba826dff4b4ba358775a213d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 13:11:34 -0400 Subject: [PATCH 04/87] [check-static-inits.sh] Allow some if ubsan is in effect --- src/check-static-inits.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/check-static-inits.sh b/src/check-static-inits.sh index 71551cbd4..def25c701 100755 --- a/src/check-static-inits.sh +++ b/src/check-static-inits.sh @@ -7,7 +7,6 @@ test -z "$srcdir" && srcdir=. test -z "$libs" && libs=.libs stat=0 - if which objdump 2>/dev/null >/dev/null; then : else @@ -31,7 +30,8 @@ done echo "Checking that no object file has lazy static C++ constructors/destructors or other such stuff" for obj in $OBJS; do - if objdump -t "$obj" | grep '__cxa_'; then + if objdump -t "$obj" | grep -q '__cxa_' && ! objdump -t "$obj" | grep -q __ubsan_handle; then + objdump -t "$obj" | grep '__cxa_' echo "Ouch, $obj has lazy static C++ constructors/destructors or other such stuff" stat=1 fi From aec0d3cbc923a8801c5bd9e9ae05801a31a7260c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 13:12:15 -0400 Subject: [PATCH 05/87] [ubsan] Re-enable now that it passes locally --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9721dbb1e..66489e87c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -251,7 +251,7 @@ workflows: - clang-asan #- clang-msan - clang-tsan - #- clang-ubsan + - clang-ubsan - fedora-outoftreebuild # cmake based builds From 12b8baa7653741ba13a89cd40f1f36b8bac11666 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 17:22:39 -0400 Subject: [PATCH 06/87] [msan] Enable again to get a build log, and try to play with suppressions --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 66489e87c..e5640b51d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -249,7 +249,7 @@ workflows: - archlinux-debug-O0-py3 - clang-O3-O0 - clang-asan - #- clang-msan + - clang-msan - clang-tsan - clang-ubsan - fedora-outoftreebuild From 10203339600e85d6aaffba6034ac250e72fdfc12 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 25 Sep 2018 01:00:32 +0330 Subject: [PATCH 07/87] [circleci] Update sanitizer bots with newer clang and Ubuntu version (#1176) --- .circleci/config.yml | 48 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e5640b51d..74411778a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -81,51 +81,67 @@ jobs: clang-asan: docker: - - image: ubuntu:18.04 + - image: ubuntu:18.10 steps: - checkout + - run: apt update || true; apt install -y wget gnupg + - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list + - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - - run: make check || .ci/fail.sh + - run: make check || .ci/fail.sh | asan_symbolize | c++filt clang-msan: docker: - - image: ubuntu:18.04 + - image: ubuntu:18.10 steps: - checkout + - run: apt update || true; apt install -y wget gnupg + - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list + - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - - run: MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh + - run: MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: - - image: ubuntu:18.04 + - image: ubuntu:18.10 steps: - checkout + - run: apt update || true; apt install -y wget gnupg + - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list + - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - - run: make check || .ci/fail.sh + - run: make check || .ci/fail.sh | asan_symbolize | c++filt clang-ubsan: docker: - - image: ubuntu:18.04 + - image: ubuntu:18.10 steps: - checkout + - run: apt update || true; apt install -y wget gnupg + - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list + - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - - run: make check || .ci/fail.sh + - run: make check || .ci/fail.sh | asan_symbolize | c++filt fedora-outoftreebuild: docker: From 1676f608c8e4f880789252ca448bb008f6dd51b4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 17:55:03 -0400 Subject: [PATCH 08/87] Minor refactoring --- src/hb-ot-map.hh | 15 ++++++++- src/hb-ot-shape-complex-hangul.cc | 2 +- src/hb-ot-shape-complex-indic.cc | 52 ++++++++++++------------------ src/hb-ot-shape-complex-khmer.cc | 38 ++++++++-------------- src/hb-ot-shape-complex-myanmar.cc | 2 +- 5 files changed, 51 insertions(+), 58 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index cc36fa277..c4e7837a8 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -166,7 +166,8 @@ struct hb_ot_map_t hb_vector_t stages[2]; /* GSUB/GPOS */ }; -enum hb_ot_map_feature_flags_t { +enum hb_ot_map_feature_flags_t +{ F_NONE = 0x0000u, F_GLOBAL = 0x0001u, /* Feature applies to all characters; results in no mask allocated for it. */ F_HAS_FALLBACK = 0x0002u, /* Has fallback implementation, so include mask bit even if feature not found. */ @@ -179,6 +180,12 @@ HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); /* Macro version for where const is desired. */ #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r))) +struct hb_ot_map_feature_t +{ + hb_tag_t tag; + hb_ot_map_feature_flags_t flags; +}; + struct hb_ot_map_builder_t { @@ -192,9 +199,15 @@ struct hb_ot_map_builder_t HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, hb_ot_map_feature_flags_t flags); + inline void add_feature (const hb_ot_map_feature_t &feat) + { add_feature (feat.tag, 1, feat.flags); } + inline void add_global_bool_feature (hb_tag_t tag) { add_feature (tag, 1, F_GLOBAL); } + inline void disable_feature (hb_tag_t tag) + { add_feature (tag, 0, F_GLOBAL); } + inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func) { add_pause (0, pause_func); } inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func) diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index ea731114a..3d8199b5c 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -65,7 +65,7 @@ override_features_hangul (hb_ot_shape_planner_t *plan) /* Uniscribe does not apply 'calt' for Hangul, and certain fonts * (Noto Sans CJK, Source Sans Han, etc) apply all of jamo lookups * in calt, which is not desirable. */ - plan->map.add_feature (HB_TAG('c','a','l','t'), 0, F_GLOBAL); + plan->map.disable_feature (HB_TAG('c','a','l','t')); } struct hangul_shape_plan_t diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index c1aa1d0fe..b541402af 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -95,42 +95,36 @@ static const indic_config_t indic_configs[] = * Indic shaper. */ -struct feature_list_t -{ - hb_tag_t tag; - hb_ot_map_feature_flags_t flags; -}; - -static const feature_list_t +static const hb_ot_map_feature_t indic_features[] = { /* * Basic features. * These features are applied in order, one at a time, after initial_reordering. */ - {HB_TAG('n','u','k','t'), F_GLOBAL}, - {HB_TAG('a','k','h','n'), F_GLOBAL}, - {HB_TAG('r','p','h','f'), F_NONE}, - {HB_TAG('r','k','r','f'), F_GLOBAL}, - {HB_TAG('p','r','e','f'), F_NONE}, - {HB_TAG('b','l','w','f'), F_NONE}, - {HB_TAG('a','b','v','f'), F_NONE}, - {HB_TAG('h','a','l','f'), F_NONE}, - {HB_TAG('p','s','t','f'), F_NONE}, - {HB_TAG('v','a','t','u'), F_GLOBAL}, - {HB_TAG('c','j','c','t'), F_GLOBAL}, + {HB_TAG('n','u','k','t'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('r','p','h','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('r','k','r','f'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('h','a','l','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('v','a','t','u'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('c','j','c','t'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, /* * Other features. * These features are applied all at once, after final_reordering. * Default Bengali font in Windows for example has intermixed * lookups for init,pres,abvs,blws features. */ - {HB_TAG('i','n','i','t'), F_NONE}, - {HB_TAG('p','r','e','s'), F_GLOBAL}, - {HB_TAG('a','b','v','s'), F_GLOBAL}, - {HB_TAG('b','l','w','s'), F_GLOBAL}, - {HB_TAG('p','s','t','s'), F_GLOBAL}, - {HB_TAG('h','a','l','n'), F_GLOBAL}, + {HB_TAG('i','n','i','t'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('h','a','l','n'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, /* * Positioning features. * We don't care about the types. @@ -169,7 +163,6 @@ enum { INDIC_NUM_FEATURES, INDIC_BASIC_FEATURES = INIT, /* Don't forget to update this! */ - INDIC_SUBST_FEATURES = _DIST /* Don't forget to update this! */ }; static void @@ -207,17 +200,14 @@ collect_features_indic (hb_ot_shape_planner_t *plan) map->add_gsub_pause (initial_reordering); for (; i < INDIC_BASIC_FEATURES; i++) { - map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ); + map->add_feature (indic_features[i]); map->add_gsub_pause (nullptr); } map->add_gsub_pause (final_reordering); - for (; i < INDIC_SUBST_FEATURES; i++) - map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ); - for (; i < INDIC_NUM_FEATURES; i++) - map->add_feature (indic_features[i].tag, 1, indic_features[i].flags); + map->add_feature (indic_features[i]); map->add_global_bool_feature (HB_TAG('c','a','l','t')); map->add_global_bool_feature (HB_TAG('c','l','i','g')); @@ -228,7 +218,7 @@ collect_features_indic (hb_ot_shape_planner_t *plan) static void override_features_indic (hb_ot_shape_planner_t *plan) { - plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); + plan->map.disable_feature (HB_TAG('l','i','g','a')); } diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 7a88aaa25..998784153 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -32,32 +32,26 @@ * Khmer shaper. */ -struct feature_list_t -{ - hb_tag_t tag; - hb_ot_map_feature_flags_t flags; -}; - -static const feature_list_t +static const hb_ot_map_feature_t khmer_features[] = { /* * Basic features. * These features are applied in order, one at a time, after reordering. */ - {HB_TAG('p','r','e','f'), F_NONE}, - {HB_TAG('b','l','w','f'), F_NONE}, - {HB_TAG('a','b','v','f'), F_NONE}, - {HB_TAG('p','s','t','f'), F_NONE}, - {HB_TAG('c','f','a','r'), F_NONE}, + {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('c','f','a','r'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, /* * Other features. * These features are applied all at once. */ - {HB_TAG('p','r','e','s'), F_GLOBAL}, - {HB_TAG('a','b','v','s'), F_GLOBAL}, - {HB_TAG('b','l','w','s'), F_GLOBAL}, - {HB_TAG('p','s','t','s'), F_GLOBAL}, + {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, /* * Positioning features. * We don't care about the types. @@ -88,7 +82,6 @@ enum { KHMER_NUM_FEATURES, KHMER_BASIC_FEATURES = _PRES, /* Don't forget to update this! */ - KHMER_SUBST_FEATURES = _DIST, /* Don't forget to update this! */ }; static void @@ -128,15 +121,12 @@ collect_features_khmer (hb_ot_shape_planner_t *plan) unsigned int i = 0; for (; i < KHMER_BASIC_FEATURES; i++) - map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ); + map->add_feature (khmer_features[i]); map->add_gsub_pause (clear_syllables); - for (; i < KHMER_SUBST_FEATURES; i++) - map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ); - for (; i < KHMER_NUM_FEATURES; i++) - map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags); + map->add_feature (khmer_features[i]); map->add_global_bool_feature (HB_TAG('c','a','l','t')); map->add_global_bool_feature (HB_TAG('c','l','i','g')); @@ -149,10 +139,10 @@ override_features_khmer (hb_ot_shape_planner_t *plan) /* Uniscribe does not apply 'kern' in Khmer. */ if (hb_options ().uniscribe_bug_compatible) { - plan->map.add_feature (HB_TAG('k','e','r','n'), 0, F_GLOBAL); + plan->map.disable_feature (HB_TAG('k','e','r','n')); } - plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); + plan->map.disable_feature (HB_TAG('l','i','g','a')); } diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 8069e3d99..215e70531 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -122,7 +122,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) static void override_features_myanmar (hb_ot_shape_planner_t *plan) { - plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); + plan->map.disable_feature (HB_TAG('l','i','g','a')); } From f048ead84a4d3fe0bb712ed228c2f39c01ce9705 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 18:01:53 -0400 Subject: [PATCH 09/87] Some more --- src/hb-ot-map.cc | 5 +++-- src/hb-ot-map.hh | 13 +++++++------ src/hb-ot-shape-complex-arabic.cc | 18 +++++++++--------- src/hb-ot-shape-complex-hangul.cc | 2 +- src/hb-ot-shape-complex-indic.cc | 8 ++++---- src/hb-ot-shape-complex-khmer.cc | 8 ++++---- src/hb-ot-shape-complex-myanmar.cc | 10 +++++----- src/hb-ot-shape-complex-tibetan.cc | 2 +- src/hb-ot-shape-complex-use.cc | 20 ++++++++++---------- src/hb-ot-shape.cc | 30 +++++++++++++++--------------- 10 files changed, 59 insertions(+), 57 deletions(-) diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index cb70583f4..ebac6d140 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -74,8 +74,9 @@ hb_ot_map_builder_t::~hb_ot_map_builder_t (void) stages[table_index].fini (); } -void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, - hb_ot_map_feature_flags_t flags) +void hb_ot_map_builder_t::add_feature (hb_tag_t tag, + hb_ot_map_feature_flags_t flags, + unsigned int value) { feature_info_t *info = feature_infos.push(); if (unlikely (!tag)) return; diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index c4e7837a8..f719cc6a3 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -196,17 +196,18 @@ struct hb_ot_map_builder_t HB_INTERNAL ~hb_ot_map_builder_t (void); - HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, - hb_ot_map_feature_flags_t flags); + HB_INTERNAL void add_feature (hb_tag_t tag, + hb_ot_map_feature_flags_t flags=F_NONE, + unsigned int value=1); inline void add_feature (const hb_ot_map_feature_t &feat) - { add_feature (feat.tag, 1, feat.flags); } + { add_feature (feat.tag, feat.flags); } - inline void add_global_bool_feature (hb_tag_t tag) - { add_feature (tag, 1, F_GLOBAL); } + inline void enable_feature (hb_tag_t tag) + { add_feature (tag, F_GLOBAL); } inline void disable_feature (hb_tag_t tag) - { add_feature (tag, 0, F_GLOBAL); } + { add_feature (tag, F_GLOBAL, 0); } inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func) { add_pause (0, pause_func); } diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index ebc1d3d5f..fff3b3128 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -202,28 +202,28 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) map->add_gsub_pause (nuke_joiners); - map->add_global_bool_feature (HB_TAG('s','t','c','h')); + map->enable_feature (HB_TAG('s','t','c','h')); map->add_gsub_pause (record_stch); - map->add_global_bool_feature (HB_TAG('c','c','m','p')); - map->add_global_bool_feature (HB_TAG('l','o','c','l')); + map->enable_feature (HB_TAG('c','c','m','p')); + map->enable_feature (HB_TAG('l','o','c','l')); map->add_gsub_pause (nullptr); for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) { bool has_fallback = plan->props.script == HB_SCRIPT_ARABIC && !FEATURE_IS_SYRIAC (arabic_features[i]); - map->add_feature (arabic_features[i], 1, has_fallback ? F_HAS_FALLBACK : F_NONE); + map->add_feature (arabic_features[i], has_fallback ? F_HAS_FALLBACK : F_NONE); map->add_gsub_pause (nullptr); } - map->add_feature (HB_TAG('r','l','i','g'), 1, F_GLOBAL|F_HAS_FALLBACK); + map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL|F_HAS_FALLBACK); if (plan->props.script == HB_SCRIPT_ARABIC) map->add_gsub_pause (arabic_fallback_shape); /* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */ - map->add_global_bool_feature (HB_TAG('r','c','l','t')); - map->add_global_bool_feature (HB_TAG('c','a','l','t')); + map->enable_feature (HB_TAG('r','c','l','t')); + map->enable_feature (HB_TAG('c','a','l','t')); map->add_gsub_pause (nullptr); /* The spec includes 'cswh'. Earlier versions of Windows @@ -234,8 +234,8 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) * Note that IranNastaliq uses this feature extensively * to fixup broken glyph sequences. Oh well... * Test case: U+0643,U+0640,U+0631. */ - //map->add_global_bool_feature (HB_TAG('c','s','w','h')); - map->add_global_bool_feature (HB_TAG('m','s','e','t')); + //map->enable_feature (HB_TAG('c','s','w','h')); + map->enable_feature (HB_TAG('m','s','e','t')); } #include "hb-ot-shape-complex-arabic-fallback.hh" diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 3d8199b5c..96fd42678 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -56,7 +56,7 @@ collect_features_hangul (hb_ot_shape_planner_t *plan) hb_ot_map_builder_t *map = &plan->map; for (unsigned int i = FIRST_HANGUL_FEATURE; i < HANGUL_FEATURE_COUNT; i++) - map->add_feature (hangul_features[i], 1, F_NONE); + map->add_feature (hangul_features[i]); } static void diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index b541402af..e2fae7aea 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -190,10 +190,10 @@ collect_features_indic (hb_ot_shape_planner_t *plan) /* Do this before any lookups have been applied. */ map->add_gsub_pause (setup_syllables); - map->add_global_bool_feature (HB_TAG('l','o','c','l')); + map->enable_feature (HB_TAG('l','o','c','l')); /* The Indic specs do not require ccmp, but we apply it here since if * there is a use of it, it's typically at the beginning. */ - map->add_global_bool_feature (HB_TAG('c','c','m','p')); + map->enable_feature (HB_TAG('c','c','m','p')); unsigned int i = 0; @@ -209,8 +209,8 @@ collect_features_indic (hb_ot_shape_planner_t *plan) for (; i < INDIC_NUM_FEATURES; i++) map->add_feature (indic_features[i]); - map->add_global_bool_feature (HB_TAG('c','a','l','t')); - map->add_global_bool_feature (HB_TAG('c','l','i','g')); + map->enable_feature (HB_TAG('c','a','l','t')); + map->enable_feature (HB_TAG('c','l','i','g')); map->add_gsub_pause (clear_syllables); } diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 998784153..77059293d 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -116,8 +116,8 @@ collect_features_khmer (hb_ot_shape_planner_t *plan) * * https://github.com/harfbuzz/harfbuzz/issues/974 */ - map->add_global_bool_feature (HB_TAG('l','o','c','l')); - map->add_global_bool_feature (HB_TAG('c','c','m','p')); + map->enable_feature (HB_TAG('l','o','c','l')); + map->enable_feature (HB_TAG('c','c','m','p')); unsigned int i = 0; for (; i < KHMER_BASIC_FEATURES; i++) @@ -128,8 +128,8 @@ collect_features_khmer (hb_ot_shape_planner_t *plan) for (; i < KHMER_NUM_FEATURES; i++) map->add_feature (khmer_features[i]); - map->add_global_bool_feature (HB_TAG('c','a','l','t')); - map->add_global_bool_feature (HB_TAG('c','l','i','g')); + map->enable_feature (HB_TAG('c','a','l','t')); + map->enable_feature (HB_TAG('c','l','i','g')); } diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 215e70531..532ebfdc9 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -96,27 +96,27 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) /* Do this before any lookups have been applied. */ map->add_gsub_pause (setup_syllables); - map->add_global_bool_feature (HB_TAG('l','o','c','l')); + map->enable_feature (HB_TAG('l','o','c','l')); /* The Indic specs do not require ccmp, but we apply it here since if * there is a use of it, it's typically at the beginning. */ - map->add_global_bool_feature (HB_TAG('c','c','m','p')); + map->enable_feature (HB_TAG('c','c','m','p')); map->add_gsub_pause (initial_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) { - map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); + map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); } map->add_gsub_pause (final_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); + map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ); for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) - map->add_feature (positioning_features[i], 1, F_GLOBAL); + map->enable_feature (positioning_features[i]); } static void diff --git a/src/hb-ot-shape-complex-tibetan.cc b/src/hb-ot-shape-complex-tibetan.cc index 9982ebc29..27c60b11e 100644 --- a/src/hb-ot-shape-complex-tibetan.cc +++ b/src/hb-ot-shape-complex-tibetan.cc @@ -40,7 +40,7 @@ static void collect_features_tibetan (hb_ot_shape_planner_t *plan) { for (const hb_tag_t *script_features = tibetan_features; script_features && *script_features; script_features++) - plan->map.add_global_bool_feature (*script_features); + plan->map.enable_feature (*script_features); } diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index 62aef7e6f..0ca088ba8 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -129,37 +129,37 @@ collect_features_use (hb_ot_shape_planner_t *plan) map->add_gsub_pause (setup_syllables); /* "Default glyph pre-processing group" */ - map->add_global_bool_feature (HB_TAG('l','o','c','l')); - map->add_global_bool_feature (HB_TAG('c','c','m','p')); - map->add_global_bool_feature (HB_TAG('n','u','k','t')); - map->add_global_bool_feature (HB_TAG('a','k','h','n')); + map->enable_feature (HB_TAG('l','o','c','l')); + map->enable_feature (HB_TAG('c','c','m','p')); + map->enable_feature (HB_TAG('n','u','k','t')); + map->enable_feature (HB_TAG('a','k','h','n')); /* "Reordering group" */ map->add_gsub_pause (clear_substitution_flags); - map->add_feature (HB_TAG('r','p','h','f'), 1, F_MANUAL_ZWJ); + map->add_feature (HB_TAG('r','p','h','f'), F_MANUAL_ZWJ); map->add_gsub_pause (record_rphf); map->add_gsub_pause (clear_substitution_flags); - map->add_feature (HB_TAG('p','r','e','f'), 1, F_GLOBAL | F_MANUAL_ZWJ); + map->add_feature (HB_TAG('p','r','e','f'), F_GLOBAL | F_MANUAL_ZWJ); map->add_gsub_pause (record_pref); /* "Orthographic unit shaping group" */ for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) - map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); + map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ); map->add_gsub_pause (reorder); /* "Topographical features" */ for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++) - map->add_feature (arabic_features[i], 1, F_NONE); + map->add_feature (arabic_features[i]); map->add_gsub_pause (nullptr); /* "Standard typographic presentation" */ for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); + map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ); /* "Positional feature application" */ for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) - map->add_feature (positioning_features[i], 1, F_GLOBAL); + map->enable_feature (positioning_features[i]); } struct use_shape_plan_t diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 437b0feb4..6bfd2c7a0 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -71,17 +71,17 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, { hb_ot_map_builder_t *map = &planner->map; - map->add_global_bool_feature (HB_TAG('r','v','r','n')); + map->enable_feature (HB_TAG('r','v','r','n')); map->add_gsub_pause (nullptr); switch (props->direction) { case HB_DIRECTION_LTR: - map->add_global_bool_feature (HB_TAG ('l','t','r','a')); - map->add_global_bool_feature (HB_TAG ('l','t','r','m')); + map->enable_feature (HB_TAG ('l','t','r','a')); + map->enable_feature (HB_TAG ('l','t','r','m')); break; case HB_DIRECTION_RTL: - map->add_global_bool_feature (HB_TAG ('r','t','l','a')); - map->add_feature (HB_TAG ('r','t','l','m'), 1, F_NONE); + map->enable_feature (HB_TAG ('r','t','l','a')); + map->add_feature (HB_TAG ('r','t','l','m')); break; case HB_DIRECTION_TTB: case HB_DIRECTION_BTT: @@ -91,22 +91,22 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, } /* Automatic fractions. */ - map->add_feature (HB_TAG ('f','r','a','c'), 1, F_NONE); - map->add_feature (HB_TAG ('n','u','m','r'), 1, F_NONE); - map->add_feature (HB_TAG ('d','n','o','m'), 1, F_NONE); + map->add_feature (HB_TAG ('f','r','a','c')); + map->add_feature (HB_TAG ('n','u','m','r')); + map->add_feature (HB_TAG ('d','n','o','m')); /* Random! */ - map->add_feature (HB_TAG ('r','a','n','d'), HB_OT_MAP_MAX_VALUE, F_GLOBAL | F_RANDOM); + map->add_feature (HB_TAG ('r','a','n','d'), F_GLOBAL | F_RANDOM, HB_OT_MAP_MAX_VALUE); if (planner->shaper->collect_features) planner->shaper->collect_features (planner); for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++) - map->add_global_bool_feature (common_features[i]); + map->enable_feature (common_features[i]); if (HB_DIRECTION_IS_HORIZONTAL (props->direction)) for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++) - map->add_feature (horizontal_features[i], 1, F_GLOBAL | + map->add_feature (horizontal_features[i], F_GLOBAL | (horizontal_features[i] == HB_TAG('k','e','r','n') ? F_HAS_FALLBACK : F_NONE)); else @@ -115,7 +115,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, * matter which script/langsys it is listed (or not) under. * See various bugs referenced from: * https://github.com/harfbuzz/harfbuzz/issues/63 */ - map->add_feature (HB_TAG ('v','e','r','t'), 1, F_GLOBAL | F_GLOBAL_SEARCH); + map->add_feature (HB_TAG ('v','e','r','t'), F_GLOBAL | F_GLOBAL_SEARCH); } if (planner->shaper->override_features) @@ -124,9 +124,9 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, for (unsigned int i = 0; i < num_user_features; i++) { const hb_feature_t *feature = &user_features[i]; - map->add_feature (feature->tag, feature->value, - (feature->start == 0 && feature->end == (unsigned int) -1) ? - F_GLOBAL : F_NONE); + map->add_feature (feature->tag, + (feature->start == 0 && feature->end == (unsigned int) -1) ? F_GLOBAL : F_NONE, + feature->value); } } From 70136a78cb9eda244767f8e8a3d30d0f3c569d01 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 18:03:34 -0400 Subject: [PATCH 10/87] Remove F_COMBINE Now I wonder if any bots will be unhappy we calling | in static const initializations... Or would that cost runtime init? Our tests don't detect any.. --- src/hb-ot-map.hh | 2 -- src/hb-ot-shape-complex-arabic.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index f719cc6a3..b6942ca2b 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -177,8 +177,6 @@ enum hb_ot_map_feature_flags_t F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ }; HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); -/* Macro version for where const is desired. */ -#define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r))) struct hb_ot_map_feature_t { diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index fff3b3128..375fa1dbd 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -217,7 +217,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) map->add_gsub_pause (nullptr); } - map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL|F_HAS_FALLBACK); + map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL | F_HAS_FALLBACK); if (plan->props.script == HB_SCRIPT_ARABIC) map->add_gsub_pause (arabic_fallback_shape); From d9867497d09af929554eaa89cc6fee865b018646 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 18:11:59 -0400 Subject: [PATCH 11/87] Minor --- src/hb-ot-shape.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 6bfd2c7a0..5404a5c3a 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -125,7 +125,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, { const hb_feature_t *feature = &user_features[i]; map->add_feature (feature->tag, - (feature->start == 0 && feature->end == (unsigned int) -1) ? F_GLOBAL : F_NONE, + (feature->start == HB_FEATURE_GLOBAL_START && + feature->end == HB_FEATURE_GLOBAL_END) ? F_GLOBAL : F_NONE, feature->value); } } From d748dc76644f28d4130f9cb1dee7a22cbe81c25d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 18:30:50 -0400 Subject: [PATCH 12/87] More iter inits --- src/hb-ot-layout-gsubgpos.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 031b39b9b..5dd4c3da1 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -506,21 +506,21 @@ struct hb_ot_apply_context_t : auto_zwnj (true), auto_zwj (true), random (false), - random_state (1) {} + random_state (1) { init_iters (); } - inline void reinit_iters (void) + inline void init_iters (void) { iter_input.init (this, false); iter_context.init (this, true); } - inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; } - inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; reinit_iters (); } - inline void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; reinit_iters (); } + inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; init_iters (); } + inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; init_iters (); } + inline void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; init_iters (); } inline void set_random (bool random_) { random = random_; } inline void set_recurse_func (recurse_func_t func) { recurse_func = func; } inline void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; } - inline void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; reinit_iters (); } + inline void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; init_iters (); } inline uint32_t random_number (void) { From 6c0e7eb6a6f3f888442c0a97ce6a771631990ed6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 19:07:23 -0400 Subject: [PATCH 13/87] Minor --- src/hb-ot-map.hh | 1 + src/hb-ot-shape-complex-indic.cc | 34 ++++++++++++++++---------------- src/hb-ot-shape-complex-khmer.cc | 18 ++++++++--------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index b6942ca2b..13bbc8fe5 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -173,6 +173,7 @@ enum hb_ot_map_feature_flags_t F_HAS_FALLBACK = 0x0002u, /* Has fallback implementation, so include mask bit even if feature not found. */ F_MANUAL_ZWNJ = 0x0004u, /* Don't skip over ZWNJ when matching **context**. */ F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */ + F_MANUAL_JOINERS = F_MANUAL_ZWNJ | F_MANUAL_ZWJ, F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */ F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ }; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index e2fae7aea..1fec0e566 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -102,29 +102,29 @@ indic_features[] = * Basic features. * These features are applied in order, one at a time, after initial_reordering. */ - {HB_TAG('n','u','k','t'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('r','p','h','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('r','k','r','f'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('h','a','l','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('v','a','t','u'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('c','j','c','t'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('n','u','k','t'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('r','p','h','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('r','k','r','f'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('h','a','l','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('v','a','t','u'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('c','j','c','t'), F_GLOBAL | F_MANUAL_JOINERS}, /* * Other features. * These features are applied all at once, after final_reordering. * Default Bengali font in Windows for example has intermixed * lookups for init,pres,abvs,blws features. */ - {HB_TAG('i','n','i','t'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('h','a','l','n'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('i','n','i','t'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('h','a','l','n'), F_GLOBAL | F_MANUAL_JOINERS}, /* * Positioning features. * We don't care about the types. diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 77059293d..f8c0a4beb 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -39,19 +39,19 @@ khmer_features[] = * Basic features. * These features are applied in order, one at a time, after reordering. */ - {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('c','f','a','r'), F_NONE | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('c','f','a','r'), F_NONE | F_MANUAL_JOINERS}, /* * Other features. * These features are applied all at once. */ - {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, - {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_ZWJ | F_MANUAL_ZWNJ}, + {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_JOINERS}, /* * Positioning features. * We don't care about the types. From 8282e881b51363811078bce53fad6aa5b41f7b41 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Sep 2018 19:43:01 -0400 Subject: [PATCH 14/87] Disable msan bot again Fixes https://github.com/harfbuzz/harfbuzz/issues/1175 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 74411778a..3bf1977a5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -265,7 +265,7 @@ workflows: - archlinux-debug-O0-py3 - clang-O3-O0 - clang-asan - - clang-msan + #- clang-msan # https://github.com/harfbuzz/harfbuzz/issues/1175 - clang-tsan - clang-ubsan - fedora-outoftreebuild From 4b4be7701f635f8378e7f868cfbe8d4571fc841f Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 25 Sep 2018 09:24:35 +0330 Subject: [PATCH 15/87] [circle] Add an obsessive clang bot (#1178) --- .circleci/config.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bf1977a5..ec8abd923 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -79,6 +79,22 @@ jobs: - run: make - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh + clang-everything: + docker: + - image: ubuntu:18.10 + steps: + - checkout + - run: apt update || true; apt install -y wget gnupg + - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list + - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list + - run: apt update || true + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: pip install fonttools + - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-documentation-unknown-command -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make + - run: make check || .ci/fail.sh + clang-asan: docker: - image: ubuntu:18.10 @@ -264,6 +280,7 @@ workflows: - alpine-O3-NOMMAP - archlinux-debug-O0-py3 - clang-O3-O0 + - clang-everything - clang-asan #- clang-msan # https://github.com/harfbuzz/harfbuzz/issues/1175 - clang-tsan From 824111d4842b9a7bbbdcd147325f8f372ed3d37c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 25 Sep 2018 12:47:37 -0400 Subject: [PATCH 16/87] Fix iOS build Fixes https://github.com/harfbuzz/harfbuzz/pull/1179 --- src/hb-coretext.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index f921e3a02..8b120aac6 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -210,7 +210,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) } CFURLRef original_url = nullptr; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +#if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1060 ATSFontRef atsFont; FSRef fsref; OSStatus status; @@ -240,7 +240,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) * process in Blink. This can be detected by the new file URL location * that the newly found font points to. */ CFURLRef new_url = nullptr; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +#if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1060 atsFont = CTFontGetPlatformFont (new_ct_font, NULL); status = ATSFontGetFileReference (atsFont, &fsref); if (status == noErr) From 04caf11608d2db13eb6ed2ecc3d406e284b4c13c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 12:13:47 -0400 Subject: [PATCH 17/87] [hb-view] Change subpixel bits from 8 to 6 To match FreeType units, such that FreeType gets correct size from us. This matters more now that we allow setting --ft-load-flags. --- util/hb-view.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/hb-view.cc b/util/hb-view.cc index ef75e6da7..69a4c9504 100644 --- a/util/hb-view.cc +++ b/util/hb-view.cc @@ -30,7 +30,7 @@ #include "view-cairo.hh" #define DEFAULT_FONT_SIZE 256 -#define SUBPIXEL_BITS 8 +#define SUBPIXEL_BITS 6 int main (int argc, char **argv) From 8bb73dad7f3279e1f1362cf9a137504e8ef08985 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Wed, 26 Sep 2018 20:50:51 +0330 Subject: [PATCH 18/87] Add a multithreaded test (#1184) --- test/api/Makefile.am | 6 ++ test/api/test-multithread.c | 146 ++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 test/api/test-multithread.c diff --git a/test/api/Makefile.am b/test/api/Makefile.am index d92e96694..1c0f92c13 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -76,6 +76,12 @@ TEST_PROGS += \ test-ot-tag \ $(NULL) +if HAVE_PTHREAD +TEST_PROGS += test-multithread +test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) +test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) +endif + if HAVE_FREETYPE TEST_PROGS += \ test-ot-math \ diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c new file mode 100644 index 000000000..3a0d8845d --- /dev/null +++ b/test/api/test-multithread.c @@ -0,0 +1,146 @@ +/* + * Copyright © 2018 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + */ + +#include +#include +#include + +#include + +#include +#include + +const char *text = "طرح‌نَما"; +const char *path = +#if defined(__linux__) + "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"; +#elif defined(_WIN32) || defined(_WIN64) + "C:\\Windows\\Fonts\\tahoma.ttf"; +#elif __APPLE__ + "/Library/Fonts/Tahoma.ttf"; +#endif + +int num_iters = 200; + +hb_font_t *font; + +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +static void +fill_the_buffer(hb_buffer_t *buffer) +{ + hb_buffer_add_utf8 (buffer, text, sizeof (text), 0, sizeof (text)); + hb_buffer_guess_segment_properties (buffer); + hb_shape (font, buffer, NULL, 0); +} + +static void * +thread_func (void *data) +{ + hb_buffer_t *buffer = (hb_buffer_t *) data; + + pthread_mutex_lock (&mutex); + pthread_mutex_unlock (&mutex); + + int i; + for (i = 0; i < num_iters; i++) + { + hb_buffer_clear_contents (buffer); + fill_the_buffer (buffer); + } + + return 0; +} + +int +main (int argc, char **argv) +{ + int i; + int num_threads = 1; // FIXME: Increase this and fix the issue + pthread_t *threads = calloc (num_threads, sizeof (pthread_t)); + hb_buffer_t **buffers = calloc (num_threads, sizeof (hb_buffer_t *)); + + pthread_mutex_lock (&mutex); + + hb_blob_t *blob = hb_blob_create_from_file (path); + hb_face_t *face = hb_face_create (blob, 0); + font = hb_font_create (face); + hb_ot_font_set_funcs (font); + + for (i = 0; i < num_threads; i++) + { + hb_buffer_t *buffer = hb_buffer_create (); + buffers[i] = buffer; + pthread_create (&threads[i], NULL, thread_func, buffer); + } + + /* Let them loose! */ + pthread_mutex_unlock (&mutex); + + for (i = 0; i < num_threads; i++) + { + pthread_join (threads[i], NULL); + + hb_buffer_t *ref_buffer = hb_buffer_create (); + fill_the_buffer (ref_buffer); + + for (i = 0; i < num_threads; i++) + { + hb_buffer_t *buffer = buffers[i]; + hb_buffer_diff_flags_t diff = hb_buffer_diff (ref_buffer, buffer, (hb_codepoint_t) -1, 0); + if (diff) + { + fprintf (stderr, "One of the buffers (%d) was different from the reference.\n", i); + char out[255]; + + hb_buffer_serialize_glyphs (buffer, 0, hb_buffer_get_length (ref_buffer), + out, sizeof (out), NULL, + font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + fprintf (stderr, "Actual: %s\n", out); + + hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), + out, sizeof (out), NULL, + font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + fprintf (stderr, "Expected: %s\n", out); + + return 1; + } + hb_buffer_destroy (buffer); + } + + hb_buffer_destroy (ref_buffer); + } + + free (buffers); + free (threads); + + hb_font_destroy (font); + hb_face_destroy (face); + hb_blob_destroy (blob); + + return 0; +} From 34d5a2595331c568ae524057d031c9d5d2573978 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 15:02:21 -0400 Subject: [PATCH 19/87] Fix test-multithread and increase num_threads to 30 What were you thinking? ;) --- test/api/test-multithread.c | 50 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 3a0d8845d..b9bcdf868 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -78,7 +78,7 @@ int main (int argc, char **argv) { int i; - int num_threads = 1; // FIXME: Increase this and fix the issue + int num_threads = 30; // FIXME: Increase this and fix the issue pthread_t *threads = calloc (num_threads, sizeof (pthread_t)); hb_buffer_t **buffers = calloc (num_threads, sizeof (hb_buffer_t *)); @@ -99,42 +99,38 @@ main (int argc, char **argv) /* Let them loose! */ pthread_mutex_unlock (&mutex); + hb_buffer_t *ref_buffer = hb_buffer_create (); + fill_the_buffer (ref_buffer); + for (i = 0; i < num_threads; i++) { pthread_join (threads[i], NULL); - - hb_buffer_t *ref_buffer = hb_buffer_create (); - fill_the_buffer (ref_buffer); - - for (i = 0; i < num_threads; i++) + hb_buffer_t *buffer = buffers[i]; + hb_buffer_diff_flags_t diff = hb_buffer_diff (ref_buffer, buffer, (hb_codepoint_t) -1, 0); + if (diff) { - hb_buffer_t *buffer = buffers[i]; - hb_buffer_diff_flags_t diff = hb_buffer_diff (ref_buffer, buffer, (hb_codepoint_t) -1, 0); - if (diff) - { - fprintf (stderr, "One of the buffers (%d) was different from the reference.\n", i); - char out[255]; + fprintf (stderr, "One of the buffers (%d) was different from the reference.\n", i); + char out[255]; - hb_buffer_serialize_glyphs (buffer, 0, hb_buffer_get_length (ref_buffer), - out, sizeof (out), NULL, - font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); - fprintf (stderr, "Actual: %s\n", out); + hb_buffer_serialize_glyphs (buffer, 0, hb_buffer_get_length (ref_buffer), + out, sizeof (out), NULL, + font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + fprintf (stderr, "Actual: %s\n", out); - hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), - out, sizeof (out), NULL, - font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); - fprintf (stderr, "Expected: %s\n", out); + hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), + out, sizeof (out), NULL, + font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + fprintf (stderr, "Expected: %s\n", out); - return 1; - } - hb_buffer_destroy (buffer); + return 1; } - - hb_buffer_destroy (ref_buffer); + hb_buffer_destroy (buffer); } + hb_buffer_destroy (ref_buffer); + free (buffers); free (threads); From 90a0f9fa0c020c268ac3ba31c7f1337eed85f35e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 15:03:07 -0400 Subject: [PATCH 20/87] Make TSan happy with make_immutable() --- src/hb-blob.cc | 2 ++ src/hb-face.cc | 2 ++ src/hb-font.cc | 4 ++++ src/hb-unicode.cc | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index fca3c910b..f09526659 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -293,6 +293,8 @@ hb_blob_make_immutable (hb_blob_t *blob) { if (hb_object_is_inert (blob)) return; + if (blob->immutable) + return; blob->immutable = true; } diff --git a/src/hb-face.cc b/src/hb-face.cc index 19eea4d34..fbab18aa3 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -325,6 +325,8 @@ hb_face_make_immutable (hb_face_t *face) { if (unlikely (hb_object_is_inert (face))) return; + if (face->immutable) + return; face->immutable = true; } diff --git a/src/hb-font.cc b/src/hb-font.cc index 9dcf6c123..77762f2d8 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -586,6 +586,8 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs) { if (unlikely (hb_object_is_inert (ffuncs))) return; + if (ffuncs->immutable) + return; ffuncs->immutable = true; } @@ -1444,6 +1446,8 @@ hb_font_make_immutable (hb_font_t *font) { if (unlikely (hb_object_is_inert (font))) return; + if (font->immutable) + return; if (font->parent) hb_font_make_immutable (font->parent); diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index bb1cd6821..0e8b520d0 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -308,6 +308,8 @@ hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) { if (unlikely (hb_object_is_inert (ufuncs))) return; + if (ufuncs->immutable) + return; ufuncs->immutable = true; } From e88009a93f5d13ed31b6262f928761e9574dcef1 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Wed, 26 Sep 2018 22:53:02 +0330 Subject: [PATCH 21/87] Minor, remove the no longer needed comment on test-multithread --- test/api/test-multithread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index b9bcdf868..4570da125 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -78,7 +78,7 @@ int main (int argc, char **argv) { int i; - int num_threads = 30; // FIXME: Increase this and fix the issue + int num_threads = 30; pthread_t *threads = calloc (num_threads, sizeof (pthread_t)); hb_buffer_t **buffers = calloc (num_threads, sizeof (hb_buffer_t *)); From 39da1914b4fd1c58d61cb29c78a0904ff6b905c6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Wed, 26 Sep 2018 23:32:45 +0330 Subject: [PATCH 22/87] Test freetype funcs on test-multithread (#1187) --- test/api/Makefile.am | 6 ++++-- test/api/test-multithread.c | 25 +++++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 1c0f92c13..466d56f04 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -77,9 +77,11 @@ TEST_PROGS += \ $(NULL) if HAVE_PTHREAD +if HAVE_FREETYPE TEST_PROGS += test-multithread -test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) -test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) +test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS) +test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS) +endif endif if HAVE_FREETYPE diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 4570da125..c87da3c0f 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -30,6 +30,7 @@ #include #include +#include #include const char *text = "طرح‌نَما"; @@ -74,8 +75,8 @@ thread_func (void *data) return 0; } -int -main (int argc, char **argv) +void +test_body () { int i; int num_threads = 30; @@ -84,11 +85,6 @@ main (int argc, char **argv) pthread_mutex_lock (&mutex); - hb_blob_t *blob = hb_blob_create_from_file (path); - hb_face_t *face = hb_face_create (blob, 0); - font = hb_font_create (face); - hb_ot_font_set_funcs (font); - for (i = 0; i < num_threads; i++) { hb_buffer_t *buffer = hb_buffer_create (); @@ -124,7 +120,7 @@ main (int argc, char **argv) HB_BUFFER_SERIALIZE_FLAG_DEFAULT); fprintf (stderr, "Expected: %s\n", out); - return 1; + exit (1); } hb_buffer_destroy (buffer); } @@ -133,6 +129,19 @@ main (int argc, char **argv) free (buffers); free (threads); +} + +int +main (int argc, char **argv) +{ + hb_blob_t *blob = hb_blob_create_from_file (path); + hb_face_t *face = hb_face_create (blob, 0); + font = hb_font_create (face); + + hb_ft_font_set_funcs (font); + test_body (); + hb_ot_font_set_funcs (font); + test_body (); hb_font_destroy (font); hb_face_destroy (face); From c9c75fe3d9eb36f166d594ceb5889a1dc0b14fe6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 27 Sep 2018 00:08:06 +0330 Subject: [PATCH 23/87] [ci] Compile freetype on tsan and put sanitizer flags on correct places (#1188) --- .circleci/config.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ec8abd923..97d211bc4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,7 +107,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: make check || .ci/fail.sh | asan_symbolize | c++filt @@ -123,7 +123,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh | asan_symbolize | c++filt @@ -139,9 +139,10 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" ./autogen.sh && ./configure && make -j4 && cd .. + - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - - run: make check || .ci/fail.sh | asan_symbolize | c++filt + - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt clang-ubsan: docker: @@ -155,7 +156,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CFLAGS="-O1 -g -fno-omit-frame-pointer" CXXFLAGS="-O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: make check || .ci/fail.sh | asan_symbolize | c++filt From d183b33c1dd42055a9432f4a756ea20856913201 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 16:29:35 -0400 Subject: [PATCH 24/87] Rename test --- test/api/Makefile.am | 2 +- test/api/{test-subset-codepoints.c => test-collect-unicodes.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/api/{test-subset-codepoints.c => test-collect-unicodes.c} (100%) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 466d56f04..f910f9e05 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -30,13 +30,13 @@ noinst_PROGRAMS = $(TEST_PROGS) TEST_PROGS = \ test-blob \ test-buffer \ + test-collect-unicodes \ test-common \ test-font \ test-object \ test-set \ test-shape \ test-subset \ - test-subset-codepoints \ test-subset-cmap \ test-subset-glyf \ test-subset-hdmx \ diff --git a/test/api/test-subset-codepoints.c b/test/api/test-collect-unicodes.c similarity index 100% rename from test/api/test-subset-codepoints.c rename to test/api/test-collect-unicodes.c From ec743fce2a72a1cb76ac9401747a442a03a051d9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 16:37:18 -0400 Subject: [PATCH 25/87] Add more atomic intrinsics --- src/hb-atomic.hh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 6e3672c18..8bc94039e 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -49,17 +49,21 @@ /* Defined externally, i.e. in config.h. */ -#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME) +#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) /* C++11-style GCC primitives. */ +#define _hb_memory_barrier() __sync_synchronize () + #define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add ((AI), (V), __ATOMIC_ACQ_REL) #define hb_atomic_int_impl_set_relaxed(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELAXED) +#define hb_atomic_int_impl_set(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELEASE) #define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), __ATOMIC_RELAXED) +#define hb_atomic_int_impl_get(AI) __atomic_load_n ((AI), __ATOMIC_ACQUIRE) #define hb_atomic_ptr_impl_set_relaxed(P, V) __atomic_store_n ((P), (V), __ATOMIC_RELAXED) #define hb_atomic_ptr_impl_get_relaxed(P) __atomic_load_n ((P), __ATOMIC_RELAXED) -#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_CONSUME) +#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_ACQUIRE) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -74,13 +78,19 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) #include +#define _hb_memory_barrier() std::atomic_thread_fence(std::memory_order_ack_rel) +#define _hb_memory_r_barrier() std::atomic_thread_fence(std::memory_order_acquire) +#define _hb_memory_w_barrier() std::atomic_thread_fence(std::memory_order_release) + #define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (AI)->fetch_add ((V), std::memory_order_acq_rel)) #define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_relaxed)) +#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_release)) #define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast *> (AI)->load (std::memory_order_relaxed)) +#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast *> (AI)->load (std::memory_order_acquire)) #define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast *> (P)->store ((V), std::memory_order_relaxed)) #define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast *> (P)->load (std::memory_order_relaxed)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_consume)) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_acquire)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -243,6 +253,9 @@ static_assert ((sizeof (long) == sizeof (void *)), ""); #ifndef hb_atomic_ptr_impl_get_relaxed #define hb_atomic_ptr_impl_get_relaxed(P) (*(P)) #endif +#ifndef hb_atomic_int_impl_get +inline int hb_atomic_int_impl_get (int *AI) { int v = *AI; _hb_memory_r_barrier (); return v; } +#endif #ifndef hb_atomic_ptr_impl_get inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; _hb_memory_r_barrier (); return v; } #endif @@ -252,7 +265,9 @@ inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; _hb_memory_r_barr struct hb_atomic_int_t { inline void set_relaxed (int v_) const { hb_atomic_int_impl_set_relaxed (&v, v_); } + inline void set (int v_) const { hb_atomic_int_impl_set (&v, v_); } inline int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed (&v); } + inline int get (void) const { return hb_atomic_int_impl_get (&v); } inline int inc (void) { return hb_atomic_int_impl_add (&v, 1); } inline int dec (void) { return hb_atomic_int_impl_add (&v, -1); } From 7f30629cddcf0196d7b754df0cb2d4a8e5fed4b6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 16:40:23 -0400 Subject: [PATCH 26/87] [ft] Make TSan happy --- src/hb-ft.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 3aed71883..50182f1b6 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -70,7 +70,7 @@ struct hb_ft_font_t bool symbol; /* Whether selected cmap is symbol cmap. */ bool unref; /* Whether to destroy ft_face when done. */ - mutable int cached_x_scale; + mutable hb_atomic_int_t cached_x_scale; mutable hb_advance_cache_t advance_cache; }; @@ -88,7 +88,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref) ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; - ft_font->cached_x_scale = 0; + ft_font->cached_x_scale.set (0); ft_font->advance_cache.init (); return ft_font; @@ -250,10 +250,10 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, int load_flags = ft_font->load_flags; int mult = font->x_scale < 0 ? -1 : +1; - if (font->x_scale != ft_font->cached_x_scale) + if (font->x_scale != ft_font->cached_x_scale.get ()) { ft_font->advance_cache.clear (); - ft_font->cached_x_scale = font->x_scale; + ft_font->cached_x_scale.set (font->x_scale); } for (unsigned int i = 0; i < count; i++) From 662f7d7e8bfa77b21ffa05e853f61dda993dcc8a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Sep 2018 18:42:37 -0400 Subject: [PATCH 27/87] [arabic] Do the joiner-flipping only for rlig feature See comment. --- src/hb-ot-shape-complex-arabic.cc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 375fa1dbd..d136a6644 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -159,7 +159,7 @@ static const struct arabic_state_table_entry { static void -nuke_joiners (const hb_ot_shape_plan_t *plan, +flip_joiners (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); @@ -200,7 +200,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) * work correctly. See https://github.com/harfbuzz/harfbuzz/issues/505 */ - map->add_gsub_pause (nuke_joiners); map->enable_feature (HB_TAG('s','t','c','h')); map->add_gsub_pause (record_stch); @@ -217,14 +216,29 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) map->add_gsub_pause (nullptr); } + /* Normally, Unicode says a ZWNJ means "don't ligate". In Arabic script + * however, it says a ZWJ should also mean "don't ligate". So we convert + * a ZWJ to a ZWNJ for GSUB. We want to revert it back to ZWJ before + * GPOS processing though. So we just flip their roles, and flip back + * later. Note that this makes a ZWNJ into ZWJ for GSUB stage, which + * means it would *not* break ligatures. But since ligatures around + * ZWNJ are rare, we don't care. + * + * Since we don't currently have a way to apply a pause before GPOS + * starts, let's just do this dance around a few required GUSB features. */ + map->add_gsub_pause (flip_joiners); + map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL | F_HAS_FALLBACK); + if (plan->props.script == HB_SCRIPT_ARABIC) map->add_gsub_pause (arabic_fallback_shape); /* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */ map->enable_feature (HB_TAG('r','c','l','t')); map->enable_feature (HB_TAG('c','a','l','t')); - map->add_gsub_pause (nullptr); + + /* And undo here. */ + map->add_gsub_pause (flip_joiners); /* The spec includes 'cswh'. Earlier versions of Windows * used to enable this by default, but testing suggests @@ -381,14 +395,14 @@ setup_masks_arabic (const hb_ot_shape_plan_t *plan, static void -nuke_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED, +flip_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) { unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) - if (_hb_glyph_info_is_zwj (&info[i])) + if (_hb_glyph_info_is_joiner (&info[i])) _hb_glyph_info_flip_joiners (&info[i]); } From 0c1d852bc41a4f69f890be4817c84bd7de56e07a Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 27 Sep 2018 11:53:17 +0330 Subject: [PATCH 28/87] Use clang for compiling freetype for tsan bot --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 97d211bc4..c3271599d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,7 +139,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" ./autogen.sh && ./configure && make -j4 && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j4 && cd .. - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt From 9e9a36ee651502b69717895385387951a2d0802a Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Thu, 27 Sep 2018 16:33:49 +0200 Subject: [PATCH 29/87] Fix infinite loop when walking up the directory hierarchy (#1183) A single find_package(harfbuzz) line in user code resulted in this loop getting stuck when _harfbuzz_libdir_iter became "/". --- src/harfbuzz-config.cmake.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/harfbuzz-config.cmake.in b/src/harfbuzz-config.cmake.in index 87b15721a..304410d9b 100644 --- a/src/harfbuzz-config.cmake.in +++ b/src/harfbuzz-config.cmake.in @@ -12,7 +12,11 @@ set(_harfbuzz_libdir "@libdir@") string(REPLACE "${_harfbuzz_remove_string}/" "" _harfbuzz_libdir "${_harfbuzz_libdir}") set(_harfbuzz_libdir_iter "${_harfbuzz_libdir}") while (_harfbuzz_libdir_iter) + set(_harfbuzz_libdir_prev_iter "${_harfbuzz_libdir_iter}") get_filename_component(_harfbuzz_libdir_iter "${_harfbuzz_libdir_iter}" DIRECTORY) + if (_harfbuzz_libdir_prev_iter STREQUAL _harfbuzz_libdir_iter) + break() + endif () get_filename_component(_harfbuzz_prefix "${_harfbuzz_prefix}" DIRECTORY) endwhile () unset(_harfbuzz_libdir_iter) From 305468708dc9ce9dadad36c117c380f13bcc6a26 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 27 Sep 2018 16:54:23 -0400 Subject: [PATCH 30/87] [cache] Use atomic writes in clear() To help TSan. --- src/hb-cache.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-cache.hh b/src/hb-cache.hh index f8581b4de..ec2e8635f 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh @@ -42,7 +42,10 @@ struct hb_cache_t inline void fini (void) {} inline void clear (void) - { memset (values, 255, sizeof (values)); } + { + for (unsigned i = 0; i < ARRAY_LENGTH (values); i++) + values[i].set_relaxed (-1); + } inline bool get (unsigned int key, unsigned int *value) const { From 3ee96984f4633852736b33640c89d1706bc77e0b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 27 Sep 2018 17:20:26 -0400 Subject: [PATCH 31/87] Fixup atomics from recent change --- src/hb-atomic.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 8bc94039e..6f9d6ec2b 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -84,9 +84,9 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) #define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (AI)->fetch_add ((V), std::memory_order_acq_rel)) #define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_relaxed)) -#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_release)) +#define hb_atomic_int_impl_set(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_release)) #define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast *> (AI)->load (std::memory_order_relaxed)) -#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast *> (AI)->load (std::memory_order_acquire)) +#define hb_atomic_int_impl_get(AI) (reinterpret_cast *> (AI)->load (std::memory_order_acquire)) #define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast *> (P)->store ((V), std::memory_order_relaxed)) #define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast *> (P)->load (std::memory_order_relaxed)) @@ -253,6 +253,9 @@ static_assert ((sizeof (long) == sizeof (void *)), ""); #ifndef hb_atomic_ptr_impl_get_relaxed #define hb_atomic_ptr_impl_get_relaxed(P) (*(P)) #endif +#ifndef hb_atomic_int_impl_set +inline void hb_atomic_int_impl_get (int *AI, int v) { _hb_memory_w_barrier (); *AI = v; } +#endif #ifndef hb_atomic_int_impl_get inline int hb_atomic_int_impl_get (int *AI) { int v = *AI; _hb_memory_r_barrier (); return v; } #endif From d2542cd28c70b2ba7ab28c0fe5459a1b4a873478 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 27 Sep 2018 17:23:24 -0400 Subject: [PATCH 32/87] More atomic fixup --- src/hb-atomic.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 6f9d6ec2b..e1ecad4a5 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -289,7 +289,7 @@ struct hb_atomic_ptr_t inline void init (T* v_ = nullptr) { set_relaxed (v_); } inline void set_relaxed (T* v_) const { hb_atomic_ptr_impl_set_relaxed (&v, v_); } - inline T *get_relaxed (void) const { return hb_atomic_ptr_impl_get_relaxed (&v); } + inline T *get_relaxed (void) const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); } inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); } inline bool cmpexch (const T *old, T *new_) const{ return hb_atomic_ptr_impl_cmpexch (&v, old, new_); } From dbc3070a15290310bb5aade11d04eb24fe958094 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 28 Sep 2018 16:01:15 +0330 Subject: [PATCH 33/87] Make test-multithread pass the tsan bot test (#1193) --- test/api/test-multithread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index c87da3c0f..657188255 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -50,7 +50,7 @@ hb_font_t *font; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static void -fill_the_buffer(hb_buffer_t *buffer) +fill_the_buffer (hb_buffer_t *buffer) { hb_buffer_add_utf8 (buffer, text, sizeof (text), 0, sizeof (text)); hb_buffer_guess_segment_properties (buffer); @@ -134,6 +134,9 @@ test_body () int main (int argc, char **argv) { + // Dummy call to alleviate _guess_segment_properties thread safety-ness + hb_language_get_default (); + hb_blob_t *blob = hb_blob_create_from_file (path); hb_face_t *face = hb_face_create (blob, 0); font = hb_font_create (face); From c09bf3d50589c8eb95b322ef3e4eb8a288dacebe Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 28 Sep 2018 16:13:01 +0330 Subject: [PATCH 34/87] test-multithread, check the results on every iteration (#1194) --- test/api/test-multithread.c | 59 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 657188255..6881a00fc 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -43,9 +43,11 @@ const char *path = "/Library/Fonts/Tahoma.ttf"; #endif +int num_threads = 30; int num_iters = 200; hb_font_t *font; +hb_buffer_t *ref_buffer; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; @@ -57,6 +59,29 @@ fill_the_buffer (hb_buffer_t *buffer) hb_shape (font, buffer, NULL, 0); } +static void +validity_check (hb_buffer_t *buffer) { + if (hb_buffer_diff (ref_buffer, buffer, (hb_codepoint_t) -1, 0)) + { + fprintf (stderr, "One of the buffers was different from the reference.\n"); + char out[255]; + + hb_buffer_serialize_glyphs (buffer, 0, hb_buffer_get_length (ref_buffer), + out, sizeof (out), NULL, + font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + fprintf (stderr, "Actual: %s\n", out); + + hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), + out, sizeof (out), NULL, + font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + fprintf (stderr, "Expected: %s\n", out); + + exit (1); + } +} + static void * thread_func (void *data) { @@ -70,6 +95,7 @@ thread_func (void *data) { hb_buffer_clear_contents (buffer); fill_the_buffer (buffer); + validity_check (buffer); } return 0; @@ -95,38 +121,12 @@ test_body () /* Let them loose! */ pthread_mutex_unlock (&mutex); - hb_buffer_t *ref_buffer = hb_buffer_create (); - fill_the_buffer (ref_buffer); - for (i = 0; i < num_threads; i++) { pthread_join (threads[i], NULL); - hb_buffer_t *buffer = buffers[i]; - hb_buffer_diff_flags_t diff = hb_buffer_diff (ref_buffer, buffer, (hb_codepoint_t) -1, 0); - if (diff) - { - fprintf (stderr, "One of the buffers (%d) was different from the reference.\n", i); - char out[255]; - - hb_buffer_serialize_glyphs (buffer, 0, hb_buffer_get_length (ref_buffer), - out, sizeof (out), NULL, - font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); - fprintf (stderr, "Actual: %s\n", out); - - hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), - out, sizeof (out), NULL, - font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); - fprintf (stderr, "Expected: %s\n", out); - - exit (1); - } - hb_buffer_destroy (buffer); + hb_buffer_destroy (buffers[i]); } - hb_buffer_destroy (ref_buffer); - free (buffers); free (threads); } @@ -141,11 +141,16 @@ main (int argc, char **argv) hb_face_t *face = hb_face_create (blob, 0); font = hb_font_create (face); + ref_buffer = hb_buffer_create (); + fill_the_buffer (ref_buffer); + hb_ft_font_set_funcs (font); test_body (); hb_ot_font_set_funcs (font); test_body (); + hb_buffer_destroy (ref_buffer); + hb_font_destroy (font); hb_face_destroy (face); hb_blob_destroy (blob); From 598be3bb38fd11a288f8155b8c27ffef4ebdd8b9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 08:33:26 -0400 Subject: [PATCH 35/87] Minor --- test/api/test-multithread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 6881a00fc..898f19a0f 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -135,6 +135,7 @@ int main (int argc, char **argv) { // Dummy call to alleviate _guess_segment_properties thread safety-ness + // https://github.com/harfbuzz/harfbuzz/issues/1191 hb_language_get_default (); hb_blob_t *blob = hb_blob_create_from_file (path); From 21fbee831e0eab2c2f4513825c939158f4578156 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 08:43:37 -0400 Subject: [PATCH 36/87] [test-multithread] Take num-threads and num-iters from command-line --- test/api/test-multithread.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 898f19a0f..2dbecc9bf 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -134,6 +134,11 @@ test_body () int main (int argc, char **argv) { + if (argc > 1) + num_threads = atoi (argv[1]); + if (argc > 2) + num_iters = atoi (argv[2]); + // Dummy call to alleviate _guess_segment_properties thread safety-ness // https://github.com/harfbuzz/harfbuzz/issues/1191 hb_language_get_default (); From 7e6e094abd27fd022fe9aea1872ef82f6a0cdcec Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 08:45:57 -0400 Subject: [PATCH 37/87] [test-multithread] Install ot funcs before filling ref buffer --- test/api/test-multithread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 2dbecc9bf..a75feffaa 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -147,12 +147,13 @@ main (int argc, char **argv) hb_face_t *face = hb_face_create (blob, 0); font = hb_font_create (face); + hb_ot_font_set_funcs (font); + ref_buffer = hb_buffer_create (); fill_the_buffer (ref_buffer); - hb_ft_font_set_funcs (font); test_body (); - hb_ot_font_set_funcs (font); + hb_ft_font_set_funcs (font); test_body (); hb_buffer_destroy (ref_buffer); From b435df3a5b6f7fddc091c4362a36840305144a57 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 09:13:14 -0400 Subject: [PATCH 38/87] More atomic tuneup --- src/hb-atomic.hh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index e1ecad4a5..5cb7ca5d5 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -119,7 +119,7 @@ static inline void _hb_memory_barrier (void) #define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((LONG *) (AI), (V)) static_assert ((sizeof (LONG) == sizeof (int)), ""); -#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((P), (N), (O)) == (O)) #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) @@ -147,17 +147,17 @@ static inline int _hb_fetch_and_add (int *AI, int V) _hb_memory_r_barrier (); return result; } -static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, const void *N) +static inline bool _hb_compare_and_swap_ptr (void **P, void *O, void *N) { _hb_memory_w_barrier (); - int result = atomic_cas_ptr ((void **) P, (void *) O, (void *) N) == (void *) O; + bool result = atomic_cas_ptr (P, O, N) == O; _hb_memory_r_barrier (); return result; } #define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V)) -#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swap_ptr ((const void **) (P), (O), (N)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swap_ptr ((P), (O), (N)) #elif !defined(HB_NO_MT) && defined(__APPLE__) @@ -174,12 +174,12 @@ static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, cons #define hb_atomic_int_impl_add(AI, V) (OSAtomicAdd32Barrier ((V), (AI)) - (V)) #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100) -#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((O), (N), (P)) #else #if __ppc64__ || __x86_64__ || __aarch64__ -#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (void *) (O), (int64_t) (void *) (N), (int64_t*) (P)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P)) #else -#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (void *) (O), (int32_t) (void *) (N), (int32_t*) (P)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P)) #endif #endif @@ -254,7 +254,7 @@ static_assert ((sizeof (long) == sizeof (void *)), ""); #define hb_atomic_ptr_impl_get_relaxed(P) (*(P)) #endif #ifndef hb_atomic_int_impl_set -inline void hb_atomic_int_impl_get (int *AI, int v) { _hb_memory_w_barrier (); *AI = v; } +inline void hb_atomic_int_impl_set (int *AI, int v) { _hb_memory_w_barrier (); *AI = v; } #endif #ifndef hb_atomic_int_impl_get inline int hb_atomic_int_impl_get (int *AI) { int v = *AI; _hb_memory_r_barrier (); return v; } @@ -291,7 +291,7 @@ struct hb_atomic_ptr_t inline void set_relaxed (T* v_) const { hb_atomic_ptr_impl_set_relaxed (&v, v_); } inline T *get_relaxed (void) const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); } inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); } - inline bool cmpexch (const T *old, T *new_) const{ return hb_atomic_ptr_impl_cmpexch (&v, old, new_); } + inline bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); } mutable T *v; }; From 4cd342baea323bf9709340bbabfc092c976c239c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 09:47:45 -0400 Subject: [PATCH 39/87] Fix ubsan bot --- test/api/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index f910f9e05..ce6098543 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -81,6 +81,7 @@ if HAVE_FREETYPE TEST_PROGS += test-multithread test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS) test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS) +test_multithread_LINK = $(LINK) endif endif From 02bebe42c1ffbd8e11b232c943317c8cd8141afb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 09:51:35 -0400 Subject: [PATCH 40/87] [test/text-rendering-tests] Update from upstream --- test/shaping/data/text-rendering-tests/DISABLED | 4 ++++ .../data/text-rendering-tests/Makefile.sources | 4 ++++ .../fonts/TestMORXThirtyone.ttf | Bin 0 -> 2964 bytes .../fonts/TestMORXThirtytwo.ttf | Bin 0 -> 2948 bytes .../fonts/TestMORXTwentynine.ttf | Bin 0 -> 3012 bytes .../text-rendering-tests/tests/MORX-29.tests | 4 ++++ .../text-rendering-tests/tests/MORX-30.tests | 4 ++++ .../text-rendering-tests/tests/MORX-31.tests | 8 ++++++++ .../text-rendering-tests/tests/MORX-32.tests | 4 ++++ 9 files changed, 28 insertions(+) create mode 100644 test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyone.ttf create mode 100644 test/shaping/data/text-rendering-tests/fonts/TestMORXThirtytwo.ttf create mode 100644 test/shaping/data/text-rendering-tests/fonts/TestMORXTwentynine.ttf create mode 100644 test/shaping/data/text-rendering-tests/tests/MORX-29.tests create mode 100644 test/shaping/data/text-rendering-tests/tests/MORX-30.tests create mode 100644 test/shaping/data/text-rendering-tests/tests/MORX-31.tests create mode 100644 test/shaping/data/text-rendering-tests/tests/MORX-32.tests diff --git a/test/shaping/data/text-rendering-tests/DISABLED b/test/shaping/data/text-rendering-tests/DISABLED index 58de258f8..1ce62e072 100644 --- a/test/shaping/data/text-rendering-tests/DISABLED +++ b/test/shaping/data/text-rendering-tests/DISABLED @@ -28,6 +28,10 @@ tests/MORX-25.tests tests/MORX-26.tests tests/MORX-27.tests tests/MORX-28.tests +tests/MORX-29.tests +tests/MORX-30.tests +tests/MORX-31.tests +tests/MORX-32.tests # Rounding differences tests/SHARAN-1.tests diff --git a/test/shaping/data/text-rendering-tests/Makefile.sources b/test/shaping/data/text-rendering-tests/Makefile.sources index 4be9d05d7..5c8cd03f9 100644 --- a/test/shaping/data/text-rendering-tests/Makefile.sources +++ b/test/shaping/data/text-rendering-tests/Makefile.sources @@ -52,7 +52,11 @@ DISBALED_TESTS = \ tests/MORX-26.tests \ tests/MORX-27.tests \ tests/MORX-28.tests \ + tests/MORX-29.tests \ tests/MORX-2.tests \ + tests/MORX-30.tests \ + tests/MORX-31.tests \ + tests/MORX-32.tests \ tests/MORX-3.tests \ tests/MORX-4.tests \ tests/MORX-5.tests \ diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyone.ttf b/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyone.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c64c12c06957ef34e90ddeba7e18ad7b1acc0c84 GIT binary patch literal 2964 zcmb7GTWlLe6umQ>+DVO zo%=ZV&fNzwBC^pbk|;bl+!0ANr<#da7o>-dq!U^8B5MbK5&X@^Cg+a6pRW9hh>sGj zxGR-RjMtskzs24Mn6VTDRvW(`^d-#JRC?w_;B)pU?4JhTJ2`bEQDd zBJwfpuL7^6r>0LR?GMC=R{jqDrA#87?EZcKheTGy=bvY%ax-i#JBj_*vA=}`cFd>l z{AA}r`=-B0l751OzMNb4t60DK;=)#<{11}Ce*|kKE~FT+k$%c|;ogJ&MM*I{nS18F z&XCm64yrH&47Ofc0eZZkCh?2xaY!opBcd9#(_GmBim;H-5z1E^dv}fuP%kMoCMm#h z0hlj9Pvk=E5*L+J3}jyT7YM!oHrX!fU>UNpgXCwE#92SQYyno`Q8K(%BZuAKYpD`h zSm6D7>Z1V~rm=k9h_)I0F6fNr^ZD=cALT#HzlXZKWnzK`!Agvk=#*-z0u{n_6Fp0x z(q-1gGVCqh#5eK;zlT4=U*qSYfqE4xZ=)t6x9*5)EfLw_Qd?SMU;=83&jQx1wRq>a zeSZG(AN;ydD17;kj!>wB+neWkErfs0dqZJf8x}i%hEZ5)nO|qQXNtSma5Zk#Jes6R z+LB|&Efsc)W2i20mos3{8m0FHkCG>t7@@OEa$6`A0 zs}4Yj*Oc3~|BOb!OUjcVV}gHP6Vx*L?%##NpEV$k#5dfQs7WNlZ&;l-0o zZ*jP`J>jWeH&j|RUs>$9Zn3C7JsQ&@ZcjX*qI{@cG2}p4UFX@`=J%{^Qa1LCj*smx z27J#wQe(@;daA33ny1EYzNNH^E?Qj{X(>IYNK52b46-kM^uU96SGBi=!k(i0^QpsQ z2a!mJrf-OUU2;NA6fE`akCYyMJgx_IO}5G&SzU_4?Z$B%jqq}3=f~mj$HiDB-SDmB zXUC>Z;#OKYmB{0}(r{=6Tn-I~76@uiT(w-5wWsIjxqWUfbY>49JadR~E)5*n&6&in z6pn9M{EaymPcGEA`E858F!xG-yYtnu3_D9REbs21q=vnS2LMhjyq@d2<|t;myyGuE z$~oivA9@UTb_GL8#xJtEdar7KgWb1y$>CM(Z!DfHL$m$g(F8;fp$xj)t>Gxp%|H~5 z89ikU6q?HI0pP1*yl2hUXk*alTytHM+pPqe+dTfwq1JBCnuf4TuD2`AtAnnqpVi-8 zz6x8_euu+RUFWE;@wO|0NJD+qp6Z%fTUD*2rh4^SytFuV&;pBaJKi-;qNN5z@!V!p z%GzsNukYR7lz6yNb~QM;eM3C9eU>F(kUjOTA=uk!jAeNv-gfw=#C-wtd68XKj~X+9=IrTbSUUg>n!bGshx@jZ9%y)1by}|+I^Tah_ZB^q{w{Gsq z+%`A0?S}L$w`VeMznRUxV}1b^SU>bDi5!N$tm+fpJ*ndfZa;nc>$4BTrx!k>(7{{S zsp>7VRg+uvcb{Ul=blG{el)Q0n*lrxVpP#IdV^Jn_q7n2G$S84ljf+>fdXAY5t=N} z7SPWZ=qhTY&kA%6^U^N`x|RlbWr23mO1_V_(iCNB4pArYO;6DbzBI35Mkq|3)CFoU zWw3VydgGMD7ev8#Cj)*x-3UGhi(NEGLo^CL1bnZSM+jCA+J&N#3)dSe=LrPfj^UoNtNB}z)RGM=Qe=vPRQuH z7-` literal 0 HcmV?d00001 diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtytwo.ttf b/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtytwo.ttf new file mode 100644 index 0000000000000000000000000000000000000000..07ed76c1b7738ddf0f841cbe2bf4a633c8829ce0 GIT binary patch literal 2948 zcmb7GU2Gdw7C!e*u;V(3QAR)xa00v3u855RU;Xb}QLkl+FF52|=WynsMjiUdd?gjlpIEvSeW8uQ&5$BnHD z#2wwa=bU?fzH{cx%q2!db~;NEMMlRvqv@7(3lZyv^!DSKWR5+>I>28Bf7{8~r4w&u zsy`v(lSDV%l};t6>(A|d8GCPI#?ug3?fg9GE0}HR%);s5N9+RZp8(%CJ9j);Yq77u zJ_g>ONuJIj@=5G(1g~V~=1;eU*t0|%eg=PkHknEF{{P4=L{`M-U*zWU3v3HJgZsri$`E^x#ri5oR zR})svt4XS)tvP1gQsuBX$LfQ3x$P_g&c{fTfGO{1Kuso z%8uU2>8Zn|fNy#xYVEmrZ%xfu%iPp$ca&GrO`9qrt)=G@X^H$wK@Me39J%jqTSt31 z;w`zqls-0f6p3_d`u4=9WlyM?Lgl^#(ej6%Na!J5ldZB>R@b6%hw-?LMtHib>-|XN z{Zg#5Zus2!ALq`U;#OWcmB{PA)^KPATuu!SEf~^VxaznpYfmgMbH~zB_`w5w^ugO1 z=hDdW{hUesTH*M>>i?K)^~_2`d%(W>9rJ7mbhw_c$grzC!^-XsNovH0cmUwiBHOsG zYtB-p>pTAP1AFlU7K%e_IQ+FOS?DFA8zaMZf=aYs+L}#U@X_MbNh>VM9r)I` zh}Ieq#q*d=DQhq6y18$6bMk>E+1=>kj_rx~?nRdRm+WnDkHOwfQ!K}u@U`1Wl<)`5 z_eFMFy=usOZ~d}cdt(A)^5DLS(>qnaKe%Vl%CU(<$>hXx`}F?(@u(J`NyAqFSSEm_ zri4X!Q3V=3rmC`bacHO~of+Pke5T9Qz#V$5*Z*wLPQtn@{kS!S=PvO9MlN|tH77So~bcwWSoLl z9@1&ZPk|Qs&x2loC!srzN(^HiMFoZKde6gU9uzuc*ybS>u@%&In=zGjxXPohVM)@T zk;9Bp!(+IM$cx|w3dP8BkoxI>K`+pDtl}vy0MmB7mz_p6#M8||mPb^9VHWEgayg0p zQPg9&WRoviiLNm7pF{5RsAy`PO*zth$;*w!y!wG+0CN(^ri^s}tN2nF1E-XzNmbnI z!AsPJcQ}ZDP}u0fIB66kop#_2=)u0}gMkwBY*E72&U`oxiSv=zTN{&#d9V{QE2bM$ koVB)L4jShxj)R|hT7n2edz+Pru;BSIIetu!) z++VWw9}@9tqAd?+=F+pSE7w28+Fvn}83?R){sib-7#*4H(#7!m>>1d<1b%QKe>UA{ zv9G~C0X~>bUo0T;QyXWXXgg5p8SHyiunAqLcX}fcCt%E zTi?R^J`&h5o)7)$>r>9Y|B)np4hem*vghR=~FSvSq%}Phhww_QW=#758 zbEj3ZcB!%0`X#2fyS)dV_c!gDtgc$HCU#1C4GoiR`I+NCtgfP$w%0`3NY5kE68Tkv9Lt_N`Q#(E zuFh!8UvYmUb7tlg66x0TJ*khXcBqvi)xJaV>djB3^oXv>R@pDB8&SB^*lwc{e&5sc zZY=h0C0128eB%C>yRT0?sw<}w`Ga>F4y}OOtzpx`5zT|!!DU%{X?2x5S5~4=ALipv zpJtp(V`nEgllYy&@qO$6WuEm*YfYUY`})6`Z)>Q_^GZ#IJ=Gc3c6UTlV*$hi0FM^i z&2?RKS2Eq)@i(90obeMsdlpZ22SZiHFEdwDKy|*x9$UZV4k*so)-TndIrzuHs&Tc#5cDox~?xw~-mlBRQH`xw1G&<}yhr6+1`%ZkcICaw+i*qNw zH6Egk21N0EW>d=AtNZU8JlL9kszvrTd$@B?DtU03&HYyPH+d&vZ>Jen;4S#t;h&NU zhRydy_FDaF#C&gqvR8X!3fJ_}(W#4lYA_f+bZG6&)UkAWYPEBAVj>yWlJgn(3IWR$ zuryS#2rsHYqbF2V)~*c?_h+&r+tPpN@icL#o)`%J`pOkHcP$z^jISq${XFdL$VBs} zG+}L3Q??%s4di~jl0WeM>@s)ea@YS@DE!&{1FW$T=+_gu4SiYF=lcgT7t-AM_~Rd4 zeF{DU@R@)PzQP_=ZL?=2(^=@v(j5LE3jRAe@Vn^;;ES*rrE!|1Y4FRCaepJJ{S)V{-)2iolq`tl-SCh*@A02r|f~2Pa$Xa_Gl}k)#yv_8;2xqG+~SL2 zTsW=7O{(VU0xzNGLlnlpC~EX#k~DOz3#G(?SDk=4^payxso?#Evu- literal 0 HcmV?d00001 diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-29.tests b/test/shaping/data/text-rendering-tests/tests/MORX-29.tests new file mode 100644 index 000000000..82fd96300 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-29.tests @@ -0,0 +1,4 @@ +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+004D,U+004D,U+0059,U+0059,U+0041,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|M@1880,0|X@2710,0|X@3074,0|M@3438,0|I@4268,0|N@5098,0|S@5928,0|M@6758,0|Y@7588,0|Y@7920,0|A@8252,0|Z@9082,0|Z@9404,0] +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+004D,U+004D,U+0059,U+0059,U+0042,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|M@1880,0|X@2710,0|X@3074,0|M@3438,0|M@4268,0|I@5098,0|N@5928,0|S@6758,0|Y@7588,0|Y@7920,0|B@8252,0|Z@9082,0|Z@9404,0] +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+004D,U+004D,U+0059,U+0059,U+0043,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|M@1880,0|X@2710,0|X@3074,0|M@3438,0|M@4268,0|Y@5098,0|Y@5430,0|I@5762,0|N@6592,0|S@7422,0|C@8252,0|Z@9082,0|Z@9404,0] +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+004D,U+004D,U+0059,U+0059,U+0044,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|M@1880,0|X@2710,0|X@3074,0|M@3438,0|M@4268,0|Y@5098,0|Y@5430,0|D@5762,0|I@6592,0|N@7422,0|S@8252,0|Z@9082,0|Z@9404,0] diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-30.tests b/test/shaping/data/text-rendering-tests/tests/MORX-30.tests new file mode 100644 index 000000000..ad4ab2170 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-30.tests @@ -0,0 +1,4 @@ +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+0058,U+0041,U+0059,U+0059,U+0041,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|I@1880,0|N@2710,0|S@3540,0|I@4370,0|N@5200,0|S@6030,0|M@6860,0|X@7690,0|X@8054,0|X@8418,0|A@8782,0|Y@9612,0|Y@9944,0|A@10276,0|Z@11106,0|Z@11428,0] +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+0058,U+0041,U+0059,U+0059,U+0042,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|I@1880,0|I@2710,0|N@3540,0|S@4370,0|N@5200,0|S@6030,0|M@6860,0|X@7690,0|X@8054,0|X@8418,0|A@8782,0|Y@9612,0|Y@9944,0|B@10276,0|Z@11106,0|Z@11428,0] +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+0058,U+0042,U+0059,U+0059,U+0041,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|I@1880,0|N@2710,0|S@3540,0|M@4370,0|I@5200,0|N@6030,0|S@6860,0|X@7690,0|X@8054,0|X@8418,0|B@8782,0|Y@9612,0|Y@9944,0|A@10276,0|Z@11106,0|Z@11428,0] +../fonts/TestMORXTwentynine.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0050,U+0051,U+0052,U+004D,U+004D,U+0058,U+0058,U+0058,U+0042,U+0059,U+0059,U+0042,U+005A,U+005A:[P|Q@333,0|R@699,0|M@1050,0|M@1880,0|I@2710,0|N@3540,0|S@4370,0|I@5200,0|N@6030,0|S@6860,0|X@7690,0|X@8054,0|X@8418,0|B@8782,0|Y@9612,0|Y@9944,0|B@10276,0|Z@11106,0|Z@11428,0] diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-31.tests b/test/shaping/data/text-rendering-tests/tests/MORX-31.tests new file mode 100644 index 000000000..6cc40b6e1 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-31.tests @@ -0,0 +1,8 @@ +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0041,U+0059,U+0059,U+0041,U+005A,U+005A:[X|X@364,0|I@728,0|N@1558,0|S@2388,0|A@3218,0|Y@4048,0|Y@4380,0|A@4712,0|Z@5542,0|Z@5864,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0041,U+0059,U+0059,U+0042,U+0059,U+0059:[X|X@364,0|A@728,0|I@1558,0|N@2388,0|S@3218,0|Y@4048,0|Y@4380,0|B@4712,0|Y@5542,0|Y@5874,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0042,U+0059,U+0059,U+0041,U+005A,U+005A:[X|X@364,0|I@728,0|N@1558,0|S@2388,0|B@3218,0|Y@4048,0|Y@4380,0|A@4712,0|Z@5542,0|Z@5864,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0042,U+0059,U+0059,U+0042,U+005A,U+005A:[X|X@364,0|B@728,0|I@1558,0|N@2388,0|S@3218,0|Y@4048,0|Y@4380,0|B@4712,0|Z@5542,0|Z@5864,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0041:[I|N@830,0|S@1660,0|M@2490,0|P@3320,0|Q@3653,0|R@4019,0|I@4370,0|N@5200,0|S@6030,0|A@6860,0|X@7690,0|Y@8054,0|Z@8386,0|A@8708,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0042:[I|N@830,0|S@1660,0|M@2490,0|P@3320,0|Q@3653,0|R@4019,0|A@4370,0|I@5200,0|N@6030,0|S@6860,0|X@7690,0|Y@8054,0|Z@8386,0|B@8708,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0042,U+0058,U+0059,U+005A,U+0041:[M|I@830,0|N@1660,0|S@2490,0|P@3320,0|Q@3653,0|R@4019,0|I@4370,0|N@5200,0|S@6030,0|B@6860,0|X@7690,0|Y@8054,0|Z@8386,0|A@8708,0] +../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0042,U+0058,U+0059,U+005A,U+0042:[M|I@830,0|N@1660,0|S@2490,0|P@3320,0|Q@3653,0|R@4019,0|B@4370,0|I@5200,0|N@6030,0|S@6860,0|X@7690,0|Y@8054,0|Z@8386,0|B@8708,0] diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-32.tests b/test/shaping/data/text-rendering-tests/tests/MORX-32.tests new file mode 100644 index 000000000..6f3ae888e --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-32.tests @@ -0,0 +1,4 @@ +../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0041:[I|N@830,0|S@1660,0|A@2490,0] +../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0041,U+0059:[I|N@830,0|S@1660,0|X@2490,0|A@2854,0|Y@3684,0] +../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0042:[B|I@830,0|N@1660,0|S@2490,0] +../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0042,U+0059:[X|I@364,0|N@1194,0|S@2024,0|B@2854,0|Y@3684,0] From 0d18ec5467818fa8f763ec2871146a64d39987e7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 10:00:07 -0400 Subject: [PATCH 41/87] [morx] unsafe-to-break in Insertion Makes MORX-29, MORX-30, MORX-31 pass. --- src/hb-aat-layout-morx-table.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index a8b287fde..08fe73543 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -629,6 +629,8 @@ struct InsertionSubtable buffer->skip_glyph (); buffer->move_to (end + count); + + buffer->unsafe_to_break_from_outbuffer (mark, MIN (buffer->idx + 1, buffer->len)); } if (entry->data.currentInsertIndex != 0xFFFF) From f4072e8cb81072cd6d51a2607efedb76c02e7db1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 10:14:23 -0400 Subject: [PATCH 42/87] [morx] Remove mark_set from Insertion text-rendering-tests test MORX-32 shows that for Insertion, an unset mark is treated as mark set at 0. This is unlike the Reordering lookup where un unset mark performs nothing. Fixes MORX-32. --- src/hb-aat-layout-morx-table.hh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 08fe73543..60d05e61a 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -592,7 +592,6 @@ struct InsertionSubtable hb_aat_apply_context_t *c_) : ret (false), c (c_), - mark_set (false), mark (0), insertionAction (table+table->insertionAction) {} @@ -608,7 +607,7 @@ struct InsertionSubtable hb_buffer_t *buffer = driver->buffer; unsigned int flags = entry->flags; - if (entry->data.markedInsertIndex != 0xFFFF && mark_set) + if (entry->data.markedInsertIndex != 0xFFFF) { unsigned int count = (flags & MarkedInsertCount); unsigned int start = entry->data.markedInsertIndex; @@ -669,10 +668,7 @@ struct InsertionSubtable } if (flags & SetMark) - { - mark_set = true; mark = buffer->out_len; - } return true; } @@ -681,7 +677,6 @@ struct InsertionSubtable bool ret; private: hb_aat_apply_context_t *c; - bool mark_set; unsigned int mark; const UnsizedArrayOf &insertionAction; }; From 8cb8209c911a69442f23f744981e3ed01e44a3fc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 10:55:28 -0400 Subject: [PATCH 43/87] Fix bot fails --- test/api/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index ce6098543..20057aa22 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -81,7 +81,7 @@ if HAVE_FREETYPE TEST_PROGS += test-multithread test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS) test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS) -test_multithread_LINK = $(LINK) +test_multithread_LINK = $(LINK) $(test_multithread_LDADD) endif endif From 33231a855f0e3d2a14e5e2fcb921c6fc773ae6cf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 11:06:49 -0400 Subject: [PATCH 44/87] Fix pthread fail for real Using a hack... --- test/api/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 20057aa22..02e878034 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -81,7 +81,9 @@ if HAVE_FREETYPE TEST_PROGS += test-multithread test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS) test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS) -test_multithread_LINK = $(LINK) $(test_multithread_LDADD) +# The auto-generated link rule somehow includes CFLAGS as well. Without +# it, pthread link fails, because, who knows why, $PTHREAD_LIBS is empty. +test_multithread_LINK = $(LINK) $(PTHREAD_CFLAGS) endif endif From d289d6381864649504abfb1196ac20a1d4664a4e Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 28 Sep 2018 20:47:21 +0330 Subject: [PATCH 45/87] [ci] Trying to fix mingw bot As https://github.com/Alexpux/MSYS2-packages/issues/702 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cc4acec1c..356afce66 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,7 @@ environment: MSYS2_ARCH: i686 install: - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Syu --noconfirm"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --force -Syu --noconfirm"' - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel" build_script: From 7b68edf2abc7680199360d52ed283cfc4f49b7d5 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 28 Sep 2018 20:53:48 +0330 Subject: [PATCH 46/87] [tests] Don't try to get glyph names on failures As it may cause a race unrelated to the issue actually happened --- test/api/test-multithread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index a75feffaa..63dd8d7eb 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -69,13 +69,13 @@ validity_check (hb_buffer_t *buffer) { hb_buffer_serialize_glyphs (buffer, 0, hb_buffer_get_length (ref_buffer), out, sizeof (out), NULL, font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES); fprintf (stderr, "Actual: %s\n", out); hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), out, sizeof (out), NULL, font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES); fprintf (stderr, "Expected: %s\n", out); exit (1); From d4d261a97723b27fb9ad9a69b8dc7fd8c560a98b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 29 Sep 2018 01:57:50 +0330 Subject: [PATCH 47/87] [ci] Another try on fixing mingw bots Per https://github.com/Alexpux/MSYS2-packages/issues/163#issuecomment-73555971 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 356afce66..30bcb0a2b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,7 @@ environment: MSYS2_ARCH: i686 install: - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --force -Syu --noconfirm"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Sy && pacman -S pacman-mirrors && pacman --force -Syu --noconfirm"' - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel" build_script: From 9be8062b4d241f02bb96df436e98f10f08bda4f8 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 29 Sep 2018 02:11:05 +0330 Subject: [PATCH 48/87] [ci] Another try on mingw bot --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 30bcb0a2b..f10078fdd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,7 @@ environment: MSYS2_ARCH: i686 install: - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Sy && pacman -S pacman-mirrors && pacman --force -Syu --noconfirm"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --force --noconfirm -Sy && pacman --noconfirm --force -S pacman-mirrors && pacman --force -Syu --noconfirm"' - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel" build_script: @@ -44,8 +44,8 @@ build_script: - 'if "%compiler%"=="msvc" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%' - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" ctest --output-on-failure -C %configuration%' - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syyu mingw-w64-$MSYS2_ARCH-gcc"' - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config,python2}"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm --force -Syyu mingw-w64-$MSYS2_ARCH-gcc"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm --force -S --needed mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config,python2}"' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "curl https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h > %MINGW_PREFIX%/%MINGW_CHOST%/include/dwrite_1.h"' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || .ci/fail.sh"' From 909a07b587884e9cd1d92ba9f3d5b96d8774c67a Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 29 Sep 2018 03:10:13 +0330 Subject: [PATCH 49/87] [circleci] Improve clang-everything bot log, more to come #1196 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3271599d..67caff063 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-documentation-unknown-command -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: make check || .ci/fail.sh From 9b0b40b3c1ac8155c80ed5dc976228f4d3ec7e1f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 11:16:18 -0400 Subject: [PATCH 50/87] Fix fallback kerning to check for current glyph's mask --- src/hb-ot-shape-fallback.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index 5f43023be..5fec9d87d 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -444,7 +444,8 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, if (!plan->has_kern) return; OT::hb_ot_apply_context_t c (1, font, buffer); - c.set_lookup_mask (plan->kern_mask); + hb_mask_t kern_mask = plan->kern_mask; + c.set_lookup_mask (kern_mask); c.set_lookup_props (OT::LookupFlag::IgnoreMarks); OT::hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c.iter_input; skippy_iter.init (&c); @@ -454,6 +455,12 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, hb_glyph_position_t *pos = buffer->pos; for (unsigned int idx = 0; idx < count;) { + if (!(buffer->cur().mask & kern_mask)) + { + idx++; + continue; + } + skippy_iter.reset (idx, 1); if (!skippy_iter.next ()) { From c763b9440189b541316054ba4f623e728b5aae77 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 28 Sep 2018 20:53:07 -0400 Subject: [PATCH 51/87] [test-multithread] Disable FreeType funcs --- test/api/test-multithread.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 63dd8d7eb..116260bde 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -153,8 +153,12 @@ main (int argc, char **argv) fill_the_buffer (ref_buffer); test_body (); - hb_ft_font_set_funcs (font); - test_body (); + + /* hb-font backed by FreeType functions can only be used from + * one thread at a time, because that's FT_Face's MT guarantee. + * So, disable this, even though it works "most of the time". */ + //hb_ft_font_set_funcs (font); + //test_body (); hb_buffer_destroy (ref_buffer); From 678beff64ca3b2963de25d8a76a2bf3710c3d7a6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 29 Sep 2018 10:16:14 +0330 Subject: [PATCH 52/87] [circleci] Add -Wno-reserved-id-macro to clang-everything --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67caff063..4d1adad2d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: make check || .ci/fail.sh From cefdef0247026f941eba8930c73b66b0498bb63c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 29 Sep 2018 10:19:54 +0330 Subject: [PATCH 53/87] Minor on test-multithread, align the actual and expected results --- test/api/test-multithread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 116260bde..7e357fd51 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -70,7 +70,7 @@ validity_check (hb_buffer_t *buffer) { out, sizeof (out), NULL, font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES); - fprintf (stderr, "Actual: %s\n", out); + fprintf (stderr, "Actual: %s\n", out); hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), out, sizeof (out), NULL, From 06be2aa93fa6ea8cc32684a4b51bfe927c5202bb Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 30 Sep 2018 00:15:25 +0330 Subject: [PATCH 54/87] [ci] Build glib and freetype and enable msan bot (#1198) --- .circleci/config.yml | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d1adad2d..c96e29218 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: - run: apt update && apt install -y ninja-build binutils libtool autoconf automake make cmake gcc g++ pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: ./autogen.sh - - run: make + - run: make -j32 - run: make distcheck || .ci/fail.sh - run: rm -rf harfbuzz-* - run: make distdir && cd harfbuzz-* && cmake -DHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install @@ -48,7 +48,7 @@ jobs: - run: apk update && apk add ragel make pkgconfig libtool autoconf automake gettext gcc g++ glib-dev freetype-dev cairo-dev # C??FLAGS are not needed for a regular build - run: CFLAGS="-O3" CXXFLAGS="-O3 -DHB_NO_MMAP" ./autogen.sh - - run: make + - run: make -j32 - run: make check || .ci/fail.sh archlinux-debug-O0-py3: @@ -60,7 +60,7 @@ jobs: - run: pip install fonttools # C??FLAGS are not needed for a regular build - run: CFLAGS="-O0" CXXFLAGS="-O0" CPPFLAGS="-DHB_DEBUG" ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh clang-O3-O0: @@ -71,12 +71,12 @@ jobs: - run: apt update || true - run: apt install -y ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j4 && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j32 && cd .. - run: CFLAGS="-O3" CXXFLAGS="-O3" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh - run: CFLAGS="-O0" CXXFLAGS="-O0" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh clang-everything: @@ -92,7 +92,7 @@ jobs: - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh clang-asan: @@ -108,7 +108,7 @@ jobs: - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh | asan_symbolize | c++filt clang-msan: @@ -121,11 +121,13 @@ jobs: - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake automake1.11 gtk-doc-tools gettext make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools + - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh || true && ./configure && make -j32 --ignore-errors && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make - - run: MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh | asan_symbolize | c++filt + - run: make -j32 + - run: MSAN_OPTIONS=exitcode=42 LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs:$PWD/glib-2.28.0/glib/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: @@ -139,10 +141,9 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j4 && cd .. - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make - - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt + - run: make -j32 + - run: make check || .ci/fail.sh | asan_symbolize | c++filt clang-ubsan: docker: @@ -157,7 +158,7 @@ jobs: - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh | asan_symbolize | c++filt fedora-outoftreebuild: @@ -189,7 +190,7 @@ jobs: - run: dnf install -y gcc ragel cmake make which glib2-devel freetype-devel cairo-devel libicu-devel graphite2-devel wget tar bzip2 python libnsl || true - run: wget http://$ODSUSER:$ODSPASS@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_FREETYPE=ON -Bbuild -H. - - run: make -Cbuild + - run: make -Cbuild -j32 - run: CTEST_OUTPUT_ON_FAILURE=1 make -Cbuild test - run: make -Cbuild install @@ -200,7 +201,7 @@ jobs: - 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 + - run: make -j32 crosscompile-notest-freebsd9: docker: @@ -209,7 +210,7 @@ jobs: - checkout - run: apt update && apt install -y pkg-config ragel - run: ./autogen.sh --prefix=/freebsd --host=x86_64-pc-freebsd9 - - run: make + - run: make -j32 crosscompile-notest-psvita: docker: @@ -219,7 +220,7 @@ jobs: - run: apt update && apt install ragel - run: git clone https://github.com/vitasdk/vdpm && cd vdpm && ./bootstrap-vitasdk.sh - run: ./autogen.sh --prefix=/usr/local/vitasdk/arm-vita-eabi --host=arm-vita-eabi - - run: make + - run: make -j32 crosscompile-cmake-notest-android-arm: docker: @@ -283,7 +284,7 @@ workflows: - clang-O3-O0 - clang-everything - clang-asan - #- clang-msan # https://github.com/harfbuzz/harfbuzz/issues/1175 + - clang-msan - clang-tsan - clang-ubsan - fedora-outoftreebuild From ba0f0f156fe05bda760efcb0c8d34f303fa26ab0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 03:49:52 -0400 Subject: [PATCH 55/87] Document setlocale() threadsafety issue "Fixes" //github.com/harfbuzz/harfbuzz/issues/1191 --- src/hb-buffer.cc | 2 ++ src/hb-common.cc | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 8fecea721..c9824ec36 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -1499,6 +1499,8 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer) * it will be set to the process's default language as returned by * hb_language_get_default(). This may change in the future by * taking buffer script into consideration when choosing a language. + * Note that hb_language_get_default() is NOT threadsafe the first time + * it is called. See documentation for that function for details. * * Since: 0.9.7 **/ diff --git a/src/hb-common.cc b/src/hb-common.cc index a9c62e802..16f870142 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -361,7 +361,14 @@ hb_language_to_string (hb_language_t language) /** * hb_language_get_default: * + * Get default language from current locale. * + * Note that the first time this function is called, it calls + * "setlocale (LC_CTYPE, nullptr)" to fetch current locale. The underlying + * setlocale function is, in many implementations, NOT threadsafe. To avoid + * problems, call this function once before multiple threads can call it. + * This function is only used from hb_buffer_guess_segment_properties() by + * HarfBuzz itself. * * Return value: (transfer none): * From bd07d2878ff28baecf7b4b587a18ffbb744b7eb1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 03:54:40 -0400 Subject: [PATCH 56/87] Use buffer scratch_flags to remember if we had any joiners --- src/hb-buffer.hh | 3 ++- src/hb-ot-layout.hh | 12 ++++++++++-- src/hb-ot-shape-complex-arabic.cc | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index bcaf066c7..24d46400a 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -68,7 +68,8 @@ enum hb_buffer_scratch_flags_t { HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u, HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u, HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u, - HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u, + HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS = 0x00000020u, + HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000040u, /* Reserved for complex shapers' internal use. */ HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u, diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 7a787b77e..d9b954f4c 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -224,8 +224,16 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) { buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES; props |= UPROPS_MASK_IGNORABLE; - if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ; - else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ; + if (u == 0x200Cu) + { + props |= UPROPS_MASK_Cf_ZWNJ; + buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS; + } + else if (u == 0x200Du) + { + props |= UPROPS_MASK_Cf_ZWJ; + buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS; + } /* Mongolian Free Variation Selectors need to be remembered * because although we need to hide them like default-ignorables, * they need to non-ignorable during shaping. This is similar to diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index d136a6644..c4a695ab9 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -399,6 +399,9 @@ flip_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) { + if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS)) + return; + unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) From 8a31e406291f4cb27480fc85049f08abd739cb59 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 05:27:39 -0400 Subject: [PATCH 57/87] [font] Make *_advance() fallback to *_advances And remove redundant implementations. --- src/hb-font.cc | 12 ++++++++++++ src/hb-ft.cc | 19 ------------------- src/hb-ot-font.cc | 22 ---------------------- 3 files changed, 12 insertions(+), 41 deletions(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index 77762f2d8..c0beea66e 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -141,6 +141,12 @@ hb_font_get_glyph_h_advance_default (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { + if (font->has_glyph_h_advances_func ()) + { + hb_position_t ret; + font->get_glyph_h_advances (1, &glyph, 0, &ret, 0); + return ret; + } return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph)); } @@ -159,6 +165,12 @@ hb_font_get_glyph_v_advance_default (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { + if (font->has_glyph_v_advances_func ()) + { + hb_position_t ret; + font->get_glyph_v_advances (1, &glyph, 0, &ret, 0); + return ret; + } return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph)); } diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 50182f1b6..6da31fc29 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -218,24 +218,6 @@ hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED, return true; } -static hb_position_t -hb_ft_get_glyph_h_advance (hb_font_t *font, - void *font_data, - hb_codepoint_t glyph, - void *user_data HB_UNUSED) -{ - const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; - FT_Fixed v; - - if (unlikely (FT_Get_Advance (ft_font->ft_face, glyph, ft_font->load_flags, &v))) - return 0; - - if (font->x_scale < 0) - v = -v; - - return (v + (1<<9)) >> 10; -} - static void hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, unsigned count, @@ -480,7 +462,6 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_tcmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph); } -static hb_position_t -hb_ot_get_glyph_h_advance (hb_font_t *font, - void *font_data, - hb_codepoint_t glyph, - void *user_data HB_UNUSED) -{ - const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data; - return font->em_scale_x (ot_face->hmtx.get_relaxed ()->get_advance (glyph, font)); -} - static void hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, unsigned count, @@ -93,16 +83,6 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, } } -static hb_position_t -hb_ot_get_glyph_v_advance (hb_font_t *font, - void *font_data, - hb_codepoint_t glyph, - void *user_data HB_UNUSED) -{ - const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data; - return font->em_scale_y (-(int) ot_face->vmtx.get_relaxed ()->get_advance (glyph, font)); -} - static void hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data, unsigned count, @@ -217,9 +197,7 @@ static struct hb_ot_face_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t Date: Sun, 30 Sep 2018 05:34:30 -0400 Subject: [PATCH 58/87] Tweak HB_TAG and HB_UNTAG uint32_t was getting promoted to signed int, which is not what we wanted... Wow, clang has become good at generating warnings... ../../src/hb-common.h:349:29: warning: signed shift result (0xFF000000) sets the sign bit of the shift expression's type ('int') and becomes negative [-Wshift-sign-overflow] _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ ^~~~~~~~~~ ../../src/hb-common.h:93:20: note: expanded from macro 'HB_TAG_MAX' define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/hb-common.h:89:57: note: expanded from macro 'HB_TAG' define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4)))) ~~~~~~~~~~~~~~~^ ~~ ../../src/hb-common.h:349:3: warning: ISO C restricts enumerator values to range of 'int' (4294967295 is too large) [-Wpedantic] _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ ^ ~~~~~~~~~~ --- src/hb-common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-common.h b/src/hb-common.h index fdceff9dc..37bbb2b14 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -86,8 +86,8 @@ typedef union _hb_var_int_t { typedef uint32_t hb_tag_t; -#define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4)))) -#define HB_UNTAG(tag) ((uint8_t)((tag)>>24)), ((uint8_t)((tag)>>16)), ((uint8_t)((tag)>>8)), ((uint8_t)(tag)) +#define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF))) +#define HB_UNTAG(tag) (((tag)>>24)&0xFF), (((tag)>>16)&0xFF), (((tag)>>8)&0xFF), ((tag)&0xFF) #define HB_TAG_NONE HB_TAG(0,0,0,0) #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) From b1e07e1e6cc7a8e5445c7aeb9491ae629029011b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 05:43:22 -0400 Subject: [PATCH 59/87] [indic/khmer] Remove use of global constructors Alternative woul have been to resurrect F_COMBINE that I removed in 70136a78cb9eda244767f8e8a3d30d0f3c569d01 But this does it for now. I'm not sure why check-static-inits.sh didn't catch this before. Clang -Weverything bot did: CXX libharfbuzz_la-hb-ot-shape-complex-indic.lo hb-ot-shape-complex-indic.cc:99:1: warning: declaration requires a global constructor [-Wglobal-constructors] indic_features[] = ^ 1 warning generated. CXX libharfbuzz_la-hb-ot-shape-complex-khmer.lo hb-ot-shape-complex-khmer.cc:36:1: warning: declaration requires a global constructor [-Wglobal-constructors] khmer_features[] = ^ 1 warning generated. --- src/hb-ot-map.hh | 2 ++ src/hb-ot-shape-complex-indic.cc | 34 ++++++++++++++++---------------- src/hb-ot-shape-complex-khmer.cc | 18 ++++++++--------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 13bbc8fe5..cc8b8d842 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -174,11 +174,13 @@ enum hb_ot_map_feature_flags_t F_MANUAL_ZWNJ = 0x0004u, /* Don't skip over ZWNJ when matching **context**. */ F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */ F_MANUAL_JOINERS = F_MANUAL_ZWNJ | F_MANUAL_ZWJ, + F_GLOBAL_MANUAL_JOINERS= F_GLOBAL | F_MANUAL_JOINERS, F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */ F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ }; HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); + struct hb_ot_map_feature_t { hb_tag_t tag; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 1fec0e566..4131e705d 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -102,29 +102,29 @@ indic_features[] = * Basic features. * These features are applied in order, one at a time, after initial_reordering. */ - {HB_TAG('n','u','k','t'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('r','p','h','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('r','k','r','f'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('h','a','l','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('v','a','t','u'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('c','j','c','t'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('n','u','k','t'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('a','k','h','n'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('r','p','h','f'), F_MANUAL_JOINERS}, + {HB_TAG('r','k','r','f'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('p','r','e','f'), F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','f'), F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','f'), F_MANUAL_JOINERS}, + {HB_TAG('h','a','l','f'), F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','f'), F_MANUAL_JOINERS}, + {HB_TAG('v','a','t','u'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('c','j','c','t'), F_GLOBAL_MANUAL_JOINERS}, /* * Other features. * These features are applied all at once, after final_reordering. * Default Bengali font in Windows for example has intermixed * lookups for init,pres,abvs,blws features. */ - {HB_TAG('i','n','i','t'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('h','a','l','n'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('i','n','i','t'), F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('b','l','w','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('p','s','t','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('h','a','l','n'), F_GLOBAL_MANUAL_JOINERS}, /* * Positioning features. * We don't care about the types. diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index f8c0a4beb..d46f0b3a0 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -39,19 +39,19 @@ khmer_features[] = * Basic features. * These features are applied in order, one at a time, after reordering. */ - {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('c','f','a','r'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','f'), F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','f'), F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','f'), F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','f'), F_MANUAL_JOINERS}, + {HB_TAG('c','f','a','r'), F_MANUAL_JOINERS}, /* * Other features. * These features are applied all at once. */ - {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('b','l','w','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('p','s','t','s'), F_GLOBAL_MANUAL_JOINERS}, /* * Positioning features. * We don't care about the types. From e910a1aef4b2413c627240fc06d2a5696b24747a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 05:46:20 -0400 Subject: [PATCH 60/87] [util] Add empty virtual destructor to option_group_t From clang -Weverything bot: ./options.hh:57:8: warning: 'option_group_t' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor] struct option_group_t ^ --- util/options.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/options.hh b/util/options.hh index 456e0a0fc..0c929a229 100644 --- a/util/options.hh +++ b/util/options.hh @@ -56,6 +56,8 @@ void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GN struct option_group_t { + virtual ~option_group_t () {} + virtual void add_options (struct option_parser_t *parser) = 0; virtual void pre_parse (GError **error G_GNUC_UNUSED) {}; From 2e728a7d86c714d845524a0722c2b653feb9d915 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 05:47:36 -0400 Subject: [PATCH 61/87] [util] Mark var static From clang -Weverything bot: options.cc:39:3: warning: no previous extern declaration for non-static variable 'supported_font_funcs' [-Wmissing-variable-declarations] --- util/options.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/options.cc b/util/options.cc index 0ab16d628..2897ec8f3 100644 --- a/util/options.cc +++ b/util/options.cc @@ -33,7 +33,7 @@ #include #endif -struct supported_font_funcs_t { +static struct supported_font_funcs_t { char name[4]; void (*func) (hb_font_t *); } supported_font_funcs[] = From 9caa432d0c5c09c8151cfce1e2cc184fbdd89594 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 05:49:08 -0400 Subject: [PATCH 62/87] [util] Use HB_FALLTHROUGH Sure, gcc knows to warn about this as well: ../../util/options.cc:175:17: warning: this statement may fall through [-Wimplicit-fallthrough=] case 1: m.r = m.t; ~~~~^~~~~ ../../util/options.cc:176:5: note: here case 2: m.b = m.t; ^~~~ But HOLY SMOKES, look at clang -Weverything bot message: options.cc:176:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] case 2: m.b = m.t; ^ options.cc:176:5: note: insert 'HB_FALLTHROUGH;' to silence this warning case 2: m.b = m.t; ^ HB_FALLTHROUGH; Right, it's telling me to insert "HB_FALLTHROUGH;" there!!!!!!!!! --- util/options.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/options.cc b/util/options.cc index 2897ec8f3..bfb11b457 100644 --- a/util/options.cc +++ b/util/options.cc @@ -172,9 +172,9 @@ parse_margin (const char *name G_GNUC_UNUSED, view_options_t *view_opts = (view_options_t *) data; view_options_t::margin_t &m = view_opts->margin; switch (sscanf (arg, "%lf%*[ ,]%lf%*[ ,]%lf%*[ ,]%lf", &m.t, &m.r, &m.b, &m.l)) { - case 1: m.r = m.t; - case 2: m.b = m.t; - case 3: m.l = m.r; + case 1: m.r = m.t; HB_FALLTHROUGH; + case 2: m.b = m.t; HB_FALLTHROUGH; + case 3: m.l = m.r; HB_FALLTHROUGH; case 4: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, @@ -489,7 +489,7 @@ parse_font_size (const char *name G_GNUC_UNUSED, return true; } switch (sscanf (arg, "%lf%*[ ,]%lf", &font_opts->font_size_x, &font_opts->font_size_y)) { - case 1: font_opts->font_size_y = font_opts->font_size_x; + case 1: font_opts->font_size_y = font_opts->font_size_x; HB_FALLTHROUGH; case 2: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, @@ -507,7 +507,7 @@ parse_font_ppem (const char *name G_GNUC_UNUSED, { font_options_t *font_opts = (font_options_t *) data; switch (sscanf (arg, "%d%*[ ,]%d", &font_opts->x_ppem, &font_opts->y_ppem)) { - case 1: font_opts->y_ppem = font_opts->x_ppem; + case 1: font_opts->y_ppem = font_opts->x_ppem; HB_FALLTHROUGH; case 2: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, From 2382dd07fa6ff49638b146a523e9d2e93cf69ceb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 05:54:47 -0400 Subject: [PATCH 63/87] Minor --- util/options.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/options.hh b/util/options.hh index 0c929a229..1a26697d6 100644 --- a/util/options.hh +++ b/util/options.hh @@ -56,12 +56,12 @@ void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GN struct option_group_t { - virtual ~option_group_t () {} + virtual ~option_group_t (void) {} virtual void add_options (struct option_parser_t *parser) = 0; - virtual void pre_parse (GError **error G_GNUC_UNUSED) {}; - virtual void post_parse (GError **error G_GNUC_UNUSED) {}; + virtual void pre_parse (GError **error G_GNUC_UNUSED) {} + virtual void post_parse (GError **error G_GNUC_UNUSED) {} }; From 89ed040b21b366c927199bedd0e4cb060389d076 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 06:06:26 -0400 Subject: [PATCH 64/87] [util] Fix more non-virtual-destructor warnings --- util/options.hh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/util/options.hh b/util/options.hh index 1a26697d6..4d920ad03 100644 --- a/util/options.hh +++ b/util/options.hh @@ -67,7 +67,8 @@ struct option_group_t struct option_parser_t { - option_parser_t (const char *usage) { + option_parser_t (const char *usage) + { memset (this, 0, sizeof (*this)); usage_str = usage; context = g_option_context_new (usage); @@ -75,7 +76,8 @@ struct option_parser_t add_main_options (); } - ~option_parser_t (void) { + virtual ~option_parser_t (void) + { g_option_context_free (context); g_ptr_array_foreach (to_free, (GFunc) g_free, nullptr); g_ptr_array_free (to_free, TRUE); @@ -115,7 +117,8 @@ struct option_parser_t struct view_options_t : option_group_t { - view_options_t (option_parser_t *parser) { + view_options_t (option_parser_t *parser) + { annotate = false; fore = nullptr; back = nullptr; @@ -124,7 +127,7 @@ struct view_options_t : option_group_t add_options (parser); } - ~view_options_t (void) + virtual ~view_options_t (void) { g_free (fore); g_free (back); @@ -159,7 +162,7 @@ struct shape_options_t : option_group_t add_options (parser); } - ~shape_options_t (void) + virtual ~shape_options_t (void) { g_free (direction); g_free (language); @@ -463,7 +466,8 @@ struct font_options_t : option_group_t add_options (parser); } - ~font_options_t (void) { + virtual ~font_options_t (void) + { g_free (font_file); free (variations); g_free (font_funcs); @@ -496,7 +500,8 @@ struct font_options_t : option_group_t struct text_options_t : option_group_t { - text_options_t (option_parser_t *parser) { + text_options_t (option_parser_t *parser) + { text_before = nullptr; text_after = nullptr; @@ -510,7 +515,8 @@ struct text_options_t : option_group_t add_options (parser); } - ~text_options_t (void) { + virtual ~text_options_t (void) + { g_free (text_before); g_free (text_after); g_free (text); @@ -548,7 +554,8 @@ struct text_options_t : option_group_t struct output_options_t : option_group_t { output_options_t (option_parser_t *parser, - const char **supported_formats_ = nullptr) { + const char **supported_formats_ = nullptr) + { output_file = nullptr; output_format = nullptr; supported_formats = supported_formats_; @@ -558,7 +565,8 @@ struct output_options_t : option_group_t add_options (parser); } - ~output_options_t (void) { + virtual ~output_options_t (void) + { g_free (output_file); g_free (output_format); if (fp) From b5285b34798cb7ee672343d00cbe066ea8a2ef83 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 12:23:01 +0200 Subject: [PATCH 65/87] [util] Remove unneeded virtual clang warning: ../../util/options.hh:72:13: warning: destination for this 'memset' call is a pointer to dynamic class 'option_parser_t'; vtable pointer will be overwritten [-Wdynamic-class-memaccess] memset (this, 0, sizeof (*this)); ~~~~~~ ^ ../../util/options.hh:72:13: note: explicitly cast the pointer to silence this warning memset (this, 0, sizeof (*this)); ^ (void*) --- util/options.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/options.hh b/util/options.hh index 4d920ad03..40e1ab892 100644 --- a/util/options.hh +++ b/util/options.hh @@ -76,7 +76,7 @@ struct option_parser_t add_main_options (); } - virtual ~option_parser_t (void) + ~option_parser_t (void) { g_option_context_free (context); g_ptr_array_foreach (to_free, (GFunc) g_free, nullptr); From 0a9aab672287149540e8d90b5063ad4c562c423c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 30 Sep 2018 14:45:43 +0330 Subject: [PATCH 66/87] [circleci] Try to fix msan bot --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c96e29218..d5af98719 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,8 @@ jobs: - checkout - run: brew update-reset - run: brew install wget pkg-config libtool ragel freetype glib cairo - - run: wget https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 + - run: wget https:/ + /packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo # Ignoring assembler complains, https://stackoverflow.com/a/39867021 - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*' @@ -123,7 +124,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake automake1.11 gtk-doc-tools gettext make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh || true && ./configure && make -j32 --ignore-errors && cd .. + - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ ./configure && make -j32 && cd .. - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 From 24f148df3ecc899c9cf6d5359d3d35ee5e84a98c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 30 Sep 2018 14:46:56 +0330 Subject: [PATCH 67/87] [circleci] minor --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d5af98719..3335d88ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,8 +9,7 @@ jobs: - checkout - run: brew update-reset - run: brew install wget pkg-config libtool ragel freetype glib cairo - - run: wget https:/ - /packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 + - run: wget https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo # Ignoring assembler complains, https://stackoverflow.com/a/39867021 - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*' From 57aabbc29ec6dfa7f1b57da7b6c62fdc547f8ef8 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 30 Sep 2018 16:31:28 +0330 Subject: [PATCH 68/87] [circleci] Another on fixing msan --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3335d88ab..6dd605aa5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -123,11 +123,12 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake automake1.11 gtk-doc-tools gettext make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ ./configure && make -j32 && cd .. + - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 + - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 - - run: MSAN_OPTIONS=exitcode=42 LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs:$PWD/glib-2.28.0/glib/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt + - run: MSAN_OPTIONS=exitcode=42 LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: From ad701f05cc86c22e8e53b7f5458887457e3a5e5f Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 30 Sep 2018 17:30:42 +0330 Subject: [PATCH 69/87] [circleci] Use an instrumented freetype on msan bot --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6dd605aa5..486a7c358 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,10 +125,12 @@ jobs: - run: pip install fonttools - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && make install && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 - - run: MSAN_OPTIONS=exitcode=42 LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt + - run: MSAN_OPTIONS=exitcode=42 make check --ignore-errors + # always run fail, till we fix msan "make check" isssue and remove --ignore-erros, then we can merge the two lines + - run: .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: From 0a89f9572fe2d0d9fbf0297e0a69307f0ba1a17c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 30 Sep 2018 17:44:15 +0330 Subject: [PATCH 70/87] =?UTF-8?q?[circleci]=20Pass=20=E2=80=8Cfreetype=20c?= =?UTF-8?q?ompile=20flags=20to=20right=20place?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 486a7c358..8bf232505 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,7 +125,7 @@ jobs: - run: pip install fonttools - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && make install && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 - run: MSAN_OPTIONS=exitcode=42 make check --ignore-errors From 247756a7d89008ee6a7d1171dc07ba22454c6034 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 13:10:54 +0200 Subject: [PATCH 71/87] Fix glib-mkenum warning GEN hb-gobject-enums.h WARNING: Failed to parse "/*< private >*/" in ../../src/hb-buffer.h --- src/hb-buffer.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 4ed458fbb..7d60b4f18 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -62,9 +62,7 @@ HB_BEGIN_DECLS typedef struct hb_glyph_info_t { hb_codepoint_t codepoint; - /*< private >*/ hb_mask_t mask; - /*< public >*/ uint32_t cluster; /*< private >*/ From 5c65ed800de4caef5ee9ad2111225fa5d8235737 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 17:48:55 +0200 Subject: [PATCH 72/87] Fix bug introduced in 9b0b40b3c1ac8155c80ed5dc976228f4d3ec7e1f Also discovered by msan bot. --- src/hb-ot-shape-fallback.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index 5fec9d87d..f7409e8bf 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -455,7 +455,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, hb_glyph_position_t *pos = buffer->pos; for (unsigned int idx = 0; idx < count;) { - if (!(buffer->cur().mask & kern_mask)) + if (!(info[idx].mask & kern_mask)) { idx++; continue; From be0b2ed3162f465dbf44a0f018d4e2af5dcdf87c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:01:20 +0200 Subject: [PATCH 73/87] More warning fixes --- test/api/test-multithread.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 7e357fd51..b9efca9bf 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -33,8 +33,8 @@ #include #include -const char *text = "طرح‌نَما"; -const char *path = +static const char *text = "طرح‌نَما"; +static const char *path = #if defined(__linux__) "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"; #elif defined(_WIN32) || defined(_WIN64) @@ -43,11 +43,11 @@ const char *path = "/Library/Fonts/Tahoma.ttf"; #endif -int num_threads = 30; -int num_iters = 200; +static int num_threads = 30; +static int num_iters = 200; -hb_font_t *font; -hb_buffer_t *ref_buffer; +static hb_font_t *font; +static hb_buffer_t *ref_buffer; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; @@ -102,7 +102,7 @@ thread_func (void *data) } void -test_body () +test_body (void) { int i; int num_threads = 30; From dcfcb950b81a2865ef01f5a69087264b79ed1bfd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:14:50 +0200 Subject: [PATCH 74/87] [test] Fix -Wunused-parameter warnings --- test/api/hb-test.h | 1 + test/api/test-blob.c | 2 +- test/api/test-c.c | 2 +- test/api/test-font.c | 16 ++++++++-------- test/api/test-multithread.c | 2 +- test/api/test-ot-color.c | 2 +- test/api/test-shape.c | 14 +++++++------- test/api/test-unicode.c | 10 +++++----- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/test/api/hb-test.h b/test/api/hb-test.h index 307845f62..39d091b60 100644 --- a/test/api/hb-test.h +++ b/test/api/hb-test.h @@ -42,6 +42,7 @@ HB_BEGIN_DECLS /* Just in case */ #undef G_DISABLE_ASSERT +#define HB_UNUSED G_GNUC_UNUSED /* Misc */ diff --git a/test/api/test-blob.c b/test/api/test-blob.c index d566f4e9d..7914a26ce 100644 --- a/test/api/test-blob.c +++ b/test/api/test-blob.c @@ -195,7 +195,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data) } static void -fixture_finish (fixture_t *fixture, gconstpointer user_data) +fixture_finish (fixture_t *fixture, gconstpointer user_data HB_UNUSED) { hb_blob_destroy (fixture->blob); g_assert_cmpint (fixture->freed, ==, 1); diff --git a/test/api/test-c.c b/test/api/test-c.c index 4b43b8379..78d6e974d 100644 --- a/test/api/test-c.c +++ b/test/api/test-c.c @@ -58,7 +58,7 @@ #endif int -main (int argc, char **argv) +main (void) { return !*hb_shape_list_shapers (); } diff --git a/test/api/test-font.c b/test/api/test-font.c index 4a2393ec6..4cd8dd8bf 100644 --- a/test/api/test-font.c +++ b/test/api/test-font.c @@ -83,7 +83,7 @@ free_up (void *user_data) } static hb_blob_t * -get_table (hb_face_t *face, hb_tag_t tag, void *user_data) +get_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data HB_UNUSED) { if (tag == HB_TAG ('a','b','c','d')) return hb_blob_create (test_data, sizeof (test_data), HB_MEMORY_MODE_READONLY, NULL, NULL); @@ -210,10 +210,10 @@ test_fontfuncs_nil (void) } static hb_bool_t -contour_point_func1 (hb_font_t *font, void *font_data, - hb_codepoint_t glyph, unsigned int point_index, +contour_point_func1 (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, + hb_codepoint_t glyph, unsigned int point_index HB_UNUSED, hb_position_t *x, hb_position_t *y, - void *user_data) + void *user_data HB_UNUSED) { if (glyph == 1) { *x = 2; @@ -230,10 +230,10 @@ contour_point_func1 (hb_font_t *font, void *font_data, } static hb_bool_t -contour_point_func2 (hb_font_t *font, void *font_data, +contour_point_func2 (hb_font_t *font, void *font_data HB_UNUSED, hb_codepoint_t glyph, unsigned int point_index, hb_position_t *x, hb_position_t *y, - void *user_data) + void *user_data HB_UNUSED) { if (glyph == 1) { *x = 6; @@ -246,9 +246,9 @@ contour_point_func2 (hb_font_t *font, void *font_data, } static hb_position_t -glyph_h_advance_func1 (hb_font_t *font, void *font_data, +glyph_h_advance_func1 (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, hb_codepoint_t glyph, - void *user_data) + void *user_data HB_UNUSED) { if (glyph == 1) return 8; diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index b9efca9bf..de288b6a4 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -101,7 +101,7 @@ thread_func (void *data) return 0; } -void +static void test_body (void) { int i; diff --git a/test/api/test-ot-color.c b/test/api/test-ot-color.c index 22584d20e..254f01556 100644 --- a/test/api/test-ot-color.c +++ b/test/api/test-ot-color.c @@ -99,6 +99,7 @@ static hb_face_t *cpal_v0 = NULL; static hb_face_t *cpal_v1 = NULL; +#if 0 #define assert_color_rgba(colors, i, r, g, b, a) G_STMT_START { \ const hb_ot_color_t *_colors = (colors); \ const size_t _i = (i); \ @@ -122,7 +123,6 @@ static hb_face_t *cpal_v1 = NULL; } G_STMT_END -#if 0 static void test_hb_ot_color_get_palette_count (void) { diff --git a/test/api/test-shape.c b/test/api/test-shape.c index 6232e7382..2a0024d04 100644 --- a/test/api/test-shape.c +++ b/test/api/test-shape.c @@ -41,9 +41,9 @@ static const char test_data[] = "test\0data"; static hb_position_t -glyph_h_advance_func (hb_font_t *font, void *font_data, +glyph_h_advance_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, hb_codepoint_t glyph, - void *user_data) + void *user_data HB_UNUSED) { switch (glyph) { case 1: return 10; @@ -54,10 +54,10 @@ glyph_h_advance_func (hb_font_t *font, void *font_data, } static hb_bool_t -glyph_func (hb_font_t *font, void *font_data, - hb_codepoint_t unicode, hb_codepoint_t variant_selector, +glyph_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, + hb_codepoint_t unicode, hb_codepoint_t variation_selector HB_UNUSED, hb_codepoint_t *glyph, - void *user_data) + void *user_data HB_UNUSED) { switch (unicode) { case 'T': *glyph = 1; return TRUE; @@ -68,9 +68,9 @@ glyph_func (hb_font_t *font, void *font_data, } static hb_position_t -glyph_h_kerning_func (hb_font_t *font, void *font_data, +glyph_h_kerning_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, hb_codepoint_t left, hb_codepoint_t right, - void *user_data) + void *user_data HB_UNUSED) { if (left == 1 && right == 2) return -2; diff --git a/test/api/test-unicode.c b/test/api/test-unicode.c index 88f12e779..4238ca992 100644 --- a/test/api/test-unicode.c +++ b/test/api/test-unicode.c @@ -645,18 +645,18 @@ typedef struct { } data_fixture_t; static void -data_fixture_init (data_fixture_t *f, gconstpointer user_data) +data_fixture_init (data_fixture_t *f, gconstpointer user_data HB_UNUSED) { f->data[0].value = MAGIC0; f->data[1].value = MAGIC1; } static void -data_fixture_finish (data_fixture_t *f, gconstpointer user_data) +data_fixture_finish (data_fixture_t *f HB_UNUSED, gconstpointer user_data HB_UNUSED) { } static void -test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data) +test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data HB_UNUSED) { hb_unicode_funcs_t *uf, *aa; @@ -678,7 +678,7 @@ test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data) } static void -test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data) +test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data HB_UNUSED) { hb_unicode_funcs_t *uf, *aa; @@ -697,7 +697,7 @@ test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data) } static void -test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data) +test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNUSED) { hb_unicode_funcs_t *uf, *aa; From 90dd255e570bf8ea3436e2f29242068845256e55 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:19:54 +0200 Subject: [PATCH 75/87] Change _HB_SCRIPT_MAX_VALUE from 0xFFFFFFFF to 0x7FFFFFFF Fixes https://github.com/harfbuzz/harfbuzz/issues/504 --- src/hb-common.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-common.h b/src/hb-common.h index 37bbb2b14..6101d72fe 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -340,13 +340,15 @@ typedef enum HB_SCRIPT_INVALID = HB_TAG_NONE, /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t - * without risking undefined behavior. Include both a signed and unsigned max, - * since technically enums are int, and indeed, hb_script_t ends up being signed. + * without risking undefined behavior. We have two, for historical reasons. + * HB_TAG_MAX used to be unsigned, but that was invalid Ansi C, so was changed + * to _HB_SCRIPT_MAX_VALUE to be equal to HB_TAG_MAX_SIGNED as well. + * * See this thread for technicalities: * * https://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html */ - _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ + _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX_SIGNED, /*< skip >*/ _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/ } hb_script_t; From 3f08750fa6772e7e342b96192b84cb9963f7335b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:23:34 +0200 Subject: [PATCH 76/87] Move _POSIX_SOURCE to hb.hh --- src/hb-blob.cc | 5 ----- src/hb.hh | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index f09526659..c1ed0f2a7 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -25,11 +25,6 @@ * Red Hat Author(s): Behdad Esfahbod */ -/* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html */ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include "hb.hh" #include "hb-blob.hh" diff --git a/src/hb.hh b/src/hb.hh index 631592def..cfe6d68fb 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -35,6 +35,10 @@ #include "config.h" #endif +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L +#endif + #include "hb.h" #define HB_H_IN #ifdef HAVE_OT From 1dd1e56bf42af5b11afc3e34f78869e93d39867e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:25:58 +0200 Subject: [PATCH 77/87] Revert "Fix glib-mkenum warning" This reverts commit 247756a7d89008ee6a7d1171dc07ba22454c6034. Was wrong. Right fix coming. --- src/hb-buffer.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 7d60b4f18..4ed458fbb 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -62,7 +62,9 @@ HB_BEGIN_DECLS typedef struct hb_glyph_info_t { hb_codepoint_t codepoint; + /*< private >*/ hb_mask_t mask; + /*< public >*/ uint32_t cluster; /*< private >*/ From ad1c190ecfbac66ffeef69db769073a33331eed3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:26:45 +0200 Subject: [PATCH 78/87] Correct fix for glib-mkenum warning --- src/hb-buffer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 4ed458fbb..4c746f401 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -93,8 +93,7 @@ typedef struct hb_glyph_info_t typedef enum { /*< flags >*/ HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001, - /*< private >*/ - HB_GLYPH_FLAG_DEFINED = 0x00000001 /* OR of all defined flags */ + HB_GLYPH_FLAG_DEFINED = 0x00000001 /*< skip >*/ /* OR of all defined flags */ } hb_glyph_flags_t; HB_EXTERN hb_glyph_flags_t From dc9b47ae87096d34d146e50e44e742a76861976f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 18:35:12 +0200 Subject: [PATCH 79/87] [msan] Remove uninstrumented libraries --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8bf232505..4db6dceb7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -126,7 +126,7 @@ jobs: - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib - run: make -j32 - run: MSAN_OPTIONS=exitcode=42 make check --ignore-errors # always run fail, till we fix msan "make check" isssue and remove --ignore-erros, then we can merge the two lines From 3babb0813c69d2b419f06773f366a44a9ad32cdb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Sep 2018 20:02:30 +0200 Subject: [PATCH 80/87] [msan] Disable icu explicitly --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4db6dceb7..8581ef65a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -126,7 +126,7 @@ jobs: - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib + - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --without-icu - run: make -j32 - run: MSAN_OPTIONS=exitcode=42 make check --ignore-errors # always run fail, till we fix msan "make check" isssue and remove --ignore-erros, then we can merge the two lines From 0fa1edbd3bbf825be078677dc46c3440f9802551 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Mon, 1 Oct 2018 09:40:29 +0330 Subject: [PATCH 81/87] [circleci] Couple of fixes (#1200) * Raise error on warnings on -everything * Enable fontconfig to two bots * Fix msan bot now that all of its real complain are gone --- .circleci/config.yml | 14 ++++++-------- src/check-symbols.sh | 2 ++ src/hb-ucdn.cc | 2 ++ test/fuzzing/run-shape-fuzzer-tests.py | 2 ++ test/fuzzing/run-subset-fuzzer-tests.py | 2 ++ util/helper-cairo.cc | 2 ++ 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8581ef65a..450b62bee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ jobs: - image: ubuntu:17.10 steps: - checkout - - run: apt update && apt install -y ninja-build binutils libtool autoconf automake make cmake gcc g++ pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt update && apt install -y ninja-build binutils libtool autoconf automake make cmake gcc g++ pkg-config ragel gtk-doc-tools libfontconfig1-dev libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: ./autogen.sh - run: make -j32 @@ -69,13 +69,13 @@ jobs: steps: - checkout - run: apt update || true - - run: apt install -y ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y ragel libfreetype6-dev libfontconfig1-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j32 && cd .. - - run: CFLAGS="-O3" CXXFLAGS="-O3" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-O3" CXXFLAGS="-O3" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-fontconfig --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh - - run: CFLAGS="-O0" CXXFLAGS="-O0" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-O0" CXXFLAGS="-O0" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-fontconfig --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh @@ -91,7 +91,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Werror -fPIC -Wno-unused-parameter -Wno-missing-variable-declarations -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-shadow -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-unused-macros -Wno-unreachable-code-return" CXXFLAGS="-Weverything -Werror -fPIC -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 - run: make check || .ci/fail.sh @@ -128,9 +128,7 @@ jobs: - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --without-icu - run: make -j32 - - run: MSAN_OPTIONS=exitcode=42 make check --ignore-errors - # always run fail, till we fix msan "make check" isssue and remove --ignore-erros, then we can merge the two lines - - run: .ci/fail.sh | asan_symbolize | c++filt + - run: MSAN_OPTIONS=exitcode=42 SKIPCHECKSYMBOLS=1 SKIPFUZZERTESTS=1 make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: diff --git a/src/check-symbols.sh b/src/check-symbols.sh index cea868488..d197e8e3c 100755 --- a/src/check-symbols.sh +++ b/src/check-symbols.sh @@ -3,6 +3,8 @@ LC_ALL=C export LC_ALL +test -z "$SKIPCHECKSYMBOLS" || exit 77 + test -z "$srcdir" && srcdir=. test -z "$libs" && libs=.libs stat=0 diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc index 624c1eb41..fe45e8f92 100644 --- a/src/hb-ucdn.cc +++ b/src/hb-ucdn.cc @@ -240,7 +240,9 @@ hb_ucdn_decompose_compatibility(hb_unicode_funcs_t *ufuncs HB_UNUSED, } +#ifdef HB_USE_ATEXIT static void free_static_ucdn_funcs (void); +#endif static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t { diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index fea0b01b4..e87cd09df 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -4,6 +4,8 @@ from __future__ import print_function, division, absolute_import import sys, os, subprocess +if os.environ.get ("SKIPFUZZERTESTS", "") != "": sys.exit (0) + srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") top_builddir = os.environ.get ("top_builddir", ".") diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index 013628860..aa045fed6 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -4,6 +4,8 @@ from __future__ import print_function, division, absolute_import import sys, os, subprocess +if os.environ.get ("SKIPFUZZERTESTS", "") != "": sys.exit (0) + srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") top_builddir = os.environ.get ("top_builddir", ".") diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc index 5914ab746..7a698f30b 100644 --- a/util/helper-cairo.cc +++ b/util/helper-cairo.cc @@ -64,11 +64,13 @@ _cairo_eps_surface_create_for_stream (cairo_write_func_t write_func, static FT_Library ft_library; +#ifdef HAVE_ATEXIT static inline void free_ft_library (void) { FT_Done_FreeType (ft_library); } +#endif cairo_scaled_font_t * helper_cairo_create_scaled_font (const font_options_t *font_opts) From df827a6ab88cd8bde346176fc53a5c2d57eee808 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 11:34:20 +0200 Subject: [PATCH 82/87] [cache] Fix cache coherency corner-case If key_bits+value_bits-cache_bits==32 then -1 is ambiguous... --- src/hb-cache.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-cache.hh b/src/hb-cache.hh index ec2e8635f..70e966e8d 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh @@ -36,7 +36,8 @@ template = cache_bits), ""); - static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (unsigned int)), ""); + static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), ""); + static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int)); inline void init (void) { clear (); } inline void fini (void) {} @@ -51,7 +52,8 @@ struct hb_cache_t { unsigned int k = key & ((1u<> value_bits) != (key >> cache_bits)) + if ((key_bits + value_bits - cache_bits == 8 * sizeof (hb_atomic_int_t) && v == (unsigned int) -1) || + (v >> value_bits) != (key >> cache_bits)) return false; *value = v & ((1u< Date: Mon, 1 Oct 2018 12:10:00 +0200 Subject: [PATCH 83/87] [morx] Break out if buffer gets into error Was getting stuck not making progress somehow. --- src/hb-aat-layout-common.hh | 2 ++ src/hb-aat-layout-morx-table.hh | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 052aad7fc..b0faa1db5 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -585,6 +585,8 @@ struct StateTableDriver if (unlikely (!c->transition (this, entry))) break; + if (unlikely (!buffer->successful)) return; + last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0; state = entry->newState; diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 60d05e61a..c58e6744d 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -886,6 +886,8 @@ struct Chain (void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index); + if (unlikely (!c->buffer->successful)) return; + skip: subtable = &StructAfter (*subtable); c->set_lookup_index (c->lookup_index + 1); @@ -942,12 +944,14 @@ struct morx inline void apply (hb_aat_apply_context_t *c) const { + if (unlikely (!c->buffer->successful)) return; c->set_lookup_index (0); const Chain *chain = &firstChain; unsigned int count = chainCount; for (unsigned int i = 0; i < count; i++) { chain->apply (c); + if (unlikely (!c->buffer->successful)) return; chain = &StructAfter (*chain); } } From 3426a361571a1996b5a895fb9374ce3a4a7f9af3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 12:55:57 +0200 Subject: [PATCH 84/87] Unbreak bots --- src/hb-cache.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-cache.hh b/src/hb-cache.hh index 70e966e8d..eb48f18cf 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh @@ -37,7 +37,7 @@ struct hb_cache_t { static_assert ((key_bits >= cache_bits), ""); static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), ""); - static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int)); + static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int), ""); inline void init (void) { clear (); } inline void fini (void) {} From ceef311dcaea7e1ecfedb4f1257a705572611f0f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 12:45:06 +0200 Subject: [PATCH 85/87] [use] Change categories for Left_And_* matras These are only relevant to Sinhala, because they decompose in other cases. The USE spec categorizes them all as VPst. No idea why we weren't following that before. --- src/gen-use-table.py | 4 ++-- src/hb-ot-shape-complex-use-table.cc | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gen-use-table.py b/src/gen-use-table.py index a8724619a..9c7e6f489 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -281,8 +281,8 @@ use_positions = { 'V': { 'Abv': [Top, Top_And_Bottom, Top_And_Bottom_And_Right, Top_And_Right], 'Blw': [Bottom, Overstruck, Bottom_And_Right], - 'Pst': [Right], - 'Pre': [Left, Top_And_Left, Top_And_Left_And_Right, Left_And_Right], + 'Pst': [Right, Top_And_Left, Top_And_Left_And_Right, Left_And_Right], + 'Pre': [Left], }, 'VM': { 'Abv': [Top], diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index 4862b7fe9..d4237b0a1 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -101,7 +101,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0990 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 09A0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, /* 09B0 */ B, O, B, O, O, O, B, B, B, B, O, O, CMBlw, B, VPst, VPre, - /* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, IND, O, + /* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPst, VPst, H, IND, O, /* 09D0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, B, B, O, B, /* 09E0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, /* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, B, O, FM, O, @@ -134,7 +134,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0B10 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0B20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, /* 0B30 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VAbv, - /* 0B40 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O, + /* 0B40 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPst, O, O, VPst, VPst, H, O, O, /* 0B50 */ O, O, O, O, O, O, VAbv, VAbv, O, O, O, O, B, B, O, B, /* 0B60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, /* 0B70 */ O, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O, @@ -145,7 +145,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0B90 */ B, O, B, B, B, B, O, O, O, B, B, O, B, O, B, B, /* 0BA0 */ O, O, O, B, B, O, O, O, B, B, B, O, O, O, B, B, /* 0BB0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, VPst, VPst, - /* 0BC0 */ VAbv, VPst, VPst, O, O, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, O, O, + /* 0BC0 */ VAbv, VPst, VPst, O, O, O, VPre, VPre, VPre, O, VPst, VPst, VPst, H, O, O, /* 0BD0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, O, /* 0BE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, /* 0BF0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, @@ -178,7 +178,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0D10 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0D30 */ B, B, B, B, B, B, B, B, B, B, B, VAbv, VAbv, B, VPst, VPst, - /* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, R, O, + /* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, O, VPre, VPre, VPre, O, VPst, VPst, VPst, H, R, O, /* 0D50 */ O, O, O, O, IND, IND, IND, VPst, O, O, O, O, O, O, O, B, /* 0D60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, /* 0D70 */ O, O, O, O, O, O, O, O, O, O, IND, IND, IND, IND, IND, IND, @@ -190,7 +190,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0DA0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0DB0 */ B, B, O, B, B, B, B, B, B, B, B, B, O, B, O, O, /* 0DC0 */ B, B, B, B, B, B, B, O, O, O, H, O, O, O, O, VPst, - /* 0DD0 */ VPst, VPst, VAbv, VAbv, VBlw, O, VBlw, O, VPst, VPre, VPre, VPre, VPre, VPre, VPre, VPst, + /* 0DD0 */ VPst, VPst, VAbv, VAbv, VBlw, O, VBlw, O, VPst, VPre, VPst, VPre, VPst, VPst, VPst, VPst, /* 0DE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, /* 0DF0 */ O, O, VPst, VPst, O, O, O, O, @@ -238,8 +238,8 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1780 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1790 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 17A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 17B0 */ B, B, B, B, O, O, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VPre, VPre, - /* 17C0 */ VPre, VPre, VPre, VPre, VPre, VPre, VMAbv, VMPst, VPst, VMAbv, VMAbv, FM, FAbv, CMAbv, FM, FM, + /* 17B0 */ B, B, B, B, O, O, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VPst, VPst, + /* 17C0 */ VPst, VPre, VPre, VPre, VPst, VPst, VMAbv, VMPst, VPst, VMAbv, VMAbv, FM, FAbv, CMAbv, FM, FM, /* 17D0 */ FM, VAbv, H, FM, O, O, O, O, O, O, O, O, B, VAbv, O, O, /* 17E0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, @@ -296,7 +296,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1B10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1B20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1B30 */ B, B, B, B, CMAbv, VPst, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VPre, VPre, - /* 1B40 */ VPre, VPre, VAbv, VAbv, H, B, B, B, B, B, B, B, O, O, O, O, + /* 1B40 */ VPst, VPst, VAbv, VAbv, H, B, B, B, B, B, B, B, O, O, O, O, /* 1B50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, /* 1B60 */ O, O, O, O, O, O, O, O, O, O, O, SMAbv, SMBlw, SMAbv, SMAbv, SMAbv, /* 1B70 */ SMAbv, SMAbv, SMAbv, SMAbv, O, O, O, O, O, O, O, O, O, O, O, O, @@ -319,7 +319,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1C00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1C10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1C20 */ B, B, B, B, SUB, SUB, VPst, VPre, VPre, VPre, VPst, VPst, VBlw, FAbv, FAbv, FAbv, + /* 1C20 */ B, B, B, B, SUB, SUB, VPst, VPre, VPre, VPst, VPst, VPst, VBlw, FAbv, FAbv, FAbv, /* 1C30 */ FAbv, FAbv, FAbv, FAbv, VMPre, VMPre, FM, CMBlw, O, O, O, O, O, O, O, O, /* 1C40 */ B, B, B, B, B, B, B, B, B, B, O, O, O, B, B, B, @@ -564,7 +564,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11310 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11320 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, /* 11330 */ B, O, B, B, O, B, B, B, B, B, O, CMBlw, CMBlw, B, VPst, VPst, - /* 11340 */ VAbv, VPst, VPst, VPst, VPst, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O, + /* 11340 */ VAbv, VPst, VPst, VPst, VPst, O, O, VPre, VPre, O, O, VPst, VPst, H, O, O, /* 11350 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, B, B, /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, @@ -588,7 +588,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11480 */ O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11490 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 114A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 114B0 */ VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VPre, VAbv, VPre, VPre, VPst, VPre, VMAbv, + /* 114B0 */ VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VPre, VAbv, VPst, VPst, VPst, VPst, VMAbv, /* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, @@ -600,7 +600,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11580 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11590 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 115A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VPst, - /* 115B0 */ VPre, VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, VPre, VPre, VMAbv, VMAbv, VMPst, H, + /* 115B0 */ VPre, VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPst, VPst, VPst, VMAbv, VMAbv, VMPst, H, /* 115C0 */ CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* 115D0 */ O, O, O, O, O, O, O, O, B, B, B, B, VBlw, VBlw, O, O, /* 115E0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, From 81afdbe803ca949d915d03cab4a6ed6c6e6ff304 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 15:01:04 +0200 Subject: [PATCH 86/87] [use] Disable automatic ZWJ for 'akhn' feature Fixes https://github.com/harfbuzz/harfbuzz/issues/746 --- src/hb-ot-shape-complex-use.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index 0ca088ba8..929d60d9b 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -132,7 +132,7 @@ collect_features_use (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('l','o','c','l')); map->enable_feature (HB_TAG('c','c','m','p')); map->enable_feature (HB_TAG('n','u','k','t')); - map->enable_feature (HB_TAG('a','k','h','n')); + map->add_feature (HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_ZWJ); /* "Reordering group" */ map->add_gsub_pause (clear_substitution_flags); From eb1e60287732ede6040ce6f7498c10909448d248 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 15:31:50 +0200 Subject: [PATCH 87/87] [test] Try import unicodedata2 as unicodedata --- test/shaping/hb_test_tools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py index 8348dc269..c9a44033b 100644 --- a/test/shaping/hb_test_tools.py +++ b/test/shaping/hb_test_tools.py @@ -4,6 +4,10 @@ from __future__ import print_function, division, absolute_import import sys, os, re, difflib, unicodedata, errno, cgi from itertools import * +try: + import unicodedata2 as unicodedata +except Exception: + pass diff_symbols = "-+=*&^%$#@!~/" diff_colors = ['red', 'green', 'blue']