From d0cadcf187a8a8b0875f054420842015d33211cb Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Mon, 18 Dec 2017 22:30:27 +0000 Subject: harfbuzz-1.7.3 git-svn-id: svn://tug.org/texlive/trunk@46090 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/harfbuzz/ChangeLog | 5 + Build/source/libs/harfbuzz/TLpatches/ChangeLog | 5 + Build/source/libs/harfbuzz/TLpatches/TL-Changes | 2 +- Build/source/libs/harfbuzz/configure | 24 +- .../libs/harfbuzz/harfbuzz-src/CMakeLists.txt | 5 + Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog | 367 +++++++++++++++++++++ Build/source/libs/harfbuzz/harfbuzz-src/NEWS | 10 + Build/source/libs/harfbuzz/harfbuzz-src/README | 2 +- .../source/libs/harfbuzz/harfbuzz-src/config.h.in | 3 + .../source/libs/harfbuzz/harfbuzz-src/configure.ac | 3 +- .../libs/harfbuzz/harfbuzz-src/src/hb-common.cc | 4 +- .../libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc | 14 +- .../libs/harfbuzz/harfbuzz-src/src/hb-debug.hh | 18 +- .../source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc | 2 + .../src/hb-ot-layout-common-private.hh | 93 ++++-- .../harfbuzz-src/src/hb-ot-layout-gpos-table.hh | 40 +-- .../harfbuzz-src/src/hb-ot-layout-gsub-table.hh | 35 +- .../harfbuzz-src/src/hb-ot-shape-complex-indic.cc | 16 +- .../libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc | 2 +- .../libs/harfbuzz/harfbuzz-src/src/hb-private.hh | 2 + .../harfbuzz-src/src/hb-set-digest-private.hh | 39 ++- .../harfbuzz/harfbuzz-src/src/hb-set-private.hh | 112 +++++-- .../libs/harfbuzz/harfbuzz-src/src/hb-set.cc | 6 +- Build/source/libs/harfbuzz/version.ac | 2 +- 24 files changed, 677 insertions(+), 134 deletions(-) (limited to 'Build/source/libs/harfbuzz') diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index 406e2166766..4139c8adc8f 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2017-12-18 Akira Kakuto + + Import harfbuzz-1.7.3. + * version.ac: Adjusted. + 2017-12-05 Akira Kakuto Import harfbuzz-1.7.2. diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index 9bda1aeac71..2e420f12350 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2017-12-18 Akira Kakuto + + Imported harfbuzz-1.7.3 source tree from: + http://www.freedesktop.org/software/harfbuzz/release/ + 2017-12-05 Akira Kakuto Imported harfbuzz-1.7.2 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index dd0eb716a30..4bb6f9024fb 100644 --- a/Build/source/libs/harfbuzz/TLpatches/TL-Changes +++ b/Build/source/libs/harfbuzz/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the harfbuzz-1.7.2/ tree as obtained from: +Changes applied to the harfbuzz-1.7.3/ tree as obtained from: http://www.freedesktop.org/software/harfbuzz/release/ Removed: diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index 515d8b76eb3..c59feaaabdc 100755 --- a/Build/source/libs/harfbuzz/configure +++ b/Build/source/libs/harfbuzz/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 1.7.2. +# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 1.7.3. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='1.7.2' -PACKAGE_STRING='harfbuzz (TeX Live) 1.7.2' +PACKAGE_VERSION='1.7.3' +PACKAGE_STRING='harfbuzz (TeX Live) 1.7.3' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1314,7 +1314,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures harfbuzz (TeX Live) 1.7.2 to adapt to many kinds of systems. +\`configure' configures harfbuzz (TeX Live) 1.7.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1385,7 +1385,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of harfbuzz (TeX Live) 1.7.2:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 1.7.3:";; esac cat <<\_ACEOF @@ -1492,7 +1492,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -harfbuzz (TeX Live) configure 1.7.2 +harfbuzz (TeX Live) configure 1.7.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2082,7 +2082,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by harfbuzz (TeX Live) $as_me 1.7.2, which was +It was created by harfbuzz (TeX Live) $as_me 1.7.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4005,7 +4005,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='1.7.2' + VERSION='1.7.3' # Some tools Automake needs. @@ -4199,8 +4199,8 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags HB_VERSION_MAJOR=1 HB_VERSION_MINOR=7 -HB_VERSION_MICRO=2 -HB_VERSION=1.7.2 +HB_VERSION_MICRO=3 +HB_VERSION=1.7.3 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -6989,7 +6989,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by harfbuzz (TeX Live) $as_me 1.7.2, which was +This file was extended by harfbuzz (TeX Live) $as_me 1.7.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7055,7 +7055,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -harfbuzz (TeX Live) config.status 1.7.2 +harfbuzz (TeX Live) config.status 1.7.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt index 2357609902d..24ccb6fce65 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 2.8.0) project(harfbuzz) +enable_testing() ## Limit framework build to Xcode generator if (BUILD_FRAMEWORK) @@ -683,3 +684,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) endif () endif () endif () + +# Needs to come last so that variables defined above are passed to +# subdirectories. +add_subdirectory(test) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 03b0b158969..eb9d7349740 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,370 @@ +commit 1245395a60ab6b04fc4653c448a97bb6ffee672c +Author: Behdad Esfahbod +Date: Sun Dec 17 12:32:33 2017 -0500 + + [coretext] In hb_coretext_font_create() set ptem + + Otherwise setting the CTFont was ineffective as it would have been + recreated anyway unless font size was set to 18 CSS points. + + src/hb-coretext.cc | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +commit 493a005d9527b6075f3c1ca4b41c22d7805f975c +Author: Behdad Esfahbod +Date: Sat Dec 16 11:49:39 2017 -0500 + + [set] In add_sorted_array(), bail if data is not sorted + + src/hb-set-private.hh | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +commit a7bd6d7a4c53ff61d7d8286a594aaa0a0e15b1a1 +Author: Behdad Esfahbod +Date: Sat Dec 16 11:11:18 2017 -0500 + + [collect_glyphs] Bail if input data looks like garbage + + Specificaly, when a range or sorted array has unexpected order, + we take that as + font data being garbage and bail out. This fixes significant slowdown + on a bad + version of Chandas font which has a 600KB GPOS with garbage inside. + + Later on, I like to add a maximum-work counter for collect_glyphs + to protect + against malicious fonts as well. + + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=794896 + + src/hb-ot-layout-common-private.hh | 14 +++++++------- + src/hb-set-private.hh | 4 ++-- + 2 files changed, 9 insertions(+), 9 deletions(-) + +commit 1ce7d6e215ef9d5386010bcdbbca79ef01811596 +Author: Behdad Esfahbod +Date: Sat Dec 16 11:36:16 2017 -0500 + + [set] Optimize add_array() / add_sorted_array() + + Does page lookup as needed. + + src/hb-set-private.hh | 54 + ++++++++++++++++++++++++++++++++++++--------------- + 1 file changed, 38 insertions(+), 16 deletions(-) + +commit 71e6adf1e2d65eb905a0ba247672fe36169955ef +Author: Behdad Esfahbod +Date: Sat Dec 16 11:07:37 2017 -0500 + + [collect_glyphs] handle ClassDef better + + src/hb-ot-layout-common-private.hh | 63 + ++++++++++++++++++++++++++++++------ + src/hb-ot-layout-gdef-table.hh | 2 +- + src/hb-ot-layout-gpos-table.hh | 5 +-- + src/hb-ot-layout-gsubgpos-private.hh | 2 +- + 4 files changed, 56 insertions(+), 16 deletions(-) + +commit 87cc5a65cb4b98a3a857b5846085ef0814b392a8 +Author: Behdad Esfahbod +Date: Sat Dec 16 06:18:07 2017 -0800 + + [collect_glyphs] In PairPosFornat2 do not collect classDef1 + + The coverage already covered that. + + src/hb-ot-layout-gpos-table.hh | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +commit 81f27df4d9db1bfc1dd04593cbd121397b86e9a6 +Author: Behdad Esfahbod +Date: Sat Dec 16 06:12:06 2017 -0800 + + More work towards improving collect_glyphs() against bad input + + The three "XXXXX"'s should be switched to false. Doing that + separately for ease + of bisecting... + + src/hb-ot-layout-common-private.hh | 7 +++---- + src/hb-ot-layout-gpos-table.hh | 25 ++++++++++--------------- + src/hb-ot-layout-gsub-table.hh | 35 + +++++++++++++---------------------- + src/hb-set-digest-private.hh | 6 ++++-- + src/hb-set-private.hh | 36 + ++++++++++++++++++------------------ + 5 files changed, 48 insertions(+), 61 deletions(-) + +commit 5d02572034e3dafbe87000fd0aa34b858bd95075 +Author: Behdad Esfahbod +Date: Thu Dec 14 19:33:55 2017 -0800 + + [set] Add add_sorted_array() + + Not optimized to use sortedness yet. Also start putting in place + infra + to faster reject bad data. + + A version of Chandas.ttf found on some Chrome bots has 660kb of GPOS, + mostly junk. That is causing 48 million of set->add() calls in + collect_glyphs(), which is insane. + + In the upcoming commits, I'll be speeding that up by optimizing + add_sorted_array(), while also reducing work by rejecting out-of-sort + arrays quickly and propagate the rejection. + + Part of https://bugs.chromium.org/p/chromium/issues/detail?id=794896 + + src/hb-ot-layout-common-private.hh | 51 + +++++++++++++++++++++++------------- + src/hb-ot-layout-gdef-table.hh | 2 +- + src/hb-ot-layout-gpos-table.hh | 10 +++---- + src/hb-ot-layout-gsubgpos-private.hh | 2 +- + src/hb-set-digest-private.hh | 31 ++++++++++++++++++---- + src/hb-set-private.hh | 21 +++++++++++++-- + 6 files changed, 84 insertions(+), 33 deletions(-) + +commit 9d6511a7343ba150e8072e5fe91732db54a92309 +Author: Behdad Esfahbod +Date: Thu Dec 14 19:04:55 2017 -0800 + + [set] Reduce number of preallocated pages from 8 to 1 + + Now that pagesize is 8192, this feels better. + + src/hb-set-private.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ae2e2b068e1ab68d1f814165cb86fa38deef1f5b +Author: Behdad Esfahbod +Date: Thu Dec 14 18:15:14 2017 -0800 + + Fix partial tracing debug builds + + src/hb-debug.hh | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +commit 9daa88cd790b80a8bc7eaae2e7eec6f2f9fc60cf +Author: Behdad Esfahbod +Date: Thu Dec 14 13:37:48 2017 -0800 + + Minor + + src/hb-set-private.hh | 11 +++++++++++ + src/hb-set.cc | 6 ++---- + 2 files changed, 13 insertions(+), 4 deletions(-) + +commit f424a342233ae32bbfabbdeadf59c82420b0880b +Author: Behdad Esfahbod +Date: Thu Dec 14 13:30:38 2017 -0800 + + [set] Change pagesize from 512 bits to 8192 bits + + Fixes perf regression on some heavy fonts in Chrome's FT+HB + interaction. + + See: + https://bugs.chromium.org/p/chromium/issues/detail?id=782220 + + More work to be done: + https://bugs.chromium.org/p/chromium/issues/detail?id=794896 + + src/hb-set-private.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 0fe62c1f333200523e10663f47a58b82e3f22154 +Author: Behdad Esfahbod +Date: Wed Dec 13 13:12:20 2017 -0800 + + [set] Add add_array() + + To be used to optimize adding a whole bunch of (sorted) items at + the same time, + as in CoverageFormat1. + + src/hb-ot-layout-common-private.hh | 4 +--- + src/hb-set-digest-private.hh | 12 ++++++++++++ + src/hb-set-private.hh | 6 ++++++ + 3 files changed, 19 insertions(+), 3 deletions(-) + +commit 20e69c950d431391f92335f8845e5d4291aca8f3 +Author: ebraminio +Date: Thu Dec 7 12:24:12 2017 +0330 + + [test] print commented line, like the original script (#649) + + test/shaping/run-tests.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 71ad2777c52aeb0842038881899499a49cb895f2 +Author: ebraminio +Date: Thu Dec 7 11:35:36 2017 +0330 + + [ci] Add an after distribution test runner (#648) + + .circleci/config.yml | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +commit 5f061d27d5289c7608a6579dca668b1f5be7f4e8 +Author: ebraminio +Date: Thu Dec 7 11:22:55 2017 +0330 + + Rewrite run-tests in python (#647) + + test/shaping/Makefile.am | 4 +- + test/shaping/run-tests.py | 115 + ++++++++++++++++++++++++++++++++++++++++++++++ + test/shaping/run-tests.sh | 65 -------------------------- + 3 files changed, 117 insertions(+), 67 deletions(-) + +commit 3ce6c7bd96296a44950110e84ade76c7c1df06e4 +Author: Khaled Hosny +Date: Wed Dec 6 21:08:20 2017 +0200 + + [ci] Sort out Travis configuration + + Use a matrix to avoid a gazillion if's. + + .ci/deploy-docs.sh | 2 ++ + .ci/run-coveralls.sh | 14 +++++++++++ + .travis.yml | 69 + ++++++++++++++++++++++++++++++++-------------------- + 3 files changed, 58 insertions(+), 27 deletions(-) + +commit 5a6d2b986a02fc47fa9dcbb330e6949af8e375ff +Author: ebraminio +Date: Wed Dec 6 18:27:27 2017 +0330 + + [ci] minor improvements (#644) + + .circleci/config.yml | 3 +++ + appveyor.yml | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +commit 840a32e3f3ed0a85bfa84e69efaeb504d92d1aa7 +Author: Khaled Hosny +Date: Wed Dec 6 00:49:25 2017 +0200 + + Run cmake tests on CI builds + + .circleci/config.yml | 6 ++++-- + appveyor.yml | 2 +- + 2 files changed, 5 insertions(+), 3 deletions(-) + +commit c8609551485cfca6f9629c565b9dd5f02aa14f3e +Author: Khaled Hosny +Date: Wed Dec 6 00:43:28 2017 +0200 + + Add API tests to cmake build + + CMakeLists.txt | 5 +++++ + test/CMakeLists.txt | 1 + + test/api/CMakeLists.txt | 39 +++++++++++++++++++++++++++++++++++++++ + test/api/hb-test.h | 2 ++ + test/api/test-c.c | 2 ++ + 5 files changed, 49 insertions(+) + +commit f19126dd35b03f6e05a67cbc406b3ce4a3e35022 +Author: Khaled Hosny +Date: Tue Dec 5 22:52:54 2017 +0200 + + We are already inside “if HAVE_GLIB” check + + test/api/Makefile.am | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit 7af48a3f37abac0aa1a1ad79c98399a9a71bd903 +Author: ebraminio +Date: Wed Dec 6 14:22:19 2017 +0330 + + [ci] Don't cache msys2 folder + + appveyor.yml | 1 - + 1 file changed, 1 deletion(-) + +commit b6f505c7164e302d2990cf056b73e918a641e976 +Author: ebraminio +Date: Wed Dec 6 13:51:04 2017 +0330 + + [ci] Enable glib and freetype on appveyor cmake (#643) + + appveyor.yml | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +commit 03b7a221f701a9b003890878e730ad175c3fdd86 +Author: Behdad Esfahbod +Date: Tue Dec 5 13:12:11 2017 -0800 + + [debug] Use %p to print pointers + + Fixes https://github.com/harfbuzz/harfbuzz/issues/640 + + src/hb-debug.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 353cc6fbf09d16aad18b48a3a46ec7dd348aedc6 +Author: Ebrahim Byagowi +Date: Wed Dec 6 00:04:30 2017 +0330 + + [ci] Fix appveyor badge + + README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 0dc03ef75724376927a7d63b991508c2901fcdf9 +Author: Nathan Willis +Date: Tue Dec 5 17:43:09 2017 +0000 + + Indic: always hyphenate pre-base-reordering, for clarity. + + src/hb-ot-shape-complex-indic.cc | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit be59f3cbf4e3269ea05d5a707cdae04a32e097ce +Author: Behdad Esfahbod +Date: Tue Dec 5 09:01:28 2017 -0800 + + Silence unused-variables warning on MSVC + + Fixes https://github.com/harfbuzz/harfbuzz/issues/635 + + src/hb-private.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit 80c1b01f054c5d65ca96a568aaf1c28ffe97215b +Author: David Corbett +Date: Tue Dec 5 08:28:42 2017 -0500 + + Allow digits in language system tags + + src/hb-ot-tag.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 85bb89a88bdfae02fb7c27c7b994f4f22723442a +Author: David Corbett +Date: Mon Dec 4 15:15:27 2017 -0500 + + Fix string matching in parse_bool + + src/hb-common.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 0fd89dc61c6a26253aa9bb85e8dfd9faded11440 +Author: Olivier Blin +Date: Mon Dec 4 18:58:41 2017 +0100 + + [hb-ft] Fix build when Multiple Master font support is disabled + in freetype + + FT_Set_Var_Blend_Coordinates() is not available when "Multiple Master + font interface" is disabled in freetype's modules.cfg + + configure.ac | 1 + + src/hb-ft.cc | 2 ++ + util/helper-cairo.cc | 2 ++ + 3 files changed, 5 insertions(+) + commit 843f7f70355f62511a5d8be3b905c853bf362629 Author: Behdad Esfahbod Date: Mon Dec 4 08:52:39 2017 -0800 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index 6242ee5c33c..54a0fecbd60 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,13 @@ +Overview of changes leading to 1.7.3 +Monday, December 18, 2017 +==================================== + +- hb_set_t performance tuning and optimizations. +- Speed up collect_glyphs() and reject garbage data. +- In hb_coretext_font_create() set font point-size (ptem). +- Misc fixes. + + Overview of changes leading to 1.7.2 Monday, December 4, 2017 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/README b/Build/source/libs/harfbuzz/harfbuzz-src/README index 4303222a4eb..aa055169d5a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/README +++ b/Build/source/libs/harfbuzz/harfbuzz-src/README @@ -1,5 +1,5 @@ [![Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz) -[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz) +[![Build status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz) [![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz) [![Coverage Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz) [ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in b/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in index 212a5fbf872..49cca787882 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in +++ b/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in @@ -39,6 +39,9 @@ /* Define to 1 if you have the `FT_Get_Var_Blend_Coordinates' function. */ #undef HAVE_FT_GET_VAR_BLEND_COORDINATES +/* Define to 1 if you have the `FT_Set_Var_Blend_Coordinates' function. */ +#undef HAVE_FT_SET_VAR_BLEND_COORDINATES + /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index 6d8b5779bd8..bff842cfc51 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac +++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [1.7.2], + [1.7.3], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) @@ -354,6 +354,7 @@ if $have_freetype; then save_libs=$LIBS LIBS="$LIBS $FREETYPE_LIBS" AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates) + AC_CHECK_FUNCS(FT_Set_Var_Blend_Coordinates) LIBS=$save_libs fi AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc index 92720d9e7d7..cb1fb43ffbb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc @@ -784,9 +784,9 @@ parse_bool (const char **pp, const char *end, uint32_t *pv) (*pp)++; /* CSS allows on/off as aliases 1/0. */ - if (*pp - p == 2 || 0 == strncmp (p, "on", 2)) + if (*pp - p == 2 && 0 == strncmp (p, "on", 2)) *pv = 1; - else if (*pp - p == 3 || 0 == strncmp (p, "off", 2)) + else if (*pp - p == 3 && 0 == strncmp (p, "off", 3)) *pv = 0; else return false; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index 2dd10d2da5a..44020176939 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -39,7 +39,7 @@ #define HB_CORETEXT_DEFAULT_FONT_SIZE 12.f static CGFloat -coretext_font_size (float ptem) +coretext_font_size_from_ptem (float ptem) { /* CoreText points are CSS pixels (96 per inch), * NOT typographic points (72 per inch). @@ -49,6 +49,12 @@ coretext_font_size (float ptem) ptem *= 96.f / 72.f; return ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem; } +static float +coretext_font_size_to_ptem (CGFloat size) +{ + size *= 72.f / 96.f; + return size <= 0.f ? 0 : size; +} static void release_table_data (void *user_data) @@ -84,7 +90,7 @@ _hb_cg_font_release (void *data) HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face) HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font, - fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size (font->ptem)) <= .5 + fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem (font->ptem)) <= .5 ) static CTFontDescriptorRef @@ -282,7 +288,7 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr; CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face); - CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size (font->ptem)); + CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size_from_ptem (font->ptem)); if (unlikely (!ct_font)) { @@ -314,6 +320,8 @@ hb_coretext_font_create (CTFontRef ct_font) if (unlikely (hb_object_is_inert (font))) return font; + hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font))); + /* Let there be dragons here... */ HB_SHAPER_DATA_GET (font) = (hb_coretext_shaper_font_data_t *) CFRetain (ct_font); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh index 20dead65b65..6c425f7b9dd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh @@ -93,7 +93,7 @@ _hb_debug_msg_va (const char *what, fprintf (stderr, "%-10s", what ? what : ""); if (obj) - fprintf (stderr, "(%0*lx) ", (unsigned int) (2 * sizeof (void *)), (unsigned long) obj); + fprintf (stderr, "(%*p) ", (unsigned int) (2 * sizeof (void *)), obj); else fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), ""); @@ -220,8 +220,8 @@ template <> {} template -struct hb_auto_trace_t { - +struct hb_auto_trace_t +{ explicit inline hb_auto_trace_t (unsigned int *plevel_, const char *what_, const void *obj_, @@ -269,7 +269,17 @@ struct hb_auto_trace_t { bool returned; }; template /* Make sure we don't use hb_auto_trace_t when not tracing. */ -struct hb_auto_trace_t<0, ret_t>; +struct hb_auto_trace_t<0, ret_t> +{ + explicit inline hb_auto_trace_t (unsigned int *plevel_, + const char *what_, + const void *obj_, + const char *func, + const char *message, + ...) HB_PRINTF_FUNC(6, 7) {} + + inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; } +}; /* For disabled tracing; optimize out everything. * https://github.com/harfbuzz/harfbuzz/pull/605 */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc index 0f15f8c3d0f..4f33e114b40 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc @@ -747,6 +747,7 @@ hb_ft_font_set_funcs (hb_font_t *font) FT_Set_Transform (ft_face, &matrix, nullptr); } +#ifdef HAVE_FT_SET_VAR_BLEND_COORDINATES unsigned int num_coords; const int *coords = hb_font_get_var_coords_normalized (font, &num_coords); if (num_coords) @@ -760,6 +761,7 @@ hb_ft_font_set_funcs (hb_font_t *font) free (ft_coords); } } +#endif ft_face->generic.data = blob; ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh index 86a74ccb604..5e699e1967f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh @@ -155,8 +155,8 @@ struct RangeRecord } template - inline void add_coverage (set_t *glyphs) const { - glyphs->add_range (start, end); + inline bool add_coverage (set_t *glyphs) const { + return glyphs->add_range (start, end); } GlyphID start; /* First GlyphID in the range */ @@ -715,10 +715,8 @@ struct CoverageFormat1 } template - inline void add_coverage (set_t *glyphs) const { - unsigned int count = glyphArray.len; - for (unsigned int i = 0; i < count; i++) - glyphs->add (glyphArray[i]); + inline bool add_coverage (set_t *glyphs) const { + return glyphs->add_sorted_array (glyphArray.array, glyphArray.len); } public: @@ -817,10 +815,12 @@ struct CoverageFormat2 } template - inline void add_coverage (set_t *glyphs) const { + inline bool add_coverage (set_t *glyphs) const { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) - rangeRecord[i].add_coverage (glyphs); + if (unlikely (!rangeRecord[i].add_coverage (glyphs))) + return false; + return true; } public: @@ -927,12 +927,14 @@ struct Coverage } } + /* Might return false if array looks unsorted. + * Used for faster rejection of corrupt data. */ template - inline void add_coverage (set_t *glyphs) const { + inline bool add_coverage (set_t *glyphs) const { switch (u.format) { - case 1: u.format1.add_coverage (glyphs); break; - case 2: u.format2.add_coverage (glyphs); break; - default: break; + case 1: return u.format1.add_coverage (glyphs); + case 2: return u.format2.add_coverage (glyphs); + default:return false; } } @@ -1018,11 +1020,36 @@ struct ClassDefFormat1 } template - inline void add_class (set_t *glyphs, unsigned int klass) const { + inline bool add_coverage (set_t *glyphs) const { + unsigned int start = 0; + unsigned int count = classValue.len; + for (unsigned int i = 0; i < count; i++) + { + if (classValue[i]) + continue; + + if (start != i) + if (unlikely (!glyphs->add_range (startGlyph + start, startGlyph + i))) + return false; + + start = i + 1; + } + if (start != count) + if (unlikely (!glyphs->add_range (startGlyph + start, startGlyph + count))) + return false; + + return true; + } + + template + inline bool add_class (set_t *glyphs, unsigned int klass) const { unsigned int count = classValue.len; for (unsigned int i = 0; i < count; i++) + { if (classValue[i] == klass) glyphs->add (startGlyph + i); + } + return true; } inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { @@ -1075,11 +1102,25 @@ struct ClassDefFormat2 } template - inline void add_class (set_t *glyphs, unsigned int klass) const { + inline bool add_coverage (set_t *glyphs) const { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) + if (rangeRecord[i].value) + if (unlikely (!rangeRecord[i].add_coverage (glyphs))) + return false; + return true; + } + + template + inline bool add_class (set_t *glyphs, unsigned int klass) const { + unsigned int count = rangeRecord.len; + for (unsigned int i = 0; i < count; i++) + { if (rangeRecord[i].value == klass) - rangeRecord[i].add_coverage (glyphs); + if (unlikely (!rangeRecord[i].add_coverage (glyphs))) + return false; + } + return true; } inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { @@ -1137,11 +1178,25 @@ struct ClassDef } } - inline void add_class (hb_set_t *glyphs, unsigned int klass) const { + /* Might return false if array looks unsorted. + * Used for faster rejection of corrupt data. */ + template + inline bool add_coverage (set_t *glyphs) const { + switch (u.format) { + case 1: return u.format1.add_coverage (glyphs); + case 2: return u.format2.add_coverage (glyphs); + default:return false; + } + } + + /* Might return false if array looks unsorted. + * Used for faster rejection of corrupt data. */ + template + inline bool add_class (set_t *glyphs, unsigned int klass) const { switch (u.format) { - case 1: u.format1.add_class (glyphs, klass); return; - case 2: u.format2.add_class (glyphs, klass); return; - default:return; + case 1: return u.format1.add_class (glyphs, klass); + case 2: return u.format2.add_class (glyphs, klass); + default:return false; } } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh index 3dcf2ec911a..b344d793c7c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh @@ -462,7 +462,7 @@ struct SinglePosFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverage).add_coverage (c->input); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const @@ -510,7 +510,7 @@ struct SinglePosFormat2 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverage).add_coverage (c->input); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const @@ -607,12 +607,7 @@ struct PairSet unsigned int record_size = UINT16::static_size * (1 + len1 + len2); const PairValueRecord *record = CastP (arrayZ); - unsigned int count = len; - for (unsigned int i = 0; i < count; i++) - { - c->input->add (record->secondGlyph); - record = &StructAtOffset (record, record_size); - } + c->input->add_array (&record->secondGlyph, len, record_size); } inline bool apply (hb_apply_context_t *c, @@ -689,7 +684,7 @@ struct PairPosFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverage).add_coverage (c->input); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = pairSet.len; for (unsigned int i = 0; i < count; i++) (this+pairSet[i]).collect_glyphs (c, valueFormat); @@ -755,17 +750,8 @@ struct PairPosFormat2 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverage).add_coverage (c->input); - - unsigned int count1 = class1Count; - const ClassDef &klass1 = this+classDef1; - for (unsigned int i = 0; i < count1; i++) - klass1.add_class (c->input, i); - - unsigned int count2 = class2Count; - const ClassDef &klass2 = this+classDef2; - for (unsigned int i = 0; i < count2; i++) - klass2.add_class (c->input, i); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+classDef2).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const @@ -906,7 +892,7 @@ struct CursivePosFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverage).add_coverage (c->input); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const @@ -1064,8 +1050,8 @@ struct MarkBasePosFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+markCoverage).add_coverage (c->input); - (this+baseCoverage).add_coverage (c->input); + if (unlikely (!(this+markCoverage).add_coverage (c->input))) return; + if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const @@ -1167,8 +1153,8 @@ struct MarkLigPosFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+markCoverage).add_coverage (c->input); - (this+ligatureCoverage).add_coverage (c->input); + if (unlikely (!(this+markCoverage).add_coverage (c->input))) return; + if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const @@ -1280,8 +1266,8 @@ struct MarkMarkPosFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+mark1Coverage).add_coverage (c->input); - (this+mark2Coverage).add_coverage (c->input); + if (unlikely (!(this+mark1Coverage).add_coverage (c->input))) return; + if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return; } inline const Coverage &get_coverage (void) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh index 28e0790e6ca..0b09c4e4a1a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh @@ -54,13 +54,13 @@ struct SingleSubstFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; Coverage::Iter iter; for (iter.init (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ hb_codepoint_t glyph_id = iter.get_glyph (); - c->input->add (glyph_id); c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu); } } @@ -139,13 +139,13 @@ struct SingleSubstFormat2 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; Coverage::Iter iter; unsigned int count = substitute.len; for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - c->input->add (iter.get_glyph ()); c->output->add (substitute[iter.get_coverage ()]); } } @@ -269,9 +269,7 @@ struct Sequence inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - unsigned int count = substitute.len; - for (unsigned int i = 0; i < count; i++) - c->output->add (substitute[i]); + c->output->add_array (substitute.array, substitute.len); } inline bool apply (hb_apply_context_t *c) const @@ -348,7 +346,7 @@ struct MultipleSubstFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverage).add_coverage (c->input); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = sequence.len; for (unsigned int i = 0; i < count; i++) (this+sequence[i]).collect_glyphs (c); @@ -474,17 +472,15 @@ struct AlternateSubstFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; Coverage::Iter iter; unsigned int count = alternateSet.len; for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - c->input->add (iter.get_glyph ()); const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; - unsigned int count = alt_set.len; - for (unsigned int i = 0; i < count; i++) - c->output->add (alt_set[i]); + c->output->add_array (alt_set.array, alt_set.len); } } @@ -615,9 +611,7 @@ struct Ligature inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - unsigned int count = component.len; - for (unsigned int i = 1; i < count; i++) - c->input->add (component[i]); + c->input->add_array (component.array, component.len ? component.len - 1 : 0); c->output->add (ligGlyph); } @@ -801,13 +795,13 @@ struct LigatureSubstFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; Coverage::Iter iter; unsigned int count = ligatureSet.len; for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - c->input->add (iter.get_glyph ()); (this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c); } } @@ -970,25 +964,22 @@ struct ReverseChainSingleSubstFormat1 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - - const OffsetArrayOf &lookahead = StructAfter > (backtrack); + if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count; - (this+coverage).add_coverage (c->input); - count = backtrack.len; for (unsigned int i = 0; i < count; i++) - (this+backtrack[i]).add_coverage (c->before); + if (unlikely (!(this+backtrack[i]).add_coverage (c->before))) return; + const OffsetArrayOf &lookahead = StructAfter > (backtrack); count = lookahead.len; for (unsigned int i = 0; i < count; i++) - (this+lookahead[i]).add_coverage (c->after); + if (unlikely (!(this+lookahead[i]).add_coverage (c->after))) return; const ArrayOf &substitute = StructAfter > (lookahead); count = substitute.len; - for (unsigned int i = 0; i < count; i++) - c->output->add (substitute[i]); + c->output->add_array (substitute.array, substitute.len); } inline const Coverage &get_coverage (void) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc index 7d0e7c5a4e0..97d6d38287a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc @@ -714,7 +714,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, * following algorithm: starting from the end of the syllable, move backwards * until a consonant is found that does not have a below-base or post-base * form (post-base forms have to follow below-base forms), or that is not a - * pre-base reordering Ra, or arrive at the first consonant. The consonant + * pre-base-reordering Ra, or arrive at the first consonant. The consonant * stopped at will be the base. * * o If the syllable starts with Ra + Halant (in a script that has Reph) @@ -785,11 +785,11 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, if (info[i].indic_position() == POS_BELOW_C) seen_below = true; - /* -> or that is not a pre-base reordering Ra, + /* -> or that is not a pre-base-reordering Ra, * * IMPLEMENTATION NOTES: * - * Our pre-base reordering Ra's are marked POS_POST_C, so will be skipped + * Our pre-base-reordering Ra's are marked POS_POST_C, so will be skipped * by the logic above already. */ @@ -1124,7 +1124,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, unsigned int pref_len = 2; if (indic_plan->mask_array[PREF] && base + pref_len < end) { - /* Find a Halant,Ra sequence and mark it for pre-base reordering processing. */ + /* Find a Halant,Ra sequence and mark it for pre-base-reordering processing. */ for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) { hb_codepoint_t glyphs[2]; for (unsigned int j = 0; j < pref_len; j++) @@ -1518,7 +1518,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, /* 3. If reph should be repositioned after the main consonant: find the * first consonant not ligated with main, or find the first - * consonant that is not a potential pre-base reordering Ra. + * consonant that is not a potential pre-base-reordering Ra. */ if (reph_pos == REPH_POS_AFTER_MAIN) { @@ -1607,13 +1607,13 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, } - /* o Reorder pre-base reordering consonants: + /* o Reorder pre-base-reordering consonants: * - * If a pre-base reordering consonant is found, reorder it according to + * If a pre-base-reordering consonant is found, reorder it according to * the following rules: */ - if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */ + if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base-reordering Ra. */ { for (unsigned int i = base + 1; i < end; i++) if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc index 0514c41a34a..1338c31732f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc @@ -920,7 +920,7 @@ hb_ot_tag_from_language (hb_language_t language) char tag[4]; int i; s += 6; - for (i = 0; i < 4 && ISALPHA (s[i]); i++) + for (i = 0; i < 4 && ISALNUM (s[i]); i++) tag[i] = TOUPPER (s[i]); if (i) { for (; i < 4; i++) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh index 9c55b4bc4b4..acddd893810 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh @@ -112,6 +112,8 @@ extern "C" void hb_free_impl(void *ptr); #endif #if __GNUC__ >= 4 #define HB_UNUSED __attribute__((unused)) +#elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */ +#define HB_UNUSED __pragma(warning(suppress: 4100 4101)) #else #define HB_UNUSED #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest-private.hh index 9135136c00a..e099a826414 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest-private.hh @@ -71,7 +71,7 @@ struct hb_set_digest_lowest_bits_t mask |= mask_for (g); } - inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { + inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) { if ((b >> shift) - (a >> shift) >= mask_bits - 1) mask = (mask_t) -1; else { @@ -79,6 +79,27 @@ struct hb_set_digest_lowest_bits_t mask_t mb = mask_for (b); mask |= mb + (mb - ma) - (mb < ma); } + return true; + } + + template + inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) + { + for (unsigned int i = 0; i < count; i++) + { + add (*array); + array = (const T *) (stride + (const char *) array); + } + } + template + inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) + { + for (unsigned int i = 0; i < count; i++) + { + add (*array); + array = (const T *) (stride + (const char *) array); + } + return true; } inline bool may_have (hb_codepoint_t g) const { @@ -108,9 +129,23 @@ struct hb_set_digest_combiner_t tail.add (g); } - inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { + inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) { head.add_range (a, b); tail.add_range (a, b); + return true; + } + template + inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) + { + head.add_array (array, count, stride); + tail.add_array (array, count, stride); + } + template + inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) + { + head.add_sorted_array (array, count, stride); + tail.add_sorted_array (array, count, stride); + return true; } inline bool may_have (hb_codepoint_t g) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh index 5971e9b7a3d..4715e1f3661 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh @@ -70,20 +70,19 @@ struct hb_set_t inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { - elt_t *la = &elt (a); - elt_t *lb = &elt (b); - if (la == lb) - *la |= (mask (b) << 1) - mask(a); - else - { - *la |= ~(mask (a) - 1); - la++; - - memset (la, 0xff, (char *) lb - (char *) la); + elt_t *la = &elt (a); + elt_t *lb = &elt (b); + if (la == lb) + *la |= (mask (b) << 1) - mask(a); + else + { + *la |= ~(mask (a) - 1); + la++; - *lb |= ((mask (b) << 1) - 1); + memset (la, 0xff, (char *) lb - (char *) la); - } + *lb |= ((mask (b) << 1) - 1); + } } inline bool is_equal (const page_t *other) const @@ -151,7 +150,7 @@ struct hb_set_t return 0; } - static const unsigned int PAGE_BITS = 512; /* Use to tune. */ + static const unsigned int PAGE_BITS = 8192; /* Use to tune. */ static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, ""); typedef uint64_t elt_t; @@ -182,7 +181,18 @@ struct hb_set_t ASSERT_POD (); bool in_error; hb_prealloced_array_t page_map; - hb_prealloced_array_t pages; + hb_prealloced_array_t pages; + + inline void init (void) + { + page_map.init (); + pages.init (); + } + inline void finish (void) + { + page_map.finish (); + pages.finish (); + } inline bool resize (unsigned int count) { @@ -215,39 +225,89 @@ struct hb_set_t { if (unlikely (in_error)) return; if (unlikely (g == INVALID)) return; - page_t *page = page_for_insert (g); - if (unlikely (!page)) return; + page_t *page = page_for_insert (g); if (unlikely (!page)) return; page->add (g); } - inline void add_range (hb_codepoint_t a, hb_codepoint_t b) + inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) { - if (unlikely (in_error || a > b || a == INVALID || b == INVALID)) return; + if (unlikely (in_error || a > b || a == INVALID || b == INVALID)) return false; unsigned int ma = get_major (a); unsigned int mb = get_major (b); if (ma == mb) { - page_t *page = page_for_insert (a); - if (unlikely (!page)) return; + page_t *page = page_for_insert (a); if (unlikely (!page)) return false; page->add_range (a, b); } else { - page_t *page = page_for_insert (a); - if (unlikely (!page)) return; + page_t *page = page_for_insert (a); if (unlikely (!page)) return false; page->add_range (a, major_start (ma + 1) - 1); for (unsigned int m = ma + 1; m < mb; m++) { - page = page_for_insert (major_start (m)); - if (unlikely (!page)) return; + page = page_for_insert (major_start (m)); if (unlikely (!page)) return false; page->init1 (); } - page = page_for_insert (b); - if (unlikely (!page)) return; + page = page_for_insert (b); if (unlikely (!page)) return false; page->add_range (major_start (mb), b); } + return true; } + + template + inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) + { + if (unlikely (in_error)) return; + if (!count) return; + hb_codepoint_t g = *array; + while (count) + { + unsigned int m = get_major (g); + page_t *page = page_for_insert (g); if (unlikely (!page)) return; + unsigned int start = major_start (m); + unsigned int end = major_start (m + 1); + do + { + page->add (g); + + array++; + count--; + } + while (count && (g = *array, start <= g && g < end)); + } + } + + /* Might return false if array looks unsorted. + * Used for faster rejection of corrupt data. */ + template + inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) + { + if (unlikely (in_error)) return false; + if (!count) return true; + hb_codepoint_t g = *array; + hb_codepoint_t last_g = g; + while (count) + { + unsigned int m = get_major (g); + page_t *page = page_for_insert (g); if (unlikely (!page)) return false; + unsigned int end = major_start (m + 1); + do + { + /* If we try harder we can change the following comparison to <=; + * Not sure if it's worth it. */ + if (g < last_g) return false; + last_g = g; + page->add (g); + + array++; + count--; + } + while (count && (g = *array, g < end)); + } + return true; + } + inline void del (hb_codepoint_t g) { if (unlikely (in_error)) return; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc index e2c788225d5..0b4f871e852 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc @@ -45,8 +45,7 @@ hb_set_create (void) if (!(set = hb_object_create ())) return hb_set_get_empty (); - set->page_map.init (); - set->pages.init (); + set->init (); return set; } @@ -96,8 +95,7 @@ hb_set_destroy (hb_set_t *set) { if (!hb_object_destroy (set)) return; - set->page_map.finish (); - set->pages.finish (); + set->finish (); free (set); } diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index 80db91b5745..2073c7ddf9c 100644 --- a/Build/source/libs/harfbuzz/version.ac +++ b/Build/source/libs/harfbuzz/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current harfbuzz version -m4_define([harfbuzz_version], [1.7.2]) +m4_define([harfbuzz_version], [1.7.3]) -- cgit v1.2.3