diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2024-05-14 00:13:23 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2024-05-14 00:13:23 +0000 |
commit | b71b71446356c3a9c9d9cabfca22dacb2770748c (patch) | |
tree | 5a2b6a045ddd6066c44ee39441f669fd3fd9d3f4 /Build/source/libs | |
parent | 5779e84f91fef0949723f95e30ff64eb58fb9064 (diff) |
harfbuzz 8.5.0
git-svn-id: svn://tug.org/texlive/trunk@71261 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs')
62 files changed, 3320 insertions, 792 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README index 70735c67fef..7f3a7943c68 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -28,7 +28,7 @@ graphite2 1.3.14 - checked 10apr20 https://sourceforge.net/projects/silgraphite/files/graphite2/ (requires C++11) -harfbuzz 8.4.0 - checked 30mar24 +harfbuzz 8.5.0 - checked 14may24 https://github.com/harfbuzz/harfbuzz/releases/latest icu 74.2 - checked 22dec23 diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index acce9fbc15d..7b80efeaa0b 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2024-05-14 Akira Kakuto <kakuto@jcom.zaq.ne.jp> + + Import harfbuzz-8.5.0. + * version.ac: Adjusted. + 2024-03-30 Akira Kakuto <kakuto@jcom.zaq.ne.jp> Import harfbuzz-8.4.0. diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index a27c8a168a2..55d1e9440af 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2024-05-14 Akira Kakuto <kakuto@jcom.zaq.ne.jp> + + Imported harfbuzz-8.5.0 source tree from: + https://github.com/harfbuzz/harfbuzz/releases/download/8.5.0/ + 2024-03-30 Akira Kakuto <kakuto@jcom.zaq.ne.jp> Imported harfbuzz-8.4.0 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index 91070d39a51..18a639e8ff3 100644 --- a/Build/source/libs/harfbuzz/TLpatches/TL-Changes +++ b/Build/source/libs/harfbuzz/TLpatches/TL-Changes @@ -1,5 +1,5 @@ -Changes applied to the harfbuzz-8.4.0/ tree as obtained from: - https://github.com/harfbuzz/harfbuzz/releases/download/8.4.0/ +Changes applied to the harfbuzz-8.5.0/ tree as obtained from: + https://github.com/harfbuzz/harfbuzz/releases/download/8.5.0/ Removed: COPYING diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index de6b816d2fd..80065b6fc3b 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.72 for harfbuzz (TeX Live) 8.4.0. +# Generated by GNU Autoconf 2.72 for harfbuzz (TeX Live) 8.5.0. # # Report bugs to <tex-k@tug.org>. # @@ -604,8 +604,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='8.4.0' -PACKAGE_STRING='harfbuzz (TeX Live) 8.4.0' +PACKAGE_VERSION='8.5.0' +PACKAGE_STRING='harfbuzz (TeX Live) 8.5.0' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1339,7 +1339,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) 8.4.0 to adapt to many kinds of systems. +'configure' configures harfbuzz (TeX Live) 8.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1411,7 +1411,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of harfbuzz (TeX Live) 8.4.0:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 8.5.0:";; esac cat <<\_ACEOF @@ -1516,7 +1516,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -harfbuzz (TeX Live) configure 8.4.0 +harfbuzz (TeX Live) configure 8.5.0 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -2073,7 +2073,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 8.4.0, which was +It was created by harfbuzz (TeX Live) $as_me 8.5.0, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -5069,7 +5069,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='8.4.0' + VERSION='8.5.0' # Some tools Automake needs. @@ -5296,9 +5296,9 @@ echo 'tldbg:KPSE_BASIC done (pkg=harfbuzz, amopt=no-define)' >&5 HB_VERSION_MAJOR=8 -HB_VERSION_MINOR=4 +HB_VERSION_MINOR=5 HB_VERSION_MICRO=0 -HB_VERSION=8.4.0 +HB_VERSION=8.5.0 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -9135,7 +9135,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 8.4.0, which was +This file was extended by harfbuzz (TeX Live) $as_me 8.5.0, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9203,7 +9203,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -harfbuzz (TeX Live) config.status 8.4.0 +harfbuzz (TeX Live) config.status 8.5.0 configured by $0, generated by GNU Autoconf 2.72, 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 57ccf27679d..56d5ad8efc4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt @@ -124,6 +124,7 @@ endif () if (MSVC) add_definitions(-wd4244 -wd4267 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) + add_definitions(-bigobj) endif () diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 9b87eec6ea4..970487a7d17 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,1391 @@ +commit 30485ee8c3d43c553afb9d78b9924cb71c8d2f19 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Mon May 13 23:45:50 2024 +0300 + + Typo + + NEWS | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 9ea29789d7e85900853a0bd54f968c33ecd52b93 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon May 13 14:43:47 2024 -0600 + + [aat] Minor + + src/hb-aat-layout-common.hh | 2 +- + src/hb-aat-layout-morx-table.hh | 8 ++++---- + 2 files changed, 5 insertions(+), 5 deletions(-) + +commit 71b1ba7aa678771b34ea4a0c062aa8622bc3ffaf +Author: Khaled Hosny <khaled@aliftype.com> +Date: Mon May 13 23:07:51 2024 +0300 + + 8.5.0 + + NEWS | 15 +++++++++++++++ + configure.ac | 2 +- + docs/harfbuzz-docs.xml | 1 + + meson.build | 2 +- + src/hb-subset-input.cc | 4 ++-- + src/hb-subset.h | 2 +- + src/hb-version.h | 4 ++-- + 7 files changed, 23 insertions(+), 7 deletions(-) + +commit 0660a4d408736e663c1c7274fff400be546f998f +Author: Garret Rieger <grieger@google.com> +Date: Mon May 13 19:28:57 2024 +0000 + + [subset] fix fuzzer found heap use after free in BASE subsetting. + + src/hb-subset-plan.cc | 4 +++- + ...-testcase-minimized-hb-subset-fuzzer-6696597055406080 | Bin 0 -> 1054 bytes + 2 files changed, 3 insertions(+), 1 deletion(-) + +commit 3f38ffd633b143e13e1899073d5d33fd9ad3a9e1 +Author: Garret Rieger <grieger@google.com> +Date: Mon May 13 18:50:43 2024 +0000 + + [subset] Fix remaining double conversion warnings. + + src/hb-ot-layout-common.hh | 12 ++++++------ + src/hb-ot-var-avar-table.hh | 8 ++++---- + src/hb-ot-var-common.hh | 10 +++++++--- + src/hb-subset-input.cc | 8 ++++---- + src/hb-subset-instancer-solver.hh | 2 +- + src/test-item-varstore.cc | 4 ++-- + 6 files changed, 24 insertions(+), 20 deletions(-) + +commit 6253b3a905ff516aabac62516c28a86eececb7b9 +Author: Steve Lhomme <robux4@ycbcr.xyz> +Date: Mon May 13 11:01:58 2024 +0200 + + [meson] build ragel as a native tool + + When cross compiling it will build a target (host) binary that can't be run on the building machine. + + Also remove the install flag which is not compatible with the native flag, but the custom built ragel is correctly picked. + + subprojects/packagefiles/ragel/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 31c45e841f0763860946aa8ec6b0ffad5907310e +Merge: 3609ebb0d 3d3c6db4b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon May 13 10:20:12 2024 -0700 + + Merge pull request #4711 from harfbuzz/aat-set-digest + + [aat] Use set digest to speed up + +commit 3609ebb0d134212f0113906f5d100cdb94126c96 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon May 13 11:05:04 2024 -0600 + + [htmx] Return non-variable advance if no glyf table available + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4706 + + src/hb-ot-hmtx-table.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 3d3c6db4b2de657c535b2d6c04446a99a9e99876 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon May 13 11:00:21 2024 -0600 + + [kern] Allow format 1 / 3 in OT-style kern table + + Otherwise we were failing to sanitize them, and Bad Things + were happening after. + + src/hb-aat-layout-kerx-table.hh | 4 ++-- + src/hb-aat-layout-morx-table.hh | 8 ++++---- + src/hb-ot-kern-table.hh | 4 ++-- + 3 files changed, 8 insertions(+), 8 deletions(-) + +commit fb6074259483fe0132e3ed4dc5e8bc5efb3ecfa9 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon May 13 10:27:02 2024 +0000 + + Bump github/codeql-action from 3.25.3 to 3.25.4 + + Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.3 to 3.25.4. + - [Release notes](https://github.com/github/codeql-action/releases) + - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/github/codeql-action/compare/d39d31e687223d841ef683f52467bd88e9b21c14...ccf74c947955fd1cf117aef6a0e4e66191ef6f61) + + --- + updated-dependencies: + - dependency-name: github/codeql-action + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/scorecard.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 364ae509b5901c9d4019d9794ed570bc82fc6248 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon May 13 10:27:05 2024 +0000 + + Bump ossf/scorecard-action from 2.3.1 to 2.3.3 + + Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.1 to 2.3.3. + - [Release notes](https://github.com/ossf/scorecard-action/releases) + - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) + - [Commits](https://github.com/ossf/scorecard-action/compare/0864cf19026789058feabb7e87baa5f140aac736...dc50aa9510b46c811795eb24b2f1ba02a914e534) + + --- + updated-dependencies: + - dependency-name: ossf/scorecard-action + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/scorecard.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 44d8489fddd98d1f092849836cec4f95678d88cb +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon May 13 10:27:10 2024 +0000 + + Bump actions/checkout from 4.1.4 to 4.1.5 + + Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.4 to 4.1.5. + - [Release notes](https://github.com/actions/checkout/releases) + - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) + - [Commits](https://github.com/actions/checkout/compare/0ad4b8fadaa221de15dcec353f45205ec38ea70b...44c2b7a8a4ea60a981eaca3cf939b5f4305c123b) + + --- + updated-dependencies: + - dependency-name: actions/checkout + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/arm-ci.yml | 2 +- + .github/workflows/configs-build.yml | 2 +- + .github/workflows/coverity-scan.yml | 2 +- + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + .github/workflows/msvc-ci.yml | 2 +- + .github/workflows/msys2-ci.yml | 2 +- + .github/workflows/scorecard.yml | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +commit e2ab6c7bc87cb3f52329278bd8419d58b4f85c4d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun May 12 15:25:13 2024 -0600 + + [kern/kerx] Add accelerator and set-digest filtering + + src/hb-aat-layout-common.hh | 18 ++++- + src/hb-aat-layout-kerx-table.hh | 143 ++++++++++++++++++++++++++++++++++++++-- + src/hb-aat-layout.cc | 9 ++- + src/hb-ot-face-table-list.hh | 4 +- + src/hb-ot-face.cc | 1 + + src/hb-ot-kern-table.hh | 67 ++++++++++++++++++- + src/hb-ot-layout-gsubgpos.hh | 2 +- + src/hb-ot-layout.cc | 8 +-- + src/hb-set-digest.hh | 8 +-- + 9 files changed, 234 insertions(+), 26 deletions(-) + +commit 5f32c60d05f4664ad28ae450fdb25326b688ad7d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun May 12 15:16:25 2024 -0600 + + [kerx] Remove set-digests since accelerator is not shared + + src/hb-aat-layout-kerx-table.hh | 18 +----------------- + 1 file changed, 1 insertion(+), 17 deletions(-) + +commit ebbec7713bbdb405844e46015db2bef178e9e069 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun May 12 15:10:21 2024 -0600 + + [kern] Use the sanitized version from face + + I'm not sure why kern/kerx/morx were written this way + before. + + src/hb-ot-layout.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 23e4a3cf2612ef240b8d882c7031f5f6a8d7c91f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun May 12 10:49:46 2024 -0600 + + [aat/morx] Add an accelerator + + src/hb-aat-layout-common.hh | 62 +++++++------ + src/hb-aat-layout-morx-table.hh | 195 +++++++++++++++++++++++++++++++++++++--- + src/hb-aat-layout.cc | 44 ++++----- + src/hb-ot-face-table-list.hh | 4 +- + src/hb-ot-face.cc | 1 + + src/hb-set-digest.hh | 4 + + 6 files changed, 250 insertions(+), 60 deletions(-) + +commit 0828ccc5dc8db56dc64f248a0e6657a322334a40 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun May 12 10:06:06 2024 -0600 + + [aat] Move buffer out of StateTableDriver + + src/hb-aat-layout-common.hh | 13 ++++++------- + src/hb-aat-layout-kerx-table.hh | 19 ++++++++++--------- + src/hb-aat-layout-morx-table.hh | 40 ++++++++++++++++++++-------------------- + 3 files changed, 36 insertions(+), 36 deletions(-) + +commit bba0c0e27cf22244d6ffcd9dffc8e9ad1f4c1bc6 +Author: David Corbett <corbett.dav@northeastern.edu> +Date: Sat May 11 23:15:35 2024 -0400 + + Add test-cff.cc + + src/Makefile.am | 5 ++++ + src/meson.build | 1 + + src/test-cff.cc | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 81 insertions(+) + +commit 0db136b1b09232083d99e4315dd4432ed0195d2c +Author: David Corbett <corbett.dav@northeastern.edu> +Date: Thu May 9 11:49:48 2024 -0400 + + [subset-cff] Shorten output of `encode_num_tp` + + src/hb-subset-cff-common.hh | 57 ++++++++++++++++++--- + test/api/fonts/AdobeVFPrototype.abc.static.otf | Bin 2576 -> 2576 bytes + ...obeVFPrototype.default.all.wght=650,CNTR=50.otf | Bin 41760 -> 41760 bytes + .../Cantarell-VF-ABC.default.all.wght=800.otf | Bin 1488 -> 1488 bytes + .../Cantarell-VF-ABC.retain-gids.all.wght=800.otf | Bin 1488 -> 1488 bytes + 5 files changed, 51 insertions(+), 6 deletions(-) + +commit 5a405b310e617c1ee87491401c98f70dff2e2a51 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat May 11 10:03:47 2024 -0600 + + [aat] First sketch at using hb_set_digest_t + + They are not cached in an accelerator yet. + + src/hb-aat-layout-common.hh | 100 ++++++++++++++++++++++++++++++++++++++-- + src/hb-aat-layout-kerx-table.hh | 25 ++++++++-- + 2 files changed, 118 insertions(+), 7 deletions(-) + +commit 51582558075557db274de8893bc43b1f0fd37893 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat May 11 09:25:22 2024 -0600 + + [set-digest] Add operator []. Also auto-initialize + + src/hb-set-digest.hh | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +commit 3d75d445e474b9f5bde7ab47514498f30836de50 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat May 11 08:58:58 2024 -0600 + + [set] Clarify add_range() params + + src/hb-set.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 7975c9cabda33f6f02fb7dd3d54dd8e46dc84950 +Author: Qunxin Liu <qxliu@google.com> +Date: Wed May 8 10:11:03 2024 -0700 + + [instancer] bug fix for COLRv1, add missing mapping to VarIdx::NO_VARIATION + + src/hb-subset-plan.cc | 17 +++++++++++++---- + .../Foldit.default.41.wght=300-600.ttf | Bin 0 -> 2396 bytes + .../instantiate_colrv1/Foldit.default.41.wght=900.ttf | Bin 0 -> 1704 bytes + .../KalniaGlaze.default.41.wght=300-600.ttf | Bin 0 -> 3096 bytes + .../KalniaGlaze.default.41.wght=900.ttf | Bin 0 -> 2544 bytes + .../KalniaGlaze.default.all.wght=300-600.ttf | Bin 0 -> 5612 bytes + .../KalniaGlaze.default.all.wght=900.ttf | Bin 0 -> 4088 bytes + test/subset/data/fonts/KalniaGlaze.ttf | Bin 0 -> 5944 bytes + test/subset/data/tests/instantiate_colrv1.tests | 2 ++ + 9 files changed, 15 insertions(+), 4 deletions(-) + +commit b74a7ecc93e283d059df51ee4f46961a782bcdb8 +Author: Garret Rieger <grieger@google.com> +Date: Tue May 7 19:53:01 2024 +0000 + + Fix IUP differences accoss platforms. + + - Slightly increase the tolerance to account for differences in floating point math across platforms. + - The specific issue is a fused multiply add (d = d1 + (x - x1) * scale; in hb-subset-instancer-iup.cc) + - Also fix more implicit double conversion warnings. + + src/hb-ot-var-common.hh | 2 +- + src/hb-subset-instancer-iup.cc | 28 ++++++++++++++-------------- + test/subset/meson.build | 9 +-------- + 3 files changed, 16 insertions(+), 23 deletions(-) + +commit 0e1ffd77f90cd81320557d4ebce285b121c7325c +Author: Qunxin Liu <qxliu@google.com> +Date: Tue May 7 13:55:03 2024 -0700 + + [instancer] add a warning for CFF partial instancing + + It's not supported yet + + src/hb-subset-cff2.cc | 3 +++ + 1 file changed, 3 insertions(+) + +commit a3d8a59dc2f365728e6ac7ecaa87413ddcaf1d19 +Author: Garret Rieger <grieger@google.com> +Date: Tue May 7 18:32:56 2024 +0000 + + Fix double to float cast warning. + + src/hb-subset-plan.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 6ef69f749dae3c5819cb4eb502c103276d649c27 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue May 7 10:43:48 2024 -0700 + + [cff2] Minor init + + src/hb-cff2-interp-cs.hh | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +commit ca6425704defad269380e9433ec0e9b2afc61d75 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue May 7 10:19:30 2024 -0700 + + Rename result_t to rebase_tent_result_t + + src/hb-ot-var-common.hh | 28 ++++++++-------- + src/hb-subset-instancer-solver.cc | 18 +++++------ + src/hb-subset-instancer-solver.hh | 8 +++-- + src/test-subset-instancer-solver.cc | 64 ++++++++++++++++++------------------- + 4 files changed, 60 insertions(+), 58 deletions(-) + +commit 847ead35887a085724515724d9f6ac38ffc8a74f +Merge: a96f7c878 a5c9c8269 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon May 6 14:58:48 2024 -0600 + + Merge pull request #4691 from googlefonts/colrv1 + + [instancer] support partial instancing for COLRv1 + +commit a96f7c878413b1de5061cc6961685edc191f9e2f +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon May 6 20:41:37 2024 +0000 + + Bump jinja2 from 3.1.3 to 3.1.4 in /.ci + + Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4. + - [Release notes](https://github.com/pallets/jinja/releases) + - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) + - [Commits](https://github.com/pallets/jinja/compare/3.1.3...3.1.4) + + --- + updated-dependencies: + - dependency-name: jinja2 + dependency-type: indirect + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .ci/requirements.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit a5c9c82692f3ec6a7b831ec312966882ebc8c49c +Author: Qunxin Liu <qxliu@google.com> +Date: Mon May 6 13:22:49 2024 -0700 + + rename expected files from *.retain-all-codepoint.* to *.all.* + + This is to fix file name too long error + tar: harfbuzz-8.4.0/test/subset/data/expected/sync_vmetrics/playwrite_mm.subset.default.retain-all-codepoint.SPED=25,YEXT=520,wght=100-400,slnt=18.iup_optimize.ttf: file name is too long (cannot be split); not dumped + tar: Exiting with failure status due to previous errors + + ...0.ttf => Comfortaa-Regular-new.default.all.wght=300.ttf} | Bin + ...0.ttf => Comfortaa-Regular-new.default.all.wght=700.ttf} | Bin + ...point.wght=300.ttf => Muli-ABC.default.all.wght=300.ttf} | Bin + ...point.wght=700.ttf => Muli-ABC.default.all.wght=700.ttf} | Bin + ...-codepoint.ttf => Comfortaa-Regular-new.default.all.ttf} | Bin + ...=> Comfortaa-Regular-new.drop-hints-retain-gids.all.ttf} | Bin + ...depoint.ttf => Comfortaa-Regular-new.drop-hints.all.ttf} | Bin + ...all-codepoint.ttf => Comfortaa-Regular-new.gids.all.ttf} | Bin + ...epoint.ttf => Comfortaa-Regular-new.glyph-names.all.ttf} | Bin + ... Comfortaa-Regular-new.keep-all-layout-features.all.ttf} | Bin + ...nt.ttf => Comfortaa-Regular-new.layout-features.all.ttf} | Bin + ...codepoint.ttf => Comfortaa-Regular-new.name-ids.all.ttf} | Bin + ...int.ttf => Comfortaa-Regular-new.name-languages.all.ttf} | Bin + ...epoint.ttf => Comfortaa-Regular-new.name-legacy.all.ttf} | Bin + ...> Comfortaa-Regular-new.no-prune-unicode-ranges.all.ttf} | Bin + ...int.ttf => Comfortaa-Regular-new.notdef-outline.all.ttf} | Bin + ...epoint.ttf => Comfortaa-Regular-new.retain-gids.all.ttf} | Bin + ...int.ttf => NanumMyeongjo-Regular-subset.default.all.ttf} | Bin + ...mMyeongjo-Regular-subset.drop-hints-retain-gids.all.ttf} | Bin + ....ttf => NanumMyeongjo-Regular-subset.drop-hints.all.ttf} | Bin + ...epoint.ttf => NanumMyeongjo-Regular-subset.gids.all.ttf} | Bin + ...ttf => NanumMyeongjo-Regular-subset.glyph-names.all.ttf} | Bin + ...yeongjo-Regular-subset.keep-all-layout-features.all.ttf} | Bin + ...=> NanumMyeongjo-Regular-subset.layout-features.all.ttf} | Bin + ...nt.ttf => NanumMyeongjo-Regular-subset.name-ids.all.ttf} | Bin + ... => NanumMyeongjo-Regular-subset.name-languages.all.ttf} | Bin + ...ttf => NanumMyeongjo-Regular-subset.name-legacy.all.ttf} | Bin + ...Myeongjo-Regular-subset.no-prune-unicode-ranges.all.ttf} | Bin + ... => NanumMyeongjo-Regular-subset.notdef-outline.all.ttf} | Bin + ...ttf => NanumMyeongjo-Regular-subset.retain-gids.all.ttf} | Bin + ...all-codepoint.ttf => Roboto-Regular.abc.default.all.ttf} | Bin + ...tf => Roboto-Regular.abc.drop-hints-retain-gids.all.ttf} | Bin + ...-codepoint.ttf => Roboto-Regular.abc.drop-hints.all.ttf} | Bin + ...in-all-codepoint.ttf => Roboto-Regular.abc.gids.all.ttf} | Bin + ...codepoint.ttf => Roboto-Regular.abc.glyph-names.all.ttf} | Bin + ... => Roboto-Regular.abc.keep-all-layout-features.all.ttf} | Bin + ...point.ttf => Roboto-Regular.abc.layout-features.all.ttf} | Bin + ...ll-codepoint.ttf => Roboto-Regular.abc.name-ids.all.ttf} | Bin + ...epoint.ttf => Roboto-Regular.abc.name-languages.all.ttf} | Bin + ...codepoint.ttf => Roboto-Regular.abc.name-legacy.all.ttf} | Bin + ...f => Roboto-Regular.abc.no-prune-unicode-ranges.all.ttf} | Bin + ...epoint.ttf => Roboto-Regular.abc.notdef-outline.all.ttf} | Bin + ...codepoint.ttf => Roboto-Regular.abc.retain-gids.all.ttf} | Bin + ...p14_font1.notdef-outline-drop-hints-retain-gids.all.otf} | Bin + ...t.otf => cmap14_font1.notdef-outline-drop-hints.all.otf} | Bin + ...depoint.otf => cmap14_font1.notdef-outline-gids.all.otf} | Bin + ...int.otf => cmap14_font1.notdef-outline-name-ids.all.otf} | Bin + ....otf => cmap14_font1.notdef-outline-retain-gids.all.otf} | Bin + ...ll-codepoint.otf => cmap14_font1.notdef-outline.all.otf} | Bin + ...p14_font2.notdef-outline-drop-hints-retain-gids.all.otf} | Bin + ...t.otf => cmap14_font2.notdef-outline-drop-hints.all.otf} | Bin + ...depoint.otf => cmap14_font2.notdef-outline-gids.all.otf} | Bin + ...int.otf => cmap14_font2.notdef-outline-name-ids.all.otf} | Bin + ....otf => cmap14_font2.notdef-outline-retain-gids.all.otf} | Bin + ...ll-codepoint.otf => cmap14_font2.notdef-outline.all.otf} | Bin + ...4Variable-Roman_subset.keep-all-layout-features.all.otf} | Bin + ....retain-all-codepoint.ttf => TestCOLRv1.default.all.ttf} | Bin + ...epoint.ttf => TestCOLRv1.drop-hints-retain-gids.all.ttf} | Bin + ...tain-all-codepoint.ttf => TestCOLRv1.drop-hints.all.ttf} | Bin + ...ain-all-codepoint.ttf => TestCOLRv1.retain-gids.all.ttf} | Bin + ...ault.retain-all-codepoint.ttf => Foldit.default.all.ttf} | Bin + ...-codepoint.ttf => Foldit.drop-hints-retain-gids.all.ttf} | Bin + ...s.retain-all-codepoint.ttf => Foldit.drop-hints.all.ttf} | Bin + ....retain-all-codepoint.ttf => Foldit.retain-gids.all.ttf} | Bin + ...e.ABC.default.all.wght=200-300,opsz=14.iup_optimize.ttf} | Bin + ...oFlex-Variable.ABC.default.all.wght=200-300,opsz=14.ttf} | Bin + ....default.all.wght=400,wdth=100,opsz=14.iup_optimize.ttf} | Bin + ...-Variable.ABC.default.all.wght=400,wdth=100,opsz=14.ttf} | Bin + ...question-subset.default.all.wdth=112.5.iup_optimize.ttf} | Bin + ...> AnekBangla-question-subset.default.all.wdth=112.5.ttf} | Bin + ...toSansOriya-subset.default.all.wdth=75.iup_optimize.ttf} | Bin + ...=75.ttf => NotoSansOriya-subset.default.all.wdth=75.ttf} | Bin + ...t.keep-all-layout-features.all.wdth=75.iup_optimize.ttf} | Bin + ...nsOriya-subset.keep-all-layout-features.all.wdth=75.ttf} | Bin + ...ttf => Roboto-Variable.default.all.wght=150,wdth=80.ttf} | Bin + ...ttf => Roboto-Variable.default.all.wght=300,wdth=90.ttf} | Bin + ...riable.no-prune-unicode-ranges.all.wght=150,wdth=80.ttf} | Bin + ...riable.no-prune-unicode-ranges.all.wght=300,wdth=90.ttf} | Bin + ...AnekBangla-subset.default.all.wght=300.iup_optimize.ttf} | Bin + ...t=300.ttf => AnekBangla-subset.default.all.wght=300.ttf} | Bin + ...int.ttf => glyf_bug_3131.drop-hints-retain-gids.all.ttf} | Bin + ...-all-codepoint.ttf => glyf_bug_3131.retain-gids.all.ttf} | Bin + ...efault.all.wght=200-300-500,wdth=80-90.iup_optimize.ttf} | Bin + ...ariable.ABC.default.all.wght=200-300-500,wdth=80-90.ttf} | Bin + ...e.ABC.default.all.wght=300-600,wdth=85.iup_optimize.ttf} | Bin + ...oboto-Variable.ABC.default.all.wght=300-600,wdth=85.ttf} | Bin + ...efault.all.wght=200-300-500,wdth=80-90.iup_optimize.ttf} | Bin + ...e.composite.default.all.wght=200-300-500,wdth=80-90.ttf} | Bin + ...osite.default.all.wght=300-600,wdth=85.iup_optimize.ttf} | Bin + ...Variable.composite.default.all.wght=300-600,wdth=85.ttf} | Bin + ...all-codepoint.ttf => Ubuntu-Regular.glyph-names.all.ttf} | Bin + ...int.wght=700.ttf => RobotoMono.default.all.wght=700.ttf} | Bin + ...2.ttf => Handjet.default.all.wght=100,ELGR=1,ELSH=2.ttf} | Bin + ...> Handjet.notdef-outline.all.wght=100,ELGR=1,ELSH=2.ttf} | Bin + ....ttf => NotoSerifHK-subset.default.all.wght=400-600.ttf} | Bin + ...=500.ttf => NotoSerifHK-subset.default.all.wght=500.ttf} | Bin + ...tf => AdobeVFPrototype.default.all.wght=650,CNTR=50.otf} | Bin + ...ht=800.otf => Cantarell-VF-ABC.default.all.wght=800.otf} | Bin + ...00.otf => Cantarell-VF-ABC.retain-gids.all.wght=800.otf} | Bin + ...wght=300-600.ttf => Foldit.default.all.wght=300-600.ttf} | Bin + ...depoint.wght=900.ttf => Foldit.default.all.wght=900.ttf} | Bin + ...=> Roboto-Variable.ABC.default.all.wght=200,wdth=90.ttf} | Bin + ...=> Roboto-Variable.ABC.default.all.wght=650,wdth=85.ttf} | Bin + ...oto-Variable.composite.default.all.wght=200,wdth=90.ttf} | Bin + ...oto-Variable.composite.default.all.wght=650,wdth=85.ttf} | Bin + ...t1_multiple_subrules_f1.layout-test-retain-gids.all.otf} | Bin + ... gpos_context1_multiple_subrules_f1.layout-test.all.otf} | Bin + ...t2_multiple_subrules_f1.layout-test-retain-gids.all.otf} | Bin + ... gpos_context2_multiple_subrules_f1.layout-test.all.otf} | Bin + ...gpos_context3_simple_f1.layout-test-retain-gids.all.otf} | Bin + ...oint.otf => gpos_context3_simple_f1.layout-test.all.otf} | Bin + ...=> NotoSansNewa-Regular.layout-test-retain-gids.all.ttf} | Bin + ...depoint.ttf => NotoSansNewa-Regular.layout-test.all.ttf} | Bin + ...oint.ttf => SpectralSC-ExtraLightItalic.default.all.ttf} | Bin + ....ttf => SpectralSC-ExtraLightItalic.glyph-names.all.ttf} | Bin + ...f => SpectralSC-ExtraLightItalic.notdef-outline.all.ttf} | Bin + ...depoint.ttf => AlegreyaSans-BlackItalic.default.all.ttf} | Bin + ...int.ttf => AlegreyaSans-BlackItalic.glyph-names.all.ttf} | Bin + ....ttf => AlegreyaSans-BlackItalic.notdef-outline.all.ttf} | Bin + ...odepoint.ttf => AnekBangla-latin-subset.default.all.ttf} | Bin + ...point.ttf => IndicTestJalandhar-Regular.default.all.ttf} | Bin + ...nt.ttf => IndicTestJalandhar-Regular.drop-hints.all.ttf} | Bin + ...int.ttf => IndicTestJalandhar-Regular.keep-gdef.all.ttf} | Bin + ...odepoint.ttf => IndicTestHowrah-Regular.default.all.ttf} | Bin + ...point.ttf => IndicTestHowrah-Regular.drop-hints.all.ttf} | Bin + ...oint.ttf => IndicTestHowrah-Regular.retain-gids.all.ttf} | Bin + ...int.otf => gpos1_2_font.layout-test-retain-gids.all.otf} | Bin + ...n-all-codepoint.otf => gpos1_2_font.layout-test.all.otf} | Bin + ...nt.otf => gpos2_1_font7.layout-test-retain-gids.all.otf} | Bin + ...-all-codepoint.otf => gpos2_1_font7.layout-test.all.otf} | Bin + ...nt.otf => gpos2_2_font5.layout-test-retain-gids.all.otf} | Bin + ...-all-codepoint.otf => gpos2_2_font5.layout-test.all.otf} | Bin + ...oint.otf => gpos3_font3.layout-test-retain-gids.all.otf} | Bin + ...in-all-codepoint.otf => gpos3_font3.layout-test.all.otf} | Bin + ...pos4_multiple_anchors_1.layout-test-retain-gids.all.otf} | Bin + ...int.otf => gpos4_multiple_anchors_1.layout-test.all.otf} | Bin + ...oint.otf => gpos5_font1.layout-test-retain-gids.all.otf} | Bin + ...in-all-codepoint.otf => gpos5_font1.layout-test.all.otf} | Bin + ...oint.otf => gpos6_font1.layout-test-retain-gids.all.otf} | Bin + ...in-all-codepoint.otf => gpos6_font1.layout-test.all.otf} | Bin + ...g1_multiple_subrules_f1.layout-test-retain-gids.all.otf} | Bin + ...gpos_chaining1_multiple_subrules_f1.layout-test.all.otf} | Bin + ...g2_multiple_subrules_f1.layout-test-retain-gids.all.otf} | Bin + ...gpos_chaining2_multiple_subrules_f1.layout-test.all.otf} | Bin + ...pos_chaining3_simple_f1.layout-test-retain-gids.all.otf} | Bin + ...int.otf => gpos_chaining3_simple_f1.layout-test.all.otf} | Bin + ..._alternate_substitution.layout-test-retain-gids.all.otf} | Bin + ....otf => gsub_alternate_substitution.layout-test.all.otf} | Bin + ...t1_multiple_subrules_f2.layout-test-retain-gids.all.otf} | Bin + ... gsub_context1_multiple_subrules_f2.layout-test.all.otf} | Bin + ...t2_multiple_subrules_f2.layout-test-retain-gids.all.otf} | Bin + ... gsub_context2_multiple_subrules_f2.layout-test.all.otf} | Bin + ..._context3_successive_f1.layout-test-retain-gids.all.otf} | Bin + ....otf => gsub_context3_successive_f1.layout-test.all.otf} | Bin + ....ttf => Molengo-Regular.layout-test-retain-gids.all.ttf} | Bin + ...ll-codepoint.ttf => Molengo-Regular.layout-test.all.ttf} | Bin + ...g1_multiple_subrules_f1.layout-test-retain-gids.all.otf} | Bin + ...gsub_chaining1_multiple_subrules_f1.layout-test.all.otf} | Bin + ...g2_multiple_subrules_f1.layout-test-retain-gids.all.otf} | Bin + ...gsub_chaining2_multiple_subrules_f1.layout-test.all.otf} | Bin + ...sub_chaining3_simple_f2.layout-test-retain-gids.all.otf} | Bin + ...int.otf => gsub_chaining3_simple_f2.layout-test.all.otf} | Bin + ... gsub8_manually_created.layout-test-retain-gids.all.otf} | Bin + ...point.otf => gsub8_manually_created.layout-test.all.otf} | Bin + ...-codepoint.ttf => NotoNastaliqUrdu-Bold.default.all.ttf} | Bin + ...epoint.ttf => NotoNastaliqUrdu-Bold.retain-gids.all.ttf} | Bin + ...depoint.ttf => NotoNastaliqUrdu-Regular.default.all.ttf} | Bin + ...int.ttf => NotoNastaliqUrdu-Regular.retain-gids.all.ttf} | Bin + ...etain-all-codepoint.ttf => Tinos-Italic.default.all.ttf} | Bin + ...n-all-codepoint.ttf => Tinos-Italic.glyph-names.all.ttf} | Bin + ...ll-codepoint.ttf => Tinos-Italic.notdef-outline.all.ttf} | Bin + ...n-all-codepoint.ttf => Tinos-Italic.retain-gids.all.ttf} | Bin + ...oint.ttf => NotoIKEAHebrewLatin-Regular.default.all.ttf} | Bin + ....ttf => NotoIKEAHebrewLatin-Regular.layout-test.all.ttf} | Bin + ....ttf => NotoIKEAHebrewLatin-Regular.retain-gids.all.ttf} | Bin + ...ll-codepoint.ttf => STIXTwoMath-Regular.default.all.ttf} | Bin + ...odepoint.ttf => STIXTwoMath-Regular.glyph-names.all.ttf} | Bin + ...point.ttf => STIXTwoMath-Regular.notdef-outline.all.ttf} | Bin + ...odepoint.ttf => STIXTwoMath-Regular.retain-gids.all.ttf} | Bin + ...ain-all-codepoint.ttf => Caudex-Regular.default.all.ttf} | Bin + ...all-codepoint.ttf => Caudex-Regular.glyph-names.all.ttf} | Bin + ....ttf => Caudex-Regular.keep-all-layout-features.all.ttf} | Bin + ...-codepoint.ttf => Caudex-Regular.notdef-outline.all.ttf} | Bin + ...all-codepoint.ttf => Caudex-Regular.retain-gids.all.ttf} | Bin + ...toSans-VF.abc.no-layout.all.wght=150,wdth=80,CTGR=0.ttf} | Bin + ...toSans-VF.abc.no-layout.all.wght=300,wdth=90,CTGR=0.ttf} | Bin + ...all.wght=200-600,wdth=80-90,CTGR=20-60.iup_optimize.ttf} | Bin + ....abc.default.all.wght=200-600,wdth=80-90,CTGR=20-60.ttf} | Bin + ...toSans-VF.abc.default.all.wght=300-600.iup_optimize.ttf} | Bin + ...600.ttf => NotoSans-VF.abc.default.all.wght=300-600.ttf} | Bin + ...toSans-VF.abc.default.all.wght=500-800.iup_optimize.ttf} | Bin + ...800.ttf => NotoSans-VF.abc.default.all.wght=500-800.ttf} | Bin + ...Roboto-Variable.ABC.default.all.wght=400,wdth=100.0.ttf} | Bin + ... Roboto-Variable.ABC.default.all.wght=drop,wdth=100.ttf} | Bin + ...oint.ttf => SreeKrushnadevaraya-Regular.default.all.ttf} | Bin + ....ttf => SreeKrushnadevaraya-Regular.glyph-names.all.ttf} | Bin + ...f => SreeKrushnadevaraya-Regular.notdef-outline.all.ttf} | Bin + ....ttf => SreeKrushnadevaraya-Regular.retain-gids.all.ttf} | Bin + ....no-layout.all.wght=400,CASL=0,CRSV=0,MONO=0,slnt=0.ttf} | Bin + ....no-layout.all.wght=500,CASL=0,CRSV=0,MONO=0,slnt=0.ttf} | Bin + ....SPED=25,YEXT=520,wght=100-400,slnt=18.iup_optimize.ttf} | Bin + ...t.default.all.SPED=25,YEXT=520,wght=100-400,slnt=18.ttf} | Bin + ...ariable-Roman.default.all.wght=300-600.iup_optimize.ttf} | Bin + ... SourceSerifVariable-Roman.default.all.wght=300-600.ttf} | Bin + ...ariable-Roman.default.all.wght=500-800.iup_optimize.ttf} | Bin + ... SourceSerifVariable-Roman.default.all.wght=500-800.ttf} | Bin + ...alueformat-subset.default.all.wght=400.iup_optimize.ttf} | Bin + ...toSansOriya-valueformat-subset.default.all.wght=400.ttf} | Bin + ...eformat-subset.drop-hints.all.wght=400.iup_optimize.ttf} | Bin + ...ansOriya-valueformat-subset.drop-hints.all.wght=400.ttf} | Bin + test/subset/subset_test_suite.py | 2 +- + 211 files changed, 1 insertion(+), 1 deletion(-) + +commit 3b3c154bd1da1969199a5d4add1a643ab057a828 +Author: Qunxin Liu <qxliu@google.com> +Date: Mon May 6 12:56:23 2024 -0700 + + add back missing tests that were disabled when wrapped by experimental + + test/subset/data/Makefile.am | 11 +++++++++++ + test/subset/data/Makefile.sources | 11 +++++++++++ + 2 files changed, 22 insertions(+) + +commit 6c8985724e257b1525da6698bf7ce054a3dad9a5 +Author: Qunxin Liu <qxliu@google.com> +Date: Thu May 2 10:11:06 2024 -0700 + + fix bots + + src/OT/Color/COLR/COLR.hh | 2 +- + test/subset/data/Makefile.am | 1 - + test/subset/data/Makefile.sources | 1 - + test/subset/meson.build | 2 +- + 4 files changed, 2 insertions(+), 4 deletions(-) + +commit f614a7d3095c2ad8fe3551ffee4a44adc2c4b14c +Author: Qunxin Liu <qxliu@google.com> +Date: Thu May 2 10:05:18 2024 -0700 + + [instancer] add/update tests for COLRv1 instancing + + test/subset/data/Makefile.am | 2 +- + test/subset/data/Makefile.sources | 2 +- + .../expected/colrv1/TestCOLRv1.default.E000,E004.ttf | Bin 940 -> 940 bytes + .../colrv1/TestCOLRv1.default.E002,E003,E004.ttf | Bin 1248 -> 1248 bytes + .../expected/colrv1/TestCOLRv1.default.E003,E004.ttf | Bin 1044 -> 1044 bytes + .../TestCOLRv1.default.retain-all-codepoint.ttf | Bin 1532 -> 1532 bytes + .../TestCOLRv1.drop-hints-retain-gids.E000,E004.ttf | Bin 1020 -> 1020 bytes + ...stCOLRv1.drop-hints-retain-gids.E002,E003,E004.ttf | Bin 1304 -> 1304 bytes + .../TestCOLRv1.drop-hints-retain-gids.E003,E004.ttf | Bin 1124 -> 1124 bytes + ...v1.drop-hints-retain-gids.retain-all-codepoint.ttf | Bin 1532 -> 1532 bytes + .../colrv1/TestCOLRv1.drop-hints.E000,E004.ttf | Bin 940 -> 940 bytes + .../colrv1/TestCOLRv1.drop-hints.E002,E003,E004.ttf | Bin 1248 -> 1248 bytes + .../colrv1/TestCOLRv1.drop-hints.E003,E004.ttf | Bin 1044 -> 1044 bytes + .../TestCOLRv1.drop-hints.retain-all-codepoint.ttf | Bin 1532 -> 1532 bytes + .../colrv1/TestCOLRv1.retain-gids.E000,E004.ttf | Bin 1020 -> 1020 bytes + .../colrv1/TestCOLRv1.retain-gids.E002,E003,E004.ttf | Bin 1304 -> 1304 bytes + .../colrv1/TestCOLRv1.retain-gids.E003,E004.ttf | Bin 1124 -> 1124 bytes + .../TestCOLRv1.retain-gids.retain-all-codepoint.ttf | Bin 1532 -> 1532 bytes + .../colrv1_copy_varstore/Foldit.default.41,42.ttf | Bin 43840 -> 0 bytes + .../colrv1_copy_varstore/Foldit.default.41.ttf | Bin 43028 -> 0 bytes + .../Foldit.default.retain-all-codepoint.ttf | Bin 44324 -> 0 bytes + .../Foldit.drop-hints-retain-gids.41,42.ttf | Bin 43816 -> 0 bytes + .../Foldit.drop-hints-retain-gids.41.ttf | Bin 43012 -> 0 bytes + ...it.drop-hints-retain-gids.retain-all-codepoint.ttf | Bin 44288 -> 0 bytes + .../colrv1_copy_varstore/Foldit.drop-hints.41,42.ttf | Bin 43800 -> 0 bytes + .../colrv1_copy_varstore/Foldit.drop-hints.41.ttf | Bin 42996 -> 0 bytes + .../Foldit.drop-hints.retain-all-codepoint.ttf | Bin 44288 -> 0 bytes + .../colrv1_copy_varstore/Foldit.retain-gids.41,42.ttf | Bin 43856 -> 0 bytes + .../colrv1_copy_varstore/Foldit.retain-gids.41.ttf | Bin 43044 -> 0 bytes + .../Foldit.retain-gids.retain-all-codepoint.ttf | Bin 44324 -> 0 bytes + .../colrv1_subset_varstore/Foldit.default.41,42.ttf | Bin 0 -> 3536 bytes + .../colrv1_subset_varstore/Foldit.default.41.ttf | Bin 0 -> 2628 bytes + .../Foldit.default.retain-all-codepoint.ttf | Bin 0 -> 4060 bytes + .../Foldit.drop-hints-retain-gids.41,42.ttf | Bin 0 -> 3512 bytes + .../Foldit.drop-hints-retain-gids.41.ttf | Bin 0 -> 2612 bytes + ...it.drop-hints-retain-gids.retain-all-codepoint.ttf | Bin 0 -> 4024 bytes + .../Foldit.drop-hints.41,42.ttf | Bin 0 -> 3496 bytes + .../colrv1_subset_varstore/Foldit.drop-hints.41.ttf | Bin 0 -> 2596 bytes + .../Foldit.drop-hints.retain-all-codepoint.ttf | Bin 0 -> 4024 bytes + .../Foldit.retain-gids.41,42.ttf | Bin 0 -> 3552 bytes + .../colrv1_subset_varstore/Foldit.retain-gids.41.ttf | Bin 0 -> 2644 bytes + .../Foldit.retain-gids.retain-all-codepoint.ttf | Bin 0 -> 4060 bytes + ...ldit.default.retain-all-codepoint.wght=300-600.ttf | Bin 0 -> 4004 bytes + ...py_varstore.tests => colrv1_subset_varstore.tests} | 3 +++ + test/subset/data/tests/instantiate_colrv1.tests | 1 + + test/subset/meson.build | 2 +- + 46 files changed, 7 insertions(+), 3 deletions(-) + +commit 247039de5afebacf0a84b4c59ae814c9743c23c5 +Author: Qunxin Liu <qxliu@google.com> +Date: Fri Apr 26 13:36:52 2024 -0700 + + [instancer] partial instantiating support for COLRv1 + + Also add subset support for COLRv1 VarStore/DeltaSetIndexMap + + src/OT/Color/COLR/COLR.hh | 201 ++++++++++++++++++++++++++++++++++---- + src/hb-subset-plan-member-list.hh | 4 + + src/hb-subset-plan.cc | 56 ++++++++++- + 3 files changed, 240 insertions(+), 21 deletions(-) + +commit 625a9a963ac4dc885e72fb68ee51cbe07c4fd76b +Author: Qunxin Liu <qxliu@google.com> +Date: Fri May 3 14:52:53 2024 -0700 + + [instancer] use correct constant for No VARIATIONS index + + src/hb-ot-layout-base-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ebcdadbf546dc7a067bb18f1fa232c4871faf943 +Author: Qunxin Liu <qxliu@google.com> +Date: Fri May 3 14:24:56 2024 -0700 + + [instancer] add tests for instantiating BASE table + + ...-subset.default.retain-all-codepoint.wght=400-600.ttf | Bin 0 -> 2680 bytes + ...ifHK-subset.default.retain-all-codepoint.wght=500.ttf | Bin 0 -> 1932 bytes + test/subset/data/fonts/NotoSerifHK-subset.ttf | Bin 0 -> 3248 bytes + test/subset/data/tests/instantiate_base.tests | 15 +++++++++++++++ + test/subset/meson.build | 1 + + 5 files changed, 16 insertions(+) + +commit c5a85a73fa66fee7524f5e39ba5751e25b5b0f49 +Author: Qunxin Liu <qxliu@google.com> +Date: Fri May 3 09:44:14 2024 -0700 + + [instancer] support BASE table + + src/hb-ot-layout-base-table.hh | 64 ++++++++++++++++++++++++++++++++++----- + src/hb-subset-plan-member-list.hh | 2 +- + src/hb-subset-plan.cc | 10 +++--- + 3 files changed, 64 insertions(+), 12 deletions(-) + +commit 4d2380f56d780b9bd9825e95989f1185cb9a961d +Merge: f03bf4997 f145ab2f1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri May 3 14:05:56 2024 -0500 + + Merge pull request #4693 from harfbuzz/promote-vf-api + + [instancer] Promote partial instancing API out of experimental. + +commit f145ab2f1ef326746cd625493d4b5af2271bd967 +Author: Garret Rieger <grieger@google.com> +Date: Fri May 3 18:24:33 2024 +0000 + + Disable empty_region_vardata test when running on 32bit machines. + + test/subset/meson.build | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +commit e81c8c1312f2c9140960520cedeea8264ca7f0ee +Author: Garret Rieger <grieger@google.com> +Date: Fri May 3 18:06:14 2024 +0000 + + Change tolerance from float to double. + + src/hb-ot-var-common.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 36e82fd5b35b29044d7bc24be3326ed8d0fc6e26 +Author: Garret Rieger <grieger@google.com> +Date: Fri May 3 17:33:37 2024 +0000 + + Use sizeof(repeat_x_deltas[0]) instead of sizeof(int). + + src/hb-subset-instancer-iup.cc | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit f03bf49978070c165a4e6c5fc86d7b1fde02f038 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Fri May 3 00:35:40 2024 +0300 + + [ci] Try to fix finding ICU on macOS runner + + .github/workflows/macos-ci.yml | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 91f54d4bae20a109382c913340b4c67da781f4e0 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Fri May 3 00:15:38 2024 +0300 + + [ci] Try to fix pip install on macOS runner + + Use setup-python action which which I think uses venv so pip install + will not fail as now installing system-wide packages with pip is + disallowed. + + .github/workflows/linux-ci.yml | 4 ++++ + .github/workflows/macos-ci.yml | 7 ++++++- + 2 files changed, 10 insertions(+), 1 deletion(-) + +commit 0617266273ade741b4ed34648f5f7cb55741ddec +Author: Garret Rieger <grieger@google.com> +Date: Thu May 2 22:05:03 2024 +0000 + + Test using double's in IUP optimizatio code. + + Trying to resolve delta differences on MINGW 32bit. + + src/hb-subset-instancer-iup.cc | 46 +++++++++++++++++++++--------------------- + src/hb-subset-instancer-iup.hh | 2 +- + 2 files changed, 24 insertions(+), 24 deletions(-) + +commit ba1f194a1d62164be439a7f1f8ed9a87da9f7061 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu May 2 12:18:11 2024 -0600 + + [gsubgpos] Reduce stack use in recursion + + src/OT/Layout/GSUB/Ligature.hh | 15 +++- + src/hb-ot-layout-gsubgpos.hh | 81 ++++++++++++++++++--- + .../crash-06c15853f99560aafddeda9f0879327b38475e07 | Bin 0 -> 103 bytes + 3 files changed, 84 insertions(+), 12 deletions(-) + +commit 4cf606f6740ffaa618a61d24517eeeb199cf1729 +Author: Garret Rieger <grieger@google.com> +Date: Thu May 2 20:46:29 2024 +0000 + + [instancer] Promote partial instancing api out of experimental. + + docs/harfbuzz-sections.txt | 4 ++-- + perf/benchmark-subset.cc | 2 -- + src/gen-def.py | 2 -- + src/hb-ot-var-gvar-table.hh | 5 +---- + src/hb-subset-input.cc | 7 ++----- + src/hb-subset-plan.cc | 2 -- + src/hb-subset.h | 11 +++++------ + test/subset/meson.build | 20 ++++++++++---------- + util/hb-subset.cc | 5 +---- + util/helper-subset.hh | 2 -- + 10 files changed, 21 insertions(+), 39 deletions(-) + +commit c04d0a295f7ca081f8d086acf329e9be099b791c +Author: Qunxin Liu <qxliu@google.com> +Date: Thu Apr 25 14:57:36 2024 -0700 + + [subset] generate colrv1 varsotre inner_maps in the plan + + Also merge remap_variation_indices APIs used by GDEF and BASE into 1 + + src/OT/Color/COLR/COLR.hh | 40 ++++++++++++-- + src/OT/Layout/GDEF/GDEF.hh | 41 -------------- + src/hb-subset-plan-member-list.hh | 2 + + src/hb-subset-plan.cc | 109 +++++++++++++++++++++++--------------- + 4 files changed, 105 insertions(+), 87 deletions(-) + +commit 690893e3673815c90d2635894e111c5170ec8656 +Author: Qunxin Liu <qxliu@google.com> +Date: Mon Oct 2 09:09:53 2023 -0700 + + [subset] collect variation indices for COLRv1 + + src/OT/Color/COLR/COLR.hh | 75 ++++++++++++++++++++++++++++++++----- + src/OT/Color/COLR/colrv1-closure.hh | 50 ++++++++++++++++++++----- + src/hb-subset-plan.cc | 3 +- + 3 files changed, 107 insertions(+), 21 deletions(-) + +commit 6ac7a05cdc2f3597bd65c30bd2ab019991761a33 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 29 10:49:34 2024 +0000 + + Bump actions/upload-artifact from 4.3.2 to 4.3.3 + + Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.2 to 4.3.3. + - [Release notes](https://github.com/actions/upload-artifact/releases) + - [Commits](https://github.com/actions/upload-artifact/compare/1746f4ab65b179e0ea60a494b83293b640dd5bba...65462800fd760344b1a7b4382951275a0abb4808) + + --- + updated-dependencies: + - dependency-name: actions/upload-artifact + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/cifuzz.yml | 2 +- + .github/workflows/msys2-ci.yml | 2 +- + .github/workflows/scorecard.yml | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +commit 11f37aac8fe7db9eca96fbc0fb8dfcad4bae3b1e +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 29 10:49:30 2024 +0000 + + Bump hendrikmuhs/ccache-action from 1.2.12 to 1.2.13 + + Bumps [hendrikmuhs/ccache-action](https://github.com/hendrikmuhs/ccache-action) from 1.2.12 to 1.2.13. + - [Release notes](https://github.com/hendrikmuhs/ccache-action/releases) + - [Commits](https://github.com/hendrikmuhs/ccache-action/compare/faf867a11c028c0b483fb2ae72b6fc8f7d842714...c92f40bee50034e84c763e33b317c77adaa81c92) + + --- + updated-dependencies: + - dependency-name: hendrikmuhs/ccache-action + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + .github/workflows/msvc-ci.yml | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +commit 77b9b8c862a51ae80cda1d9abeee2a965d65739b +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 29 10:49:25 2024 +0000 + + Bump github/codeql-action from 3.25.1 to 3.25.3 + + Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.1 to 3.25.3. + - [Release notes](https://github.com/github/codeql-action/releases) + - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/github/codeql-action/compare/c7f9125735019aa87cfc361530512d50ea439c71...d39d31e687223d841ef683f52467bd88e9b21c14) + + --- + updated-dependencies: + - dependency-name: github/codeql-action + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/scorecard.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit c7b4f16ae8b516b2d97830d9b2df62e7090d24ec +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 29 10:49:17 2024 +0000 + + Bump actions/checkout from 4.1.3 to 4.1.4 + + Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.3 to 4.1.4. + - [Release notes](https://github.com/actions/checkout/releases) + - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) + - [Commits](https://github.com/actions/checkout/compare/1d96c772d19495a3b5c517cd2bc0cb401ea0529f...0ad4b8fadaa221de15dcec353f45205ec38ea70b) + + --- + updated-dependencies: + - dependency-name: actions/checkout + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/arm-ci.yml | 2 +- + .github/workflows/configs-build.yml | 2 +- + .github/workflows/coverity-scan.yml | 2 +- + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + .github/workflows/msvc-ci.yml | 2 +- + .github/workflows/msys2-ci.yml | 2 +- + .github/workflows/scorecard.yml | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +commit aeadd7c1a682d7bdbc9ae5a39dd1f7ba12394679 +Author: Garret Rieger <grieger@google.com> +Date: Tue Apr 23 19:50:19 2024 +0000 + + [subset] Offsets in BaseLangSysRecord are relative to the parent table and not the BaseLangSysRecord. + + https://learn.microsoft.com/en-us/typography/opentype/spec/base#baselangsysrecord-1 + + src/hb-ot-layout-base-table.hh | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +commit 33cae9b4f5cc9905e28c0e704b061f712e8b2b3e +Author: Garret Rieger <grieger@google.com> +Date: Fri Apr 19 21:58:10 2024 +0000 + + [repacker] If repacking fails for GSUB/GPOS try re-running with extension promotion and table splitting. + + src/hb-repacker.hh | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +commit adab75fbaa410e622aab5dbdfe3b3340ec5f59e0 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 22 10:33:25 2024 +0000 + + Bump actions/upload-artifact from 4.3.1 to 4.3.2 + + Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.1 to 4.3.2. + - [Release notes](https://github.com/actions/upload-artifact/releases) + - [Commits](https://github.com/actions/upload-artifact/compare/5d5d22a31266ced268874388b861e4b58bb5c2f3...1746f4ab65b179e0ea60a494b83293b640dd5bba) + + --- + updated-dependencies: + - dependency-name: actions/upload-artifact + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/cifuzz.yml | 2 +- + .github/workflows/msys2-ci.yml | 2 +- + .github/workflows/scorecard.yml | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +commit 7aab4847db2abfa91ffe9b03b7cb0f1ee8102a17 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 22 10:33:33 2024 +0000 + + Bump github/codeql-action from 3.24.10 to 3.25.1 + + Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.10 to 3.25.1. + - [Release notes](https://github.com/github/codeql-action/releases) + - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/github/codeql-action/compare/4355270be187e1b672a7a1c7c7bae5afdc1ab94a...c7f9125735019aa87cfc361530512d50ea439c71) + + --- + updated-dependencies: + - dependency-name: github/codeql-action + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/scorecard.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit e2892805a9a0512b5d8c066e3754aefbadcfc070 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 22 10:33:38 2024 +0000 + + Bump actions/checkout from 4.1.2 to 4.1.3 + + Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.3. + - [Release notes](https://github.com/actions/checkout/releases) + - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) + - [Commits](https://github.com/actions/checkout/compare/9bb56186c3b09b4f86b1c65136769dd318469633...1d96c772d19495a3b5c517cd2bc0cb401ea0529f) + + --- + updated-dependencies: + - dependency-name: actions/checkout + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/arm-ci.yml | 2 +- + .github/workflows/configs-build.yml | 2 +- + .github/workflows/coverity-scan.yml | 2 +- + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + .github/workflows/msvc-ci.yml | 2 +- + .github/workflows/msys2-ci.yml | 2 +- + .github/workflows/scorecard.yml | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +commit a69a6cb09ee0ea1296c3bbd30c66b56f21afb6b6 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Apr 16 17:08:06 2024 -0600 + + Avoid a copy + + src/hb-ot-var-common.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 2cfa55056cdbcaf724971f26d098fc118fd3f81b +Author: Garret Rieger <grieger@google.com> +Date: Wed Mar 27 23:21:57 2024 +0000 + + [instancer] Switch to doubles for delta calculations. + + FontTools uses double's internally so match FontTool's precision so we get the same results more often for floating point calculations. + + src/hb-algs.hh | 4 + + src/hb-ot-os2-table.hh | 2 +- + src/hb-ot-post-table.hh | 2 +- + src/hb-ot-stat-table.hh | 3 +- + src/hb-ot-var-common.hh | 52 +-- + src/hb-ot-var-fvar-table.hh | 7 +- + src/hb-subset-instancer-solver.cc | 76 ++-- + src/hb-subset-instancer-solver.hh | 24 +- + src/test-subset-instancer-solver.cc | 390 ++++++++++----------- + src/test-tuple-varstore.cc | 22 +- + ...nt.wght=200-300-500,wdth=80-90.iup_optimize.ttf | Bin 8684 -> 8684 bytes + ...n-all-codepoint.wght=200-300-500,wdth=80-90.ttf | Bin 8708 -> 8708 bytes + ...nt.wght=200-300-500,wdth=80-90.iup_optimize.ttf | Bin 7516 -> 7516 bytes + ...n-all-codepoint.wght=200-300-500,wdth=80-90.ttf | Bin 7568 -> 7568 bytes + .../data/tests/glyf_partial_instancing.tests | 4 - + 15 files changed, 295 insertions(+), 291 deletions(-) + +commit f8ebf27a721daf05fd34215ed661f6e07a7b699e +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 15 10:32:58 2024 +0000 + + Bump setuptools from 69.2.0 to 69.5.1 in /.ci + + Bumps [setuptools](https://github.com/pypa/setuptools) from 69.2.0 to 69.5.1. + - [Release notes](https://github.com/pypa/setuptools/releases) + - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) + - [Commits](https://github.com/pypa/setuptools/compare/v69.2.0...v69.5.1) + + --- + updated-dependencies: + - dependency-name: setuptools + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .ci/requirements.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 71200c13418ce0050a84ce7f1ea5a6eafefa31e1 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 15 10:21:59 2024 +0000 + + Bump codecov/codecov-action from 4.2.0 to 4.3.0 + + Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.2.0 to 4.3.0. + - [Release notes](https://github.com/codecov/codecov-action/releases) + - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/codecov/codecov-action/compare/7afa10ed9b269c561c2336fd862446844e0cbf71...84508663e988701840491b86de86b666e8a86bed) + + --- + updated-dependencies: + - dependency-name: codecov/codecov-action + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 39b5ae79f0e4018ecb004c1a27d6c9f16492f5a5 +Author: Timo Suoranta <timo.suoranta@supercell.com> +Date: Fri Apr 12 17:15:09 2024 +0300 + + Fix for #4395 + + CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +commit c053e8f29257814e11ad61493dbbe29f27656de4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Apr 11 08:58:49 2024 -0600 + + [aat] Simplify (or not?) SubtableGlyphCoverage.sanitize() + + src/hb-aat-layout-common.hh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +commit d137d5579908ae29a4fecdc2e31a9987fc0c6c1c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Apr 11 08:53:17 2024 -0600 + + [aat] Add (unused) SubtableGlyphCoverage + + src/hb-aat-layout-common.hh | 32 ++++++++++++++++++++++++++++++++ + src/hb-aat-layout-kerx-table.hh | 10 ++++++++++ + src/hb-aat-layout-morx-table.hh | 11 +++++++++-- + 3 files changed, 51 insertions(+), 2 deletions(-) + +commit d8d2a98b8daa282b28672f5058e1d45c1b6b1fe5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Apr 11 07:45:41 2024 -0600 + + [aat] Whitespace + + src/hb-aat-layout-common.hh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +commit b3e4721af7969b1bc46f974107e1f555a96eface +Author: Khaled Hosny <khaled@aliftype.com> +Date: Tue Apr 9 18:54:36 2024 +0200 + + Revert "[ci] Enable experimental_api on distcheck job" + + This reverts commit 89570d195962a4a9fce98eda450a5567782f26d3. + + .circleci/config.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 607931b39612bceac28b3a819517c74ed2e88751 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 8 10:04:44 2024 +0000 + + Bump fonttools from 4.50.0 to 4.51.0 in /.ci + + Bumps [fonttools](https://github.com/fonttools/fonttools) from 4.50.0 to 4.51.0. + - [Release notes](https://github.com/fonttools/fonttools/releases) + - [Changelog](https://github.com/fonttools/fonttools/blob/main/NEWS.rst) + - [Commits](https://github.com/fonttools/fonttools/compare/4.50.0...4.51.0) + + --- + updated-dependencies: + - dependency-name: fonttools + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .ci/requirements-fonttools.txt | 86 +++++++++++++++++++++--------------------- + .ci/requirements.txt | 86 +++++++++++++++++++++--------------------- + 2 files changed, 86 insertions(+), 86 deletions(-) + +commit cd825c9ae8ad834edcf041c35be67112b33ddfe4 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 8 10:47:51 2024 +0000 + + Bump github/codeql-action from 3.24.9 to 3.24.10 + + Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.9 to 3.24.10. + - [Release notes](https://github.com/github/codeql-action/releases) + - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/github/codeql-action/compare/1b1aada464948af03b950897e5eb522f92603cc2...4355270be187e1b672a7a1c7c7bae5afdc1ab94a) + + --- + updated-dependencies: + - dependency-name: github/codeql-action + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/scorecard.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 51dcc99c872d93d80147573456d146de9a8d11e8 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 8 10:47:54 2024 +0000 + + Bump codecov/codecov-action from 4.1.1 to 4.2.0 + + Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.1.1 to 4.2.0. + - [Release notes](https://github.com/codecov/codecov-action/releases) + - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/codecov/codecov-action/compare/c16abc29c95fcf9174b58eb7e1abf4c866893bc8...7afa10ed9b269c561c2336fd862446844e0cbf71) + + --- + updated-dependencies: + - dependency-name: codecov/codecov-action + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit c84acc8e0703ee35a2ea15b259a4f04a7b3e5abf +Author: Garret Rieger <grieger@google.com> +Date: Mon Apr 8 23:46:14 2024 +0000 + + [subset] Fix fuzzer found memory leak. + + Fixes https://oss-fuzz.com/testcase-detail/6159925345583104. + + src/hb-ot-layout-common.hh | 2 ++ + ...testcase-minimized-hb-subset-fuzzer-6159925345583104 | Bin 0 -> 46421 bytes + 2 files changed, 2 insertions(+) + +commit 89570d195962a4a9fce98eda450a5567782f26d3 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Tue Apr 9 01:56:27 2024 +0200 + + [ci] Enable experimental_api on distcheck job + + .circleci/config.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 12dcafe01505f60027e5b30c5e30d4cbce976dd1 +Author: Garret Rieger <grieger@google.com> +Date: Mon Apr 8 22:59:32 2024 +0000 + + Add test-hb-subset-parsing.c to extra dist. Needed for meson compile w/ experimental api. + + util/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f3727c4767262365c232e2fe74d8d96512b3b90e +Author: David Corbett <corbett.dav@northeastern.edu> +Date: Thu Apr 4 19:04:59 2024 -0400 + + Recognize ot_languages2’s disambiguation priority + + src/gen-tag-table.py | 18 +++++++++++------- + src/hb-ot-tag-table.hh | 45 ++++----------------------------------------- + 2 files changed, 15 insertions(+), 48 deletions(-) + +commit 2fcace77b2137abb44468a04e87d8716294641a9 +Author: Garret Rieger <grieger@google.com> +Date: Tue Apr 2 17:42:14 2024 +0000 + + [subet] Don't use experimental api flag in benchmark if not compiled with experimental api. + + perf/benchmark-subset.cc | 2 ++ + 1 file changed, 2 insertions(+) + +commit 41612df9d378705352e6745c89732563138c150b +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 1 10:57:16 2024 +0000 + + Bump actions/setup-python from 5.0.0 to 5.1.0 + + Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.0.0 to 5.1.0. + - [Release notes](https://github.com/actions/setup-python/releases) + - [Commits](https://github.com/actions/setup-python/compare/0a5c61591373683505ea898e09a3ea4f39ef2b9c...82c7e631bb3cdc910f68e0081d67478d79c6982d) + + --- + updated-dependencies: + - dependency-name: actions/setup-python + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/msvc-ci.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit d5d05a9866ec28ba7ab369c069e4fdaeb06b6382 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Mon Apr 1 10:57:19 2024 +0000 + + Bump codecov/codecov-action from 4.1.0 to 4.1.1 + + Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.1.0 to 4.1.1. + - [Release notes](https://github.com/codecov/codecov-action/releases) + - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) + - [Commits](https://github.com/codecov/codecov-action/compare/54bcd8715eee62d40e33596ef5e8f0f48dbbccab...c16abc29c95fcf9174b58eb7e1abf4c866893bc8) + + --- + updated-dependencies: + - dependency-name: codecov/codecov-action + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] <support@github.com> + + .github/workflows/linux-ci.yml | 2 +- + .github/workflows/macos-ci.yml | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 7de2d11150a8cdfaa5859c845846f5063b6a8197 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Apr 1 01:54:09 2024 -0600 + + Fix autotools test + + src/check-c-linkage-decls.py | 1 + + src/hb-cplusplus.hh | 3 --- + src/hb-wasm-api.h | 3 +++ + 3 files changed, 4 insertions(+), 3 deletions(-) + +commit 2bd6124737c71df248c6b3af1d201aab93acc428 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Sat Mar 30 02:20:21 2024 +0200 + + Fix Python warning + + fix_get_types.py:14: SyntaxWarning: invalid escape sequence '\(' + + src/fix_get_types.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 63973005bc07aba599b47fdd4cf788647b601ccd Author: Khaled Hosny <khaled@aliftype.com> Date: Fri Mar 29 16:26:17 2024 +0200 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index e94c6a89379..e705d08aeb4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,18 @@ +Overview of changes leading to 8.5.0 +Monday, May 13, 2024 +==================================== +- API for partial instancing is now stable and have been promoted out of + experimental APIs. +- Support instancing “BASE” table. +- Speedup AAT shaping by 13–30%. +- Various build fixes. +- Various subsetter and instancer fixes. + +- New API ++HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS ++hb_subset_input_get_axis_range() ++hb_subset_input_pin_axis_location() + Overview of changes leading to 8.4.0 Saturday, March 29, 2024 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index 40f5994e858..2efadb9cbba 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], - [8.4.0], + [8.5.0], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/meson.build b/Build/source/libs/harfbuzz/harfbuzz-src/meson.build index fed3dc05549..d8d8424e7b9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/meson.build +++ b/Build/source/libs/harfbuzz/harfbuzz-src/meson.build @@ -1,6 +1,6 @@ project('harfbuzz', 'c', 'cpp', meson_version: '>= 0.55.0', - version: '8.4.0', + version: '8.5.0', default_options: [ 'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway # 'cpp_rtti=false', # Do NOT enable, wraps inherit it and ICU needs RTTI diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am index 0f708a446f8..71b9f5def0e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am @@ -443,6 +443,7 @@ COMPILED_TESTS = \ test-algs \ test-array \ test-bimap \ + test-cff \ test-iter \ test-machinery \ test-map \ @@ -477,6 +478,10 @@ test_bimap_SOURCES = test-bimap.cc hb-static.cc test_bimap_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) test_bimap_LDADD = $(COMPILED_TESTS_LDADD) +test_cff_SOURCES = test-cff.cc hb-static.cc +test_cff_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_cff_LDADD = $(COMPILED_TESTS_LDADD) + test_iter_SOURCES = test-iter.cc hb-static.cc test_iter_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) test_iter_LDADD = $(COMPILED_TESTS_LDADD) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/COLR.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/COLR.hh index 623775a771d..835d87f8c6b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/COLR.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/COLR.hh @@ -159,23 +159,35 @@ struct hb_colrv1_closure_context_t : void add_palette_index (unsigned palette_index) { palette_indices->add (palette_index); } + void add_var_idxes (unsigned first_var_idx, unsigned num_idxes) + { + if (!num_idxes || first_var_idx == VarIdx::NO_VARIATION) return; + variation_indices->add_range (first_var_idx, first_var_idx + num_idxes - 1); + } + public: const void *base; hb_set_t visited_paint; hb_set_t *glyphs; hb_set_t *layer_indices; hb_set_t *palette_indices; + hb_set_t *variation_indices; + unsigned num_var_idxes; unsigned nesting_level_left; hb_colrv1_closure_context_t (const void *base_, hb_set_t *glyphs_, hb_set_t *layer_indices_, hb_set_t *palette_indices_, + hb_set_t *variation_indices_, + unsigned num_var_idxes_ = 1, unsigned nesting_level_left_ = HB_MAX_NESTING_LEVEL) : base (base_), glyphs (glyphs_), layer_indices (layer_indices_), palette_indices (palette_indices_), + variation_indices (variation_indices_), + num_var_idxes (num_var_idxes_), nesting_level_left (nesting_level_left_) {} }; @@ -242,7 +254,12 @@ struct Variable } void closurev1 (hb_colrv1_closure_context_t* c) const - { value.closurev1 (c); } + { + c->num_var_idxes = 0; + // update c->num_var_idxes during value closure + value.closurev1 (c); + c->add_var_idxes (varIdxBase, c->num_var_idxes); + } bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer) const @@ -252,8 +269,18 @@ struct Variable if (c->plan->all_axes_pinned) return_trace (true); - //TODO: update varIdxBase for partial-instancing - return_trace (c->serializer->embed (varIdxBase)); + VarIdx new_varidx; + new_varidx = varIdxBase; + if (varIdxBase != VarIdx::NO_VARIATION) + { + hb_pair_t<unsigned, int> *new_varidx_delta; + if (!c->plan->colrv1_variation_idx_delta_map.has (varIdxBase, &new_varidx_delta)) + return_trace (false); + + new_varidx = hb_first (*new_varidx_delta); + } + + return_trace (c->serializer->embed (new_varidx)); } bool sanitize (hb_sanitize_context_t *c) const @@ -345,7 +372,10 @@ struct NoVariable struct ColorStop { void closurev1 (hb_colrv1_closure_context_t* c) const - { c->add_palette_index (paletteIndex); } + { + c->add_palette_index (paletteIndex); + c->num_var_idxes = 2; + } bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer, @@ -542,6 +572,9 @@ struct Affine2x3 return_trace (c->check_struct (this)); } + void closurev1 (hb_colrv1_closure_context_t* c) const + { c->num_var_idxes = 6; } + bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer, uint32_t varIdxBase) const @@ -617,7 +650,10 @@ struct PaintColrLayers struct PaintSolid { void closurev1 (hb_colrv1_closure_context_t* c) const - { c->add_palette_index (paletteIndex); } + { + c->add_palette_index (paletteIndex); + c->num_var_idxes = 1; + } bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer, @@ -666,7 +702,10 @@ template <template<typename> class Var> struct PaintLinearGradient { void closurev1 (hb_colrv1_closure_context_t* c) const - { (this+colorLine).closurev1 (c); } + { + (this+colorLine).closurev1 (c); + c->num_var_idxes = 6; + } bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer, @@ -733,7 +772,10 @@ template <template<typename> class Var> struct PaintRadialGradient { void closurev1 (hb_colrv1_closure_context_t* c) const - { (this+colorLine).closurev1 (c); } + { + (this+colorLine).closurev1 (c); + c->num_var_idxes = 6; + } bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer, @@ -800,7 +842,10 @@ template <template<typename> class Var> struct PaintSweepGradient { void closurev1 (hb_colrv1_closure_context_t* c) const - { (this+colorLine).closurev1 (c); } + { + (this+colorLine).closurev1 (c); + c->num_var_idxes = 4; + } bool subset (hb_subset_context_t *c, const ItemVarStoreInstancer &instancer, @@ -1544,6 +1589,9 @@ struct ClipBoxFormat2 : Variable<ClipBoxFormat1> clip_box.yMax += roundf (instancer (varIdxBase, 3)); } } + + void closurev1 (hb_colrv1_closure_context_t* c) const + { c->variation_indices->add_range (varIdxBase, varIdxBase + 3); } }; struct ClipBox @@ -1559,6 +1607,14 @@ struct ClipBox } } + void closurev1 (hb_colrv1_closure_context_t* c) const + { + switch (u.format) { + case 2: u.format2.closurev1 (c); + default:return; + } + } + template <typename context_t, typename ...Ts> typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { @@ -1606,6 +1662,12 @@ struct ClipRecord int cmp (hb_codepoint_t g) const { return g < startGlyphID ? -1 : g <= endGlyphID ? 0 : +1; } + void closurev1 (hb_colrv1_closure_context_t* c, const void *base) const + { + if (!c->glyphs->intersects (startGlyphID, endGlyphID)) return; + (base+clipBox).closurev1 (c); + } + bool subset (hb_subset_context_t *c, const void *base, const ItemVarStoreInstancer &instancer) const @@ -1941,6 +2003,76 @@ struct LayerList : Array32OfOffset32To<Paint> } }; +struct delta_set_index_map_subset_plan_t +{ + unsigned get_inner_bit_count () const { return inner_bit_count; } + unsigned get_width () const { return ((outer_bit_count + inner_bit_count + 7) / 8); } + hb_array_t<const uint32_t> get_output_map () const { return output_map.as_array (); } + + delta_set_index_map_subset_plan_t (const hb_map_t &new_deltaset_idx_varidx_map) + { + map_count = 0; + outer_bit_count = 0; + inner_bit_count = 1; + output_map.init (); + + /* search backwards */ + unsigned count = new_deltaset_idx_varidx_map.get_population (); + if (!count) return; + + unsigned last_idx = (unsigned)-1; + unsigned last_varidx = (unsigned)-1; + + for (unsigned i = count; i; i--) + { + unsigned delta_set_idx = i - 1; + unsigned var_idx = new_deltaset_idx_varidx_map.get (delta_set_idx); + if (i == count) + { + last_idx = delta_set_idx; + last_varidx = var_idx; + continue; + } + if (var_idx != last_varidx) + break; + last_idx = delta_set_idx; + } + + map_count = last_idx + 1; + } + + bool remap (const hb_map_t &new_deltaset_idx_varidx_map) + { + /* recalculate bit_count */ + outer_bit_count = 1; + inner_bit_count = 1; + + if (unlikely (!output_map.resize (map_count, false))) return false; + + for (unsigned idx = 0; idx < map_count; idx++) + { + uint32_t *var_idx; + if (!new_deltaset_idx_varidx_map.has (idx, &var_idx)) return false; + output_map.arrayZ[idx] = *var_idx; + + unsigned outer = (*var_idx) >> 16; + unsigned bit_count = (outer == 0) ? 1 : hb_bit_storage (outer); + outer_bit_count = hb_max (bit_count, outer_bit_count); + + unsigned inner = (*var_idx) & 0xFFFF; + bit_count = (inner == 0) ? 1 : hb_bit_storage (inner); + inner_bit_count = hb_max (bit_count, inner_bit_count); + } + return true; + } + + private: + unsigned map_count; + unsigned outer_bit_count; + unsigned inner_bit_count; + hb_vector_t<uint32_t> output_map; +}; + struct COLR { static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR; @@ -1992,8 +2124,22 @@ struct COLR void closure_forV1 (hb_set_t *glyphset, hb_set_t *layer_indices, - hb_set_t *palette_indices) const - { colr->closure_forV1 (glyphset, layer_indices, palette_indices); } + hb_set_t *palette_indices, + hb_set_t *variation_indices, + hb_set_t *delta_set_indices) const + { colr->closure_forV1 (glyphset, layer_indices, palette_indices, variation_indices, delta_set_indices); } + + bool has_var_store () const + { return colr->has_var_store (); } + + const ItemVariationStore &get_var_store () const + { return colr->get_var_store (); } + + bool has_delta_set_index_map () const + { return colr->has_delta_set_index_map (); } + + const DeltaSetIndexMap &get_delta_set_index_map () const + { return colr->get_delta_set_index_map (); } private: hb_blob_ptr_t<COLR> colr; @@ -2030,14 +2176,16 @@ struct COLR void closure_forV1 (hb_set_t *glyphset, hb_set_t *layer_indices, - hb_set_t *palette_indices) const + hb_set_t *palette_indices, + hb_set_t *variation_indices, + hb_set_t *delta_set_indices) const { if (version != 1) return; hb_barrier (); hb_set_t visited_glyphs; - hb_colrv1_closure_context_t c (this, &visited_glyphs, layer_indices, palette_indices); + hb_colrv1_closure_context_t c (this, &visited_glyphs, layer_indices, palette_indices, variation_indices); const BaseGlyphList &baseglyph_paintrecords = this+baseGlyphList; for (const BaseGlyphPaintRecord &baseglyph_paintrecord: baseglyph_paintrecords.iter ()) @@ -2049,6 +2197,22 @@ struct COLR paint.dispatch (&c); } hb_set_union (glyphset, &visited_glyphs); + + const ClipList &cliplist = this+clipList; + c.glyphs = glyphset; + for (const ClipRecord &clip_record : cliplist.clips.iter()) + clip_record.closurev1 (&c, &cliplist); + + // if a DeltaSetIndexMap is included, collected variation indices are + // actually delta set indices, we need to map them into variation indices + if (has_delta_set_index_map ()) + { + const DeltaSetIndexMap &var_idx_map = this+varIdxMap; + delta_set_indices->set (*variation_indices); + variation_indices->clear (); + for (unsigned delta_set_idx : *delta_set_indices) + variation_indices->add (var_idx_map.map (delta_set_idx)); + } } const LayerList& get_layerList () const @@ -2057,6 +2221,18 @@ struct COLR const BaseGlyphList& get_baseglyphList () const { return (this+baseGlyphList); } + bool has_var_store () const + { return version >= 1 && varStore != 0; } + + bool has_delta_set_index_map () const + { return version >= 1 && varIdxMap != 0; } + + const DeltaSetIndexMap &get_delta_set_index_map () const + { return (version == 0 || varIdxMap == 0) ? Null (DeltaSetIndexMap) : this+varIdxMap; } + + const ItemVariationStore &get_var_store () const + { return (version == 0 || varStore == 0) ? Null (ItemVariationStore) : this+varStore; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2132,6 +2308,88 @@ struct COLR return record; } + bool downgrade_to_V0 (const hb_set_t &glyphset) const + { + //no more COLRv1 glyphs, downgrade to version 0 + for (const BaseGlyphPaintRecord& _ : get_baseglyphList ()) + if (glyphset.has (_.glyphId)) + return false; + + return true; + } + + bool subset_varstore (hb_subset_context_t *c, + COLR* out /* OUT */) const + { + TRACE_SUBSET (this); + if (!varStore || c->plan->all_axes_pinned || + !c->plan->colrv1_variation_idx_delta_map) + return_trace (true); + + const ItemVariationStore& var_store = this+varStore; + if (c->plan->normalized_coords) + { + item_variations_t item_vars; + /* turn off varstore optimization when varIdxMap is null, so we maintain + * original var_idx sequence */ + bool optimize = (varIdxMap != 0) ? true : false; + if (!item_vars.instantiate (var_store, c->plan, + optimize, /* optimization */ + optimize, /* use_no_variation_idx = false */ + c->plan->colrv1_varstore_inner_maps.as_array ())) + return_trace (false); + + if (!out->varStore.serialize_serialize (c->serializer, + item_vars.has_long_word (), + c->plan->axis_tags, + item_vars.get_region_list (), + item_vars.get_vardata_encodings ())) + return_trace (false); + + /* if varstore is optimized, update colrv1_new_deltaset_idx_varidx_map in + * subset plan */ + if (optimize) + { + const hb_map_t &varidx_map = item_vars.get_varidx_map (); + for (auto _ : c->plan->colrv1_new_deltaset_idx_varidx_map.iter_ref ()) + { + uint32_t varidx = _.second; + uint32_t *new_varidx; + if (varidx_map.has (varidx, &new_varidx)) + _.second = *new_varidx; + else + _.second = VarIdx::NO_VARIATION; + } + } + } + else + { + if (unlikely (!out->varStore.serialize_serialize (c->serializer, + &var_store, + c->plan->colrv1_varstore_inner_maps.as_array ()))) + return_trace (false); + } + + return_trace (true); + } + + bool subset_delta_set_index_map (hb_subset_context_t *c, + COLR* out /* OUT */) const + { + TRACE_SUBSET (this); + if (!varIdxMap || c->plan->all_axes_pinned || + !c->plan->colrv1_new_deltaset_idx_varidx_map) + return_trace (true); + + const hb_map_t &deltaset_idx_varidx_map = c->plan->colrv1_new_deltaset_idx_varidx_map; + delta_set_index_map_subset_plan_t index_map_plan (deltaset_idx_varidx_map); + + if (unlikely (!index_map_plan.remap (deltaset_idx_varidx_map))) + return_trace (false); + + return_trace (out->varIdxMap.serialize_serialize (c->serializer, index_map_plan)); + } + bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); @@ -2200,34 +2458,28 @@ struct COLR auto *colr_prime = c->serializer->start_embed<COLR> (); if (unlikely (!c->serializer->extend_min (colr_prime))) return_trace (false); - if (version == 0) - return_trace (colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)); + if (version == 0 || downgrade_to_V0 (glyphset)) + return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it)); - auto snap = c->serializer->snapshot (); + //start version 1 if (!c->serializer->allocate_size<void> (5 * HBUINT32::static_size)) return_trace (false); + if (!colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)) return_trace (false); + + /* subset ItemVariationStore first, cause varidx_map needs to be updated + * after instancing */ + if (!subset_varstore (c, colr_prime)) return_trace (false); ItemVarStoreInstancer instancer (varStore ? &(this+varStore) : nullptr, varIdxMap ? &(this+varIdxMap) : nullptr, c->plan->normalized_coords.as_array ()); if (!colr_prime->baseGlyphList.serialize_subset (c, baseGlyphList, this, instancer)) - { - if (c->serializer->in_error ()) return_trace (false); - //no more COLRv1 glyphs: downgrade to version 0 - c->serializer->revert (snap); - return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it)); - } - - if (!colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)) return_trace (false); + return_trace (false); colr_prime->layerList.serialize_subset (c, layerList, this, instancer); colr_prime->clipList.serialize_subset (c, clipList, this, instancer); - if (!varStore || c->plan->all_axes_pinned) - return_trace (true); - colr_prime->varIdxMap.serialize_copy (c->serializer, varIdxMap, this); - colr_prime->varStore.serialize_copy (c->serializer, varStore, this); - return_trace (true); + return_trace (subset_delta_set_index_map (c, colr_prime)); } const Paint *get_base_glyph_paint (hb_codepoint_t glyph) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/colrv1-closure.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/colrv1-closure.hh index 705863d4ade..9ed0aa5632a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/colrv1-closure.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Color/COLR/colrv1-closure.hh @@ -66,34 +66,64 @@ HB_INTERNAL void PaintColrGlyph::closurev1 (hb_colrv1_closure_context_t* c) cons template <template<typename> class Var> HB_INTERNAL void PaintTransform<Var>::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + (this+transform).closurev1 (c); +} HB_INTERNAL void PaintTranslate::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 2; +} HB_INTERNAL void PaintScale::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 2; +} HB_INTERNAL void PaintScaleAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 4; +} HB_INTERNAL void PaintScaleUniform::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 1; +} HB_INTERNAL void PaintScaleUniformAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 3; +} HB_INTERNAL void PaintRotate::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 1; +} HB_INTERNAL void PaintRotateAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 3; +} HB_INTERNAL void PaintSkew::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 2; +} HB_INTERNAL void PaintSkewAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const -{ (this+src).dispatch (c); } +{ + (this+src).dispatch (c); + c->num_var_idxes = 4; +} HB_INTERNAL void PaintComposite::closurev1 (hb_colrv1_closure_context_t* c) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh index 317b96c714b..45baeb4ec59 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh @@ -1022,47 +1022,6 @@ struct GDEF void collect_variation_indices (hb_collect_variation_indices_context_t *c) const { get_lig_caret_list ().collect_variation_indices (c); } - void remap_layout_variation_indices (const hb_set_t *layout_variation_indices, - const hb_vector_t<int>& normalized_coords, - bool calculate_delta, /* not pinned at default */ - bool no_variations, /* all axes pinned */ - hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map /* OUT */) const - { - if (!has_var_store ()) return; - const ItemVariationStore &var_store = get_var_store (); - float *store_cache = var_store.create_cache (); - - unsigned new_major = 0, new_minor = 0; - unsigned last_major = (layout_variation_indices->get_min ()) >> 16; - for (unsigned idx : layout_variation_indices->iter ()) - { - int delta = 0; - if (calculate_delta) - delta = roundf (var_store.get_delta (idx, normalized_coords.arrayZ, - normalized_coords.length, store_cache)); - - if (no_variations) - { - layout_variation_idx_delta_map->set (idx, hb_pair_t<unsigned, int> (HB_OT_LAYOUT_NO_VARIATIONS_INDEX, delta)); - continue; - } - - uint16_t major = idx >> 16; - if (major >= var_store.get_sub_table_count ()) break; - if (major != last_major) - { - new_minor = 0; - ++new_major; - } - - unsigned new_idx = (new_major << 16) + new_minor; - layout_variation_idx_delta_map->set (idx, hb_pair_t<unsigned, int> (new_idx, delta)); - ++new_minor; - last_major = major; - } - var_store.destroy_cache (store_cache); - } - protected: union { FixedVersion<> version; /* Version identifier */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/Ligature.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/Ligature.hh index 402ed12ae20..e0ec82a2365 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/Ligature.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/Ligature.hh @@ -90,8 +90,17 @@ struct Ligature unsigned int total_component_count = 0; + if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return false; + unsigned match_positions_stack[4]; + unsigned *match_positions = match_positions_stack; + if (unlikely (count > ARRAY_LENGTH (match_positions_stack))) + { + match_positions = (unsigned *) hb_malloc (hb_max (count, 1u) * sizeof (unsigned)); + if (unlikely (!match_positions)) + return_trace (false); + } + unsigned int match_end = 0; - unsigned int match_positions[HB_MAX_CONTEXT_LENGTH]; if (likely (!match_input (c, count, &component[1], @@ -102,6 +111,8 @@ struct Ligature &total_component_count))) { c->buffer->unsafe_to_concat (c->buffer->idx, match_end); + if (match_positions != match_positions_stack) + hb_free (match_positions); return_trace (false); } @@ -145,6 +156,8 @@ struct Ligature pos); } + if (match_positions != match_positions_stack) + hb_free (match_positions); return_trace (true); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py index fe18eda897f..27f5639e78c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py @@ -14,6 +14,7 @@ def removeprefix(s): HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')] +HBHEADERS = [x for x in HBHEADERS if x.endswith ('.h')] HBSOURCES = [ removeprefix(x) for x in os.getenv ('HBSOURCES', '').split () ] or [ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/fix_get_types.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/fix_get_types.py index 208b9dfcd61..64d8ce5a555 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/fix_get_types.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/fix_get_types.py @@ -11,5 +11,5 @@ args = parser.parse_args () with open (args.input, 'r') as inp, open (args.output, 'w') as out: for l in inp.readlines (): l = re.sub ('_t_get_type', '_get_type', l) - l = re.sub ('_T \(', ' (', l) + l = re.sub (r'_T \(', ' (', l) out.write (l) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py index f199d7f3144..6011817bc54 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py @@ -22,8 +22,6 @@ if '--experimental-api' not in sys.argv: """hb_shape_justify hb_subset_repack_or_fail hb_subset_input_override_name_table -hb_subset_input_set_axis_range -hb_subset_input_get_axis_range """.splitlines () symbols = [x for x in symbols if x not in experimental_symbols] symbols = "\n".join (symbols) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-tag-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-tag-table.py index 86913c3efab..4769ee809fa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-tag-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-tag-table.py @@ -1127,9 +1127,10 @@ print (' * hb_ot_ambiguous_tag_to_language') print (' * @tag: A language tag.') print (' *') print (' * Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to') -print (' * many language tags) and the best tag is not the alphabetically first, or if') -print (' * the best tag consists of multiple subtags, or if the best tag does not appear') -print (' * in #ot_languages.') +print (' * many language tags) and the best tag is not the first (sorted alphabetically,') +print (' * with two-letter tags having priority over all three-letter tags), or if the') +print (' * best tag consists of multiple subtags, or if the best tag does not appear in') +print (' * #ot_languages2 or #ot_languages3.') print (' *') print (' * Return value: The #hb_language_t corresponding to the BCP 47 language tag,') print (' * or #HB_LANGUAGE_INVALID if @tag is not ambiguous.') @@ -1170,7 +1171,8 @@ def verify_disambiguation_dict (): if '-' in primary_tags[0]: disambiguation[ot_tag] = primary_tags[0] else: - first_tag = sorted (t for t in bcp_47_tags if t not in bcp_47.grandfathered and ot_tag in ot.from_bcp_47.get (t))[0] + first_tag = sorted ((t for t in bcp_47_tags if t not in bcp_47.grandfathered and ot_tag in ot.from_bcp_47.get (t)), + key=lambda t: (len (t), t))[0] if primary_tags[0] != first_tag: disambiguation[ot_tag] = primary_tags[0] elif len (primary_tags) == 0: @@ -1191,9 +1193,11 @@ def verify_disambiguation_dict (): '%s is not a valid disambiguation for %s' % (disambiguation[ot_tag], ot_tag)) elif ot_tag not in disambiguation: disambiguation[ot_tag] = macrolanguages[0] - different_bcp_47_tags = sorted (t for t in bcp_47_tags if not same_tag (t, ot.from_bcp_47.get (t))) - if different_bcp_47_tags and disambiguation[ot_tag] == different_bcp_47_tags[0] and '-' not in disambiguation[ot_tag]: - del disambiguation[ot_tag] + if '-' not in disambiguation[ot_tag]: + different_bcp_47_tags = sorted ((t for t in bcp_47_tags if not same_tag (t, ot.from_bcp_47.get (t))), + key=lambda t: (len (t), t)) + if different_bcp_47_tags and disambiguation[ot_tag] == different_bcp_47_tags[0]: + del disambiguation[ot_tag] for ot_tag in disambiguation.keys (): expect (ot_tag in ot.to_bcp_47, 'unknown OT tag: %s' % ot_tag) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh index 05dd58c6df6..c26f376aa67 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh @@ -46,8 +46,9 @@ struct hb_aat_apply_context_t : hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY> { const char *get_name () { return "APPLY"; } - template <typename T> - return_t dispatch (const T &obj) { return obj.apply (this); } + template <typename T, typename ...Ts> + return_t dispatch (const T &obj, Ts&&... ds) + { return obj.apply (this, std::forward<Ts> (ds)...); } static return_t default_return_value () { return false; } bool stop_sublookup_iteration (return_t r) const { return r; } @@ -59,6 +60,9 @@ struct hb_aat_apply_context_t : const ankr *ankr_table; const OT::GDEF *gdef_table; const hb_sorted_vector_t<hb_aat_map_t::range_flags_t> *range_flags = nullptr; + hb_set_digest_t machine_glyph_set = hb_set_digest_t::full (); + hb_set_digest_t left_set = hb_set_digest_t::full (); + hb_set_digest_t right_set = hb_set_digest_t::full (); hb_mask_t subtable_flags = 0; /* Unused. For debug tracing only. */ @@ -81,6 +85,8 @@ struct hb_aat_apply_context_t : * Lookup Table */ +enum { DELETED_GLYPH = 0xFFFF }; + template <typename T> struct Lookup; template <typename T> @@ -95,6 +101,12 @@ struct LookupFormat0 return &arrayZ[glyph_id]; } + template <typename set_t> + void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const + { + glyphs.add_range (0, num_glyphs - 1); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -123,6 +135,14 @@ struct LookupSegmentSingle int cmp (hb_codepoint_t g) const { return g < first ? -1 : g <= last ? 0 : +1 ; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + if (first == DELETED_GLYPH) + return; + glyphs.add_range (first, last); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -153,6 +173,14 @@ struct LookupFormat2 return v ? &v->value : nullptr; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + unsigned count = segments.get_length (); + for (unsigned int i = 0; i < count; i++) + segments[i].collect_glyphs (glyphs); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -184,6 +212,14 @@ struct LookupSegmentArray return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + if (first == DELETED_GLYPH) + return; + glyphs.add_range (first, last); + } + int cmp (hb_codepoint_t g) const { return g < first ? -1 : g <= last ? 0 : +1; } @@ -226,6 +262,14 @@ struct LookupFormat4 return v ? v->get_value (glyph_id, this) : nullptr; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + unsigned count = segments.get_length (); + for (unsigned i = 0; i < count; i++) + segments[i].collect_glyphs (glyphs); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -254,6 +298,14 @@ struct LookupSingle int cmp (hb_codepoint_t g) const { return glyph.cmp (g); } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + if (glyph == DELETED_GLYPH) + return; + glyphs.add (glyph); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -283,6 +335,14 @@ struct LookupFormat6 return v ? &v->value : nullptr; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + unsigned count = entries.get_length (); + for (unsigned i = 0; i < count; i++) + entries[i].collect_glyphs (glyphs); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -314,6 +374,16 @@ struct LookupFormat8 &valueArrayZ[glyph_id - firstGlyph] : nullptr; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + if (unlikely (!glyphCount)) + return; + if (firstGlyph == DELETED_GLYPH) + return; + glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -358,6 +428,16 @@ struct LookupFormat10 return v; } + template <typename set_t> + void collect_glyphs (set_t &glyphs) const + { + if (unlikely (!glyphCount)) + return; + if (firstGlyph == DELETED_GLYPH) + return; + glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -406,6 +486,20 @@ struct Lookup } } + template <typename set_t> + void collect_glyphs (set_t &glyphs, unsigned int num_glyphs) const + { + switch (u.format) { + case 0: u.format0.collect_glyphs (glyphs, num_glyphs); return; + case 2: u.format2.collect_glyphs (glyphs); return; + case 4: u.format4.collect_glyphs (glyphs); return; + case 6: u.format6.collect_glyphs (glyphs); return; + case 8: u.format8.collect_glyphs (glyphs); return; + case 10: u.format10.collect_glyphs (glyphs); return; + default:return; + } + } + typename T::type get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs, unsigned int outOfRange) const @@ -460,8 +554,6 @@ struct Lookup }; DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2); -enum { DELETED_GLYPH = 0xFFFF }; - /* * (Extended) State Table */ @@ -512,6 +604,14 @@ struct Entry<void> DEFINE_SIZE_STATIC (4); }; +enum Class +{ + CLASS_END_OF_TEXT = 0, + CLASS_OUT_OF_BOUNDS = 1, + CLASS_DELETED_GLYPH = 2, + CLASS_END_OF_LINE = 3, +}; + template <typename Types, typename Extra> struct StateTable { @@ -524,21 +624,24 @@ struct StateTable STATE_START_OF_TEXT = 0, STATE_START_OF_LINE = 1, }; - enum Class + + template <typename set_t> + void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const { - CLASS_END_OF_TEXT = 0, - CLASS_OUT_OF_BOUNDS = 1, - CLASS_DELETED_GLYPH = 2, - CLASS_END_OF_LINE = 3, - }; + (this+classTable).collect_glyphs (glyphs, num_glyphs); + } int new_state (unsigned int newState) const { return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; } - unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const + template <typename set_t> + unsigned int get_class (hb_codepoint_t glyph_id, + unsigned int num_glyphs, + const set_t &glyphs) const { if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH; - return (this+classTable).get_class (glyph_id, num_glyphs, 1); + if (!glyphs[glyph_id]) return CLASS_OUT_OF_BOUNDS; + return (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS); } const Entry<Extra> *get_entries () const @@ -547,7 +650,7 @@ struct StateTable const Entry<Extra> &get_entry (int state, unsigned int klass) const { if (unlikely (klass >= nClasses)) - klass = StateTable::CLASS_OUT_OF_BOUNDS; + klass = CLASS_OUT_OF_BOUNDS; const HBUSHORT *states = (this+stateArrayTable).arrayZ; const Entry<Extra> *entries = (this+entryTable).arrayZ; @@ -690,6 +793,15 @@ struct ClassTable { return get_class (glyph_id, outOfRange); } + + template <typename set_t> + void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const + { + for (unsigned i = 0; i < classArray.len; i++) + if (classArray.arrayZ[i] != CLASS_OUT_OF_BOUNDS) + glyphs.add (firstGlyph + i); + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -703,6 +815,38 @@ struct ClassTable DEFINE_SIZE_ARRAY (4, classArray); }; +struct SubtableGlyphCoverage +{ + bool sanitize (hb_sanitize_context_t *c, unsigned subtable_count) const + { + TRACE_SANITIZE (this); + + if (unlikely (!c->check_array (&subtableOffsets, subtable_count))) + return_trace (false); + + unsigned bytes = (c->get_num_glyphs () + CHAR_BIT - 1) / CHAR_BIT; + for (unsigned i = 0; i < subtable_count; i++) + { + uint32_t offset = (uint32_t) subtableOffsets[i]; + if (offset == 0 || offset == 0xFFFFFFFF) + continue; + if (unlikely (!subtableOffsets[i].sanitize (c, this, bytes))) + return_trace (false); + } + + return_trace (true); + } + protected: + UnsizedArrayOf<NNOffset32To<UnsizedArrayOf<HBUINT8>>> subtableOffsets; + /* Array of offsets from the beginning of the + * subtable glyph coverage table to the glyph + * coverage bitfield for a given subtable; there + * is one offset for each subtable in the chain */ + /* UnsizedArrayOf<HBUINT8> coverageBitfields; *//* The individual coverage bitfields. */ + public: + DEFINE_SIZE_ARRAY (0, subtableOffsets); +}; + struct ObsoleteTypes { static constexpr bool extended = false; @@ -779,15 +923,15 @@ struct StateTableDriver using EntryT = Entry<EntryData>; StateTableDriver (const StateTableT &machine_, - hb_buffer_t *buffer_, hb_face_t *face_) : machine (machine_), - buffer (buffer_), num_glyphs (face_->get_num_glyphs ()) {} - template <typename context_t> + template <typename context_t, typename set_t = hb_set_digest_t> void drive (context_t *c, hb_aat_apply_context_t *ac) { + hb_buffer_t *buffer = ac->buffer; + if (!c->in_place) buffer->clear_output (); @@ -822,9 +966,9 @@ struct StateTableDriver } } - unsigned int klass = buffer->idx < buffer->len ? - machine.get_class (buffer->cur().codepoint, num_glyphs) : - (unsigned) StateTableT::CLASS_END_OF_TEXT; + unsigned int klass = likely (buffer->idx < buffer->len) ? + machine.get_class (buffer->cur().codepoint, num_glyphs, ac->machine_glyph_set) : + (unsigned) CLASS_END_OF_TEXT; DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx); const EntryT &entry = machine.get_entry (state, klass); const int next_state = machine.new_state (entry.newState); @@ -862,22 +1006,22 @@ struct StateTableDriver { /* 2c. */ const auto wouldbe_entry = machine.get_entry(StateTableT::STATE_START_OF_TEXT, klass); - + /* 2c'. */ - if (c->is_actionable (this, wouldbe_entry)) - return false; - + if (c->is_actionable (buffer, this, wouldbe_entry)) + return false; + /* 2c". */ return next_state == machine.new_state(wouldbe_entry.newState) && (entry.flags & context_t::DontAdvance) == (wouldbe_entry.flags & context_t::DontAdvance); }; - + const auto is_safe_to_break = [&]() { /* 1. */ - if (c->is_actionable (this, entry)) + if (c->is_actionable (buffer, this, entry)) return false; - + /* 2. */ // This one is meh, I know... const auto ok = @@ -886,15 +1030,15 @@ struct StateTableDriver || is_safe_to_break_extra(); if (!ok) return false; - + /* 3. */ - return !c->is_actionable (this, machine.get_entry (state, StateTableT::CLASS_END_OF_TEXT)); + return !c->is_actionable (buffer, this, machine.get_entry (state, CLASS_END_OF_TEXT)); }; if (!is_safe_to_break () && buffer->backtrack_len () && buffer->idx < buffer->len) buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1); - c->transition (this, entry); + c->transition (buffer, this, entry); state = next_state; DEBUG_MSG (APPLY, nullptr, "s%d", state); @@ -912,7 +1056,6 @@ struct StateTableDriver public: const StateTableT &machine; - hb_buffer_t *buffer; unsigned int num_glyphs; }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh index 0de54e0a022..8d0d87af028 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh @@ -30,6 +30,7 @@ #include "hb-kern.hh" #include "hb-aat-layout-ankr-table.hh" +#include "hb-set-digest.hh" /* * kerx -- Extended Kerning @@ -82,7 +83,7 @@ struct KernPair return_trace (c->check_struct (this)); } - protected: + public: HBGlyphID16 left; HBGlyphID16 right; FWORD value; @@ -118,6 +119,16 @@ struct KerxSubTableFormat0 return_trace (true); } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + for (const KernPair& pair : pairs) + { + left_set.add (pair.left); + right_set.add (pair.right); + } + } + struct accelerator_t { const KerxSubTableFormat0 &table; @@ -128,7 +139,10 @@ struct KerxSubTableFormat0 table (table_), c (c_) {} int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const - { return table.get_kerning (left, right, c); } + { + if (!c->left_set[left] || !c->right_set[right]) return 0; + return table.get_kerning (left, right, c); + } }; @@ -228,13 +242,14 @@ struct KerxSubTableFormat1 depth (0), crossStream (table->header.coverage & table->header.CrossStream) {} - bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, + bool is_actionable (hb_buffer_t *buffer HB_UNUSED, + StateTableDriver<Types, EntryData> *driver HB_UNUSED, const Entry<EntryData> &entry) { return Format1EntryT::performAction (entry); } - void transition (StateTableDriver<Types, EntryData> *driver, + void transition (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { - hb_buffer_t *buffer = driver->buffer; unsigned int flags = entry.flags; if (flags & Format1EntryT::Reset) @@ -351,7 +366,7 @@ struct KerxSubTableFormat1 driver_context_t dc (this, c); - StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->font->face); + StateTableDriver<Types, EntryData> driver (machine, c->font->face); driver.drive (&dc, c); return_trace (true); @@ -365,12 +380,21 @@ struct KerxSubTableFormat1 machine.sanitize (c))); } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + set_t set; + machine.collect_glyphs (set, num_glyphs); + left_set.union_ (set); + right_set.union_ (set); + } + protected: KernSubTableHeader header; StateTable<Types, EntryData> machine; NNOffsetTo<UnsizedArrayOf<FWORD>, HBUINT> kernAction; public: - DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 5 * sizeof (HBUINT)); + DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + (StateTable<Types, EntryData>::static_size + HBUINT::static_size)); }; template <typename KernSubTableHeader> @@ -413,6 +437,13 @@ struct KerxSubTableFormat2 return_trace (true); } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + (this+leftClassTable).collect_glyphs (left_set, num_glyphs); + (this+rightClassTable).collect_glyphs (right_set, num_glyphs); + } + struct accelerator_t { const KerxSubTableFormat2 &table; @@ -423,7 +454,10 @@ struct KerxSubTableFormat2 table (table_), c (c_) {} int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const - { return table.get_kerning (left, right, c); } + { + if (!c->left_set[left] || !c->right_set[right]) return 0; + return table.get_kerning (left, right, c); + } }; bool sanitize (hb_sanitize_context_t *c) const @@ -493,14 +527,14 @@ struct KerxSubTableFormat4 mark_set (false), mark (0) {} - bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, + bool is_actionable (hb_buffer_t *buffer HB_UNUSED, + StateTableDriver<Types, EntryData> *driver HB_UNUSED, const Entry<EntryData> &entry) { return entry.data.ankrActionIndex != 0xFFFF; } - void transition (StateTableDriver<Types, EntryData> *driver, + void transition (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { - hb_buffer_t *buffer = driver->buffer; - if (mark_set && entry.data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len) { hb_glyph_position_t &o = buffer->cur_pos(); @@ -600,7 +634,7 @@ struct KerxSubTableFormat4 driver_context_t dc (this, c); - StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->font->face); + StateTableDriver<Types, EntryData> driver (machine, c->font->face); driver.drive (&dc, c); return_trace (true); @@ -614,12 +648,21 @@ struct KerxSubTableFormat4 machine.sanitize (c))); } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + set_t set; + machine.collect_glyphs (set, num_glyphs); + left_set.union_ (set); + right_set.union_ (set); + } + protected: KernSubTableHeader header; StateTable<Types, EntryData> machine; HBUINT32 flags; public: - DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 20); + DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + (StateTable<Types, EntryData>::static_size + HBUINT32::static_size)); }; template <typename KernSubTableHeader> @@ -638,7 +681,7 @@ struct KerxSubTableFormat6 unsigned int num_glyphs = c->sanitizer.get_num_glyphs (); if (is_long ()) { - const typename U::Long &t = u.l; + const auto &t = u.l; unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, num_glyphs); unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, num_glyphs); unsigned int offset = l + r; @@ -651,7 +694,7 @@ struct KerxSubTableFormat6 } else { - const typename U::Short &t = u.s; + const auto &t = u.s; unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, num_glyphs); unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, num_glyphs); unsigned int offset = l + r; @@ -698,6 +741,23 @@ struct KerxSubTableFormat6 c->check_range (this, vector)))); } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + if (is_long ()) + { + const auto &t = u.l; + (this+t.rowIndexTable).collect_glyphs (left_set, num_glyphs); + (this+t.columnIndexTable).collect_glyphs (right_set, num_glyphs); + } + else + { + const auto &t = u.s; + (this+t.rowIndexTable).collect_glyphs (left_set, num_glyphs); + (this+t.columnIndexTable).collect_glyphs (right_set, num_glyphs); + } + } + struct accelerator_t { const KerxSubTableFormat6 &table; @@ -708,7 +768,10 @@ struct KerxSubTableFormat6 table (table_), c (c_) {} int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const - { return table.get_kerning (left, right, c); } + { + if (!c->left_set[left] || !c->right_set[right]) return 0; + return table.get_kerning (left, right, c); + } }; protected: @@ -794,6 +857,20 @@ struct KerxSubTable } } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + unsigned int subtable_type = get_type (); + switch (subtable_type) { + case 0: u.format0.collect_glyphs (left_set, right_set, num_glyphs); return; + case 1: u.format1.collect_glyphs (left_set, right_set, num_glyphs); return; + case 2: u.format2.collect_glyphs (left_set, right_set, num_glyphs); return; + case 4: u.format4.collect_glyphs (left_set, right_set, num_glyphs); return; + case 6: u.format6.collect_glyphs (left_set, right_set, num_glyphs); return; + default: return; + } + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -824,6 +901,8 @@ struct KerxSubTable * The 'kerx' Table */ +using kern_accelerator_data_t = hb_vector_t<hb_pair_t<hb_set_digest_t, hb_set_digest_t>>; + template <typename T> struct KerxTable { @@ -878,7 +957,8 @@ struct KerxTable return v; } - bool apply (AAT::hb_aat_apply_context_t *c) const + bool apply (AAT::hb_aat_apply_context_t *c, + const kern_accelerator_data_t *accel_data = nullptr) const { c->buffer->unsafe_to_concat (); @@ -925,6 +1005,16 @@ struct KerxTable if (reverse) c->buffer->reverse (); + if (accel_data) + { + c->left_set = (*accel_data)[i].first; + c->right_set = (*accel_data)[i].second; + } + else + { + c->left_set = c->right_set = hb_set_digest_t::full (); + } + { /* See comment in sanitize() for conditional here. */ hb_sanitize_with_object_t with (&c->sanitizer, i < count - 1 ? st : (const SubTable *) nullptr); @@ -977,8 +1067,61 @@ struct KerxTable st = &StructAfter<SubTable> (*st); } + unsigned majorVersion = thiz()->version; + if (sizeof (thiz()->version) == 4) + majorVersion = majorVersion >> 16; + if (majorVersion >= 3) + { + const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) st; + if (!coverage->sanitize (c, count)) + return_trace (false); + } + return_trace (true); } + + kern_accelerator_data_t create_accelerator_data (unsigned num_glyphs) const + { + kern_accelerator_data_t accel_data; + + typedef typename T::SubTable SubTable; + + const SubTable *st = &thiz()->firstSubTable; + unsigned int count = thiz()->tableCount; + for (unsigned int i = 0; i < count; i++) + { + hb_set_digest_t left_set, right_set; + st->collect_glyphs (left_set, right_set, num_glyphs); + accel_data.push (hb_pair (left_set, right_set)); + st = &StructAfter<SubTable> (*st); + } + + return accel_data; + } + + struct accelerator_t + { + accelerator_t (hb_face_t *face) + { + hb_sanitize_context_t sc; + this->table = sc.reference_table<T> (face); + this->accel_data = this->table->create_accelerator_data (face->get_num_glyphs ()); + } + ~accelerator_t () + { + this->table.destroy (); + } + + hb_blob_t *get_blob () const { return table.get_blob (); } + + bool apply (AAT::hb_aat_apply_context_t *c) const + { + return table->apply (c, &accel_data); + } + + hb_blob_ptr_t<T> table; + kern_accelerator_data_t accel_data; + }; }; struct kerx : KerxTable<kerx> @@ -1007,8 +1150,10 @@ struct kerx : KerxTable<kerx> DEFINE_SIZE_MIN (8); }; +struct kerx_accelerator_t : kerx::accelerator_t { + kerx_accelerator_t (hb_face_t *face) : kerx::accelerator_t (face) {} +}; } /* namespace AAT */ - #endif /* HB_AAT_LAYOUT_KERX_TABLE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh index 84365513240..4a94e6a8ff0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh @@ -74,15 +74,16 @@ struct RearrangementSubtable ret (false), start (0), end (0) {} - bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> &entry) + bool is_actionable (hb_buffer_t *buffer HB_UNUSED, + StateTableDriver<Types, EntryData> *driver HB_UNUSED, + const Entry<EntryData> &entry) const { return (entry.flags & Verb) && start < end; } - void transition (StateTableDriver<Types, EntryData> *driver, + void transition (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { - hb_buffer_t *buffer = driver->buffer; unsigned int flags = entry.flags; if (flags & MarkFirst) @@ -168,7 +169,7 @@ struct RearrangementSubtable driver_context_t dc (this); - StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face); + StateTableDriver<Types, EntryData> driver (machine, c->face); driver.drive (&dc, c); return_trace (dc.ret); @@ -180,10 +181,10 @@ struct RearrangementSubtable return_trace (machine.sanitize (c)); } - protected: + public: StateTable<Types, EntryData> machine; public: - DEFINE_SIZE_STATIC (16); + DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size)); }; template <typename Types> @@ -223,21 +224,19 @@ struct ContextualSubtable table (table_), subs (table+table->substitutionTables) {} - bool is_actionable (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> &entry) + bool is_actionable (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) const { - hb_buffer_t *buffer = driver->buffer; - if (buffer->idx == buffer->len && !mark_set) return false; return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF; } - void transition (StateTableDriver<Types, EntryData> *driver, + void transition (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { - hb_buffer_t *buffer = driver->buffer; - /* Looks like CoreText applies neither mark nor current substitution for * end-of-text if mark was not explicitly set. */ if (buffer->idx == buffer->len && !mark_set) @@ -328,7 +327,7 @@ struct ContextualSubtable driver_context_t dc (this, c); - StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face); + StateTableDriver<Types, EntryData> driver (machine, c->face); driver.drive (&dc, c); return_trace (dc.ret); @@ -361,13 +360,14 @@ struct ContextualSubtable return_trace (substitutionTables.sanitize (c, this, num_lookups)); } - protected: + public: StateTable<Types, EntryData> machine; + protected: NNOffsetTo<UnsizedListOfOffset16To<Lookup<HBGlyphID16>, HBUINT, void, false>, HBUINT> substitutionTables; public: - DEFINE_SIZE_STATIC (20); + DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size + HBUINT::static_size)); }; @@ -464,16 +464,16 @@ struct LigatureSubtable ligature (table+table->ligature), match_length (0) {} - bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> &entry) + bool is_actionable (hb_buffer_t *buffer HB_UNUSED, + StateTableDriver<Types, EntryData> *driver HB_UNUSED, + const Entry<EntryData> &entry) const { return LigatureEntryT::performAction (entry); } - void transition (StateTableDriver<Types, EntryData> *driver, + void transition (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { - hb_buffer_t *buffer = driver->buffer; - DEBUG_MSG (APPLY, nullptr, "Ligature transition at %u", buffer->idx); if (entry.flags & LigatureEntryT::SetComponent) { @@ -585,7 +585,7 @@ struct LigatureSubtable driver_context_t dc (this, c); - StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face); + StateTableDriver<Types, EntryData> driver (machine, c->face); driver.drive (&dc, c); return_trace (dc.ret); @@ -600,9 +600,10 @@ struct LigatureSubtable ligAction && component && ligature); } - protected: + public: StateTable<Types, EntryData> machine; + protected: NNOffsetTo<UnsizedArrayOf<HBUINT32>, HBUINT> ligAction; /* Offset to the ligature action table. */ NNOffsetTo<UnsizedArrayOf<HBUINT16>, HBUINT> @@ -610,7 +611,7 @@ struct LigatureSubtable NNOffsetTo<UnsizedArrayOf<HBGlyphID16>, HBUINT> ligature; /* Offset to the actual ligature lists. */ public: - DEFINE_SIZE_STATIC (28); + DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size + 3 * HBUINT::static_size)); }; template <typename Types> @@ -754,16 +755,17 @@ struct InsertionSubtable mark (0), insertionAction (table+table->insertionAction) {} - bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> &entry) + bool is_actionable (hb_buffer_t *buffer HB_UNUSED, + StateTableDriver<Types, EntryData> *driver HB_UNUSED, + const Entry<EntryData> &entry) const { return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) && (entry.data.currentInsertIndex != 0xFFFF ||entry.data.markedInsertIndex != 0xFFFF); } - void transition (StateTableDriver<Types, EntryData> *driver, + void transition (hb_buffer_t *buffer, + StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { - hb_buffer_t *buffer = driver->buffer; unsigned int flags = entry.flags; unsigned mark_loc = buffer->out_len; @@ -850,7 +852,7 @@ struct InsertionSubtable driver_context_t dc (this, c); - StateTableDriver<Types, EntryData> driver (machine, c->buffer, c->face); + StateTableDriver<Types, EntryData> driver (machine, c->face); driver.drive (&dc, c); return_trace (dc.ret); @@ -865,14 +867,15 @@ struct InsertionSubtable insertionAction); } - protected: + public: StateTable<Types, EntryData> machine; + protected: NNOffsetTo<UnsizedArrayOf<HBGlyphID16>, HBUINT> insertionAction; /* Byte offset from stateHeader to the start of * the insertion glyph table. */ public: - DEFINE_SIZE_STATIC (20); + DEFINE_SIZE_STATIC ((StateTable<Types, EntryData>::static_size + HBUINT::static_size)); }; @@ -896,6 +899,89 @@ struct Feature DEFINE_SIZE_STATIC (12); }; + +struct hb_accelerate_subtables_context_t : + hb_dispatch_context_t<hb_accelerate_subtables_context_t> +{ + struct hb_applicable_t + { + friend struct hb_accelerate_subtables_context_t; + friend struct hb_aat_layout_lookup_accelerator_t; + + public: + hb_set_digest_t digest; + + template <typename T> + auto init_ (const T &obj_, unsigned num_glyphs, hb_priority<1>) HB_AUTO_RETURN + ( + obj_.machine.collect_glyphs (this->digest, num_glyphs) + ) + + template <typename T> + void init_ (const T &obj_, unsigned num_glyphs, hb_priority<0>) + { + digest = digest.full (); + } + + template <typename T> + void init (const T &obj_, unsigned num_glyphs) + { + init_ (obj_, num_glyphs, hb_prioritize); + } + }; + + /* Dispatch interface. */ + template <typename T> + return_t dispatch (const T &obj) + { + hb_applicable_t *entry = &array[i++]; + + entry->init (obj, num_glyphs); + + return hb_empty_t (); + } + static return_t default_return_value () { return hb_empty_t (); } + + bool stop_sublookup_iteration (return_t r) const { return false; } + + hb_accelerate_subtables_context_t (hb_applicable_t *array_, unsigned num_glyphs_) : + hb_dispatch_context_t<hb_accelerate_subtables_context_t> (), + array (array_), num_glyphs (num_glyphs_) {} + + hb_applicable_t *array; + unsigned num_glyphs; + unsigned i = 0; +}; + +struct hb_aat_layout_chain_accelerator_t +{ + template <typename TChain> + static hb_aat_layout_chain_accelerator_t *create (const TChain &chain, unsigned num_glyphs) + { + unsigned count = chain.get_subtable_count (); + + unsigned size = sizeof (hb_aat_layout_chain_accelerator_t) - + HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) + + count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t); + + /* The following is a calloc because when we are collecting subtables, + * some of them might be invalid and hence not collect; as a result, + * we might not fill in all the count entries of the subtables array. + * Zeroing it allows the set digest to gatekeep it without having to + * initialize it further. */ + auto *thiz = (hb_aat_layout_chain_accelerator_t *) hb_calloc (1, size); + if (unlikely (!thiz)) + return nullptr; + + hb_accelerate_subtables_context_t c_accelerate_subtables (thiz->subtables, num_glyphs); + chain.dispatch (&c_accelerate_subtables); + + return thiz; + } + + hb_accelerate_subtables_context_t::hb_applicable_t subtables[HB_VAR_ARRAY]; +}; + template <typename Types> struct ChainSubtable { @@ -987,6 +1073,8 @@ struct Chain { typedef typename Types::HBUINT HBUINT; + unsigned get_subtable_count () const { return subtableCount; } + hb_mask_t compile_flags (const hb_aat_map_builder_t *map) const { hb_mask_t flags = defaultFlags; @@ -1027,7 +1115,8 @@ struct Chain return flags; } - void apply (hb_aat_apply_context_t *c) const + void apply (hb_aat_apply_context_t *c, + const hb_aat_layout_chain_accelerator_t *accel) const { const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types>> (featureZ.as_array (featureCount)); unsigned int count = subtableCount; @@ -1039,6 +1128,7 @@ struct Chain hb_map ([&subtable] (const hb_aat_map_t::range_flags_t _) -> bool { return subtable->subFeatureFlags & (_.flags); }))) goto skip; c->subtable_flags = subtable->subFeatureFlags; + c->machine_glyph_set = accel ? accel->subtables[i].digest : hb_set_digest_t::full (); if (!(subtable->get_coverage() & ChainSubtable<Types>::AllDirections) && HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) != @@ -1100,7 +1190,22 @@ struct Chain unsigned int get_size () const { return length; } - bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const + template <typename context_t, typename ...Ts> + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const + { + const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types>> (featureZ.as_array (featureCount)); + unsigned int count = subtableCount; + for (unsigned int i = 0; i < count; i++) + { + typename context_t::return_t ret = subtable->dispatch (c, std::forward<Ts> (ds)...); + if (c->stop_sublookup_iteration (ret)) + return ret; + subtable = &StructAfter<ChainSubtable<Types>> (*subtable); + } + return c->default_return_value (); + } + + bool sanitize (hb_sanitize_context_t *c, unsigned int version) const { TRACE_SANITIZE (this); if (!(length.sanitize (c) && @@ -1122,6 +1227,13 @@ struct Chain subtable = &StructAfter<ChainSubtable<Types>> (*subtable); } + if (version >= 3) + { + const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) subtable; + if (!coverage->sanitize (c, count)) + return_trace (false); + } + return_trace (true); } @@ -1133,7 +1245,7 @@ struct Chain UnsizedArrayOf<Feature> featureZ; /* Features. */ /*ChainSubtable firstSubtable;*//* Subtables. */ -/*subtableGlyphCoverageArray*/ /* Only if version >= 3. We don't use. */ +/*SubtableGlyphCoverage coverages*//* Only if version >= 3. */ public: DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT)); @@ -1144,13 +1256,69 @@ struct Chain * The 'mort'/'morx' Table */ -template <typename Types, hb_tag_t TAG> +template <typename T, typename Types, hb_tag_t TAG> struct mortmorx { static constexpr hb_tag_t tableTag = TAG; bool has_data () const { return version != 0; } + struct accelerator_t + { + accelerator_t (hb_face_t *face) + { + hb_sanitize_context_t sc; + this->table = sc.reference_table<T> (face); + + this->chain_count = table->get_chain_count (); + + this->accels = (hb_atomic_ptr_t<hb_aat_layout_chain_accelerator_t> *) hb_calloc (this->chain_count, sizeof (*accels)); + if (unlikely (!this->accels)) + { + this->chain_count = 0; + this->table.destroy (); + this->table = hb_blob_get_empty (); + } + } + ~accelerator_t () + { + for (unsigned int i = 0; i < this->chain_count; i++) + hb_free (this->accels[i]); + hb_free (this->accels); + this->table.destroy (); + } + + hb_blob_t *get_blob () const { return table.get_blob (); } + + template <typename Chain> + hb_aat_layout_chain_accelerator_t *get_accel (unsigned chain_index, const Chain &chain, unsigned num_glyphs) const + { + if (unlikely (chain_index >= chain_count)) return nullptr; + + retry: + auto *accel = accels[chain_index].get_acquire (); + if (unlikely (!accel)) + { + accel = hb_aat_layout_chain_accelerator_t::create (chain, num_glyphs); + if (unlikely (!accel)) + return nullptr; + + if (unlikely (!accels[chain_index].cmpexch (nullptr, accel))) + { + hb_free (accel); + goto retry; + } + } + + return accel; + } + + hb_blob_ptr_t<T> table; + unsigned int chain_count; + hb_atomic_ptr_t<hb_aat_layout_chain_accelerator_t> *accels; + }; + + void compile_flags (const hb_aat_map_builder_t *mapper, hb_aat_map_t *map) const { @@ -1167,8 +1335,14 @@ struct mortmorx } } + unsigned get_chain_count () const + { + return chainCount; + } + void apply (hb_aat_apply_context_t *c, - const hb_aat_map_t &map) const + const hb_aat_map_t &map, + const accelerator_t &accel) const { if (unlikely (!c->buffer->successful)) return; @@ -1179,8 +1353,9 @@ struct mortmorx unsigned int count = chainCount; for (unsigned int i = 0; i < count; i++) { + auto *chain_accel = accel.get_accel (i, *chain, c->face->get_num_glyphs ()); c->range_flags = &map.chain_flags[i]; - chain->apply (c); + chain->apply (c, chain_accel); if (unlikely (!c->buffer->successful)) return; chain = &StructAfter<Chain<Types>> (*chain); } @@ -1220,8 +1395,15 @@ struct mortmorx DEFINE_SIZE_MIN (8); }; -struct morx : mortmorx<ExtendedTypes, HB_AAT_TAG_morx> {}; -struct mort : mortmorx<ObsoleteTypes, HB_AAT_TAG_mort> {}; +struct morx : mortmorx<morx, ExtendedTypes, HB_AAT_TAG_morx> {}; +struct mort : mortmorx<mort, ObsoleteTypes, HB_AAT_TAG_mort> {}; + +struct morx_accelerator_t : morx::accelerator_t { + morx_accelerator_t (hb_face_t *face) : morx::accelerator_t (face) {} +}; +struct mort_accelerator_t : mort::accelerator_t { + mort_accelerator_t (hb_face_t *face) : mort::accelerator_t (face) {} +}; } /* namespace AAT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc index 5e4cea22249..9da29e51c95 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc @@ -211,14 +211,14 @@ void hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper, hb_aat_map_t *map) { - const AAT::morx& morx = *mapper->face->table.morx; + const AAT::morx& morx = *mapper->face->table.morx->table; if (morx.has_data ()) { morx.compile_flags (mapper, map); return; } - const AAT::mort& mort = *mapper->face->table.mort; + const AAT::mort& mort = *mapper->face->table.mort->table; if (mort.has_data ()) { mort.compile_flags (mapper, map); @@ -243,8 +243,8 @@ hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper, hb_bool_t hb_aat_layout_has_substitution (hb_face_t *face) { - return face->table.morx->has_data () || - face->table.mort->has_data (); + return face->table.morx->table->has_data () || + face->table.mort->table->has_data (); } void @@ -260,26 +260,30 @@ hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan, hb_aat_map_t map; builder.compile (map); - hb_blob_t *morx_blob = font->face->table.morx.get_blob (); - const AAT::morx& morx = *morx_blob->as<AAT::morx> (); - if (morx.has_data ()) { - AAT::hb_aat_apply_context_t c (plan, font, buffer, morx_blob); - if (!buffer->message (font, "start table morx")) return; - morx.apply (&c, map); - (void) buffer->message (font, "end table morx"); - return; + auto &accel = *font->face->table.morx; + const AAT::morx& morx = *accel.table; + if (morx.has_data ()) + { + AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ()); + if (!buffer->message (font, "start table morx")) return; + morx.apply (&c, map, accel); + (void) buffer->message (font, "end table morx"); + return; + } } - hb_blob_t *mort_blob = font->face->table.mort.get_blob (); - const AAT::mort& mort = *mort_blob->as<AAT::mort> (); - if (mort.has_data ()) { - AAT::hb_aat_apply_context_t c (plan, font, buffer, mort_blob); - if (!buffer->message (font, "start table mort")) return; - mort.apply (&c, map); - (void) buffer->message (font, "end table mort"); - return; + auto &accel = *font->face->table.mort; + const AAT::mort& mort = *accel.table; + if (mort.has_data ()) + { + AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ()); + if (!buffer->message (font, "start table mort")) return; + mort.apply (&c, map, accel); + (void) buffer->message (font, "end table mort"); + return; + } } } @@ -322,7 +326,7 @@ hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer) hb_bool_t hb_aat_layout_has_positioning (hb_face_t *face) { - return face->table.kerx->has_data (); + return face->table.kerx->table->has_data (); } void @@ -330,13 +334,12 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { - hb_blob_t *kerx_blob = font->face->table.kerx.get_blob (); - const AAT::kerx& kerx = *kerx_blob->as<AAT::kerx> (); + auto &accel = *font->face->table.kerx; - AAT::hb_aat_apply_context_t c (plan, font, buffer, kerx_blob); + AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ()); if (!buffer->message (font, "start table kerx")) return; c.set_ankr_table (font->face->table.ankr.get ()); - kerx.apply (&c); + accel.apply (&c); (void) buffer->message (font, "end table kerx"); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh index efa6074a422..b02793a09fd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh @@ -202,8 +202,12 @@ struct BEInt<Type, 4> /* Floats. */ /* We want our rounding towards +infinity. */ +static inline double +_hb_roundf (double x) { return floor (x + .5); } + static inline float _hb_roundf (float x) { return floorf (x + .5f); } + #define roundf(x) _hb_roundf(x) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh index 55b1d3bf8d4..06fbb72c61e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh @@ -76,16 +76,12 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs> coords = coords_; num_coords = num_coords_; varStore = acc.varStore; - seen_blend = false; - seen_vsindex_ = false; - scalars.init (); do_blend = num_coords && coords && varStore->size; set_ivs (acc.privateDicts[fd].ivs); } void fini () { - scalars.fini (); SUPER::fini (); } @@ -173,8 +169,8 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs> unsigned int ivs; hb_vector_t<float> scalars; bool do_blend; - bool seen_vsindex_; - bool seen_blend; + bool seen_vsindex_ = false; + bool seen_blend = false; typedef cs_interp_env_t<ELEM, CFF2Subrs> SUPER; }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cplusplus.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cplusplus.hh index a640e192de7..b6b5c8f781d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cplusplus.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cplusplus.hh @@ -27,9 +27,6 @@ #include "hb.h" -HB_BEGIN_DECLS -HB_END_DECLS - #ifdef __cplusplus #include <functional> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh index b552dfdd9da..db1c55490c7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh @@ -100,7 +100,7 @@ HB_OT_CORE_TABLE (OT, MVAR) /* Legacy kern. */ #ifndef HB_NO_OT_KERN -HB_OT_CORE_TABLE (OT, kern) +HB_OT_ACCELERATOR (OT, kern) #endif /* OpenType shaping. */ @@ -118,9 +118,9 @@ HB_OT_CORE_TABLE (OT, BASE) /* AAT shaping. */ #ifndef HB_NO_AAT -HB_OT_TABLE (AAT, morx) -HB_OT_TABLE (AAT, mort) -HB_OT_TABLE (AAT, kerx) +HB_OT_ACCELERATOR (AAT, morx) +HB_OT_ACCELERATOR (AAT, mort) +HB_OT_ACCELERATOR (AAT, kerx) HB_OT_TABLE (AAT, ankr) HB_OT_TABLE (AAT, trak) HB_OT_TABLE (AAT, ltag) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc index 2243ee02874..b0c927979e8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc @@ -41,6 +41,8 @@ #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsub-table.hh" #include "hb-ot-layout-gpos-table.hh" +#include "hb-aat-layout-kerx-table.hh" +#include "hb-aat-layout-morx-table.hh" void hb_ot_face_t::init0 (hb_face_t *face) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh index 48bd536121d..e259b337486 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh @@ -410,7 +410,8 @@ struct hmtxvmtx font->coords, font->num_coords, store_cache)); - return _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx); + unsigned glyf_advance = _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx); + return glyf_advance ? glyf_advance : advance; #else return advance; #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh index 39444d803f0..b87ac8f4947 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh @@ -86,6 +86,16 @@ struct KernSubTableFormat3 leftClassCount * rightClassCount)); } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + set_t set; + if (likely (glyphCount)) + set.add_range (0, glyphCount - 1); + left_set.union_ (set); + right_set.union_ (set); + } + protected: KernSubTableHeader header; @@ -135,16 +145,29 @@ struct KernSubTable switch (subtable_type) { case 0: return_trace (c->dispatch (u.format0)); #ifndef HB_NO_AAT_SHAPE - case 1: return_trace (u.header.apple ? c->dispatch (u.format1, std::forward<Ts> (ds)...) : c->default_return_value ()); + case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...)); #endif case 2: return_trace (c->dispatch (u.format2)); #ifndef HB_NO_AAT_SHAPE - case 3: return_trace (u.header.apple ? c->dispatch (u.format3, std::forward<Ts> (ds)...) : c->default_return_value ()); + case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...)); #endif default: return_trace (c->default_return_value ()); } } + template <typename set_t> + void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const + { + unsigned int subtable_type = get_type (); + switch (subtable_type) { + case 0: u.format0.collect_glyphs (left_set, right_set, num_glyphs); return; + case 1: u.format1.collect_glyphs (left_set, right_set, num_glyphs); return; + case 2: u.format2.collect_glyphs (left_set, right_set, num_glyphs); return; + case 3: u.format3.collect_glyphs (left_set, right_set, num_glyphs); return; + default: return; + } + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -318,8 +341,9 @@ struct kern } } - bool apply (AAT::hb_aat_apply_context_t *c) const - { return dispatch (c); } + bool apply (AAT::hb_aat_apply_context_t *c, + const AAT::kern_accelerator_data_t *accel_data = nullptr) const + { return dispatch (c, accel_data); } template <typename context_t, typename ...Ts> typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const @@ -343,6 +367,41 @@ struct kern return_trace (dispatch (c)); } + AAT::kern_accelerator_data_t create_accelerator_data (unsigned num_glyphs) const + { + switch (get_type ()) { + case 0: return u.ot.create_accelerator_data (num_glyphs); +#ifndef HB_NO_AAT_SHAPE + case 1: return u.aat.create_accelerator_data (num_glyphs); +#endif + default:return AAT::kern_accelerator_data_t (); + } + } + + struct accelerator_t + { + accelerator_t (hb_face_t *face) + { + hb_sanitize_context_t sc; + this->table = sc.reference_table<kern> (face); + this->accel_data = this->table->create_accelerator_data (face->get_num_glyphs ()); + } + ~accelerator_t () + { + this->table.destroy (); + } + + hb_blob_t *get_blob () const { return table.get_blob (); } + + bool apply (AAT::hb_aat_apply_context_t *c) const + { + return table->apply (c, &accel_data); + } + + hb_blob_ptr_t<kern> table; + AAT::kern_accelerator_data_t accel_data; + }; + protected: union { HBUINT32 version32; @@ -356,6 +415,10 @@ struct kern DEFINE_SIZE_UNION (4, version32); }; +struct kern_accelerator_t : kern::accelerator_t { + kern_accelerator_t (hb_face_t *face) : kern::accelerator_t (face) {} +}; + } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh index 02783990698..56290905cec 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh @@ -125,6 +125,20 @@ struct BaseCoordFormat3 auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); + if (!c->plan->pinned_at_default) + { + unsigned var_idx = (this+deviceTable).get_variation_index (); + if (var_idx != VarIdx::NO_VARIATION) + { + hb_pair_t<unsigned, int> *v; + if (!c->plan->base_variation_idx_map.has (var_idx, &v)) + return_trace (false); + + if (unlikely (!c->serializer->check_assign (out->coordinate, coordinate + hb_second (*v), + HB_SERIALIZE_ERROR_INT_OVERFLOW))) + return_trace (false); + } + } return_trace (out->deviceTable.serialize_copy (c->serializer, deviceTable, this, 0, hb_serialize_context_t::Head, @@ -401,11 +415,12 @@ struct BaseLangSysRecord bool has_data () const { return baseLangSysTag; } - const MinMax &get_min_max () const { return this+minMax; } + const MinMax &get_min_max (const void* base) const { return base+minMax; } - void collect_variation_indices (const hb_subset_plan_t* plan, + void collect_variation_indices (const void* base, + const hb_subset_plan_t* plan, hb_set_t& varidx_set /* OUT */) const - { (this+minMax).collect_variation_indices (plan, varidx_set); } + { (base+minMax).collect_variation_indices (plan, varidx_set); } bool subset (hb_subset_context_t *c, const void *base) const @@ -438,7 +453,7 @@ struct BaseScript const MinMax &get_min_max (hb_tag_t language_tag) const { const BaseLangSysRecord& record = baseLangSysRecords.bsearch (language_tag); - return record.has_data () ? record.get_min_max () : this+defaultMinMax; + return record.has_data () ? record.get_min_max (this) : this+defaultMinMax; } const BaseCoord &get_base_coord (int baseline_tag_index) const @@ -454,7 +469,7 @@ struct BaseScript (this+defaultMinMax).collect_variation_indices (plan, varidx_set); for (const BaseLangSysRecord& _ : baseLangSysRecords) - _.collect_variation_indices (plan, varidx_set); + _.collect_variation_indices (this, plan, varidx_set); } bool subset (hb_subset_context_t *c) const @@ -705,6 +720,46 @@ struct BASE (this+vAxis).collect_variation_indices (plan, varidx_set); } + bool subset_varstore (hb_subset_context_t *c, + BASE *out /* OUT */) const + { + TRACE_SUBSET (this); + if (!c->serializer->allocate_size<Offset32To<ItemVariationStore>> (Offset32To<ItemVariationStore>::static_size)) + return_trace (false); + if (!c->plan->normalized_coords) + return_trace (out->varStore.serialize_subset (c, varStore, this, c->plan->base_varstore_inner_maps.as_array ())); + + if (c->plan->all_axes_pinned) + return_trace (true); + + item_variations_t item_vars; + if (!item_vars.instantiate (this+varStore, c->plan, true, true, + c->plan->base_varstore_inner_maps.as_array ())) + return_trace (false); + + if (!out->varStore.serialize_serialize (c->serializer, + item_vars.has_long_word (), + c->plan->axis_tags, + item_vars.get_region_list (), + item_vars.get_vardata_encodings ())) + return_trace (false); + + const hb_map_t &varidx_map = item_vars.get_varidx_map (); + /* base_variation_idx_map in the plan is old_varidx->(varidx, delta) + * mapping, new varidx is generated for subsetting, we need to remap this + * after instancing */ + for (auto _ : c->plan->base_variation_idx_map.iter_ref ()) + { + uint32_t varidx = _.second.first; + uint32_t *new_varidx; + if (varidx_map.has (varidx, &new_varidx)) + _.second.first = *new_varidx; + else + _.second.first = HB_OT_LAYOUT_NO_VARIATIONS_INDEX; + } + return_trace (true); + } + bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); @@ -712,19 +767,15 @@ struct BASE if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false); out->version = version; + if (has_var_store () && !subset_varstore (c, out)) + return_trace (false); + if (hAxis && !out->hAxis.serialize_subset (c, hAxis, this)) return_trace (false); if (vAxis && !out->vAxis.serialize_subset (c, vAxis, this)) return_trace (false); - if (has_var_store ()) - { - if (!c->serializer->allocate_size<Offset32To<ItemVariationStore>> (Offset32To<ItemVariationStore>::static_size)) - return_trace (false); - return_trace (out->varStore.serialize_subset (c, varStore, this, c->plan->base_varstore_inner_maps.as_array ())); - } - return_trace (true); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh index aba427368ca..65c8309573f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh @@ -2641,7 +2641,7 @@ struct VarRegionList float max_val = axis_region->endCoord.to_float (); if (def_val != 0.f) - axis_tuples.set (*axis_tag, Triple (min_val, def_val, max_val)); + axis_tuples.set (*axis_tag, Triple ((double) min_val, (double) def_val, (double) max_val)); axis_region++; } return !axis_tuples.in_error (); @@ -3208,6 +3208,8 @@ struct ItemVariationStore for (unsigned i = 0; i < count; i++) { hb_inc_bimap_t *map = inner_maps.push (); + if (!c->propagate_error(inner_maps)) + return_trace(nullptr); auto &data = this+dataSets[i]; unsigned itemCount = data.get_item_count (); @@ -3326,19 +3328,19 @@ struct ConditionFormat1 return_trace (false); const hb_hashmap_t<hb_tag_t, Triple>& normalized_axes_location = c->plan->axes_location; - Triple axis_limit{-1.f, 0.f, 1.f}; + Triple axis_limit{-1.0, 0.0, 1.0}; Triple *normalized_limit; if (normalized_axes_location.has (*axis_tag, &normalized_limit)) axis_limit = *normalized_limit; const hb_hashmap_t<hb_tag_t, TripleDistances>& axes_triple_distances = c->plan->axes_triple_distances; - TripleDistances axis_triple_distances{1.f, 1.f}; + TripleDistances axis_triple_distances{1.0, 1.0}; TripleDistances *triple_dists; if (axes_triple_distances.has (*axis_tag, &triple_dists)) axis_triple_distances = *triple_dists; - float normalized_min = renormalizeValue (filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false); - float normalized_max = renormalizeValue (filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false); + float normalized_min = renormalizeValue ((double) filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false); + float normalized_max = renormalizeValue ((double) filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false); out->filterRangeMinValue.set_float (normalized_min); out->filterRangeMaxValue.set_float (normalized_max); @@ -3356,7 +3358,7 @@ struct ConditionFormat1 hb_tag_t axis_tag = c->axes_index_tag_map->get (axisIndex); - Triple axis_range (-1.f, 0.f, 1.f); + Triple axis_range (-1.0, 0.0, 1.0); Triple *axis_limit; bool axis_set_by_user = false; if (c->axes_location->has (axis_tag, &axis_limit)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh index c65ea32b8a0..6b760b1108d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh @@ -1254,7 +1254,7 @@ static bool match_input (hb_ot_apply_context_t *c, match_func_t match_func, const void *match_data, unsigned int *end_position, - unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], + unsigned int *match_positions, unsigned int *p_total_component_count = nullptr) { TRACE_APPLY (nullptr); @@ -1378,7 +1378,7 @@ static bool match_input (hb_ot_apply_context_t *c, } static inline bool ligate_input (hb_ot_apply_context_t *c, unsigned int count, /* Including the first glyph */ - const unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ + const unsigned int *match_positions, /* Including the first glyph */ unsigned int match_end, hb_codepoint_t lig_glyph, unsigned int total_component_count) @@ -1686,7 +1686,7 @@ static inline void recurse_lookups (context_t *c, static inline void apply_lookup (hb_ot_apply_context_t *c, unsigned int count, /* Including the first glyph */ - unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ + unsigned int *match_positions, /* Including the first glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */ unsigned int match_end) @@ -1694,6 +1694,9 @@ static inline void apply_lookup (hb_ot_apply_context_t *c, hb_buffer_t *buffer = c->buffer; int end; + unsigned int *match_positions_input = match_positions; + unsigned int match_positions_count = count; + /* All positions are distance from beginning of *output* buffer. * Adjust. */ { @@ -1797,6 +1800,27 @@ static inline void apply_lookup (hb_ot_apply_context_t *c, { if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH)) break; + if (unlikely (delta + count > match_positions_count)) + { + unsigned new_match_positions_count = hb_max (delta + count, hb_max(match_positions_count, 4u) * 1.5); + if (match_positions == match_positions_input) + { + match_positions = (unsigned int *) hb_malloc (new_match_positions_count * sizeof (match_positions[0])); + if (unlikely (!match_positions)) + break; + memcpy (match_positions, match_positions_input, count * sizeof (match_positions[0])); + match_positions_count = new_match_positions_count; + } + else + { + unsigned int *new_match_positions = (unsigned int *) hb_realloc (match_positions, new_match_positions_count * sizeof (match_positions[0])); + if (unlikely (!new_match_positions)) + break; + match_positions = new_match_positions; + match_positions_count = new_match_positions_count; + } + } + } else { @@ -1820,6 +1844,9 @@ static inline void apply_lookup (hb_ot_apply_context_t *c, match_positions[next] += delta; } + if (match_positions != match_positions_input) + hb_free (match_positions); + (void) buffer->move_to (end); } @@ -1920,8 +1947,18 @@ static bool context_apply_lookup (hb_ot_apply_context_t *c, const LookupRecord lookupRecord[], const ContextApplyLookupContext &lookup_context) { + if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false; + unsigned match_positions_stack[4]; + unsigned *match_positions = match_positions_stack; + if (unlikely (inputCount > ARRAY_LENGTH (match_positions_stack))) + { + match_positions = (unsigned *) hb_malloc (hb_max (inputCount, 1u) * sizeof (match_positions[0])); + if (unlikely (!match_positions)) + return false; + } + unsigned match_end = 0; - unsigned match_positions[HB_MAX_CONTEXT_LENGTH]; + bool ret = false; if (match_input (c, inputCount, input, lookup_context.funcs.match, lookup_context.match_data, @@ -1932,13 +1969,18 @@ static bool context_apply_lookup (hb_ot_apply_context_t *c, inputCount, match_positions, lookupCount, lookupRecord, match_end); - return true; + ret = true; } else { c->buffer->unsafe_to_concat (c->buffer->idx, match_end); - return false; + ret = false; } + + if (unlikely (match_positions != match_positions_stack)) + hb_free (match_positions); + + return ret; } template <typename Types> @@ -3018,9 +3060,20 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c, const LookupRecord lookupRecord[], const ChainContextApplyLookupContext &lookup_context) { + if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false; + unsigned match_positions_stack[4]; + unsigned *match_positions = match_positions_stack; + if (unlikely (inputCount > ARRAY_LENGTH (match_positions_stack))) + { + match_positions = (unsigned *) hb_malloc (hb_max (inputCount, 1u) * sizeof (match_positions[0])); + if (unlikely (!match_positions)) + return false; + } + + unsigned start_index = c->buffer->out_len; unsigned end_index = c->buffer->idx; unsigned match_end = 0; - unsigned match_positions[HB_MAX_CONTEXT_LENGTH]; + bool ret = true; if (!(match_input (c, inputCount, input, lookup_context.funcs.match[1], lookup_context.match_data[1], @@ -3031,17 +3084,18 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c, match_end, &end_index))) { c->buffer->unsafe_to_concat (c->buffer->idx, end_index); - return false; + ret = false; + goto done; } - unsigned start_index = c->buffer->out_len; if (!match_backtrack (c, backtrackCount, backtrack, lookup_context.funcs.match[0], lookup_context.match_data[0], &start_index)) { c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index); - return false; + ret = false; + goto done; } c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index); @@ -3049,7 +3103,12 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c, inputCount, match_positions, lookupCount, lookupRecord, match_end); - return true; + done: + + if (unlikely (match_positions != match_positions_stack)) + hb_free (match_positions); + + return ret; } template <typename Types> @@ -4328,7 +4387,7 @@ struct hb_ot_layout_lookup_accelerator_t thiz->digest.init (); for (auto& subtable : hb_iter (thiz->subtables, count)) - thiz->digest.add (subtable.digest); + thiz->digest.union_ (subtable.digest); #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc index a4c13abadf2..613c97fd9ea 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc @@ -87,7 +87,7 @@ using OT::Layout::GPOS; bool hb_ot_layout_has_kerning (hb_face_t *face) { - return face->table.kern->has_data (); + return face->table.kern->table->has_data (); } /** @@ -103,7 +103,7 @@ hb_ot_layout_has_kerning (hb_face_t *face) bool hb_ot_layout_has_machine_kerning (hb_face_t *face) { - return face->table.kern->has_state_machine (); + return face->table.kern->table->has_state_machine (); } /** @@ -123,7 +123,7 @@ hb_ot_layout_has_machine_kerning (hb_face_t *face) bool hb_ot_layout_has_cross_kerning (hb_face_t *face) { - return face->table.kern->has_cross_stream (); + return face->table.kern->table->has_cross_stream (); } void @@ -132,7 +132,7 @@ hb_ot_layout_kern (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer) { hb_blob_t *blob = font->face->table.kern.get_blob (); - const AAT::kern& kern = *blob->as<AAT::kern> (); + const auto& kern = *font->face->table.kern; AAT::hb_aat_apply_context_t c (plan, font, buffer, blob); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh index 43b58d9bbf9..6c91402269d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh @@ -272,7 +272,7 @@ struct OS2 Triple *axis_range; if (c->plan->user_axes_location.has (HB_TAG ('w','g','h','t'), &axis_range)) { - unsigned weight_class = static_cast<unsigned> (roundf (hb_clamp (axis_range->middle, 1.0f, 1000.0f))); + unsigned weight_class = static_cast<unsigned> (roundf (hb_clamp (axis_range->middle, 1.0, 1000.0))); if (os2_prime->usWeightClass != weight_class) os2_prime->usWeightClass = weight_class; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh index 8132dcfb91b..41918790371 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh @@ -116,7 +116,7 @@ struct post Triple *axis_range; if (c->plan->user_axes_location.has (HB_TAG ('s','l','n','t'), &axis_range)) { - float italic_angle = hb_max (-90.f, hb_min (axis_range->middle, 90.f)); + float italic_angle = hb_max (-90.0, hb_min (axis_range->middle, 90.0)); if (post_prime->italicAngle.to_float () != italic_angle) post_prime->italicAngle.set_float (italic_angle); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh index e88c82a13c7..ea5459ef4e2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh @@ -63,8 +63,9 @@ static bool axis_value_is_outside_axis_range (hb_tag_t axis_tag, float axis_valu if (!user_axes_location->has (axis_tag)) return false; + double axis_value_double = static_cast<double>(axis_value); Triple axis_range = user_axes_location->get (axis_tag); - return (axis_value < axis_range.minimum || axis_value > axis_range.maximum); + return (axis_value_double < axis_range.minimum || axis_value_double > axis_range.maximum); } struct StatAxisRecord diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag-table.hh index db92f4664a9..920b06b9c9b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag-table.hh @@ -2818,9 +2818,10 @@ out: * @tag: A language tag. * * Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to - * many language tags) and the best tag is not the alphabetically first, or if - * the best tag consists of multiple subtags, or if the best tag does not appear - * in #ot_languages. + * many language tags) and the best tag is not the first (sorted alphabetically, + * with two-letter tags having priority over all three-letter tags), or if the + * best tag consists of multiple subtags, or if the best tag does not appear in + * #ot_languages2 or #ot_languages3. * * Return value: The #hb_language_t corresponding to the BCP 47 language tag, * or #HB_LANGUAGE_INVALID if @tag is not ambiguous. @@ -2834,8 +2835,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("alt", -1); /* Southern Altai */ case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */ return hb_language_from_string ("und-fonnapa", -1); /* Undetermined; North American Phonetic Alphabet */ - case HB_TAG('A','R','A',' '): /* Arabic */ - return hb_language_from_string ("ar", -1); /* Arabic [macrolanguage] */ case HB_TAG('A','R','K',' '): /* Rakhine */ return hb_language_from_string ("rki", -1); /* Rakhine */ case HB_TAG('A','T','H',' '): /* Athapaskan */ @@ -2856,12 +2855,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("din", -1); /* Dinka [macrolanguage] */ case HB_TAG('D','R','I',' '): /* Dari */ return hb_language_from_string ("prs", -1); /* Dari */ - case HB_TAG('D','Z','N',' '): /* Dzongkha */ - return hb_language_from_string ("dz", -1); /* Dzongkha */ - case HB_TAG('E','T','I',' '): /* Estonian */ - return hb_language_from_string ("et", -1); /* Estonian [macrolanguage] */ - case HB_TAG('F','A','R',' '): /* Persian */ - return hb_language_from_string ("fa", -1); /* Persian [macrolanguage] */ case HB_TAG('G','O','N',' '): /* Gondi */ return hb_language_from_string ("gon", -1); /* Gondi [macrolanguage] */ case HB_TAG('H','M','A',' '): /* High Mari */ @@ -2876,10 +2869,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("iba", -1); /* Iban */ case HB_TAG('I','J','O',' '): /* Ijo */ return hb_language_from_string ("ijo", -1); /* Ijo [collection] */ - case HB_TAG('I','N','U',' '): /* Inuktitut */ - return hb_language_from_string ("iu", -1); /* Inuktitut [macrolanguage] */ - case HB_TAG('I','P','K',' '): /* Inupiat */ - return hb_language_from_string ("ik", -1); /* Inupiaq [macrolanguage] */ case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */ return hb_language_from_string ("und-fonipa", -1); /* Undetermined; International Phonetic Alphabet */ case HB_TAG('I','R','T',' '): /* Irish Traditional */ @@ -2890,36 +2879,24 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("kln", -1); /* Kalenjin [macrolanguage] */ case HB_TAG('K','G','E',' '): /* Khutsuri Georgian */ return hb_language_from_string ("und-Geok", -1); /* Undetermined; Khutsuri (Asomtavruli and Nuskhuri) */ - case HB_TAG('K','N','R',' '): /* Kanuri */ - return hb_language_from_string ("kr", -1); /* Kanuri [macrolanguage] */ case HB_TAG('K','O','H',' '): /* Korean Old Hangul */ return hb_language_from_string ("okm", -1); /* Middle Korean (10th-16th cent.) */ case HB_TAG('K','O','K',' '): /* Konkani */ return hb_language_from_string ("kok", -1); /* Konkani [macrolanguage] */ - case HB_TAG('K','O','M',' '): /* Komi */ - return hb_language_from_string ("kv", -1); /* Komi [macrolanguage] */ case HB_TAG('K','P','L',' '): /* Kpelle */ return hb_language_from_string ("kpe", -1); /* Kpelle [macrolanguage] */ case HB_TAG('K','R','N',' '): /* Karen */ return hb_language_from_string ("kar", -1); /* Karen [collection] */ case HB_TAG('K','U','I',' '): /* Kui */ return hb_language_from_string ("uki", -1); /* Kui (India) */ - case HB_TAG('K','U','R',' '): /* Kurdish */ - return hb_language_from_string ("ku", -1); /* Kurdish [macrolanguage] */ case HB_TAG('L','M','A',' '): /* Low Mari */ return hb_language_from_string ("mhr", -1); /* Eastern Mari */ case HB_TAG('L','U','H',' '): /* Luyia */ return hb_language_from_string ("luy", -1); /* Luyia [macrolanguage] */ - case HB_TAG('L','V','I',' '): /* Latvian */ - return hb_language_from_string ("lv", -1); /* Latvian [macrolanguage] */ case HB_TAG('M','A','W',' '): /* Marwari */ return hb_language_from_string ("mwr", -1); /* Marwari [macrolanguage] */ - case HB_TAG('M','L','G',' '): /* Malagasy */ - return hb_language_from_string ("mg", -1); /* Malagasy [macrolanguage] */ case HB_TAG('M','L','Y',' '): /* Malay */ return hb_language_from_string ("ms", -1); /* Malay [macrolanguage] */ - case HB_TAG('M','N','G',' '): /* Mongolian */ - return hb_language_from_string ("mn", -1); /* Mongolian [macrolanguage] */ case HB_TAG('M','N','K',' '): /* Maninka */ return hb_language_from_string ("man", -1); /* Mandingo [macrolanguage] */ case HB_TAG('M','O','L',' '): /* Romanian (Moldova) */ @@ -2930,26 +2907,16 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("myn", -1); /* Mayan [collection] */ case HB_TAG('N','A','H',' '): /* Nahuatl */ return hb_language_from_string ("nah", -1); /* Nahuatl [collection] */ - case HB_TAG('N','E','P',' '): /* Nepali */ - return hb_language_from_string ("ne", -1); /* Nepali [macrolanguage] */ case HB_TAG('N','I','S',' '): /* Nisi */ return hb_language_from_string ("njz", -1); /* Nyishi */ case HB_TAG('N','O','R',' '): /* Norwegian */ return hb_language_from_string ("no", -1); /* Norwegian [macrolanguage] */ - case HB_TAG('O','J','B',' '): /* Ojibway */ - return hb_language_from_string ("oj", -1); /* Ojibwa [macrolanguage] */ - case HB_TAG('O','R','O',' '): /* Oromo */ - return hb_language_from_string ("om", -1); /* Oromo [macrolanguage] */ - case HB_TAG('P','A','S',' '): /* Pashto */ - return hb_language_from_string ("ps", -1); /* Pashto [macrolanguage] */ case HB_TAG('P','G','R',' '): /* Polytonic Greek */ return hb_language_from_string ("el-polyton", -1); /* Modern Greek (1453-); Polytonic Greek */ case HB_TAG('P','R','O',' '): /* Provençal / Old Provençal */ return hb_language_from_string ("pro", -1); /* Old Provençal (to 1500) */ case HB_TAG('Q','U','H',' '): /* Quechua (Bolivia) */ return hb_language_from_string ("quh", -1); /* South Bolivian Quechua */ - case HB_TAG('Q','U','Z',' '): /* Quechua */ - return hb_language_from_string ("qu", -1); /* Quechua [macrolanguage] */ case HB_TAG('Q','V','I',' '): /* Quechua (Ecuador) */ return hb_language_from_string ("qvi", -1); /* Imbabura Highland Quichua */ case HB_TAG('Q','W','H',' '): /* Quechua (Peru) */ @@ -2960,10 +2927,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("ro", -1); /* Romanian */ case HB_TAG('R','O','Y',' '): /* Romany */ return hb_language_from_string ("rom", -1); /* Romany [macrolanguage] */ - case HB_TAG('S','A','N',' '): /* Sanskrit */ - return hb_language_from_string ("sa", -1); /* Sanskrit [macrolanguage] */ - case HB_TAG('S','Q','I',' '): /* Albanian */ - return hb_language_from_string ("sq", -1); /* Albanian [macrolanguage] */ case HB_TAG('S','R','B',' '): /* Serbian */ return hb_language_from_string ("sr", -1); /* Serbian */ case HB_TAG('S','X','T',' '): /* Sutu */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh index 9149959d792..75ea338e2a8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh @@ -80,7 +80,7 @@ struct AxisValueMap bool is_outside_axis_range (const Triple& axis_range) const { - float from_coord = coords[0].to_float (); + double from_coord = (double) coords[0].to_float (); return !axis_range.contains (from_coord); } @@ -100,8 +100,8 @@ struct AxisValueMap float from_coord = coords[0].to_float (); float to_coord = coords[1].to_float (); - from_coord = renormalizeValue (from_coord, unmapped_range, triple_distances); - to_coord = renormalizeValue (to_coord, axis_range, triple_distances); + from_coord = renormalizeValue ((double) from_coord, unmapped_range, triple_distances); + to_coord = renormalizeValue ((double) to_coord, axis_range, triple_distances); coords[0].set_float (from_coord); coords[1].set_float (to_coord); @@ -197,7 +197,7 @@ struct SegmentMaps : Array16Of<AxisValueMap> unmapped_val.set_int (unmap (val.to_int ())); float unmapped_max = unmapped_val.to_float (); - return Triple{unmapped_min, unmapped_middle, unmapped_max}; + return Triple{(double) unmapped_min, (double) unmapped_middle, (double) unmapped_max}; } bool subset (hb_subset_context_t *c, hb_tag_t axis_tag) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-common.hh index 379e1640593..08227aa1dfa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-common.hh @@ -299,13 +299,13 @@ struct TupleVariationHeader start = hb_min (peak, 0.f); end = hb_max (peak, 0.f); } - axis_tuples.set (*axis_tag, Triple (start, peak, end)); + axis_tuples.set (*axis_tag, Triple ((double) start, (double) peak, (double) end)); } return true; } - float calculate_scalar (hb_array_t<int> coords, unsigned int coord_count, + double calculate_scalar (hb_array_t<int> coords, unsigned int coord_count, const hb_array_t<const F2DOT14> shared_tuples, const hb_vector_t<hb_pair_t<int,int>> *shared_tuple_active_idx = nullptr) const { @@ -321,13 +321,13 @@ struct TupleVariationHeader { unsigned int index = get_index (); if (unlikely ((index + 1) * coord_count > shared_tuples.length)) - return 0.f; + return 0.0; peak_tuple = shared_tuples.sub_array (coord_count * index, coord_count).arrayZ; if (shared_tuple_active_idx) { if (unlikely (index >= shared_tuple_active_idx->length)) - return 0.f; + return 0.0; auto _ = (*shared_tuple_active_idx).arrayZ[index]; if (_.second != -1) { @@ -352,7 +352,7 @@ struct TupleVariationHeader end_tuple = get_end_tuple (coord_count).arrayZ; } - float scalar = 1.f; + double scalar = 1.0; for (unsigned int i = start_idx; i < end_idx; i += step) { int peak = peak_tuple[i].to_int (); @@ -367,15 +367,15 @@ struct TupleVariationHeader int end = end_tuple[i].to_int (); if (unlikely (start > peak || peak > end || (start < 0 && end > 0 && peak))) continue; - if (v < start || v > end) return 0.f; + if (v < start || v > end) return 0.0; if (v < peak) - { if (peak != start) scalar *= (float) (v - start) / (peak - start); } + { if (peak != start) scalar *= (double) (v - start) / (peak - start); } else - { if (peak != end) scalar *= (float) (end - v) / (end - peak); } + { if (peak != end) scalar *= (double) (end - v) / (end - peak); } } - else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.f; + else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.0; else - scalar *= (float) v / peak; + scalar *= (double) v / peak; } return scalar; } @@ -444,10 +444,10 @@ struct tuple_delta_t /* indices_length = point_count, indice[i] = 1 means point i is referenced */ hb_vector_t<bool> indices; - - hb_vector_t<float> deltas_x; + + hb_vector_t<double> deltas_x; /* empty for cvar tuples */ - hb_vector_t<float> deltas_y; + hb_vector_t<double> deltas_y; /* compiled data: header and deltas * compiled point data is saved in a hashmap within tuple_variations_t cause @@ -513,9 +513,9 @@ struct tuple_delta_t return *this; } - tuple_delta_t& operator *= (float scalar) + tuple_delta_t& operator *= (double scalar) { - if (scalar == 1.0f) + if (scalar == 1.0) return *this; unsigned num = indices.length; @@ -546,18 +546,18 @@ struct tuple_delta_t return out; } - if ((tent->minimum < 0.f && tent->maximum > 0.f) || + if ((tent->minimum < 0.0 && tent->maximum > 0.0) || !(tent->minimum <= tent->middle && tent->middle <= tent->maximum)) return out; - if (tent->middle == 0.f) + if (tent->middle == 0.0) { out.push (*this); return out; } - result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances); - for (auto t : solutions) + rebase_tent_result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances); + for (auto &t : solutions) { tuple_delta_t new_var = *this; if (t.second == Triple ()) @@ -729,8 +729,8 @@ struct tuple_delta_t { return compile_deltas (indices, deltas_x, deltas_y, compiled_deltas); } bool compile_deltas (const hb_vector_t<bool> &point_indices, - const hb_vector_t<float> &x_deltas, - const hb_vector_t<float> &y_deltas, + const hb_vector_t<double> &x_deltas, + const hb_vector_t<double> &y_deltas, hb_vector_t<char> &compiled_deltas /* OUT */) { hb_vector_t<int> rounded_deltas; @@ -1000,9 +1000,13 @@ struct tuple_delta_t { i = next_index (i, start_point, end_point); if (i == next) break; - deltas_x.arrayZ[i] = infer_delta (orig_points.arrayZ[i].x, orig_points.arrayZ[prev].x, orig_points.arrayZ[next].x, + deltas_x.arrayZ[i] = infer_delta ((double) orig_points.arrayZ[i].x, + (double) orig_points.arrayZ[prev].x, + (double) orig_points.arrayZ[next].x, deltas_x.arrayZ[prev], deltas_x.arrayZ[next]); - deltas_y.arrayZ[i] = infer_delta (orig_points.arrayZ[i].y, orig_points.arrayZ[prev].y, orig_points.arrayZ[next].y, + deltas_y.arrayZ[i] = infer_delta ((double) orig_points.arrayZ[i].y, + (double) orig_points.arrayZ[prev].y, + (double) orig_points.arrayZ[next].y, deltas_y.arrayZ[prev], deltas_y.arrayZ[next]); inferred_idxes.add (i); if (--unref_count == 0) goto no_more_gaps; @@ -1020,8 +1024,8 @@ struct tuple_delta_t { if (!inferred_idxes.has (i)) { - deltas_x.arrayZ[i] = 0.f; - deltas_y.arrayZ[i] = 0.f; + deltas_x.arrayZ[i] = 0.0; + deltas_y.arrayZ[i] = 0.0; } indices[i] = true; } @@ -1031,7 +1035,7 @@ struct tuple_delta_t bool optimize (const contour_point_vector_t& contour_points, bool is_composite, - float tolerance = 0.5f) + double tolerance = 0.5 + 1e-10) { unsigned count = contour_points.length; if (deltas_x.length != count || @@ -1062,7 +1066,7 @@ struct tuple_delta_t if (ref_count == count) return true; - hb_vector_t<float> opt_deltas_x, opt_deltas_y; + hb_vector_t<double> opt_deltas_x, opt_deltas_y; bool is_comp_glyph_wo_deltas = (is_composite && ref_count == 0); if (is_comp_glyph_wo_deltas) { @@ -1194,16 +1198,16 @@ struct tuple_delta_t return compiled_points.resize (pos, false); } - static float infer_delta (float target_val, float prev_val, float next_val, float prev_delta, float next_delta) + static double infer_delta (double target_val, double prev_val, double next_val, double prev_delta, double next_delta) { if (prev_val == next_val) - return (prev_delta == next_delta) ? prev_delta : 0.f; + return (prev_delta == next_delta) ? prev_delta : 0.0; else if (target_val <= hb_min (prev_val, next_val)) return (prev_val < next_val) ? prev_delta : next_delta; else if (target_val >= hb_max (prev_val, next_val)) return (prev_val > next_val) ? prev_delta : next_delta; - float r = (target_val - prev_val) / (next_val - prev_val); + double r = (target_val - prev_val) / (next_val - prev_val); return prev_delta + r * (next_delta - prev_delta); } @@ -1347,9 +1351,9 @@ struct TupleVariationData unsigned idx = apply_to_all ? i : indices[i]; if (idx >= point_count) continue; var.indices[idx] = true; - var.deltas_x[idx] = static_cast<float> (deltas_x[i]); + var.deltas_x[idx] = deltas_x[i]; if (is_gvar) - var.deltas_y[idx] = static_cast<float> (deltas_y[i]); + var.deltas_y[idx] = deltas_y[i]; } tuple_vars.push (std::move (var)); } while (iterator.move_to_next ()); @@ -1367,15 +1371,15 @@ struct TupleVariationData /* NULL offset, to keep original varidx valid, just return */ if (&var_data == &Null (VarData)) return true; - + unsigned num_regions = var_data.get_region_index_count (); if (!tuple_vars.alloc (num_regions)) return false; - + item_count = inner_map ? inner_map->get_population () : var_data.get_item_count (); if (!item_count) return true; unsigned row_size = var_data.get_row_size (); const HBUINT8 *delta_bytes = var_data.get_delta_bytes (); - + for (unsigned r = 0; r < num_regions; r++) { /* In VarData, deltas are organized in rows, convert them into @@ -1384,14 +1388,14 @@ struct TupleVariationData if (!tuple.deltas_x.resize (item_count, false) || !tuple.indices.resize (item_count, false)) return false; - + for (unsigned i = 0; i < item_count; i++) { tuple.indices.arrayZ[i] = true; tuple.deltas_x.arrayZ[i] = var_data.get_item_delta_fast (inner_map ? inner_map->backward (i) : i, r, delta_bytes, row_size); } - + unsigned region_index = var_data.get_region_index (r); if (region_index >= regions.length) return false; tuple.axis_tuples = regions.arrayZ[region_index]; @@ -1425,7 +1429,7 @@ struct TupleVariationData Triple *axis_limit; if (!normalized_axes_location.has (axis_tag, &axis_limit)) return false; - TripleDistances axis_triple_distances{1.f, 1.f}; + TripleDistances axis_triple_distances{1.0, 1.0}; if (axes_triple_distances.has (axis_tag)) axis_triple_distances = axes_triple_distances.get (axis_tag); @@ -1503,11 +1507,11 @@ struct TupleVariationData return false; continue; } - + hb_vector_t<char> compiled_point_data; if (!tuple_delta_t::compile_point_set (*points_set, compiled_point_data)) return false; - + if (!point_data_map.set (points_set, std::move (compiled_point_data)) || !point_set_count_map.set (points_set, 1)) return false; @@ -1547,7 +1551,7 @@ struct TupleVariationData for (tuple_delta_t& var : tuple_vars) if (!var.calc_inferred_deltas (contour_points)) return false; - + return true; } @@ -1874,7 +1878,7 @@ struct TupleVariationData if (!tuple_variations.serialize_var_headers (c, total_header_len)) return_trace (false); - + unsigned data_offset = min_size + total_header_len; if (!is_gvar) data_offset += 4; if (!c->check_assign (out->data, data_offset, HB_SERIALIZE_ERROR_INT_OVERFLOW)) return_trace (false); @@ -2335,12 +2339,12 @@ struct item_variations_t /* just sanity check, this shouldn't happen */ if (encoding.is_empty ()) return false; - + unsigned num_rows = encoding.items.length; - + /* sort rows, make result deterministic */ encoding.items.qsort (_cmp_row); - + /* compile old to new var_idxes mapping */ for (unsigned minor = 0; minor < num_rows; minor++) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh index 07d7586baac..2cd9afbb709 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh @@ -43,7 +43,7 @@ static bool axis_coord_pinned_or_within_axis_range (const hb_array_t<const F16DO unsigned axis_index, Triple axis_limit) { - float axis_coord = coords[axis_index].to_float (); + double axis_coord = static_cast<double>(coords[axis_index].to_float ()); if (axis_limit.is_point ()) { if (axis_limit.minimum != axis_coord) @@ -233,7 +233,10 @@ struct AxisRecord { float min, default_, max; get_coordinates (min, default_, max); - return TripleDistances (min, default_, max); + return TripleDistances ( + static_cast<double>(min), + static_cast<double>(default_), + static_cast<double>(max)); } bool subset (hb_subset_context_t *c) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh index 59aad57e37c..d713084faf9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh @@ -102,9 +102,8 @@ struct glyph_variations_t } bool is_composite_glyph = false; -#ifdef HB_EXPERIMENTAL_API is_composite_glyph = plan->composite_new_gids.has (new_gid); -#endif + if (!p->decompile_tuple_variations (all_contour_points->length, true /* is_gvar */, iterator, &(plan->axes_old_index_tag_map), shared_indices, shared_tuples, @@ -120,9 +119,7 @@ struct glyph_variations_t { unsigned count = plan->new_to_old_gid_list.length; bool iup_optimize = false; -#ifdef HB_EXPERIMENTAL_API iup_optimize = plan->flags & HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS; -#endif for (unsigned i = 0; i < count; i++) { hb_codepoint_t new_gid = plan->new_to_old_gid_list[i].first; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-repacker.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-repacker.hh index ed40f271ccb..cb4fdeead2e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-repacker.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-repacker.hh @@ -337,9 +337,10 @@ bool _process_overflows (const hb_vector_t<graph::overflow_record_t>& overflows, inline bool hb_resolve_graph_overflows (hb_tag_t table_tag, unsigned max_rounds , - bool recalculate_extensions, + bool always_recalculate_extensions, graph_t& sorted_graph /* IN/OUT */) { + DEBUG_MSG (SUBSET_REPACK, nullptr, "Repacking %c%c%c%c.", HB_UNTAG(table_tag)); sorted_graph.sort_shortest_distance (); if (sorted_graph.in_error ()) { @@ -351,12 +352,12 @@ hb_resolve_graph_overflows (hb_tag_t table_tag, if (!will_overflow) return true; + bool is_gsub_or_gpos = (table_tag == HB_OT_TAG_GPOS || table_tag == HB_OT_TAG_GSUB); graph::gsubgpos_graph_context_t ext_context (table_tag, sorted_graph); - if ((table_tag == HB_OT_TAG_GPOS - || table_tag == HB_OT_TAG_GSUB) - && will_overflow) + if (is_gsub_or_gpos && will_overflow) { - if (recalculate_extensions) + DEBUG_MSG (SUBSET_REPACK, nullptr, "Applying GSUB/GPOS repacking specializations."); + if (always_recalculate_extensions) { DEBUG_MSG (SUBSET_REPACK, nullptr, "Splitting subtables if needed."); if (!_presplit_subtables_if_needed (ext_context)) { @@ -412,6 +413,13 @@ hb_resolve_graph_overflows (hb_tag_t table_tag, if (graph::will_overflow (sorted_graph)) { + if (is_gsub_or_gpos && !always_recalculate_extensions) { + // If this a GSUB/GPOS table and we didn't try to extension promotion and table splitting then + // as a last ditch effort, re-run the repacker with it enabled. + DEBUG_MSG (SUBSET_REPACK, nullptr, "Failed to find a resolution. Re-running with extension promotion and table splitting enabled."); + return hb_resolve_graph_overflows (table_tag, max_rounds, true, sorted_graph); + } + DEBUG_MSG (SUBSET_REPACK, nullptr, "Offset overflow resolution failed."); return false; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh index 5681641baab..b718b94e69a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh @@ -82,7 +82,9 @@ struct hb_set_digest_bits_pattern_t void init () { mask = 0; } - void add (const hb_set_digest_bits_pattern_t &o) { mask |= o.mask; } + static hb_set_digest_bits_pattern_t full () { hb_set_digest_bits_pattern_t d; d.mask = (mask_t) -1; return d; } + + void union_ (const hb_set_digest_bits_pattern_t &o) { mask |= o.mask; } void add (hb_codepoint_t g) { mask |= mask_for (g); } @@ -129,11 +131,14 @@ struct hb_set_digest_bits_pattern_t bool may_have (hb_codepoint_t g) const { return mask & mask_for (g); } + bool operator [] (hb_codepoint_t g) const + { return may_have (g); } + private: static mask_t mask_for (hb_codepoint_t g) { return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1)); } - mask_t mask; + mask_t mask = 0; }; template <typename head_t, typename tail_t> @@ -145,10 +150,12 @@ struct hb_set_digest_combiner_t tail.init (); } - void add (const hb_set_digest_combiner_t &o) + static hb_set_digest_combiner_t full () { hb_set_digest_combiner_t d; d.head = head_t::full(); d.tail = tail_t::full (); return d; } + + void union_ (const hb_set_digest_combiner_t &o) { - head.add (o.head); - tail.add (o.tail); + head.union_ (o.head); + tail.union_(o.tail); } void add (hb_codepoint_t g) @@ -188,6 +195,9 @@ struct hb_set_digest_combiner_t return head.may_have (g) && tail.may_have (g); } + bool operator [] (hb_codepoint_t g) const + { return may_have (g); } + private: head_t head; tail_t tail; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh index ce69ea2c9b2..f6013a41416 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh @@ -86,7 +86,7 @@ struct hb_sparseset_t uint32_t hash () const { return s.hash (); } void add (hb_codepoint_t g) { s.add (g); } - bool add_range (hb_codepoint_t a, hb_codepoint_t b) { return s.add_range (a, b); } + bool add_range (hb_codepoint_t first, hb_codepoint_t last) { return s.add_range (first, last); } template <typename T> void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh index 462e99cf8c8..4039f9c959e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh @@ -115,7 +115,7 @@ struct str_encoder_t encode_byte (OpCode_BCD); // Based on: - // https://github.com/fonttools/fonttools/blob/97ed3a61cde03e17b8be36f866192fbd56f1d1a7/Lib/fontTools/misc/psCharStrings.py#L265-L294 + // https://github.com/fonttools/fonttools/blob/0738c41dfbcbc213ab9263f486ef0cccc6eb5ce5/Lib/fontTools/misc/psCharStrings.py#L267-L316 char buf[16]; /* FontTools has the following comment: @@ -133,6 +133,10 @@ struct str_encoder_t (void) hb_uselocale (((void) freelocale (clocale), oldlocale)); char *s = buf; + size_t len; + char *comma = strchr (s, ','); + if (comma) // Comma for some European locales in case no uselocale available. + *comma = '.'; if (s[0] == '0' && s[1] == '.') s++; else if (s[0] == '-' && s[1] == '0' && s[2] == '.') @@ -140,6 +144,45 @@ struct str_encoder_t s[1] = '-'; s++; } + else if ((len = strlen (s)) > 3 && !strcmp (s + len - 3, "000")) + { + unsigned exponent = len - 3; + char *s2 = s + exponent - 1; + while (*s2 == '0' && exponent > 1) + { + s2--; + exponent++; + } + snprintf (s2 + 1, sizeof (buf) - (s2 + 1 - buf), "E%u", exponent); + } + else + { + char *dot = strchr (s, '.'); + char *e = strchr (s, 'E'); + if (dot && e) + { + memmove (dot, dot + 1, e - (dot + 1)); + int exponent = atoi (e + 1); + int new_exponent = exponent - (e - (dot + 1)); + if (new_exponent == 1) + { + e[-1] = '0'; + e[0] = '\0'; + } + else + snprintf (e - 1, sizeof (buf) - (e - 1 - buf), "E%d", new_exponent); + } + } + if ((s[0] == '.' && s[1] == '0') || (s[0] == '-' && s[1] == '.' && s[2] == '0')) + { + int sign = s[0] == '-'; + char *s2 = s + sign + 1; + while (*s2 == '0') + s2++; + len = strlen (s2); + memmove (s + sign, s2, len); + snprintf (s + sign + len, sizeof (buf) - (s + sign + len - buf), "E-%u", (unsigned) (strlen (s + sign) - 1)); + } hb_vector_t<char> nibbles; while (*s) { @@ -155,20 +198,22 @@ struct str_encoder_t { s++; nibbles.push (0x0C); // E- - continue; + } else { + if (c2 == '+') + s++; + nibbles.push (0x0B); // E } - if (c2 == '+') + if (*s == '0') s++; - nibbles.push (0x0B); // E continue; } - case '.': case ',': // Comma for some European locales in case no uselocale available. + case '.': nibbles.push (0x0A); // . continue; case '-': - nibbles.push (0x0E); // . + nibbles.push (0x0E); // - continue; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc index eb5cb0c625e..9c9117d52fc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc @@ -666,6 +666,9 @@ OT::cff2::accelerator_subset_t::serialize (hb_serialize_context_t *c, bool OT::cff2::accelerator_subset_t::subset (hb_subset_context_t *c) const { + if (c->plan->normalized_coords && !c->plan->all_axes_pinned) + fprintf (stdout, "warning: CFF partial instancing is not supported.\n"); + cff2_subset_plan cff2_plan; if (unlikely (!cff2_plan.create (*this, c->plan))) return false; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc index 68a3e77788e..8974755a757 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc @@ -446,7 +446,7 @@ hb_subset_input_pin_all_axes_to_default (hb_subset_input_t *input, for (unsigned i = 0; i < axis_count; i++) { hb_tag_t axis_tag = axis_infos[i].tag; - float default_val = axis_infos[i].default_value; + double default_val = (double) axis_infos[i].default_value; if (!input->axes_location.set (axis_tag, Triple (default_val, default_val, default_val))) { hb_free (axis_infos); @@ -481,7 +481,7 @@ hb_subset_input_pin_axis_to_default (hb_subset_input_t *input, if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info)) return false; - float default_val = axis_info.default_value; + double default_val = (double) axis_info.default_value; return input->axes_location.set (axis_tag, Triple (default_val, default_val, default_val)); } @@ -511,11 +511,10 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input, if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info)) return false; - float val = hb_clamp(axis_value, axis_info.min_value, axis_info.max_value); + double val = hb_clamp((double) axis_value, (double) axis_info.min_value, (double) axis_info.max_value); return input->axes_location.set (axis_tag, Triple (val, val, val)); } -#ifdef HB_EXPERIMENTAL_API /** * hb_subset_input_set_axis_range: (skip) * @input: a #hb_subset_input_t object. @@ -538,7 +537,7 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input, * * Return value: `true` if success, `false` otherwise * - * XSince: EXPERIMENTAL + * Since: 8.5.0 **/ HB_EXTERN hb_bool_t hb_subset_input_set_axis_range (hb_subset_input_t *input, @@ -562,7 +561,7 @@ hb_subset_input_set_axis_range (hb_subset_input_t *input, float new_min_val = hb_clamp(min, axis_info.min_value, axis_info.max_value); float new_max_val = hb_clamp(max, axis_info.min_value, axis_info.max_value); float new_default_val = hb_clamp(def, new_min_val, new_max_val); - return input->axes_location.set (axis_tag, Triple (new_min_val, new_default_val, new_max_val)); + return input->axes_location.set (axis_tag, Triple ((double) new_min_val, (double) new_default_val, (double) new_max_val)); } /** @@ -577,7 +576,7 @@ hb_subset_input_set_axis_range (hb_subset_input_t *input, * * Return value: `true` if a range has been set for this axis tag, `false` otherwise. * - * XSince: EXPERIMENTAL + * Since: 8.5.0 **/ HB_EXTERN hb_bool_t hb_subset_input_get_axis_range (hb_subset_input_t *input, @@ -598,7 +597,6 @@ hb_subset_input_get_axis_range (hb_subset_input_t *input, return true; } #endif -#endif /** * hb_subset_preprocess: @@ -746,5 +744,4 @@ hb_subset_input_override_name_table (hb_subset_input_t *input, input->name_table_overrides.set (hb_ot_name_record_ids_t (platform_id, encoding_id, language_id, name_id), name_bytes); return true; } - #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.cc index 35a964d0826..074657acaf9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.cc @@ -38,7 +38,7 @@ static void _iup_contour_bound_forced_set (const hb_array_t<const contour_point_ const hb_array_t<const int> x_deltas, const hb_array_t<const int> y_deltas, hb_set_t& forced_set, /* OUT */ - float tolerance = 0.f) + double tolerance = 0.0) { unsigned len = contour_points.length; unsigned next_i = 0; @@ -47,28 +47,28 @@ static void _iup_contour_bound_forced_set (const hb_array_t<const contour_point_ unsigned last_i = (len + i -1) % len; for (unsigned j = 0; j < 2; j++) { - float cj, lcj, ncj; + double cj, lcj, ncj; int dj, ldj, ndj; if (j == 0) { - cj = contour_points.arrayZ[i].x; + cj = static_cast<double> (contour_points.arrayZ[i].x); dj = x_deltas.arrayZ[i]; - lcj = contour_points.arrayZ[last_i].x; + lcj = static_cast<double> (contour_points.arrayZ[last_i].x); ldj = x_deltas.arrayZ[last_i]; - ncj = contour_points.arrayZ[next_i].x; + ncj = static_cast<double> (contour_points.arrayZ[next_i].x); ndj = x_deltas.arrayZ[next_i]; } else { - cj = contour_points.arrayZ[i].y; + cj = static_cast<double> (contour_points.arrayZ[i].y); dj = y_deltas.arrayZ[i]; - lcj = contour_points.arrayZ[last_i].y; + lcj = static_cast<double> (contour_points.arrayZ[last_i].y); ldj = y_deltas.arrayZ[last_i]; - ncj = contour_points.arrayZ[next_i].y; + ncj = static_cast<double> (contour_points.arrayZ[next_i].y); ndj = y_deltas.arrayZ[next_i]; } - float c1, c2; + double c1, c2; int d1, d2; if (lcj <= ncj) { @@ -180,8 +180,8 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points const contour_point_t& p1, const contour_point_t& p2, int p1_dx, int p2_dx, int p1_dy, int p2_dy, - hb_vector_t<float>& interp_x_deltas, /* OUT */ - hb_vector_t<float>& interp_y_deltas /* OUT */) + hb_vector_t<double>& interp_x_deltas, /* OUT */ + hb_vector_t<double>& interp_y_deltas /* OUT */) { unsigned n = contour_points.length; if (unlikely (!interp_x_deltas.resize (n, false) || @@ -190,20 +190,20 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points for (unsigned j = 0; j < 2; j++) { - float x1, x2, d1, d2; - float *out; + double x1, x2, d1, d2; + double *out; if (j == 0) { - x1 = p1.x; - x2 = p2.x; + x1 = static_cast<double> (p1.x); + x2 = static_cast<double> (p2.x); d1 = p1_dx; d2 = p2_dx; out = interp_x_deltas.arrayZ; } else { - x1 = p1.y; - x2 = p2.y; + x1 = static_cast<double> (p1.y); + x2 = static_cast<double> (p2.y); d1 = p1_dy; d2 = p2_dy; out = interp_y_deltas.arrayZ; @@ -219,7 +219,7 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points else { for (unsigned i = 0; i < n; i++) - out[i] = 0.f; + out[i] = 0.0; } continue; } @@ -230,11 +230,11 @@ static bool _iup_segment (const hb_array_t<const contour_point_t> contour_points hb_swap (d1, d2); } - float scale = (d2 - d1) / (x2 - x1); + double scale = (d2 - d1) / (x2 - x1); for (unsigned i = 0; i < n; i++) { - float x = j == 0 ? contour_points.arrayZ[i].x : contour_points.arrayZ[i].y; - float d; + double x = (j == 0 ? static_cast<double> (contour_points.arrayZ[i].x) : static_cast<double> (contour_points.arrayZ[i].y)); + double d; if (x <= x1) d = d1; else if (x >= x2) @@ -254,9 +254,9 @@ static bool _can_iup_in_between (const hb_array_t<const contour_point_t> contour const contour_point_t& p1, const contour_point_t& p2, int p1_dx, int p2_dx, int p1_dy, int p2_dy, - float tolerance) + double tolerance) { - hb_vector_t<float> interp_x_deltas, interp_y_deltas; + hb_vector_t<double> interp_x_deltas, interp_y_deltas; if (!_iup_segment (contour_points, x_deltas, y_deltas, p1, p2, p1_dx, p2_dx, p1_dy, p2_dy, interp_x_deltas, interp_y_deltas)) @@ -266,10 +266,10 @@ static bool _can_iup_in_between (const hb_array_t<const contour_point_t> contour for (unsigned i = 0; i < num; i++) { - float dx = x_deltas.arrayZ[i] - interp_x_deltas.arrayZ[i]; - float dy = y_deltas.arrayZ[i] - interp_y_deltas.arrayZ[i]; + double dx = static_cast<double> (x_deltas.arrayZ[i]) - interp_x_deltas.arrayZ[i]; + double dy = static_cast<double> (y_deltas.arrayZ[i]) - interp_y_deltas.arrayZ[i]; - if (sqrtf ((float)dx * dx + (float)dy * dy) > tolerance) + if (sqrt (dx * dx + dy * dy) > tolerance) return false; } return true; @@ -279,7 +279,7 @@ static bool _iup_contour_optimize_dp (const contour_point_vector_t& contour_poin const hb_vector_t<int>& x_deltas, const hb_vector_t<int>& y_deltas, const hb_set_t& forced_set, - float tolerance, + double tolerance, unsigned lookback, hb_vector_t<unsigned>& costs, /* OUT */ hb_vector_t<int>& chain /* OUT */) @@ -333,7 +333,7 @@ static bool _iup_contour_optimize (const hb_array_t<const contour_point_t> conto const hb_array_t<const int> x_deltas, const hb_array_t<const int> y_deltas, hb_array_t<bool> opt_indices, /* OUT */ - float tolerance = 0.f) + double tolerance = 0.0) { unsigned n = contour_points.length; if (opt_indices.length != n || @@ -346,7 +346,7 @@ static bool _iup_contour_optimize (const hb_array_t<const contour_point_t> conto { int dx = x_deltas.arrayZ[i]; int dy = y_deltas.arrayZ[i]; - if (sqrtf ((float)dx * dx + (float)dy * dy) > tolerance) + if (sqrt ((double) dx * dx + (double) dy * dy) > tolerance) { all_within_tolerance = false; break; @@ -443,11 +443,11 @@ static bool _iup_contour_optimize (const hb_array_t<const contour_point_t> conto unsigned contour_point_size = hb_static_size (contour_point_t); for (unsigned i = 0; i < n; i++) { - hb_memcpy ((void *) repeat_x_deltas.arrayZ, (const void *) x_deltas.arrayZ, n * sizeof (float)); - hb_memcpy ((void *) (repeat_x_deltas.arrayZ + n), (const void *) x_deltas.arrayZ, n * sizeof (float)); + hb_memcpy ((void *) repeat_x_deltas.arrayZ, (const void *) x_deltas.arrayZ, n * sizeof (repeat_x_deltas[0])); + hb_memcpy ((void *) (repeat_x_deltas.arrayZ + n), (const void *) x_deltas.arrayZ, n * sizeof (repeat_x_deltas[0])); - hb_memcpy ((void *) repeat_y_deltas.arrayZ, (const void *) y_deltas.arrayZ, n * sizeof (float)); - hb_memcpy ((void *) (repeat_y_deltas.arrayZ + n), (const void *) y_deltas.arrayZ, n * sizeof (float)); + hb_memcpy ((void *) repeat_y_deltas.arrayZ, (const void *) y_deltas.arrayZ, n * sizeof (repeat_x_deltas[0])); + hb_memcpy ((void *) (repeat_y_deltas.arrayZ + n), (const void *) y_deltas.arrayZ, n * sizeof (repeat_x_deltas[0])); hb_memcpy ((void *) repeat_points.arrayZ, (const void *) contour_points.arrayZ, n * contour_point_size); hb_memcpy ((void *) (repeat_points.arrayZ + n), (const void *) contour_points.arrayZ, n * contour_point_size); @@ -496,7 +496,7 @@ bool iup_delta_optimize (const contour_point_vector_t& contour_points, const hb_vector_t<int>& x_deltas, const hb_vector_t<int>& y_deltas, hb_vector_t<bool>& opt_indices, /* OUT */ - float tolerance) + double tolerance) { if (!opt_indices.resize (contour_points.length)) return false; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.hh index 7eac5935a46..01987bd258d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-iup.hh @@ -32,6 +32,6 @@ HB_INTERNAL bool iup_delta_optimize (const contour_point_vector_t& contour_point const hb_vector_t<int>& x_deltas, const hb_vector_t<int>& y_deltas, hb_vector_t<bool>& opt_indices, /* OUT */ - float tolerance = 0.f); + double tolerance = 0.0); #endif /* HB_SUBSET_INSTANCER_IUP_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.cc index 70783c0a0d8..ca903e2707e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.cc @@ -32,17 +32,17 @@ * This should be safe. */ -constexpr static float EPSILON = 1.f / (1 << 14); -constexpr static float MAX_F2DOT14 = float (0x7FFF) / (1 << 14); +constexpr static double EPSILON = 1.0 / (1 << 14); +constexpr static double MAX_F2DOT14 = double (0x7FFF) / (1 << 14); static inline Triple _reverse_negate(const Triple &v) { return {-v.maximum, -v.middle, -v.minimum}; } -static inline float supportScalar (float coord, const Triple &tent) +static inline double supportScalar (double coord, const Triple &tent) { /* Copied from VarRegionAxis::evaluate() */ - float start = tent.minimum, peak = tent.middle, end = tent.maximum; + double start = tent.minimum, peak = tent.middle, end = tent.maximum; if (unlikely (start > peak || peak > end)) return 1.; @@ -62,20 +62,20 @@ static inline float supportScalar (float coord, const Triple &tent) return (end - coord) / (end - peak); } -static inline result_t +static inline rebase_tent_result_t _solve (Triple tent, Triple axisLimit, bool negative = false) { - float axisMin = axisLimit.minimum; - float axisDef = axisLimit.middle; - float axisMax = axisLimit.maximum; - float lower = tent.minimum; - float peak = tent.middle; - float upper = tent.maximum; + double axisMin = axisLimit.minimum; + double axisDef = axisLimit.middle; + double axisMax = axisLimit.maximum; + double lower = tent.minimum; + double peak = tent.middle; + double upper = tent.maximum; // Mirror the problem such that axisDef <= peak if (axisDef > peak) { - result_t vec = _solve (_reverse_negate (tent), + rebase_tent_result_t vec = _solve (_reverse_negate (tent), _reverse_negate (axisLimit), !negative); @@ -98,7 +98,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) * axisMin axisDef axisMax lower upper */ if (axisMax <= lower && axisMax < peak) - return result_t{}; // No overlap + return rebase_tent_result_t{}; // No overlap /* case 2: Only the peak and outermost bound fall outside the new limit; * we keep the deltaset, update peak and outermost bound and scale deltas @@ -130,10 +130,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) */ if (axisMax < peak) { - float mult = supportScalar (axisMax, tent); + double mult = supportScalar (axisMax, tent); tent = Triple{lower, axisMax, axisMax}; - result_t vec = _solve (tent, axisLimit); + rebase_tent_result_t vec = _solve (tent, axisLimit); for (auto &p : vec) p = hb_pair (p.first * mult, p.second); @@ -143,13 +143,13 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) // lower <= axisDef <= peak <= axisMax - float gain = supportScalar (axisDef, tent); - result_t out {hb_pair (gain, Triple{})}; + double gain = supportScalar (axisDef, tent); + rebase_tent_result_t out {hb_pair (gain, Triple{})}; // First, the positive side // outGain is the scalar of axisMax at the tent. - float outGain = supportScalar (axisMax, tent); + double outGain = supportScalar (axisMax, tent); /* Case 3a: Gain is more than outGain. The tent down-slope crosses * the axis into negative. We have to split it into multiples. @@ -173,10 +173,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) // Note that this is the branch taken if both gain and outGain are 0. // Crossing point on the axis. - float crossing = peak + (1 - gain) * (upper - peak); + double crossing = peak + (1 - gain) * (upper - peak); Triple loc{hb_max (lower, axisDef), peak, crossing}; - float scalar = 1.f; + double scalar = 1.0; // The part before the crossing point. out.push (hb_pair (scalar - gain, loc)); @@ -191,7 +191,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) if (upper >= axisMax) { Triple loc {crossing, axisMax, axisMax}; - float scalar = outGain; + double scalar = outGain; out.push (hb_pair (scalar - gain, loc)); } @@ -221,11 +221,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) // Downslope. Triple loc1 {crossing, upper, axisMax}; - float scalar1 = 0.f; + double scalar1 = 0.0; // Eternity justify. Triple loc2 {upper, axisMax, axisMax}; - float scalar2 = 0.f; + double scalar2 = 0.0; out.push (hb_pair (scalar1 - gain, loc1)); out.push (hb_pair (scalar2 - gain, loc2)); @@ -254,11 +254,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) * | | newUpper * axisDef axisMax */ - float newUpper = peak + (1 - gain) * (upper - peak); + double newUpper = peak + (1 - gain) * (upper - peak); assert (axisMax <= newUpper); // Because outGain > gain /* Disabled because ots doesn't like us: * https://github.com/fonttools/fonttools/issues/3350 */ - + if (false && (newUpper <= axisDef + (axisMax - axisDef) * 2)) { upper = newUpper; @@ -270,7 +270,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) } Triple loc {hb_max (axisDef, lower), peak, upper}; - float scalar = 1.f; + double scalar = 1.0; out.push (hb_pair (scalar - gain, loc)); } @@ -294,10 +294,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) else { Triple loc1 {hb_max (axisDef, lower), peak, axisMax}; - float scalar1 = 1.f; + double scalar1 = 1.0; Triple loc2 {peak, axisMax, axisMax}; - float scalar2 = outGain; + double scalar2 = outGain; out.push (hb_pair (scalar1 - gain, loc1)); // Don't add a dirac delta! @@ -325,7 +325,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) if (lower <= axisMin) { Triple loc {axisMin, axisMin, axisDef}; - float scalar = supportScalar (axisMin, tent); + double scalar = supportScalar (axisMin, tent); out.push (hb_pair (scalar - gain, loc)); } @@ -353,11 +353,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) // Downslope. Triple loc1 {axisMin, lower, axisDef}; - float scalar1 = 0.f; + double scalar1 = 0.0; // Eternity justify. Triple loc2 {axisMin, axisMin, lower}; - float scalar2 = 0.f; + double scalar2 = 0.0; out.push (hb_pair (scalar1 - gain, loc1)); out.push (hb_pair (scalar2 - gain, loc2)); @@ -369,19 +369,19 @@ _solve (Triple tent, Triple axisLimit, bool negative = false) static inline TripleDistances _reverse_triple_distances (const TripleDistances &v) { return TripleDistances (v.positive, v.negative); } -float renormalizeValue (float v, const Triple &triple, - const TripleDistances &triple_distances, bool extrapolate) +double renormalizeValue (double v, const Triple &triple, + const TripleDistances &triple_distances, bool extrapolate) { - float lower = triple.minimum, def = triple.middle, upper = triple.maximum; + double lower = triple.minimum, def = triple.middle, upper = triple.maximum; assert (lower <= def && def <= upper); if (!extrapolate) v = hb_max (hb_min (v, upper), lower); if (v == def) - return 0.f; + return 0.0; - if (def < 0.f) + if (def < 0.0) return -renormalizeValue (-v, _reverse_negate (triple), _reverse_triple_distances (triple_distances), extrapolate); @@ -390,14 +390,14 @@ float renormalizeValue (float v, const Triple &triple, return (v - def) / (upper - def); /* v < def */ - if (lower >= 0.f) + if (lower >= 0.0) return (v - def) / (def - lower); /* lower < 0 and v < default */ - float total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def; + double total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def; - float v_distance; - if (v >= 0.f) + double v_distance; + if (v >= 0.0) v_distance = (def - v) * triple_distances.positive; else v_distance = (-v) * triple_distances.negative + triple_distances.positive * def; @@ -405,18 +405,18 @@ float renormalizeValue (float v, const Triple &triple, return (-v_distance) /total_distance; } -result_t +rebase_tent_result_t rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances) { - assert (-1.f <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.f); - assert (-2.f <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.f); - assert (tent.middle != 0.f); + assert (-1.0 <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.0); + assert (-2.0 <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.0); + assert (tent.middle != 0.0); - result_t sols = _solve (tent, axisLimit); + rebase_tent_result_t sols = _solve (tent, axisLimit); - auto n = [&axisLimit, &axis_triple_distances] (float v) { return renormalizeValue (v, axisLimit, axis_triple_distances); }; + auto n = [&axisLimit, &axis_triple_distances] (double v) { return renormalizeValue (v, axisLimit, axis_triple_distances); }; - result_t out; + rebase_tent_result_t out; for (auto &p : sols) { if (!p.first) continue; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.hh index 563fccbb595..9aac9fcc7ea 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-instancer-solver.hh @@ -30,24 +30,24 @@ /* pre-normalized distances */ struct TripleDistances { - TripleDistances (): negative (1.f), positive (1.f) {} - TripleDistances (float neg_, float pos_): negative (neg_), positive (pos_) {} - TripleDistances (float min, float default_, float max) + TripleDistances (): negative (1.0), positive (1.0) {} + TripleDistances (double neg_, double pos_): negative (neg_), positive (pos_) {} + TripleDistances (double min, double default_, double max) { negative = default_ - min; positive = max - default_; } - float negative; - float positive; + double negative; + double positive; }; struct Triple { Triple () : - minimum (0.f), middle (0.f), maximum (0.f) {} + minimum (0.0), middle (0.0), maximum (0.0) {} - Triple (float minimum_, float middle_, float maximum_) : + Triple (double minimum_, double middle_, double maximum_) : minimum (minimum_), middle (middle_), maximum (maximum_) {} bool operator == (const Triple &o) const @@ -63,7 +63,7 @@ struct Triple { bool is_point () const { return minimum == middle && middle == maximum; } - bool contains (float point) const + bool contains (double point) const { return minimum <= point && point <= maximum; } /* from hb_array_t hash ()*/ @@ -82,18 +82,18 @@ struct Triple { } - float minimum; - float middle; - float maximum; + double minimum; + double middle; + double maximum; }; -using result_item_t = hb_pair_t<float, Triple>; -using result_t = hb_vector_t<result_item_t>; +using rebase_tent_result_item_t = hb_pair_t<double, Triple>; +using rebase_tent_result_t = hb_vector_t<rebase_tent_result_item_t>; /* renormalize a normalized value v to the range of an axis, * considering the prenormalized distances as well as the new axis limits. * Ported from fonttools */ -HB_INTERNAL float renormalizeValue (float v, const Triple &triple, +HB_INTERNAL double renormalizeValue (double v, const Triple &triple, const TripleDistances &triple_distances, bool extrapolate = true); /* Given a tuple (lower,peak,upper) "tent" and new axis limits @@ -107,6 +107,8 @@ HB_INTERNAL float renormalizeValue (float v, const Triple &triple, * If tent value is Triple{}, that is a special deltaset that should * be always-enabled (called "gain"). */ -HB_INTERNAL result_t rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances); +HB_INTERNAL rebase_tent_result_t rebase_tent (Triple tent, + Triple axisLimit, + TripleDistances axis_triple_distances); #endif /* HB_SUBSET_INSTANCER_SOLVER_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan-member-list.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan-member-list.hh index 74416b92f98..ade8278c40f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan-member-list.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan-member-list.hh @@ -102,6 +102,12 @@ HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(<unsigned, hb_pair_t E(<const void*, const //active layers/palettes we'd like to retain HB_SUBSET_PLAN_MEMBER (hb_map_t, colrv1_layers) HB_SUBSET_PLAN_MEMBER (hb_map_t, colr_palettes) +//colrv1 varstore retained varidx mapping +HB_SUBSET_PLAN_MEMBER (hb_vector_t<hb_inc_bimap_t>, colrv1_varstore_inner_maps) +//colrv1 retained varidx -> (new varidx, delta) mapping +HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), colrv1_variation_idx_delta_map) +//colrv1 retained new delta set index -> new varidx mapping +HB_SUBSET_PLAN_MEMBER (hb_map_t, colrv1_new_deltaset_idx_varidx_map) //Old layout item variation index -> (New varidx, delta) mapping HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), layout_variation_idx_delta_map) @@ -144,7 +150,7 @@ HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<hb_codepoint_t, contour_point_vec HB_SUBSET_PLAN_MEMBER (hb_set_t, composite_new_gids) //Old BASE item variation index -> (New varidx, 0) mapping -HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), base_variation_idx_map) +HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<unsigned, hb_pair_t E(<unsigned, int>)>), base_variation_idx_map) //BASE table varstore retained varidx mapping HB_SUBSET_PLAN_MEMBER (hb_vector_t<hb_inc_bimap_t>, base_varstore_inner_maps) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc index 068fddaeddd..d657790d54b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc @@ -399,12 +399,55 @@ _get_hb_font_with_variations (const hb_subset_plan_t *plan) } static inline void +_remap_variation_indices (const OT::ItemVariationStore &var_store, + const hb_set_t &variation_indices, + const hb_vector_t<int>& normalized_coords, + bool calculate_delta, /* not pinned at default */ + bool no_variations, /* all axes pinned */ + hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> &variation_idx_delta_map /* OUT */) +{ + if (&var_store == &Null (OT::ItemVariationStore)) return; + unsigned subtable_count = var_store.get_sub_table_count (); + float *store_cache = var_store.create_cache (); + + unsigned new_major = 0, new_minor = 0; + unsigned last_major = (variation_indices.get_min ()) >> 16; + for (unsigned idx : variation_indices) + { + int delta = 0; + if (calculate_delta) + delta = roundf (var_store.get_delta (idx, normalized_coords.arrayZ, + normalized_coords.length, store_cache)); + + if (no_variations) + { + variation_idx_delta_map.set (idx, hb_pair_t<unsigned, int> (HB_OT_LAYOUT_NO_VARIATIONS_INDEX, delta)); + continue; + } + + uint16_t major = idx >> 16; + if (major >= subtable_count) break; + if (major != last_major) + { + new_minor = 0; + ++new_major; + } + + unsigned new_idx = (new_major << 16) + new_minor; + variation_idx_delta_map.set (idx, hb_pair_t<unsigned, int> (new_idx, delta)); + ++new_minor; + last_major = major; + } + var_store.destroy_cache (store_cache); +} + +static inline void _collect_layout_variation_indices (hb_subset_plan_t* plan) { hb_blob_ptr_t<OT::GDEF> gdef = plan->source_table<OT::GDEF> (); hb_blob_ptr_t<GPOS> gpos = plan->source_table<GPOS> (); - if (!gdef->has_data ()) + if (!gdef->has_data () || !gdef->has_var_store ()) { gdef.destroy (); gpos.destroy (); @@ -420,13 +463,13 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan) if (hb_ot_layout_has_positioning (plan->source)) gpos->collect_variation_indices (&c); - gdef->remap_layout_variation_indices (&varidx_set, - plan->normalized_coords, - !plan->pinned_at_default, - plan->all_axes_pinned, - &plan->layout_variation_idx_delta_map); + _remap_variation_indices (gdef->get_var_store (), + varidx_set, plan->normalized_coords, + !plan->pinned_at_default, + plan->all_axes_pinned, + plan->layout_variation_idx_delta_map); - unsigned subtable_count = gdef->has_var_store () ? gdef->get_var_store ().get_sub_table_count () : 0; + unsigned subtable_count = gdef->get_var_store ().get_sub_table_count (); _generate_varstore_inner_maps (varidx_set, subtable_count, plan->gdef_varstore_inner_maps); gdef.destroy (); @@ -434,31 +477,6 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan) } #ifndef HB_NO_BASE -/* used by BASE table only, delta is always set to 0 in the output map */ -static inline void -_remap_variation_indices (const hb_set_t& indices, - unsigned subtable_count, - hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>>& variation_idx_delta_map /* OUT */) -{ - unsigned new_major = 0, new_minor = 0; - unsigned last_major = (indices.get_min ()) >> 16; - for (unsigned idx : indices) - { - uint16_t major = idx >> 16; - if (major >= subtable_count) break; - if (major != last_major) - { - new_minor = 0; - ++new_major; - } - - unsigned new_idx = (new_major << 16) + new_minor; - variation_idx_delta_map.set (idx, hb_pair_t<unsigned, int> (new_idx, 0)); - ++new_minor; - last_major = major; - } -} - static inline void _collect_base_variation_indices (hb_subset_plan_t* plan) { @@ -471,12 +489,20 @@ _collect_base_variation_indices (hb_subset_plan_t* plan) hb_set_t varidx_set; base->collect_variation_indices (plan, varidx_set); - unsigned subtable_count = base->get_var_store ().get_sub_table_count (); - base.destroy (); - - _remap_variation_indices (varidx_set, subtable_count, plan->base_variation_idx_map); + const OT::ItemVariationStore &var_store = base->get_var_store (); + unsigned subtable_count = var_store.get_sub_table_count (); + + + _remap_variation_indices (var_store, varidx_set, + plan->normalized_coords, + !plan->pinned_at_default, + plan->all_axes_pinned, + plan->base_variation_idx_map); _generate_varstore_inner_maps (varidx_set, subtable_count, plan->base_varstore_inner_maps); + + base.destroy (); } + #endif #endif @@ -489,12 +515,43 @@ _cmap_closure (hb_face_t *face, cmap.table->closure_glyphs (unicodes, glyphset); } -static void _colr_closure (hb_face_t *face, - hb_map_t *layers_map, - hb_map_t *palettes_map, +static void +_remap_colrv1_delta_set_index_indices (const OT::DeltaSetIndexMap &index_map, + const hb_set_t &delta_set_idxes, + hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> &variation_idx_delta_map, /* IN/OUT */ + hb_map_t &new_deltaset_idx_varidx_map /* OUT */) +{ + if (!index_map.get_map_count ()) + return; + + hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> delta_set_idx_delta_map; + unsigned new_delta_set_idx = 0; + for (unsigned delta_set_idx : delta_set_idxes) + { + unsigned var_idx = index_map.map (delta_set_idx); + unsigned new_varidx = HB_OT_LAYOUT_NO_VARIATIONS_INDEX; + int delta = 0; + + if (var_idx != HB_OT_LAYOUT_NO_VARIATIONS_INDEX) + { + hb_pair_t<unsigned, int> *new_varidx_delta; + if (!variation_idx_delta_map.has (var_idx, &new_varidx_delta)) continue; + + new_varidx = hb_first (*new_varidx_delta); + delta = hb_second (*new_varidx_delta); + } + + new_deltaset_idx_varidx_map.set (new_delta_set_idx, new_varidx); + delta_set_idx_delta_map.set (delta_set_idx, hb_pair_t<unsigned, int> (new_delta_set_idx, delta)); + new_delta_set_idx++; + } + variation_idx_delta_map = std::move (delta_set_idx_delta_map); +} + +static void _colr_closure (hb_subset_plan_t* plan, hb_set_t *glyphs_colred) { - OT::COLR::accelerator_t colr (face); + OT::COLR::accelerator_t colr (plan->source); if (!colr.is_valid ()) return; hb_set_t palette_indices, layer_indices; @@ -506,11 +563,43 @@ static void _colr_closure (hb_face_t *face, glyphs_colred->union_ (glyphset_colrv0); //closure for COLRv1 - colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices); + hb_set_t variation_indices, delta_set_indices; + colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices, &variation_indices, &delta_set_indices); colr.closure_V0palette_indices (glyphs_colred, &palette_indices); - _remap_indexes (&layer_indices, layers_map); - _remap_palette_indexes (&palette_indices, palettes_map); + _remap_indexes (&layer_indices, &plan->colrv1_layers); + _remap_palette_indexes (&palette_indices, &plan->colr_palettes); + + if (!colr.has_var_store () || !variation_indices) return; + + const OT::ItemVariationStore &var_store = colr.get_var_store (); + // generated inner_maps is used by ItemVariationStore serialize(), which is subset only + unsigned subtable_count = var_store.get_sub_table_count (); + _generate_varstore_inner_maps (variation_indices, subtable_count, plan->colrv1_varstore_inner_maps); + + /* colr variation indices mapping during planning phase: + * generate colrv1_variation_idx_delta_map. When delta set index map is not + * included, it's a mapping from varIdx-> (new varIdx,delta). Otherwise, it's + * a mapping from old delta set idx-> (new delta set idx, delta). Mapping + * delta set indices is the same as gid mapping. + * Besides, we need to generate a delta set idx-> new var_idx map for updating + * delta set index map if exists. This map will be updated again after + * instancing. */ + if (!plan->all_axes_pinned) + { + _remap_variation_indices (var_store, + variation_indices, + plan->normalized_coords, + false, /* no need to calculate delta for COLR during planning */ + plan->all_axes_pinned, + plan->colrv1_variation_idx_delta_map); + + if (colr.has_delta_set_index_map ()) + _remap_colrv1_delta_set_index_indices (colr.get_delta_set_index_map (), + delta_set_indices, + plan->colrv1_variation_idx_delta_map, + plan->colrv1_new_deltaset_idx_varidx_map); + } } static inline void @@ -821,7 +910,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, hb_set_t cur_glyphset = plan->_glyphset_mathed; if (!drop_tables->has (HB_OT_TAG_COLR)) { - _colr_closure (plan->source, &plan->colrv1_layers, &plan->colr_palettes, &cur_glyphset); + _colr_closure (plan, &cur_glyphset); _remove_invalid_gids (&cur_glyphset, plan->source->get_num_glyphs ()); } @@ -1016,9 +1105,9 @@ _normalize_axes_location (hb_face_t *face, hb_subset_plan_t *plan) normalized_default = seg_maps->map (normalized_default); normalized_max = seg_maps->map (normalized_max); } - plan->axes_location.set (axis_tag, Triple (static_cast<float> (normalized_min / 16384.f), - static_cast<float> (normalized_default / 16384.f), - static_cast<float> (normalized_max / 16384.f))); + plan->axes_location.set (axis_tag, Triple (static_cast<double> (normalized_min / 16384.0), + static_cast<double> (normalized_default / 16384.0), + static_cast<double> (normalized_max / 16384.0))); if (normalized_default != 0) plan->pinned_at_default = false; @@ -1145,11 +1234,9 @@ _get_instance_glyphs_contour_points (hb_subset_plan_t *plan) if (unlikely (!plan->new_gid_contour_points_map.set (new_gid, all_points))) return false; -#ifdef HB_EXPERIMENTAL_API /* composite new gids are only needed by iup delta optimization */ if ((plan->flags & HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS) && glyph.is_composite ()) plan->composite_new_gids.add (new_gid); -#endif } return true; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h index 73dcae4660b..365c21a6308 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h @@ -73,11 +73,11 @@ typedef struct hb_subset_plan_t hb_subset_plan_t; * OS/2 will not be recalculated. * @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout * substitution rules (GSUB). Since: 7.2.0. + * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the + * remaining gvar table's deltas. Since: 8.5.0 * @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset * to allow it to be used with incremental font transfer IFTB patches. Primarily, * this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL - * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the - * remaining gvar table's deltas. Since: EXPERIMENTAL * * List of boolean properties that can be configured on the subset input. * @@ -95,9 +95,9 @@ typedef enum { /*< flags >*/ HB_SUBSET_FLAGS_GLYPH_NAMES = 0x00000080u, HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x00000100u, HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE = 0x00000200u, + HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x00000400u, #ifdef HB_EXPERIMENTAL_API - HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00000400u, - HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x00000800u, + HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00000800u, #endif } hb_subset_flags_t; @@ -188,7 +188,6 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input, hb_tag_t axis_tag, float axis_value); -#ifdef HB_EXPERIMENTAL_API HB_EXTERN hb_bool_t hb_subset_input_get_axis_range (hb_subset_input_t *input, hb_tag_t axis_tag, @@ -204,6 +203,7 @@ hb_subset_input_set_axis_range (hb_subset_input_t *input, float axis_max_value, float axis_def_value); +#ifdef HB_EXPERIMENTAL_API HB_EXTERN hb_bool_t hb_subset_input_override_name_table (hb_subset_input_t *input, hb_ot_name_id_t name_id, @@ -212,7 +212,6 @@ hb_subset_input_override_name_table (hb_subset_input_t *input, unsigned language_id, const char *name_str, int str_len); - #endif HB_EXTERN hb_face_t * diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-wasm-api.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-wasm-api.h index f9bd98e5ea0..bb977eeb131 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-wasm-api.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-wasm-api.h @@ -27,6 +27,9 @@ /* #include "hb.h" + +HB_BEGIN_DECLS +HB_END_DECLS */ #include <stdint.h> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build index daa9198058c..8e4cea6ac5d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build @@ -712,6 +712,7 @@ if get_option('tests').enabled() 'test-algs': ['test-algs.cc', 'hb-static.cc'], 'test-array': ['test-array.cc'], 'test-bimap': ['test-bimap.cc', 'hb-static.cc'], + 'test-cff': ['test-cff.cc', 'hb-static.cc'], 'test-classdef-graph': ['graph/test-classdef-graph.cc', 'hb-static.cc', 'graph/gsubgpos-context.cc'], 'test-iter': ['test-iter.cc', 'hb-static.cc'], 'test-machinery': ['test-machinery.cc', 'hb-static.cc'], diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-cff.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-cff.cc new file mode 100644 index 00000000000..38ddba3c496 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-cff.cc @@ -0,0 +1,75 @@ +/* + * Copyright © 2024 David Corbett + * + * 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 "hb.hh" +#include "hb-ot-cff-common.hh" +#include "hb-subset-cff-common.hh" + +int +main (int argc, char **argv) +{ + /* Test encode_num_tp */ + { + CFF::str_buff_t buff; + CFF::str_encoder_t encoder (buff); + CFF::number_t number; + struct num_tp_test { + double input; + unsigned length; + unsigned char output[7]; + }; + struct num_tp_test num_tp_tests[] = { + { -9.399999999999999, 4, { 0x1E, 0xE9, 0xA4, 0xFF } }, // -9.4 + { 9.399999999999999999, 3, { 0x1E, 0x9A, 0x4F } }, // 9.4 + { 456.8, 4, { 0x1E, 0x45, 0x6A, 0x8F } }, // 456.8 + { 98765.37e2, 5, { 0x1E, 0x98, 0x76, 0x53, 0x7F } }, // 9876537 + { 1234567890.0, 7, { 0x1E, 0x12, 0x34, 0x56, 0x79, 0xB2, 0xFF } }, // 12345679E2 + { 9.876537e-4, 7, { 0x1E, 0x98, 0x76, 0x53, 0x7C, 0x10, 0xFF } }, // 9876537E-10 + { 9.876537e4, 6, { 0x1E, 0x98, 0x76, 0x5A, 0x37, 0xFF } }, // 98765.37 + { 1e8, 3, { 0x1E, 0x1B, 0x8F } }, // 1E8 + { 1e-5, 3, { 0x1E, 0x1C, 0x5F } }, // 1E-5 + { 1.2e8, 4, { 0x1E, 0x12, 0xB7, 0xFF } }, // 12E7 + { 1.2345e-5, 5, { 0x1E, 0x12, 0x34, 0x5C, 0x9F } }, // 12345E-9 + { 9.0987654e8, 6, { 0x1E, 0x90, 0x98, 0x76, 0x54, 0x0F } }, // 909876540 + { 0.1, 3, { 0x1E, 0xA1, 0xFF } }, // .1 + { -0.1, 3, { 0x1E, 0xEA, 0x1F } }, // -.1 + { 0.01, 3, { 0x1E, 0x1C, 0x2F } }, // 1E-2 + { -0.01, 4, { 0x1E, 0xE1, 0xC2, 0xFF } }, // -1E-2 + { 0.0123, 4, { 0x1E, 0x12, 0x3C, 0x4F } }, // 123E-4 + { -0.0123, 5, { 0x1E, 0xE1, 0x23, 0xC4, 0xFF } }, // -123E-4 + }; + for (size_t t = 0; t < sizeof num_tp_tests / sizeof num_tp_tests[0]; t++) + { + struct num_tp_test num_tp_test = num_tp_tests[t]; + number.set_real (num_tp_test.input); + encoder.encode_num_tp (number); + assert (buff.length == num_tp_test.length); + for (unsigned i = 0; i < buff.length; i++) + assert (buff[i] == num_tp_test.output[i]); + encoder.reset (); + } + } + + return 0; +} diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-item-varstore.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-item-varstore.cc index 99656b8d0ef..bf0a10043c3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-item-varstore.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-item-varstore.cc @@ -47,10 +47,10 @@ test_item_variations () /* partial instancing wght=300:800 */ hb_hashmap_t<hb_tag_t, Triple> normalized_axes_location; - normalized_axes_location.set (axis_tag, Triple (-0.512817f, 0.f, 0.700012f)); + normalized_axes_location.set (axis_tag, Triple (-0.512817, 0.0, 0.7000120)); hb_hashmap_t<hb_tag_t, TripleDistances> axes_triple_distances; - axes_triple_distances.set (axis_tag, TripleDistances (200.f, 500.f)); + axes_triple_distances.set (axis_tag, TripleDistances (200.0, 500.0)); result = item_vars.instantiate_tuple_vars (normalized_axes_location, axes_triple_distances); assert (result); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-subset-instancer-solver.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-subset-instancer-solver.cc index c7cba3415e6..06b71bdc102 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-subset-instancer-solver.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-subset-instancer-solver.cc @@ -24,408 +24,408 @@ * Google Author(s): Qunxin Liu */ +#include <math.h> #include "hb-subset-instancer-solver.hh" static inline bool approx (Triple a, Triple b) { - return fabsf (a.minimum - b.minimum) < 0.000001f && - fabsf (a.middle - b.middle) < 0.000001f && - fabsf (a.maximum - b.maximum) < 0.000001f; + return abs (a.minimum - b.minimum) < 0.000001 && + abs (a.middle - b.middle) < 0.000001 && + abs (a.maximum - b.maximum) < 0.000001; } -static inline bool approx (float a, float b) -{ return fabsf (a - b) < 0.000001f; } +static inline bool approx (double a, double b) +{ return abs (a - b) < 0.000001; } /* tests ported from * https://github.com/fonttools/fonttools/blob/main/Tests/varLib/instancer/solver_test.py */ int main (int argc, char **argv) { - TripleDistances default_axis_distances{1.f, 1.f}; + TripleDistances default_axis_distances{1.0, 1.0}; /* Case 1 */ { /* pin axis*/ - Triple tent (0.f, 1.f, 1.f); - Triple axis_range (0.f, 0.f, 0.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 1.0, 1.0); + Triple axis_range (0.0, 0.0, 0.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 0); } { /* pin axis*/ - Triple tent (0.f, 1.f, 1.f); - Triple axis_range (0.5f, 0.5f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 1.0, 1.0); + Triple axis_range (0.5, 0.5, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 0.5f); + assert (out[0].first == 0.5); assert (out[0].second == Triple ()); } { /* tent falls outside the new axis range */ - Triple tent (0.3f, 0.5f, 0.8f); - Triple axis_range (0.1f, 0.2f, 0.3f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.3, 0.5, 0.8); + Triple axis_range (0.1, 0.2, 0.3); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 0); } /* Case 2 */ { - Triple tent (0.f, 1.f, 1.f); - Triple axis_range (-1.f, 0.f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 1.0, 1.0); + Triple axis_range (-1.0, 0.0, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 0.5f); - assert (out[0].second == Triple (0.f, 1.f, 1.f)); + assert (out[0].first == 0.5); + assert (out[0].second == Triple (0.0, 1.0, 1.0)); } /* Case 2 */ { - Triple tent (0.f, 1.f, 1.f); - Triple axis_range (-1.f, 0.f, 0.75f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 1.0, 1.0); + Triple axis_range (-1.0, 0.0, 0.75); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 0.75f); - assert (out[0].second == Triple (0.f, 1.f, 1.f)); + assert (out[0].first == 0.75); + assert (out[0].second == Triple (0.0, 1.0, 1.0)); } /* Without gain: */ /* Case 3 */ { - Triple tent (0.f, 0.2f, 1.f); - Triple axis_range (-1.f, 0.f, 0.8f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.2, 1.0); + Triple axis_range (-1.0, 0.0, 0.8); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (0.f, 0.25f, 1.f)); - assert (approx (out[1].first, 0.25f)); - assert (out[1].second == Triple (0.25f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (0.0, 0.25, 1.0)); + assert (approx (out[1].first, 0.250)); + assert (out[1].second == Triple (0.25, 1.0, 1.0)); } /* Case 3 boundary */ { - Triple tent (0.f, 0.4f, 1.f); - Triple axis_range (-1.f, 0.f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.4, 1.0); + Triple axis_range (-1.0, 0.0, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (0.f, 0.8f, 1.f)); - assert (approx (out[1].first, 2.5f/3)); - assert (out[1].second == Triple (0.8f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (0.0, 0.8, 1.0)); + assert (approx (out[1].first, 2.5/3)); + assert (out[1].second == Triple (0.8, 1.0, 1.0)); } /* Case 4 */ { - Triple tent (0.f, 0.25f, 1.f); - Triple axis_range (-1.f, 0.f, 0.4f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.25, 1.0); + Triple axis_range (-1.0, 0.0, 0.4); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (0.f, 0.625f, 1.f)); - assert (approx (out[1].first, 0.8f)); - assert (out[1].second == Triple (0.625f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (0.0, 0.625, 1.0)); + assert (approx (out[1].first, 0.80)); + assert (out[1].second == Triple (0.625, 1.0, 1.0)); } /* Case 4 */ { - Triple tent (0.25f, 0.3f, 1.05f); - Triple axis_range (0.f, 0.2f, 0.4f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.25, 0.3, 1.05); + Triple axis_range (0.0, 0.2, 0.4); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); - assert (approx (out[0].second, Triple (0.25f, 0.5f, 1.f))); - assert (approx (out[1].first, 2.6f/3)); - assert (approx (out[1].second, Triple (0.5f, 1.f, 1.f))); + assert (out[0].first == 1.0); + assert (approx (out[0].second, Triple (0.25, 0.5, 1.0))); + assert (approx (out[1].first, 2.6 / 3)); + assert (approx (out[1].second, Triple (0.5, 1.0, 1.0))); } /* Case 4 boundary */ { - Triple tent (0.25f, 0.5f, 1.f); - Triple axis_range (0.f, 0.25f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.25, 0.5, 1.0); + Triple axis_range (0.0, 0.25, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (0.f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (0.0, 1.0, 1.0)); } /* With gain */ /* Case 3a/1neg */ { - Triple tent (0.f, 0.5f, 1.f); - Triple axis_range (0.f, 0.5f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 1.0); + Triple axis_range (0.0, 0.5, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 3); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (out[1].first == -1.f); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); - assert (out[2].first == -1.f); - assert (out[2].second == Triple (-1.f, -1.f, 0.f)); + assert (out[1].first == -1.0); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); + assert (out[2].first == -1.0); + assert (out[2].second == Triple (-1.0, -1.0, 0.0)); } { - Triple tent (0.f, 0.5f, 1.f); - Triple axis_range (0.f, 0.5f, 0.75f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 1.0); + Triple axis_range (0.0, 0.5, 0.75); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 3); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (out[1].first == -0.5f); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); - assert (out[2].first == -1.f); - assert (out[2].second == Triple (-1.f, -1.f, 0.f)); + assert (out[1].first == -0.5); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); + assert (out[2].first == -1.0); + assert (out[2].second == Triple (-1.0, -1.0, 0.0)); } { - Triple tent (0.f, 0.5f, 1.f); - Triple axis_range (0.f, 0.25f, 0.8f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.50, 1.0); + Triple axis_range (0.0, 0.25, 0.8); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 4); - assert (out[0].first == 0.5f); + assert (out[0].first == 0.5); assert (out[0].second == Triple ()); - assert (out[1].first == 0.5f); - assert (approx (out[1].second, Triple (0.f, 0.454545f, 0.909091f))); - assert (approx (out[2].first, -0.1f)); - assert (approx (out[2].second, Triple (0.909091f, 1.f, 1.f))); - assert (out[3].first == -0.5f); - assert (out[3].second == Triple (-1.f, -1.f, 0.f)); + assert (out[1].first == 0.5); + assert (approx (out[1].second, Triple (0.0, 0.454545, 0.909091))); + assert (approx (out[2].first, -0.1)); + assert (approx (out[2].second, Triple (0.909091, 1.0, 1.0))); + assert (out[3].first == -0.5); + assert (out[3].second == Triple (-1.0, -1.0, 0.0)); } /* Case 3a/1neg */ { - Triple tent (0.f, 0.5f, 2.f); - Triple axis_range (0.2f, 0.5f, 0.8f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 2.0); + Triple axis_range (0.2, 0.5, 0.8); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 3); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (approx (out[1].first, -0.2f)); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); - assert (approx (out[2].first, -0.6f)); - assert (out[2].second == Triple (-1.f, -1.f, 0.f)); + assert (approx (out[1].first, -0.2)); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); + assert (approx (out[2].first, -0.6)); + assert (out[2].second == Triple (-1.0, -1.0, 0.0)); } /* Case 3a/1neg */ { - Triple tent (0.f, 0.5f, 2.f); - Triple axis_range (0.2f, 0.5f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 2.0); + Triple axis_range (0.2, 0.5, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 3); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (approx (out[1].first, -1.f/3)); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); - assert (approx (out[2].first, -0.6f)); - assert (out[2].second == Triple (-1.f, -1.f, 0.f)); + assert (approx (out[1].first, -1.0/3)); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); + assert (approx (out[2].first, -0.6)); + assert (out[2].second == Triple (-1.0, -1.0, 0.0)); } /* Case 3 */ { - Triple tent (0.f, 0.5f, 1.f); - Triple axis_range (0.25f, 0.25f, 0.75f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 1.0); + Triple axis_range (0.25, 0.25, 0.75); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 0.5f); + assert (out[0].first == 0.5); assert (out[0].second == Triple ()); - assert (out[1].first == 0.5f); - assert (out[1].second == Triple (0.f, 0.5f, 1.0f)); + assert (out[1].first == 0.5); + assert (out[1].second == Triple (0.0, 0.5, 1.0)); } /* Case 1neg */ { - Triple tent (0.f, 0.5f, 1.f); - Triple axis_range (0.f, 0.25f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 1.0); + Triple axis_range (0.0, 0.25, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 3); - assert (out[0].first == 0.5f); + assert (out[0].first == 0.5); assert (out[0].second == Triple ()); - assert (out[1].first == 0.5f); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); - assert (out[2].first == -0.5f); - assert (out[2].second == Triple (-1.f, -1.f, 0.f)); + assert (out[1].first == 0.5); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); + assert (out[2].first == -0.5); + assert (out[2].second == Triple (-1.0, -1.0, 0.0)); } /* Case 2neg */ { - Triple tent (0.05f, 0.55f, 1.f); - Triple axis_range (0.f, 0.25f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.05, 0.55, 1.0); + Triple axis_range (0.0, 0.25, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 4); - assert (approx (out[0].first, 0.4f)); + assert (approx (out[0].first, 0.4)); assert (out[0].second == Triple ()); - assert (approx (out[1].first, 0.5f)); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); - assert (approx (out[2].first, -0.4f)); - assert (out[2].second == Triple (-1.f, -0.8f, 0.f)); - assert (approx (out[3].first, -0.4f)); - assert (out[3].second == Triple (-1.f, -1.f, -0.8f)); + assert (approx (out[1].first, 0.5)); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); + assert (approx (out[2].first, -0.4)); + assert (out[2].second == Triple (-1.0, -0.8, 0.0)); + assert (approx (out[3].first, -0.4)); + assert (out[3].second == Triple (-1.0, -1.0, -0.8)); } /* Case 2neg, other side */ { - Triple tent (-1.f, -0.55f, -0.05f); - Triple axis_range (-0.5f, -0.25f, 0.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (-1.0, -0.55, -0.05); + Triple axis_range (-0.5, -0.25, 0.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 4); - assert (approx (out[0].first, 0.4f)); + assert (approx (out[0].first, 0.4)); assert (out[0].second == Triple ()); - assert (approx (out[1].first, 0.5f)); - assert (out[1].second == Triple (-1.f, -1.f, 0.f)); - assert (approx (out[2].first, -0.4f)); - assert (out[2].second == Triple (0.f, 0.8f, 1.f)); - assert (approx (out[3].first, -0.4f)); - assert (out[3].second == Triple (0.8f, 1.f, 1.f)); + assert (approx (out[1].first, 0.5)); + assert (out[1].second == Triple (-1.0, -1.0, 0.0)); + assert (approx (out[2].first, -0.4)); + assert (out[2].second == Triple (0.0, 0.8, 1.0)); + assert (approx (out[3].first, -0.4)); + assert (out[3].second == Triple (0.8, 1.0, 1.0)); } /* Misc corner cases */ { - Triple tent (0.5f, 0.5f, 0.5f); - Triple axis_range (0.5f, 0.5f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.5, 0.5, 0.5); + Triple axis_range (0.5, 0.5, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); } { - Triple tent (0.3f, 0.5f, 0.7f); - Triple axis_range (0.1f, 0.5f, 0.9f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.3, 0.5, 0.7); + Triple axis_range (0.1, 0.5, 0.9); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 5); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (out[1].first == -1.f); - assert (out[1].second == Triple (0.f, 0.5f, 1.f)); - assert (out[2].first == -1.f); - assert (out[2].second == Triple (0.5f, 1.f, 1.f)); - assert (out[3].first == -1.f); - assert (approx (out[3].second, Triple (-1.f, -0.5f, 0.f))); - assert (out[4].first == -1.f); - assert (approx (out[4].second, Triple (-1.f, -1.f, -0.5f))); + assert (out[1].first == -1.0); + assert (approx(out[1].second, Triple (0.0, 0.5, 1.0))); + assert (out[2].first == -1.0); + assert (approx(out[2].second, Triple (0.5, 1.0, 1.0))); + assert (out[3].first == -1.0); + assert (approx (out[3].second, Triple (-1.0, -0.5, 0.0))); + assert (out[4].first == -1.0); + assert (approx (out[4].second, Triple (-1.0, -1.0, -0.5))); } { - Triple tent (0.5f, 0.5f, 0.5f); - Triple axis_range (0.25f, 0.25f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.5, 0.5, 0.5); + Triple axis_range (0.25, 0.25, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (1.f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (1.0, 1.0, 1.0)); } { - Triple tent (0.5f, 0.5f, 0.5f); - Triple axis_range (0.25f, 0.35f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.5, 0.5, 0.5); + Triple axis_range (0.25, 0.35, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (1.f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (1.0, 1.0, 1.0)); } { - Triple tent (0.5f, 0.5f, 0.55f); - Triple axis_range (0.25f, 0.35f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.5, 0.5, 0.55); + Triple axis_range (0.25, 0.35, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (1.f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (1.0, 1.0, 1.0)); } { - Triple tent (0.5f, 0.5f, 1.f); - Triple axis_range (0.5f, 0.5f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.5, 0.5, 1.0); + Triple axis_range (0.5, 0.5, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (out[1].first == -1.f); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); + assert (out[1].first == -1.0); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); } { - Triple tent (0.25f, 0.5f, 1.f); - Triple axis_range (0.5f, 0.5f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.25, 0.5, 1.0); + Triple axis_range (0.5, 0.5, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (out[1].first == -1.f); - assert (out[1].second == Triple (0.f, 1.f, 1.f)); + assert (out[1].first == -1.0); + assert (out[1].second == Triple (0.0, 1.0, 1.0)); } { - Triple tent (0.f, 0.2f, 1.f); - Triple axis_range (0.f, 0.f, 0.5f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.2, 1.0); + Triple axis_range (0.0, 0.0, 0.5); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 2); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (0.f, 0.4f, 1.f)); - assert (out[1].first == 0.625f); - assert (out[1].second == Triple (0.4f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (0.0, 0.4, 1.0)); + assert (out[1].first == 0.625); + assert (out[1].second == Triple (0.4, 1.0, 1.0)); } { - Triple tent (0.f, 0.5f, 1.f); - Triple axis_range (-1.f, 0.25f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 0.5, 1.0); + Triple axis_range (-1.0, 0.25, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 5); - assert (out[0].first == 0.5f); + assert (out[0].first == 0.5); assert (out[0].second == Triple ()); - assert (out[1].first == 0.5f); - assert (out[1].second == Triple (0.f, 1.f/3, 2.f/3)); - assert (out[2].first == -0.5f); - assert (out[2].second == Triple (2.f/3, 1.f, 1.f)); - assert (out[3].first == -0.5f); - assert (out[3].second == Triple (-1.f, -0.2f, 0.f)); - assert (out[4].first == -0.5f); - assert (out[4].second == Triple (-1.f, -1.f, -0.2f)); + assert (out[1].first == 0.5); + assert (out[1].second == Triple (0.0, 1.0/3, 2.0/3)); + assert (out[2].first == -0.5); + assert (out[2].second == Triple (2.0/3, 1.0, 1.0)); + assert (out[3].first == -0.5); + assert (out[3].second == Triple (-1.0, -0.2, 0.0)); + assert (out[4].first == -0.5); + assert (out[4].second == Triple (-1.0, -1.0, -0.2)); } { - Triple tent (0.5f, 0.5f, 0.5f); - Triple axis_range (0.f, 0.5f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.5, 0.5, 0.5); + Triple axis_range (0.0, 0.5, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 5); - assert (out[0].first == 1.f); + assert (out[0].first == 1.0); assert (out[0].second == Triple ()); - assert (out[1].first == -1.f); - assert (out[1].second == Triple (0.f, 2/(float) (1 << 14), 1.f)); - assert (out[2].first == -1.f); - assert (out[2].second == Triple (2/(float) (1 << 14), 1.f, 1.f)); - assert (out[3].first == -1.f); - assert (out[3].second == Triple (-1.f, -2/(float) (1 << 14), 0.f)); - assert (out[4].first == -1.f); - assert (out[4].second == Triple (-1.f, -1.f, -2/(float) (1 << 14))); + assert (out[1].first == -1.0); + assert (out[1].second == Triple (0.0, 2/(double) (1 << 14), 1.0)); + assert (out[2].first == -1.0); + assert (out[2].second == Triple (2/(double) (1 << 14), 1.0, 1.0)); + assert (out[3].first == -1.0); + assert (out[3].second == Triple (-1.0, -2/(double) (1 << 14), 0.0)); + assert (out[4].first == -1.0); + assert (out[4].second == Triple (-1.0, -1.0, -2/(double) (1 << 14))); } { - Triple tent (0.f, 1.f, 1.f); - Triple axis_range (-1.f, -0.5f, 1.f); - result_t out = rebase_tent (tent, axis_range, default_axis_distances); + Triple tent (0.0, 1.0, 1.0); + Triple axis_range (-1.0, -0.5, 1.0); + rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (1.f/3, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (1.0/3, 1.0, 1.0)); } { - Triple tent (0.f, 1.f, 1.f); - Triple axis_range (-1.f, -0.5f, 1.f); - TripleDistances axis_distances{2.f, 1.f}; - result_t out = rebase_tent (tent, axis_range, axis_distances); + Triple tent (0.0, 1.0, 1.0); + Triple axis_range (-1.0, -0.5, 1.0); + TripleDistances axis_distances{2.0, 1.0}; + rebase_tent_result_t out = rebase_tent (tent, axis_range, axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (out[0].second == Triple (0.5f, 1.f, 1.f)); + assert (out[0].first == 1.0); + assert (out[0].second == Triple (0.5, 1.0, 1.0)); } { - Triple tent (0.6f, 0.7f, 0.8f); - Triple axis_range (-1.f, 0.2f, 1.f); - TripleDistances axis_distances{1.f, 1.f}; - result_t out = rebase_tent (tent, axis_range, axis_distances); + Triple tent (0.6, 0.7, 0.8); + Triple axis_range (-1.0, 0.2, 1.0); + TripleDistances axis_distances{1.0, 1.0}; + rebase_tent_result_t out = rebase_tent (tent, axis_range, axis_distances); assert (out.length == 1); - assert (out[0].first == 1.f); - assert (approx (out[0].second, Triple (0.5f, 0.625f, 0.75f))); + assert (out[0].first == 1.0); + assert (approx (out[0].second, Triple (0.5, 0.625, 0.75))); } } - diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-tuple-varstore.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-tuple-varstore.cc index 97fec25e7bb..16a43381b0a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-tuple-varstore.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-tuple-varstore.cc @@ -63,10 +63,10 @@ test_decompile_cvar () assert (tuple_variations.tuple_vars[i].indices.length == 65); assert (tuple_variations.tuple_vars[i].indices.length == tuple_variations.tuple_vars[i].deltas_x.length); } - assert (tuple_variations.tuple_vars[0].axis_tuples.get (axis_tag) == Triple (-1.f, -1.f, 0.f)); - assert (tuple_variations.tuple_vars[1].axis_tuples.get (axis_tag) == Triple (0.f, 1.f, 1.f)); - - hb_vector_t<float> deltas_1 {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, -1.f, 0.f, -3.f, 1.f, 0.f, -1.f, 0.f, -3.f, 1.f, 0.f, -37.f, -37.f, -26.f, -26.f, 0.f, 0.f, 0.f, -3.f, 0.f, 0.f, 0.f, 0.f, 0.f, -3.f, 0.f, 2.f, -29.f, -29.f, -20.f, -20.f, 0.f, 0.f, 0.f, 1.f, -29.f, -29.f, -20.f, -20.f, 0.f, 0.f, 0.f, 1.f}; + assert (tuple_variations.tuple_vars[0].axis_tuples.get (axis_tag) == Triple (-1.0, -1.0, 0.0)); + assert (tuple_variations.tuple_vars[1].axis_tuples.get (axis_tag) == Triple (0.0, 1.0, 1.0)); + + hb_vector_t<double> deltas_1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, -3.0, 1.0, 0.0, -1.0, 0.0, -3.0, 1.0, 0.0, -37.0, -37.0, -26.0, -26.0, 0.0, 0.0, 0.0, -3.0, 0.0, 0.0, 0.0, 0.0, 0.0, -3.0, 0.0, 2.0, -29.0, -29.0, -20.0, -20.0, 0.0, 0.0, 0.0, 1.0, -29.0, -29.0, -20.0, -20.0, 0.0, 0.0, 0.0, 1.0}; for (unsigned i = 0; i < 65; i++) { if (i < 23) @@ -78,7 +78,7 @@ test_decompile_cvar () } } - hb_vector_t<float> deltas_2 {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 5.f, -3.f, 0.f, 1.f, 0.f, 5.f, -3.f, 0.f, 97.f, 97.f, 68.f, 68.f, 0.f, 0.f, 0.f, 5.f, 0.f, 0.f, 1.f, -1.f, 1.f, 7.f, -1.f, -5.f, 73.f, 73.f, 53.f, 53.f, 0.f, 0.f, 0.f, -1.f, 73.f, 73.f, 53.f, 53.f, 0.f, 0.f, 0.f, -1.f}; + hb_vector_t<double> deltas_2 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 5.0, -3.0, 0.0, 1.0, 0.0, 5.0, -3.0, 0.0, 97.0, 97.0, 68.0, 68.0, 0.0, 0.0, 0.0, 5.0, 0.0, 0.0, 1.0, -1.0, 1.0, 7.0, -1.0, -5.0, 73.0, 73.0, 53.0, 53.0, 0.0, 0.0, 0.0, -1.0, 73.0, 73.0, 53.0, 53.0, 0.0, 0.0, 0.0, -1.0}; for (unsigned i = 0 ; i < 65; i++) { if (i < 23) @@ -92,10 +92,10 @@ test_decompile_cvar () /* partial instancing wght=300:800 */ hb_hashmap_t<hb_tag_t, Triple> normalized_axes_location; - normalized_axes_location.set (axis_tag, Triple (-0.512817f, 0.f, 0.700012f)); + normalized_axes_location.set (axis_tag, Triple (-0.512817, 0.0, 0.700012)); hb_hashmap_t<hb_tag_t, TripleDistances> axes_triple_distances; - axes_triple_distances.set (axis_tag, TripleDistances (1.f, 1.f)); + axes_triple_distances.set (axis_tag, TripleDistances (1.0, 1.0)); tuple_variations.instantiate (normalized_axes_location, axes_triple_distances); @@ -103,12 +103,12 @@ test_decompile_cvar () assert (tuple_variations.tuple_vars[1].indices.length == 65); assert (!tuple_variations.tuple_vars[0].deltas_y); assert (!tuple_variations.tuple_vars[1].deltas_y); - assert (tuple_variations.tuple_vars[0].axis_tuples.get (axis_tag) == Triple (-1.f, -1.f, 0.f)); - assert (tuple_variations.tuple_vars[1].axis_tuples.get (axis_tag) == Triple (0.f, 1.f, 1.f)); + assert (tuple_variations.tuple_vars[0].axis_tuples.get (axis_tag) == Triple (-1.0, -1.0, 0.0)); + assert (tuple_variations.tuple_vars[1].axis_tuples.get (axis_tag) == Triple (0.0, 1.0, 1.0)); - hb_vector_t<float> rounded_deltas_1 {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, -1, 0.f, -2, 1, 0.f, -1, 0.f, -2, 1, 0.f, -19, -19, -13, -13, 0.f, 0.f, 0.f, -2, 0.f, 0.f, 0.f, 0.f, 0.f, -2, 0.f, 1, -15, -15, -10.f, -10.f, 0.f, 0.f, 0.f, 1, -15, -15, -10.f, -10.f, 0.f, 0.f, 0.f, 1}; + hb_vector_t<double> rounded_deltas_1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1, 0.0, -2, 1, 0.0, -1, 0.0, -2, 1, 0.0, -19, -19, -13, -13, 0.0, 0.0, 0.0, -2, 0.0, 0.0, 0.0, 0.0, 0.0, -2, 0.0, 1, -15, -15, -10.0, -10.0, 0.0, 0.0, 0.0, 1, -15, -15, -10.0, -10.0, 0.0, 0.0, 0.0, 1}; - hb_vector_t<float> rounded_deltas_2 {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1, 0.f, 4, -2, 0.f, 1, 0.f, 4, -2, 0.f, 68, 68, 48, 48, 0.f, 0.f, 0.f, 4, 0.f, 0.f, 1, -1, 1, 5, -1, -4, 51, 51, 37, 37, 0.f, 0.f, 0.f, -1, 51, 51, 37, 37, 0.f, 0.f, 0.f, -1}; + hb_vector_t<double> rounded_deltas_2 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 4, -2, 0.0, 1, 0.0, 4, -2, 0.0, 68, 68, 48, 48, 0.0, 0.0, 0.0, 4, 0.0, 0.0, 1, -1, 1, 5, -1, -4, 51, 51, 37, 37, 0.0, 0.0, 0.0, -1, 51, 51, 37, 37, 0.0, 0.0, 0.0, -1}; for (unsigned i = 0; i < 65; i++) { diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index 9193d66817b..c7428d51bbf 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], [8.4.0]) +m4_define([harfbuzz_version], [8.5.0]) |