diff options
Diffstat (limited to 'Build/source')
26 files changed, 664 insertions, 132 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README index 7de72c76dfb..79525fffe90 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -25,8 +25,8 @@ graphite2 1.3.14 - checked 10apr20 http://sourceforge.net/projects/silgraphite/files/graphite2/ (requires C++11) -harfbuzz 7.0.0 - checked 12feb23 - https://github.com/harfbuzz/harfbuzz/releases/tag/7.0.0 +harfbuzz 7.0.1 - checked 21feb23 + https://github.com/harfbuzz/harfbuzz/releases/tag/7.0.1 icu 70.1 - checked 16jan22 https://github.com/unicode-org/icu/releases/ diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index 0465ed80e8f..c22536bc586 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2023-02-21 Akira Kakuto <kakuto@jcom.zaq.ne.jp> + + Import harfbuzz-7.0.1. + * version.ac: Adjusted. + 2023-02-12 Akira Kakuto <kakuto@jcom.zaq.ne.jp> Import harfbuzz-7.0.0. diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index 1a4f57d5a40..3a45c304827 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2023-02-21 Akira Kakuto <kakuto@jcom.zaq.ne.jp> + + Imported harfbuzz-7.0.1 source tree from: + https://github.com/harfbuzz/harfbuzz/releases/download/7.0.1/ + 2023-02-12 Akira Kakuto <kakuto@jcom.zaq.ne.jp> Imported harfbuzz-7.0.0 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index da8b19c516a..383772522f4 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-7.0.0/ tree as obtained from: - https://github.com/harfbuzz/harfbuzz/releases/download/7.0.0/ +Changes applied to the harfbuzz-7.0.1/ tree as obtained from: + https://github.com/harfbuzz/harfbuzz/releases/download/7.0.1/ Removed: COPYING diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index fa1a4a9c825..cc3ba6db2a7 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.71 for harfbuzz (TeX Live) 7.0.0. +# Generated by GNU Autoconf 2.71 for harfbuzz (TeX Live) 7.0.1. # # Report bugs to <tex-k@tug.org>. # @@ -611,8 +611,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='7.0.0' -PACKAGE_STRING='harfbuzz (TeX Live) 7.0.0' +PACKAGE_VERSION='7.0.1' +PACKAGE_STRING='harfbuzz (TeX Live) 7.0.1' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1346,7 +1346,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) 7.0.0 to adapt to many kinds of systems. +\`configure' configures harfbuzz (TeX Live) 7.0.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1418,7 +1418,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of harfbuzz (TeX Live) 7.0.0:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 7.0.1:";; esac cat <<\_ACEOF @@ -1523,7 +1523,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -harfbuzz (TeX Live) configure 7.0.0 +harfbuzz (TeX Live) configure 7.0.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2064,7 +2064,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 7.0.0, which was +It was created by harfbuzz (TeX Live) $as_me 7.0.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -4823,7 +4823,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='7.0.0' + VERSION='7.0.1' # Some tools Automake needs. @@ -5035,8 +5035,8 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags HB_VERSION_MAJOR=7 HB_VERSION_MINOR=0 -HB_VERSION_MICRO=0 -HB_VERSION=7.0.0 +HB_VERSION_MICRO=1 +HB_VERSION=7.0.1 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -8817,7 +8817,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 7.0.0, which was +This file was extended by harfbuzz (TeX Live) $as_me 7.0.1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8885,7 +8885,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 7.0.0 +harfbuzz (TeX Live) config.status 7.0.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 686291a3085..759594e33bb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,226 @@ +commit 1d1f93a612ed071b703abab7deb0951f46a12433 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Mon Feb 20 15:54:12 2023 +0200 + + 7.0.1 + + NEWS | 6 ++++++ + configure.ac | 2 +- + meson.build | 2 +- + src/hb-version.h | 4 ++-- + 4 files changed, 10 insertions(+), 4 deletions(-) + +commit 6db871eb3aab5d4e47397b58025e678380a6fb34 +Merge: 8c1b47d7e 5b50b0771 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 21:08:14 2023 -0700 + + Merge pull request #4126 from harfbuzz/cff2-instancer + + CFF2 instancer make ots-sanitize happy + +commit 5b50b07717a0adf353e866c1f5502f1c5b374d22 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 20:30:38 2023 -0700 + + [subset-cff] Make BCD writing locale-independent + + src/hb-common.cc | 26 -------------------------- + src/hb-subset-cff-common.hh | 10 ++++++++-- + src/hb.hh | 31 +++++++++++++++++++++++++++++++ + 3 files changed, 39 insertions(+), 28 deletions(-) + +commit 4a735b30c4e31489779a06722c66f8d820b9666d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 19:51:03 2023 -0700 + + [cff2-subset] Update test + + test/api/fonts/AdobeVFPrototype.abc.static.otf | Bin 86112 -> 2576 bytes + 1 file changed, 0 insertions(+), 0 deletions(-) + +commit 21ff66cbd4445899f37c6aa6827a2d349292119b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 20:00:39 2023 -0700 + + [subset-cff2] Round blended Private values when instancing + + Hopefully no one blends BlueScale... + + src/hb-subset-cff2.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit a4b7033d0159b6372e631927b98b1963838bcc54 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 17:48:02 2023 -0700 + + [cff2-subset] Blend Private values when instancing + + src/hb-serialize.hh | 7 ++ + src/hb-subset-cff-common.hh | 80 ++++++++++++++++++++++ + src/hb-subset-cff2.cc | 159 ++++++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 239 insertions(+), 7 deletions(-) + +commit f10a4c9d6aebcc60b525a2342b0cdc6970ba32a3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 17:11:30 2023 -0700 + + [cff] Rename encode_num to encode_num_cs + + src/hb-subset-cff-common.hh | 4 ++-- + src/hb-subset-cff1.cc | 4 ++-- + src/hb-subset-cff2.cc | 6 +++--- + 3 files changed, 7 insertions(+), 7 deletions(-) + +commit c65eb5a82e4a9a0f3fe60b770741f3f4d3391bc2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 15:15:57 2023 -0700 + + [cff] Specialize cff_private_dict_op_serializer_t for CFF1/2 + + src/hb-subset-cff-common.hh | 33 --------------------------------- + src/hb-subset-cff1.cc | 32 +++++++++++++++++++++++++++++++- + src/hb-subset-cff2.cc | 36 +++++++++++++++++++++++++++++++++++- + 3 files changed, 66 insertions(+), 35 deletions(-) + +commit bf4b34e87e5d7428b7b206a38ce6d7948657a9cb +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 11:16:51 2023 -0700 + + [subset-cff2] Don't encode vsindex in Private dict + + src/hb-subset-cff-common.hh | 14 +++++++++----- + src/hb-subset-cff2.cc | 2 +- + 2 files changed, 10 insertions(+), 6 deletions(-) + +commit 220caa7e095b62fef55b03f32b65ddc564d8dc63 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 11:01:27 2023 -0700 + + [subset-cff2] Only encode VarStore link if any varstore + + src/hb-subset-cff2.cc | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +commit 82d9940a938d20bc2a4864a10e53bff4e34762ad +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 10:51:55 2023 -0700 + + [subset-cff2] Don't encode vsindex if pinned + + src/hb-subset-cff-common.hh | 8 ++++---- + src/hb-subset-cff2.cc | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +commit a88f3e8d379b7fbb0e4374f8ce1feb48ae681911 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 10:47:36 2023 -0700 + + [subset-cff2] Don't serialize VarStore if pinned + + src/hb-subset-cff2.cc | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +commit 8c1b47d7e23910c632993aa444df12cc2338d89a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 20:38:43 2023 -0700 + + [font] Fix compiler warnings + + src/hb-font.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 7c74fc96319b57499e1e3defc3e346fd3cc6848e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 14:43:07 2023 -0700 + + [CFF] Remove unused member single_val + + src/hb-cff-interp-dict-common.hh | 4 +--- + src/hb-ot-cff1-table.hh | 3 --- + src/hb-ot-cff2-table.hh | 3 --- + 3 files changed, 1 insertion(+), 9 deletions(-) + +commit 2746597b69c10b7aa1c0df2a4d36a3d92fb0769f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 19 12:14:35 2023 -0700 + + [subset-cff2] Add flush_hintmask + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4125 + + src/hb-subset-cff2.cc | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +commit adccc5355b695cfaaf6403a3187c67c7fcae623d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Feb 17 12:29:42 2023 -0700 + + [MarkBase] Adjust base-finding logic + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4124 + + src/OT/Layout/GPOS/MarkBasePosFormat1.hh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit 946477fa5472bb93f6ac099a45ec13a34d87a732 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Feb 16 15:03:50 2023 -0700 + + [font] Fix a MSVC "error" + + Oh well. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4122 + + src/hb-font.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b41efb6c4da9b1180b5178a55ceb31c68791dfdc +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 13 21:16:16 2023 -0700 + + [atomic] Use no-op asm for compiler barrier + + Fixes https://github.com/harfbuzz/harfbuzz/pull/4119 + + src/hb-atomic.hh | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +commit 2f1aa032b4c43a76953036c6a90d108fe9358711 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Mon Feb 13 09:50:04 2023 +0200 + + [doc] Give this section a nice URL + + docs/usermanual-fonts-and-faces.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 552f0714e854af0ed41d54fad710a2e4ce872af3 +Author: Khaled Hosny <khaled@aliftype.com> +Date: Mon Feb 13 09:21:05 2023 +0200 + + [meson] Fix test failure with experimental_api + + Pass --experimental-api to all gen-def.py when generating all .def + files, not only harfbuzz.def. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4117 + + src/meson.build | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +commit 40fa046cf311718665496d0516495e9c139221ba +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Feb 12 10:54:07 2023 -0700 + + [hb-info] Declare a variable unused + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4115 + + util/hb-info.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 8bdaeddfcd86aa66f560ff1ae1ae71b1e1723463 Author: Khaled Hosny <khaled@aliftype.com> Date: Sat Feb 11 23:44:58 2023 +0200 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index 22fae11e106..9a5914525c5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,9 @@ +Overview of changes leading to 7.0.1 +Monday, February 20, 2023 +==================================== +- Various build and bug fixes. + + Overview of changes leading to 7.0.0 Saturday, February 11, 2023 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index 4706213b291..099259a2752 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], - [7.0.0], + [7.0.1], [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 8d1c7321431..1515257c9c9 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: '7.0.0', + version: '7.0.1', default_options: [ 'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway 'cpp_rtti=false', # Just to support msvc, we are passing -fno-rtti also anyway diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkBasePosFormat1.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkBasePosFormat1.hh index 938369a5024..eb4712049b1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkBasePosFormat1.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkBasePosFormat1.hh @@ -133,7 +133,9 @@ struct MarkBasePosFormat1_2 auto match = skippy_iter.match (buffer->info[j - 1]); if (match == skippy_iter.MATCH) { - if (!accept (buffer, j - 1)) + // https://github.com/harfbuzz/harfbuzz/issues/4124 + if (!accept (buffer, j - 1) && + NOT_COVERED == (this+baseCoverage).get_coverage (buffer->info[j - 1].codepoint)) match = skippy_iter.SKIP; } if (match == skippy_iter.MATCH) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh index a474930357f..a6283de1408 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh @@ -111,10 +111,15 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) #endif +/* This should never be disabled, even under HB_NO_MT. + * except that MSVC gives me an internal compiler error, so disabled there. + * + * https://github.com/harfbuzz/harfbuzz/pull/4119 + */ #ifndef _hb_compiler_memory_r_barrier -/* This we always use std::atomic for; and should never be disabled... - * except that MSVC gives me an internal compiler error on it. */ -#if !defined(_MSC_VER) +#if defined(__ATOMIC_ACQUIRE) // gcc-like +#define _hb_compiler_memory_r_barrier() asm volatile("": : :"memory") +#elif !defined(_MSC_VER) #include <atomic> #define _hb_compiler_memory_r_barrier() std::atomic_signal_fence (std::memory_order_acquire) #else diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh index 5fe75659b49..ea81273b31c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh @@ -32,7 +32,7 @@ #include "hb.hh" -#line 33 "hb-buffer-deserialize-text-glyphs.hh" +#line 36 "hb-buffer-deserialize-text-glyphs.hh" static const unsigned char _deserialize_text_glyphs_trans_keys[] = { 0u, 0u, 48u, 57u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 43u, 124u, 9u, 124u, 9u, 124u, @@ -349,12 +349,12 @@ _hb_buffer_deserialize_text_glyphs (hb_buffer_t *buffer, hb_glyph_info_t info = {0}; hb_glyph_position_t pos = {0}; -#line 346 "hb-buffer-deserialize-text-glyphs.hh" +#line 353 "hb-buffer-deserialize-text-glyphs.hh" { cs = deserialize_text_glyphs_start; } -#line 349 "hb-buffer-deserialize-text-glyphs.hh" +#line 358 "hb-buffer-deserialize-text-glyphs.hh" { int _slen; int _trans; @@ -550,7 +550,7 @@ _resume: *end_ptr = p; } break; -#line 516 "hb-buffer-deserialize-text-glyphs.hh" +#line 554 "hb-buffer-deserialize-text-glyphs.hh" } _again: @@ -667,7 +667,7 @@ _again: *end_ptr = p; } break; -#line 616 "hb-buffer-deserialize-text-glyphs.hh" +#line 671 "hb-buffer-deserialize-text-glyphs.hh" } } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-dict-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-dict-common.hh index 79fe9b42c5f..53226b227e9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-dict-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-dict-common.hh @@ -35,10 +35,8 @@ using namespace OT; /* an opstr and the parsed out dict value(s) */ struct dict_val_t : op_str_t { - void init () { single_val.set_int (0); } + void init () {} void fini () {} - - number_t single_val; }; typedef dict_val_t num_dict_val_t; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc index e9f9cfeb5ff..c9a40295a3d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc @@ -29,32 +29,6 @@ #include "hb.hh" #include "hb-machinery.hh" -#if !defined(HB_NO_SETLOCALE) && (!defined(HAVE_NEWLOCALE) || !defined(HAVE_USELOCALE)) -#define HB_NO_SETLOCALE 1 -#endif - -#ifndef HB_NO_SETLOCALE - -#include <locale.h> -#ifdef HAVE_XLOCALE_H -#include <xlocale.h> // Needed on BSD/OS X for uselocale -#endif - -#ifdef WIN32 -#define hb_locale_t _locale_t -#else -#define hb_locale_t locale_t -#endif -#define hb_setlocale setlocale -#define hb_uselocale uselocale - -#else - -#define hb_locale_t void * -#define hb_setlocale(Category, Locale) "C" -#define hb_uselocale(Locale) ((hb_locale_t) 0) - -#endif /** * SECTION:hb-common diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc index 98d9f10d091..3868863105f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc @@ -2489,7 +2489,7 @@ hb_font_set_synthetic_bold (hb_font_t *font, if (font->x_embolden == x_embolden && font->y_embolden == y_embolden && - font->embolden_in_place == in_place) + font->embolden_in_place == (bool) in_place) return; font->serial++; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh index a9b1e0bcebc..f503575c34a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh @@ -697,8 +697,8 @@ struct hb_font_t bool y_neg = y_scale < 0; y_mult = (y_neg ? -((int64_t) -y_scale << 16) : ((int64_t) y_scale << 16)) / upem; - x_strength = fabs (roundf (x_scale * x_embolden)); - y_strength = fabs (roundf (y_scale * y_embolden)); + x_strength = fabsf (roundf (x_scale * x_embolden)); + y_strength = fabsf (roundf (y_scale * y_embolden)); slant_xy = y_scale ? slant * x_scale / y_scale : 0.f; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh index 8717b4a5ae4..f461a230449 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh @@ -902,8 +902,6 @@ struct cff1_private_dict_opset_t : dict_opset_t case OpCode_FamilyOtherBlues: case OpCode_StemSnapH: case OpCode_StemSnapV: - env.clear_args (); - break; case OpCode_StdHW: case OpCode_StdVW: case OpCode_BlueScale: @@ -915,7 +913,6 @@ struct cff1_private_dict_opset_t : dict_opset_t case OpCode_initialRandomSeed: case OpCode_defaultWidthX: case OpCode_nominalWidthX: - val.single_val = env.argStack.pop_num (); env.clear_args (); break; case OpCode_Subrs: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh index 9a3d2d01305..b9a8819ab85 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh @@ -283,9 +283,6 @@ struct cff2_private_dict_opset_t : dict_opset_t case OpCode_BlueFuzz: case OpCode_ExpansionFactor: case OpCode_LanguageGroup: - val.single_val = env.argStack.pop_num (); - env.clear_args (); - break; case OpCode_BlueValues: case OpCode_OtherBlues: case OpCode_FamilyBlues: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shaper-myanmar-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shaper-myanmar-machine.hh index 809f6eefb02..f7b456b11f6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shaper-myanmar-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shaper-myanmar-machine.hh @@ -50,7 +50,7 @@ enum myanmar_syllable_type_t { }; -#line 51 "hb-ot-shaper-myanmar-machine.hh" +#line 54 "hb-ot-shaper-myanmar-machine.hh" #define myanmar_syllable_machine_ex_A 9u #define myanmar_syllable_machine_ex_As 32u #define myanmar_syllable_machine_ex_C 1u @@ -77,7 +77,7 @@ enum myanmar_syllable_type_t { #define myanmar_syllable_machine_ex_ZWNJ 5u -#line 76 "hb-ot-shaper-myanmar-machine.hh" +#line 81 "hb-ot-shaper-myanmar-machine.hh" static const unsigned char _myanmar_syllable_machine_trans_keys[] = { 1u, 41u, 3u, 41u, 5u, 39u, 5u, 8u, 3u, 41u, 3u, 39u, 3u, 39u, 5u, 39u, 5u, 39u, 3u, 39u, 3u, 39u, 3u, 41u, 5u, 39u, 1u, 15u, 3u, 39u, 3u, 39u, @@ -443,7 +443,7 @@ find_syllables_myanmar (hb_buffer_t *buffer) int cs; hb_glyph_info_t *info = buffer->info; -#line 436 "hb-ot-shaper-myanmar-machine.hh" +#line 447 "hb-ot-shaper-myanmar-machine.hh" { cs = myanmar_syllable_machine_start; ts = 0; @@ -459,7 +459,7 @@ find_syllables_myanmar (hb_buffer_t *buffer) unsigned int syllable_serial = 1; -#line 448 "hb-ot-shaper-myanmar-machine.hh" +#line 463 "hb-ot-shaper-myanmar-machine.hh" { int _slen; int _trans; @@ -473,7 +473,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 460 "hb-ot-shaper-myanmar-machine.hh" +#line 477 "hb-ot-shaper-myanmar-machine.hh" } _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); @@ -519,7 +519,7 @@ _eof_trans: #line 113 "hb-ot-shaper-myanmar-machine.rl" {te = p;p--;{ found_syllable (myanmar_non_myanmar_cluster); }} break; -#line 498 "hb-ot-shaper-myanmar-machine.hh" +#line 523 "hb-ot-shaper-myanmar-machine.hh" } _again: @@ -528,7 +528,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 505 "hb-ot-shaper-myanmar-machine.hh" +#line 532 "hb-ot-shaper-myanmar-machine.hh" } if ( ++p != pe ) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh index 0c2f64cc486..61ec0253a0e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh @@ -629,6 +629,13 @@ struct hb_serialize_context_t template <typename Type> Type *embed (const Type &obj) { return embed (std::addressof (obj)); } + char *embed (const char *obj, unsigned size) + { + char *ret = this->allocate_size<char> (size, false); + if (unlikely (!ret)) return nullptr; + hb_memcpy (ret, obj, size); + return ret; + } template <typename Type, typename ...Ts> auto _copy (const Type &src, hb_priority<1>, Ts&&... ds) HB_RETURN 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 684ac5f653f..ff50b0e5185 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 @@ -81,7 +81,8 @@ struct str_encoder_t } } - void encode_num (const number_t& n) + // Encode number for CharString + void encode_num_cs (const number_t& n) { if (n.in_int_range ()) { @@ -98,6 +99,91 @@ struct str_encoder_t } } + // Encode number for TopDict / Private + void encode_num_tp (const number_t& n) + { + if (n.in_int_range ()) + { + // TODO longint + encode_int (n.to_int ()); + } + else + { + // Sigh. BCD + // https://learn.microsoft.com/en-us/typography/opentype/spec/cff2#table-5-nibble-definitions + double v = n.to_real (); + encode_byte (OpCode_BCD); + + // Based on: + // https://github.com/fonttools/fonttools/blob/97ed3a61cde03e17b8be36f866192fbd56f1d1a7/Lib/fontTools/misc/psCharStrings.py#L265-L294 + + char buf[16]; + /* FontTools has the following comment: + * + * # Note: 14 decimal digits seems to be the limitation for CFF real numbers + * # in macOS. However, we use 8 here to match the implementation of AFDKO. + * + * We use 8 here to match FontTools X-). + */ + + hb_locale_t clocale HB_UNUSED; + hb_locale_t oldlocale HB_UNUSED; + oldlocale = hb_uselocale (clocale = newlocale (LC_ALL_MASK, "C", NULL)); + snprintf (buf, sizeof (buf), "%.8G", v); + (void) hb_uselocale (((void) freelocale (clocale), oldlocale)); + + char *s = buf; + if (s[0] == '0' && s[1] == '.') + s++; + else if (s[0] == '-' && s[1] == '0' && s[2] == '.') + { + s[1] = '-'; + s++; + } + hb_vector_t<char> nibbles; + while (*s) + { + char c = s[0]; + s++; + + switch (c) + { + case 'E': + { + char c2 = *s; + if (c2 == '-') + { + s++; + nibbles.push (0x0C); // E- + continue; + } + if (c2 == '+') + s++; + nibbles.push (0x0B); // E + continue; + } + + case '.': case ',': // Comma for some European locales in case no uselocale available. + nibbles.push (0x0A); // . + continue; + + case '-': + nibbles.push (0x0E); // . + continue; + } + + nibbles.push (c - '0'); + } + nibbles.push (0x0F); + if (nibbles.length % 2) + nibbles.push (0x0F); + + unsigned count = nibbles.length; + for (unsigned i = 0; i < count; i += 2) + encode_byte ((nibbles[i] << 4) | nibbles[i+1]); + } + } + void encode_op (op_code_t op) { if (Is_OpCode_ESC (op)) @@ -190,35 +276,6 @@ struct cff_font_dict_op_serializer_t : op_serializer_t } }; -struct cff_private_dict_op_serializer_t : op_serializer_t -{ - cff_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_) - : desubroutinize (desubroutinize_), drop_hints (drop_hints_) {} - - bool serialize (hb_serialize_context_t *c, - const op_str_t &opstr, - objidx_t subrs_link) const - { - TRACE_SERIALIZE (this); - - if (drop_hints && dict_opset_t::is_hint_op (opstr.op)) - return true; - if (opstr.op == OpCode_Subrs) - { - if (desubroutinize || !subrs_link) - return_trace (true); - else - return_trace (FontDict::serialize_link2_op (c, opstr.op, subrs_link)); - } - else - return_trace (copy_opstr (c, opstr)); - } - - protected: - const bool desubroutinize; - const bool drop_hints; -}; - struct flatten_param_t { str_buff_t &flatStr; @@ -738,7 +795,7 @@ struct subr_subsetter_t return true; } - bool encode_charstrings (str_buff_vec_t &buffArray) const + bool encode_charstrings (str_buff_vec_t &buffArray, bool encode_prefix = true) const { if (unlikely (!buffArray.resize_exact (plan->num_output_glyphs ()))) return false; @@ -754,7 +811,7 @@ struct subr_subsetter_t unsigned int fd = acc.fdSelect->get_fd (glyph); if (unlikely (fd >= acc.fdCount)) return false; - if (unlikely (!encode_str (get_parsed_charstring (i), fd, buffArray.arrayZ[i]))) + if (unlikely (!encode_str (get_parsed_charstring (i), fd, buffArray.arrayZ[i], encode_prefix))) return false; } return true; @@ -984,16 +1041,16 @@ struct subr_subsetter_t } } - bool encode_str (const parsed_cs_str_t &str, const unsigned int fd, str_buff_t &buff) const + bool encode_str (const parsed_cs_str_t &str, const unsigned int fd, str_buff_t &buff, bool encode_prefix = true) const { str_encoder_t encoder (buff); encoder.reset (); bool hinting = !(plan->flags & HB_SUBSET_FLAGS_NO_HINTING); /* if a prefix (CFF1 width or CFF2 vsindex) has been removed along with hints, * re-insert it at the beginning of charstreing */ - if (str.has_prefix () && !hinting && str.is_hint_dropped ()) + if (encode_prefix && str.has_prefix () && !hinting && str.is_hint_dropped ()) { - encoder.encode_num (str.prefix_num ()); + encoder.encode_num_cs (str.prefix_num ()); if (str.prefix_op () != OpCode_Invalid) encoder.encode_op (str.prefix_op ()); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc index 538f28f5aaf..1d7ed6444ac 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc @@ -234,7 +234,7 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatte { str_encoder_t encoder (param.flatStr); for (unsigned int i = env.arg_start; i < env.argStack.get_count (); i++) - encoder.encode_num (env.eval_arg (i)); + encoder.encode_num_cs (env.eval_arg (i)); SUPER::flush_args (env, param); } @@ -248,7 +248,7 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatte { assert (env.has_width); str_encoder_t encoder (param.flatStr); - encoder.encode_num (env.width); + encoder.encode_num_cs (env.width); } static void flush_hintmask (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param) @@ -335,6 +335,36 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t typedef cff1_cs_opset_t<cff1_cs_opset_subr_subset_t, subr_subset_param_t> SUPER; }; +struct cff1_private_dict_op_serializer_t : op_serializer_t +{ + cff1_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_) + : desubroutinize (desubroutinize_), drop_hints (drop_hints_) {} + + bool serialize (hb_serialize_context_t *c, + const op_str_t &opstr, + objidx_t subrs_link) const + { + TRACE_SERIALIZE (this); + + if (drop_hints && dict_opset_t::is_hint_op (opstr.op)) + return_trace (true); + + if (opstr.op == OpCode_Subrs) + { + if (desubroutinize || !subrs_link) + return_trace (true); + else + return_trace (FontDict::serialize_link2_op (c, opstr.op, subrs_link)); + } + + return_trace (copy_opstr (c, opstr)); + } + + protected: + const bool desubroutinize; + const bool drop_hints; +}; + struct cff1_subr_subsetter_t : subr_subsetter_t<cff1_subr_subsetter_t, CFF1Subrs, const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_subr_subset_t, OpCode_endchar> { cff1_subr_subsetter_t (const OT::cff1::accelerator_subset_t &acc_, const hb_subset_plan_t *plan_) @@ -721,7 +751,7 @@ static bool _serialize_cff1 (hb_serialize_context_t *c, PrivateDict *pd = c->start_embed<PrivateDict> (); if (unlikely (!pd)) return false; c->push (); - cff_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints); + cff1_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints); /* N.B. local subrs immediately follows its corresponding private dict. i.e., subr offset == private dict size */ if (likely (pd->serialize (c, acc.privateDicts[i], privSzr, subrs_link))) { 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 01eb3fe89df..8ab4620194b 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 @@ -59,7 +59,10 @@ struct cff2_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<> switch (opstr.op) { case OpCode_vstore: - return_trace (FontDict::serialize_link4_op(c, opstr.op, info.var_store_link)); + if (info.var_store_link) + return_trace (FontDict::serialize_link4_op(c, opstr.op, info.var_store_link)); + else + return_trace (true); default: return_trace (cff_top_dict_op_serializer_t<>::serialize (c, opstr, info)); @@ -115,7 +118,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte else { str_encoder_t encoder (param.flatStr); - encoder.encode_num (arg); + encoder.encode_num_cs (arg); i++; } } @@ -135,14 +138,14 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte env.set_error (); return; } - encoder.encode_num (arg1); + encoder.encode_num_cs (arg1); } /* flatten deltas for each value */ for (unsigned int j = 0; j < arg.numValues; j++) { const blend_arg_t &arg1 = env.argStack[i + j]; for (unsigned int k = 0; k < arg1.deltas.length; k++) - encoder.encode_num (arg1.deltas[k]); + encoder.encode_num_cs (arg1.deltas[k]); } /* flatten the number of values followed by blend operator */ encoder.encode_int (arg.numValues); @@ -162,6 +165,17 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte } } + static void flush_hintmask (op_code_t op, cff2_cs_interp_env_t<blend_arg_t> &env, flatten_param_t& param) + { + SUPER::flush_hintmask (op, env, param); + if (!param.drop_hints) + { + str_encoder_t encoder (param.flatStr); + for (unsigned int i = 0; i < env.hintmask_size; i++) + encoder.encode_byte (env.str_ref[i]); + } + } + private: typedef cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatten_param_t, blend_arg_t> SUPER; typedef cs_opset_t<blend_arg_t, cff2_cs_opset_flatten_t, cff2_cs_opset_flatten_t, cff2_cs_interp_env_t<blend_arg_t>, flatten_param_t> CSOPSET; @@ -232,16 +246,193 @@ struct cff2_subr_subsetter_t : subr_subsetter_t<cff2_subr_subsetter_t, CFF2Subrs } }; -struct cff2_subset_plan { +struct cff2_private_blend_encoder_param_t +{ + cff2_private_blend_encoder_param_t (hb_serialize_context_t *c, + const CFF2VariationStore *varStore, + hb_array_t<int> normalized_coords) : + c (c), varStore (varStore), normalized_coords (normalized_coords) {} + + void init () {} + + void process_blend () + { + if (!seen_blend) + { + region_count = varStore->varStore.get_region_index_count (ivs); + scalars.resize_exact (region_count); + varStore->varStore.get_region_scalars (ivs, normalized_coords.arrayZ, normalized_coords.length, + &scalars[0], region_count); + seen_blend = true; + } + } + + double blend_deltas (hb_array_t<const number_t> deltas) const + { + double v = 0; + if (likely (scalars.length == deltas.length)) + { + unsigned count = scalars.length; + for (unsigned i = 0; i < count; i++) + v += (double) scalars.arrayZ[i] * deltas.arrayZ[i].to_real (); + } + return v; + } + + + hb_serialize_context_t *c = nullptr; + bool seen_blend = false; + unsigned ivs = 0; + unsigned region_count = 0; + hb_vector_t<float> scalars; + const CFF2VariationStore *varStore = nullptr; + hb_array_t<int> normalized_coords; +}; + +struct cff2_private_dict_blend_opset_t : dict_opset_t +{ + static void process_arg_blend (cff2_private_blend_encoder_param_t& param, + number_t &arg, + const hb_array_t<const number_t> blends, + unsigned n, unsigned i) + { + arg.set_int (round (arg.to_real () + param.blend_deltas (blends))); + } + + static void process_blend (cff2_priv_dict_interp_env_t& env, cff2_private_blend_encoder_param_t& param) + { + unsigned int n, k; + + param.process_blend (); + k = param.region_count; + n = env.argStack.pop_uint (); + /* copy the blend values into blend array of the default values */ + unsigned int start = env.argStack.get_count () - ((k+1) * n); + /* let an obvious error case fail, but note CFF2 spec doesn't forbid n==0 */ + if (unlikely (start > env.argStack.get_count ())) + { + env.set_error (); + return; + } + for (unsigned int i = 0; i < n; i++) + { + const hb_array_t<const number_t> blends = env.argStack.sub_array (start + n + (i * k), k); + process_arg_blend (param, env.argStack[start + i], blends, n, i); + } + + /* pop off blend values leaving default values now adorned with blend values */ + env.argStack.pop (k * n); + } + + static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_blend_encoder_param_t& param) + { + switch (op) { + case OpCode_StdHW: + case OpCode_StdVW: + case OpCode_BlueScale: + case OpCode_BlueShift: + case OpCode_BlueFuzz: + case OpCode_ExpansionFactor: + case OpCode_LanguageGroup: + case OpCode_BlueValues: + case OpCode_OtherBlues: + case OpCode_FamilyBlues: + case OpCode_FamilyOtherBlues: + case OpCode_StemSnapH: + case OpCode_StemSnapV: + break; + case OpCode_vsindexdict: + env.process_vsindex (); + param.ivs = env.get_ivs (); + env.clear_args (); + return; + case OpCode_blenddict: + process_blend (env, param); + return; + + default: + dict_opset_t::process_op (op, env); + if (!env.argStack.is_empty ()) return; + break; + } + + if (unlikely (env.in_error ())) return; + + // Write args then op + + str_buff_t str; + str_encoder_t encoder (str); + + unsigned count = env.argStack.get_count (); + for (unsigned i = 0; i < count; i++) + encoder.encode_num_tp (env.argStack[i]); + + encoder.encode_op (op); + + auto bytes = str.as_bytes (); + param.c->embed (&bytes, bytes.length); + + env.clear_args (); + } +}; + +struct cff2_private_dict_op_serializer_t : op_serializer_t +{ + cff2_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_, bool pinned_, + const CFF::CFF2VariationStore* varStore_, + hb_array_t<int> normalized_coords_) + : desubroutinize (desubroutinize_), drop_hints (drop_hints_), pinned (pinned_), + varStore (varStore_), normalized_coords (normalized_coords_) {} + bool serialize (hb_serialize_context_t *c, + const op_str_t &opstr, + objidx_t subrs_link) const + { + TRACE_SERIALIZE (this); + + if (drop_hints && dict_opset_t::is_hint_op (opstr.op)) + return_trace (true); + + if (opstr.op == OpCode_Subrs) + { + if (desubroutinize || !subrs_link) + return_trace (true); + else + return_trace (FontDict::serialize_link2_op (c, opstr.op, subrs_link)); + } + + if (pinned) + { + // Reinterpret opstr and process blends. + cff2_priv_dict_interp_env_t env {hb_ubytes_t (opstr.ptr, opstr.length)}; + cff2_private_blend_encoder_param_t param (c, varStore, normalized_coords); + dict_interpreter_t<cff2_private_dict_blend_opset_t, cff2_private_blend_encoder_param_t, cff2_priv_dict_interp_env_t> interp (env); + return_trace (interp.interpret (param)); + } + + return_trace (copy_opstr (c, opstr)); + } + + protected: + const bool desubroutinize; + const bool drop_hints; + const bool pinned; + const CFF::CFF2VariationStore* varStore; + hb_array_t<int> normalized_coords; +}; + + +struct cff2_subset_plan +{ bool create (const OT::cff2::accelerator_subset_t &acc, hb_subset_plan_t *plan) { orig_fdcount = acc.fdArray->count; drop_hints = plan->flags & HB_SUBSET_FLAGS_NO_HINTING; + pinned = (bool) plan->normalized_coords; desubroutinize = plan->flags & HB_SUBSET_FLAGS_DESUBROUTINIZE || - plan->normalized_coords; // For instancing we need this path + pinned; // For instancing we need this path if (desubroutinize) { @@ -260,7 +451,7 @@ struct cff2_subset_plan { return false; /* encode charstrings, global subrs, local subrs with new subroutine numbers */ - if (!subr_subsetter.encode_charstrings (subset_charstrings)) + if (!subr_subsetter.encode_charstrings (subset_charstrings, !pinned)) return false; if (!subr_subsetter.encode_globalsubrs (subset_globalsubrs)) @@ -300,8 +491,9 @@ struct cff2_subset_plan { unsigned int orig_fdcount = 0; unsigned int subset_fdcount = 1; - unsigned int subset_fdselect_size = 0; + unsigned int subset_fdselect_size = 0; unsigned int subset_fdselect_format = 0; + bool pinned = false; hb_vector_t<code_pair_t> subset_fdselect_ranges; hb_inc_bimap_t fdmap; @@ -317,7 +509,8 @@ struct cff2_subset_plan { static bool _serialize_cff2 (hb_serialize_context_t *c, cff2_subset_plan &plan, const OT::cff2::accelerator_subset_t &acc, - unsigned int num_glyphs) + unsigned int num_glyphs, + hb_array_t<int> normalized_coords) { /* private dicts & local subrs */ hb_vector_t<table_info_t> private_dict_infos; @@ -345,7 +538,8 @@ static bool _serialize_cff2 (hb_serialize_context_t *c, PrivateDict *pd = c->start_embed<PrivateDict> (); if (unlikely (!pd)) return false; c->push (); - cff_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints); + cff2_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints, plan.pinned, + acc.varStore, normalized_coords); if (likely (pd->serialize (c, acc.privateDicts[i], privSzr, subrs_link))) { unsigned fd = plan.fdmap[i]; @@ -413,7 +607,8 @@ static bool _serialize_cff2 (hb_serialize_context_t *c, } /* variation store */ - if (acc.varStore != &Null (CFF2VariationStore)) + if (acc.varStore != &Null (CFF2VariationStore) && + !plan.pinned) { c->push (); CFF2VariationStore *dest = c->start_embed<CFF2VariationStore> (); @@ -452,7 +647,8 @@ _hb_subset_cff2 (const OT::cff2::accelerator_subset_t &acc, cff2_subset_plan cff2_plan; if (unlikely (!cff2_plan.create (acc, c->plan))) return false; - return _serialize_cff2 (c->serializer, cff2_plan, acc, c->plan->num_output_glyphs ()); + return _serialize_cff2 (c->serializer, cff2_plan, acc, c->plan->num_output_glyphs (), + c->plan->normalized_coords.as_array ()); } bool diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh index aac43a29526..857571b42fd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh @@ -463,6 +463,37 @@ static int HB_UNUSED _hb_errno = 0; #endif #endif + +// Locale business + +#if !defined(HB_NO_SETLOCALE) && (!defined(HAVE_NEWLOCALE) || !defined(HAVE_USELOCALE)) +#define HB_NO_SETLOCALE 1 +#endif + +#ifndef HB_NO_SETLOCALE + +#include <locale.h> +#ifdef HAVE_XLOCALE_H +#include <xlocale.h> // Needed on BSD/OS X for uselocale +#endif + +#ifdef WIN32 +#define hb_locale_t _locale_t +#else +#define hb_locale_t locale_t +#endif +#define hb_setlocale setlocale +#define hb_uselocale uselocale + +#else + +#define hb_locale_t void * +#define hb_setlocale(Category, Locale) "C" +#define hb_uselocale(Locale) ((hb_locale_t) 0) + +#endif + + /* Lets assert int types. Saves trouble down the road. */ static_assert ((sizeof (hb_codepoint_t) == 4), ""); static_assert ((sizeof (hb_position_t) == 4), ""); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build index 7e10de8d871..435201c28c4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build @@ -522,16 +522,15 @@ hb_supported_features_h = configure_file(input: 'hb-features.h.in', # Base and default-included sources and headers -# harfbuzz gen_def = find_program('gen-def.py') - -harfbuzz_def_command_args = [gen_def, '@OUTPUT@', '@INPUT@'] +gen_def_cmd = [gen_def, '@OUTPUT@', '@INPUT@'] if get_option('experimental_api') - harfbuzz_def_command_args += '--experimental-api' + gen_def_cmd += '--experimental-api' endif +# harfbuzz harfbuzz_def = custom_target('harfbuzz.def', - command: harfbuzz_def_command_args, + command: gen_def_cmd, input: hb_headers, output: 'harfbuzz.def') defs_list = [harfbuzz_def] @@ -577,7 +576,7 @@ meson.override_dependency('harfbuzz', libharfbuzz_dep) # harfbuzz-subset harfbuzz_subset_def = custom_target('harfbuzz-subset.def', - command: [gen_def, '@OUTPUT@', '@INPUT@'], + command: gen_def_cmd, input: hb_subset_headers, output: 'harfbuzz-subset.def') defs_list += [harfbuzz_subset_def] @@ -643,7 +642,7 @@ if conf.get('HAVE_CAIRO', 0) == 1 meson.override_dependency('harfbuzz-cairo', libharfbuzz_cairo_dep) harfbuzz_cairo_def = custom_target('harfbuzz-cairo.def', - command: [gen_def, '@OUTPUT@', '@INPUT@'], + command: gen_def_cmd, input: hb_cairo_headers, output: 'harfbuzz-cairo.def') defs_list += [harfbuzz_cairo_def] @@ -729,7 +728,7 @@ pkgmod.generate(libharfbuzz_subset, libharfbuzz_icu_dep = null_dep if have_icu and not have_icu_builtin harfbuzz_icu_def = custom_target('harfbuzz-icu.def', - command: [gen_def, '@OUTPUT@', '@INPUT@'], + command: gen_def_cmd, input: [hb_icu_headers], output: 'harfbuzz-icu.def') defs_list += [harfbuzz_icu_def] @@ -817,7 +816,7 @@ if have_gobject hb_gobject_sources += [gobject_enums_c] harfbuzz_gobject_def = custom_target('harfbuzz-gobject.def', - command: [gen_def, '@OUTPUT@', '@INPUT@'], + command: gen_def_cmd, input: [hb_gobject_headers, gobject_enums_h], output: 'harfbuzz-gobject.def') defs_list += [harfbuzz_gobject_def] diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index 6e27bfde67a..c5ecaabc8c1 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], [7.0.0]) +m4_define([harfbuzz_version], [7.0.1]) |