From 960aa34473a2eea9843a9e5bd03b10d8dcdc1649 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Thu, 12 Jul 2018 23:06:34 +0000 Subject: harfbuzz 1.8.3 git-svn-id: svn://tug.org/texlive/trunk@48191 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/README | 2 +- Build/source/libs/harfbuzz/ChangeLog | 5 + Build/source/libs/harfbuzz/TLpatches/ChangeLog | 5 + Build/source/libs/harfbuzz/TLpatches/TL-Changes | 2 +- Build/source/libs/harfbuzz/config.h.in | 3 + Build/source/libs/harfbuzz/configure | 26 +- Build/source/libs/harfbuzz/configure.ac | 2 +- .../libs/harfbuzz/harfbuzz-src/CMakeLists.txt | 3 +- Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog | 423 +++++++++++ Build/source/libs/harfbuzz/harfbuzz-src/NEWS | 8 + .../source/libs/harfbuzz/harfbuzz-src/config.h.in | 3 + .../source/libs/harfbuzz/harfbuzz-src/configure.ac | 4 +- .../libs/harfbuzz/harfbuzz-src/src/Makefile.am | 8 +- .../libs/harfbuzz/harfbuzz-src/src/gen-def.py | 12 +- .../harfbuzz/harfbuzz-src/src/hb-blob-private.hh | 2 - .../libs/harfbuzz/harfbuzz-src/src/hb-blob.cc | 15 +- .../harfbuzz/harfbuzz-src/src/hb-buffer-private.hh | 1 - .../libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc | 4 +- .../libs/harfbuzz/harfbuzz-src/src/hb-common.cc | 3 +- .../libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc | 1 - .../libs/harfbuzz/harfbuzz-src/src/hb-debug.hh | 1 + .../harfbuzz/harfbuzz-src/src/hb-directwrite.cc | 1 - .../libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh | 705 +++++++++++++++++- .../harfbuzz/harfbuzz-src/src/hb-face-private.hh | 1 - .../harfbuzz/harfbuzz-src/src/hb-font-private.hh | 1 - .../source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc | 1 - .../harfbuzz/harfbuzz-src/src/hb-map-private.hh | 3 +- .../harfbuzz/harfbuzz-src/src/hb-object-private.hh | 2 - .../harfbuzz-src/src/hb-open-type-private.hh | 5 +- .../harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh | 2 +- .../harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh | 2 +- .../src/hb-ot-layout-common-private.hh | 1 - .../harfbuzz-src/src/hb-ot-layout-gpos-table.hh | 4 +- .../harfbuzz-src/src/hb-ot-layout-gsub-table.hh | 2 +- .../src/hb-ot-layout-gsubgpos-private.hh | 3 +- .../libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc | 4 +- .../harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh | 1 - .../harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh | 1 - .../harfbuzz-src/src/hb-ot-shape-complex-arabic.cc | 1 - .../harfbuzz-src/src/hb-ot-shape-complex-indic.cc | 37 + .../src/hb-ot-shape-complex-use-table.cc | 4 +- .../libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc | 4 +- .../libs/harfbuzz/harfbuzz-src/src/hb-private.hh | 790 +++------------------ .../harfbuzz/harfbuzz-src/src/hb-set-private.hh | 8 +- .../harfbuzz-src/src/hb-shape-plan-private.hh | 1 - .../harfbuzz/harfbuzz-src/src/hb-shape-plan.cc | 1 - .../harfbuzz/harfbuzz-src/src/hb-subset-input.cc | 1 - .../harfbuzz/harfbuzz-src/src/hb-subset-plan.hh | 1 - .../libs/harfbuzz/harfbuzz-src/src/hb-subset.cc | 3 +- .../harfbuzz-src/src/hb-unicode-private.hh | 1 - .../libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc | 1 - .../libs/harfbuzz/harfbuzz-src/src/hb-warning.cc | 4 +- Build/source/libs/harfbuzz/version.ac | 2 +- 53 files changed, 1336 insertions(+), 795 deletions(-) diff --git a/Build/source/libs/README b/Build/source/libs/README index fed17f86f88..0d4ff84e3e6 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -24,7 +24,7 @@ gmp 6.1.2 - checked 16dec16 graphite2 1.3.11 - checked 05mar18 http://sourceforge.net/projects/silgraphite/files/graphite2/ -harfbuzz 1.8.2 - checked 05jul18 +harfbuzz 1.8.3 - checked 13jul18 http://www.freedesktop.org/software/harfbuzz/release/ icu 61.1 - checked 29mar18 diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index fdc132da6df..6bc8166db22 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2018-07-13 Akira Kakuto + + Import harfbuzz-1.8.3. + * configure.ac, version.ac: Adjusted. + 2018-07-04 Akira Kakuto Import harfbuzz-1.8.2. diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index 723d72a3b9d..58d99e16909 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2018-07-13 Akira Kakuto + + Imported harfbuzz-1.8.3 source tree from: + http://www.freedesktop.org/software/harfbuzz/release/ + 2018-07-04 Akira Kakuto Imported harfbuzz-1.8.2 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index 1badc257ec8..b00494e006b 100644 --- a/Build/source/libs/harfbuzz/TLpatches/TL-Changes +++ b/Build/source/libs/harfbuzz/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the harfbuzz-1.8.2/ tree as obtained from: +Changes applied to the harfbuzz-1.8.3/ tree as obtained from: http://www.freedesktop.org/software/harfbuzz/release/ Removed: diff --git a/Build/source/libs/harfbuzz/config.h.in b/Build/source/libs/harfbuzz/config.h.in index 3b6525f7018..327a113ac1f 100644 --- a/Build/source/libs/harfbuzz/config.h.in +++ b/Build/source/libs/harfbuzz/config.h.in @@ -64,6 +64,9 @@ /* Use native OpenType Layout backend */ #undef HAVE_OT +/* Define to 1 if you have the `posix_memalign' function. */ +#undef HAVE_POSIX_MEMALIGN + /* Use POSIX threads */ #undef HAVE_PTHREAD diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index 745587eda52..adbcfb220bf 100755 --- a/Build/source/libs/harfbuzz/configure +++ b/Build/source/libs/harfbuzz/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 1.8.2. +# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 1.8.3. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='1.8.2' -PACKAGE_STRING='harfbuzz (TeX Live) 1.8.2' +PACKAGE_VERSION='1.8.3' +PACKAGE_STRING='harfbuzz (TeX Live) 1.8.3' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1317,7 +1317,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures harfbuzz (TeX Live) 1.8.2 to adapt to many kinds of systems. +\`configure' configures harfbuzz (TeX Live) 1.8.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1388,7 +1388,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of harfbuzz (TeX Live) 1.8.2:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 1.8.3:";; esac cat <<\_ACEOF @@ -1495,7 +1495,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -harfbuzz (TeX Live) configure 1.8.2 +harfbuzz (TeX Live) configure 1.8.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2131,7 +2131,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by harfbuzz (TeX Live) $as_me 1.8.2, which was +It was created by harfbuzz (TeX Live) $as_me 1.8.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4054,7 +4054,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='1.8.2' + VERSION='1.8.3' # Some tools Automake needs. @@ -4248,8 +4248,8 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags HB_VERSION_MAJOR=1 HB_VERSION_MINOR=8 -HB_VERSION_MICRO=2 -HB_VERSION=1.8.2 +HB_VERSION_MICRO=3 +HB_VERSION=1.8.3 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -7000,7 +7000,7 @@ fi # Functions and headers -for ac_func in atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l +for ac_func in atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l posix_memalign do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -8140,7 +8140,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by harfbuzz (TeX Live) $as_me 1.8.2, which was +This file was extended by harfbuzz (TeX Live) $as_me 1.8.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8206,7 +8206,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -harfbuzz (TeX Live) config.status 1.8.2 +harfbuzz (TeX Live) config.status 1.8.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/harfbuzz/configure.ac b/Build/source/libs/harfbuzz/configure.ac index 365ecb196ab..ebb17a1d866 100644 --- a/Build/source/libs/harfbuzz/configure.ac +++ b/Build/source/libs/harfbuzz/configure.ac @@ -37,7 +37,7 @@ KPSE_GRAPHITE2_FLAGS KPSE_ICU_FLAGS # Functions and headers -AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l) +AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l posix_memalign) save_libs="$LIBS" LIBS="$LIBS -lm" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt index 9ed7e56e8fb..e881dbd1a4d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt @@ -834,9 +834,8 @@ set_target_properties(hb-ot-tag PROPERTIES COMPILE_FLAGS "-DMAIN") if (UNIX OR MINGW) if (BUILD_SHARED_LIBS) # generate harfbuzz.def after build completion - string(REPLACE ";" " " space_separated_headers "${project_headers}") add_custom_command(TARGET harfbuzz POST_BUILD - COMMAND ${CMAKE_COMMAND} -E env "headers=${space_separated_headers}" python ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def + COMMAND "${PYTHON_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def ${project_headers} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src) add_test(NAME check-static-inits.sh diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 2ea2db34012..e5c02c5305e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,426 @@ +commit 718dfd4189275b1e4233dc7c12ab457352fccfcb +Author: Behdad Esfahbod +Date: Tue Jul 10 16:34:31 2018 +0200 + + Fix shift + + src/hb-dsalgs.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 25aa411ac524ed08624033da473a5e050ff41633 +Author: Behdad Esfahbod +Date: Tue Jul 10 16:05:03 2018 +0200 + + Put back include dependencies + + src/hb-object-private.hh | 2 ++ + src/hb-private.hh | 7 ++++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +commit 491d93bf74dd0483715ecca430715b69664e1211 +Author: Behdad Esfahbod +Date: Tue Jul 10 16:03:31 2018 +0200 + + Move more stuff from hb-private.hh to hb-dsalgs.hh + + src/hb-debug.hh | 1 + + src/hb-dsalgs.hh | 237 + ++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/hb-private.hh | 246 + +----------------------------------------------------- + 3 files changed, 240 insertions(+), 244 deletions(-) + +commit f477765661c196ac17b2c86731881a3da36a5ae6 +Author: Behdad Esfahbod +Date: Tue Jul 10 15:49:05 2018 +0200 + + Move more stuff to hb-dsalgs.hh + + src/hb-dsalgs.hh | 83 + +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/hb-private.hh | 81 + ----------------------------------------------------- + 2 files changed, 83 insertions(+), 81 deletions(-) + +commit be7f664f723fb4e7bcf15c1c2b7c6bec46f90393 +Author: Behdad Esfahbod +Date: Tue Jul 10 15:23:08 2018 +0200 + + Move hb_bytes_t to hb-dsalgs.hh + + src/hb-dsalgs.hh | 45 ++++++++++++++++++++++++++++++++++----------- + src/hb-private.hh | 26 -------------------------- + 2 files changed, 34 insertions(+), 37 deletions(-) + +commit 7a00f7eb2e3859db4563071934e76142bfd13916 +Author: Behdad Esfahbod +Date: Tue Jul 10 14:42:10 2018 +0200 + + Remove hb_auto_array_t + + src/hb-dsalgs.hh | 2 -- + 1 file changed, 2 deletions(-) + +commit be458eb05962dd5f5c60a25f54cf0b20e7d8b055 +Author: Behdad Esfahbod +Date: Tue Jul 10 14:41:04 2018 +0200 + + Include more basic internal headers from hb-private.hh + + src/hb-blob-private.hh | 2 -- + src/hb-blob.cc | 1 - + src/hb-buffer-private.hh | 1 - + src/hb-common.cc | 2 -- + src/hb-coretext.cc | 1 - + src/hb-directwrite.cc | 1 - + src/hb-face-private.hh | 1 - + src/hb-font-private.hh | 1 - + src/hb-ft.cc | 1 - + src/hb-map-private.hh | 1 - + src/hb-object-private.hh | 4 ---- + src/hb-open-type-private.hh | 1 - + src/hb-ot-layout-common-private.hh | 1 - + src/hb-ot-layout-gsubgpos-private.hh | 1 - + src/hb-ot-shape-complex-arabic.cc | 1 - + src/hb-private.hh | 6 +++++- + src/hb-set-private.hh | 1 - + src/hb-shape-plan-private.hh | 1 - + src/hb-shape-plan.cc | 1 - + src/hb-subset-input.cc | 1 - + src/hb-subset-plan.hh | 1 - + src/hb-subset.cc | 1 - + src/hb-unicode-private.hh | 1 - + src/hb-uniscribe.cc | 1 - + src/hb-warning.cc | 4 +--- + 25 files changed, 6 insertions(+), 32 deletions(-) + +commit bddeb2b10ca2f4b4bee6f7eaaf5615875a67111d +Author: Behdad Esfahbod +Date: Tue Jul 10 14:12:37 2018 +0200 + + Minor renamings of internal inline functions + + src/hb-buffer.cc | 4 ++-- + src/hb-dsalgs.hh | 2 +- + src/hb-map-private.hh | 2 +- + src/hb-open-type-private.hh | 4 ++-- + src/hb-ot-cmap-table.hh | 2 +- + src/hb-ot-hdmx-table.hh | 2 +- + src/hb-ot-layout-gpos-table.hh | 4 ++-- + src/hb-ot-layout-gsub-table.hh | 2 +- + src/hb-ot-map.cc | 4 ++-- + src/hb-ot-shape.cc | 4 ++-- + src/hb-private.hh | 27 ++++++++++++++------------- + src/hb-set-private.hh | 6 +++--- + src/hb-subset.cc | 2 +- + 13 files changed, 33 insertions(+), 32 deletions(-) + +commit d652ef299d123f28409e755ed2d2411295293f19 +Author: Behdad Esfahbod +Date: Tue Jul 10 14:05:00 2018 +0200 + + Move hb_vector_t and hb_lockable_set_t to hb-dsalgs.hh + + src/hb-dsalgs.hh | 311 + +++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/hb-private.hh | 315 + ------------------------------------------------------ + 2 files changed, 311 insertions(+), 315 deletions(-) + +commit 9e53b083295ad910a87e778ebd16cbe69ebe2130 +Author: Behdad Esfahbod +Date: Tue Jul 10 14:03:58 2018 +0200 + + Move hb_stable_sort to hb-dsalgs.hh + + Also, include hb-dsalgs.hh from end of hb-pricate.hh + + src/hb-dsalgs.hh | 51 + +++++++++++++++++++++++++++++++++++++++++ + src/hb-ot-os2-unicode-ranges.hh | 1 - + src/hb-ot-post-table.hh | 1 - + src/hb-private.hh | 51 + ++--------------------------------------- + 4 files changed, 53 insertions(+), 51 deletions(-) + +commit 39f11d8e72c6b2568f3b70847c6c9d1f374cd49c +Author: Behdad Esfahbod +Date: Tue Jul 10 14:01:39 2018 +0200 + + Minor + + src/hb-private.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 763f878cc0595162255c58ffe7a82ac1ca51cb0b +Author: Behdad Esfahbod +Date: Tue Jul 10 13:47:41 2018 +0200 + + Fix syntax + + Oops. + + src/hb-private.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 83ea277178544cd7e417bdfb7b600ede94910e13 +Author: Behdad Esfahbod +Date: Tue Jul 10 13:17:27 2018 +0200 + + Add posix_memalign() fallback + + configure.ac | 2 +- + src/hb-private.hh | 40 ++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 41 insertions(+), 1 deletion(-) + +commit 292c100d6141eb2e981fa632602d73768f748727 +Author: Behdad Esfahbod +Date: Tue Jul 10 13:16:52 2018 +0200 + + Always compile (but not use) alignof() and round() fallback codes + + Catches compile-errors in them better. + + src/hb-private.hh | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +commit 27c5317d918971c2fb67c213621a19ac790440e4 +Author: Behdad Esfahbod +Date: Tue Jul 10 13:03:42 2018 +0200 + + Fix alignof impl + + src/hb-private.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit bca83618cda7ee4f683b4685d10db9e1bef4983c +Author: Behdad Esfahbod +Date: Tue Jul 10 12:58:13 2018 +0200 + + Add fallback implementation for constexpr and alignof + + src/hb-private.hh | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +commit 7cb47d0f3f202843ebc7fb8801bf388bb90ba3aa +Author: Behdad Esfahbod +Date: Tue Jul 10 12:51:29 2018 +0200 + + Minor + + src/hb-set-private.hh | 1 + + 1 file changed, 1 insertion(+) + +commit bf9e9676dda686f5b76826b4e3148f4a0b512e3c +Merge: 46d8f0d5 53f73409 +Author: Cosimo Lupo +Date: Mon Jul 9 20:24:22 2018 +0200 + + Merge pull request #1091 from anthrotype/fix-gen-def-py + + gen-def.py: pass headers as arguments so that msys2 can convert + posix paths + +commit 53f73409a91241765ae6a0cadf7600676988b6af +Author: Cosimo Lupo +Date: Mon Jul 9 18:54:23 2018 +0100 + + CMakeLists.txt: don't pass header args as single space-separated + string + + let python's parse command-line args as usual + + CMakeLists.txt | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit 83d2233a5c47cf1feadcdece5bd4a6b498c6ee7a +Author: Cosimo Lupo +Date: Mon Jul 9 18:48:20 2018 +0100 + + CMakeLists.txt: pass headers as arguments to gen-def.py; call using + PYTHON_EXECUTABLE + + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ccdd15655480fe35226c0b757e28d3527fe2e6af +Author: Cosimo Lupo +Date: Mon Jul 9 18:26:44 2018 +0100 + + src/Makefile.am: pass headers to gen-def.py as arguments, not env vars + + src/Makefile.am | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit e3a931ef0b86419b5e4ba17de51535393471ed9d +Author: Cosimo Lupo +Date: Mon Jul 9 18:11:29 2018 +0100 + + gen-def.py: pass headers as arguments so that msys2 can convert + posix paths + + When one is not using the msys2 python, the header files that are + passed in as environment + variable cannot be found. + + https://ci.appveyor.com/project/fonttools/ttfautohint-py/build/1.0.65/job/rkremny4jjid9nl2#L803 + + This is because msys2 shell and make use POSIX paths + (e.g. /c/Users/clupo/...) + whereas non-msys2 python.exe uses native Windows paths + (e.g. C:\Users\clupo\...). + + Msys2 will automatically convert command line arguments (but not + environment variables) from + POSIX to Windows paths when calling a native win32 executable, + so we pass the header paths + as arguments instead of environment variables. + + This way the gen-def.py script can support both mingw python running + in an MSYS2 shell, and + native win32 python. + + src/gen-def.py | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +commit 46d8f0d5521c3dd0b10c78e66153faefdb9046db +Author: David Corbett +Date: Fri Jul 6 15:47:03 2018 -0400 + + Do not enforce a native direction of LTR for Runic + + Fixes #481 + + src/hb-common.cc | 1 + + 1 file changed, 1 insertion(+) + +commit 936dadc6610666aa5781e8662b859f18f9baa636 +Author: David Corbett +Date: Sat Jul 7 11:08:17 2018 -0400 + + Regenerate the USE table for Grantha and Bhaiksuki (#1090) + + Completes #1037 and fixes #1035. + + src/hb-ot-shape-complex-use-table.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 1ebaa090d80bf0b59308d2c70f5e58dd8da47450 +Author: Behdad Esfahbod +Date: Thu Jul 5 14:04:13 2018 +0430 + + Disable vectorization + + Disable vectorization for now. To correctly use them, we should + use posix_memalign() to allocate them. Otherwise, can cause + misaligned access. + + https://bugs.chromium.org/p/chromium/issues/detail?id=860184 + + src/hb-private.hh | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +commit 18a06f8a662ca7a9e63f74c6443e24a035c40655 +Author: Behdad Esfahbod +Date: Thu Jul 5 14:03:48 2018 +0430 + + Fix warning + + ../../src/hb-ot-layout-gsubgpos-private.hh:391:18: warning: + missed loop optimization, the loop counter may overflow + [-Wunsafe-loop-optimizations] + + src/hb-ot-layout-gsubgpos-private.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 058708a665cdd9e796581dbcf60a5778d3f5e240 +Author: Behdad Esfahbod +Date: Thu Jul 5 13:16:00 2018 +0430 + + Allow disabling vector_size use + + src/hb-private.hh | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +commit d8a7dedc83042c5a643195172830acf78f2e59ff +Author: Ebrahim Byagowi +Date: Wed Jul 4 15:33:39 2018 +0430 + + Use CreateFileW explicitly and pass wchar_t to it (#1087) + + src/hb-blob.cc | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +commit 9940504e933d6766f87dca7fccc3c2f889976a22 +Author: Behdad Esfahbod +Date: Tue Jul 3 14:29:25 2018 +0430 + + [indic] Adjust left-matra repositioning and Halant,ZWJ sequence + + From the new code (first paragraph is from the OT Devanagari spec.): + + /* o Reorder matras: + * + * If a pre-base matra character had been reordered before + applying basic + * features, the glyph can be moved closer to the main consonant + based on + * whether half-forms had been formed. Actual position for + the matra is + * defined as “after last standalone halant glyph, after + initial matra + * position and before the main consonant”. If ZWJ or ZWNJ + follow this + * halant, position is moved after it. + * + * IMPLEMENTATION NOTES: + * + * It looks like the last sentence is wrong. Testing, with Windows + 7 Uniscribe + * and Devanagari shows that the behavior is best described as: + * + * "If ZWJ follows this halant, matra is NOT repositioned after + this halant. + * If ZWNJ follows this halant, position is moved after it." + * + * Test case, with Adobe Devanagari or Nirmala UI: + * + * U+091F,U+094D,U+200C,U+092F,U+093F + * (Matra moves to the middle, after ZWNJ.) + * + * U+091F,U+094D,U+200D,U+092F,U+093F + * (Matra does NOT move, stays to the left.) + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1070 + + Test case added with Adobe Devanagari. + + src/hb-ot-shape-complex-indic.cc | 37 + +++++++++++++++++++++ + .../8116e5d8fedfbec74e45dc350d2416d810bed8c4.ttf | Bin 0 -> 4364 bytes + .../data/in-house/tests/indic-joiners.tests | 4 +++ + 3 files changed, 41 insertions(+) + +commit 2cb075fe26201f3e370fccfff6c1bc242b5acc79 +Author: Behdad Esfahbod +Date: Tue Jul 3 13:04:05 2018 +0430 + + Fix unused function '_hb_mapped_file_destroy' if no mmap + + src/hb-blob.cc | 2 ++ + 1 file changed, 2 insertions(+) + +commit 343e8c694b03eea625523229a9468fbb456e3aea +Author: Behdad Esfahbod +Date: Tue Jul 3 12:43:59 2018 +0430 + + 1.8.2 + + NEWS | 8 ++++++++ + configure.ac | 2 +- + src/hb-version.h | 4 ++-- + 3 files changed, 11 insertions(+), 3 deletions(-) + commit 29e7879bcf3fe955a0be3bb41e929e68f39ad01e Author: Behdad Esfahbod Date: Tue Jul 3 12:38:21 2018 +0430 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index c4fad25a928..9031766dba1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,11 @@ +Overview of changes leading to 1.8.3 +Wednesday, July 11, 2018 +==================================== +- A couple of Indic / USE bug fixes. +- Disable vectorization, as it was causing unaligned access bus error on + certain 32bit architectures. + + Overview of changes leading to 1.8.2 Tuesday, July 3, 2018 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in b/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in index c52ceb9bb0a..c2d5c3ad4aa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in +++ b/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in @@ -88,6 +88,9 @@ /* Have native OpenType Layout backend */ #undef HAVE_OT +/* Define to 1 if you have the `posix_memalign' function. */ +#undef HAVE_POSIX_MEMALIGN + /* Have POSIX threads */ #undef HAVE_PTHREAD diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index d6c23e53c01..b6fcfc02a21 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac +++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [1.8.2], + [1.8.3], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) @@ -78,7 +78,7 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl]) ]) # Functions and headers -AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l) +AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l posix_memalign) save_libs="$LIBS" LIBS="$LIBS -lm" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am index 9d5662e4a35..6dfec3bfa70 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am @@ -277,13 +277,13 @@ endif check: $(DEF_FILES) # For check-symbols.sh CLEANFILES += $(DEF_FILES) harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ harfbuzz-subset.def: $(HB_SUBSET_headers) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ harfbuzz-icu.def: $(HB_ICU_headers) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ harfbuzz-gobject.def: $(HB_GOBJECT_headers) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ GENERATORS = \ 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 9a997d65a1b..ba39eaae586 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py @@ -4,8 +4,14 @@ from __future__ import print_function, division, absolute_import import io, os, re, sys +if len (sys.argv) < 3: + sys.exit("usage: gen-def.py harfbuzz.def hb.h [hb-blob.h hb-buffer.h ...]") + +output_file = sys.argv[1] +header_paths = sys.argv[2:] + headers_content = [] -for h in os.environ["headers"].split (' '): +for h in header_paths: if h.endswith (".h"): with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ()) @@ -13,7 +19,7 @@ result = """EXPORTS %s LIBRARY lib%s-0.dll""" % ( "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))), - sys.argv[1].replace ('.def', '') + output_file.replace ('.def', '') ) -with open (sys.argv[1], "w") as f: f.write (result) +with open (output_file, "w") as f: f.write (result) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob-private.hh index b72fa721b89..56a7b668bfc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob-private.hh @@ -31,8 +31,6 @@ #include "hb-private.hh" -#include "hb-object-private.hh" - /* * hb_blob_t diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc index 98e9c65c23d..5bab1abbe9a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc @@ -31,7 +31,6 @@ #endif #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-blob-private.hh" #ifdef HAVE_SYS_MMAN_H @@ -508,6 +507,7 @@ struct hb_mapped_file_t #endif }; +#if (defined(HAVE_MMAP) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_MMAP) static void _hb_mapped_file_destroy (hb_mapped_file_t *file) { @@ -522,6 +522,7 @@ _hb_mapped_file_destroy (hb_mapped_file_t *file) free (file); } +#endif /** * hb_blob_create_from_file: @@ -567,9 +568,15 @@ fail_without_close: hb_mapped_file_t *file = (hb_mapped_file_t *) calloc (1, sizeof (hb_mapped_file_t)); if (unlikely (!file)) return hb_blob_get_empty (); - HANDLE fd = CreateFile (file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED, - nullptr); + HANDLE fd; + unsigned int size = strlen (file_name) + 1; + wchar_t * wchar_file_name = (wchar_t *) malloc (sizeof (wchar_t) * size); + if (unlikely (wchar_file_name == nullptr)) goto fail_without_close; + mbstowcs (wchar_file_name, file_name, size); + fd = CreateFileW (wchar_file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED, + nullptr); + free (wchar_file_name); if (unlikely (fd == INVALID_HANDLE_VALUE)) goto fail_without_close; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh index dd6f1dcd383..f45814070cd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh @@ -31,7 +31,6 @@ #define HB_BUFFER_PRIVATE_HH #include "hb-private.hh" -#include "hb-object-private.hh" #include "hb-unicode-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc index 7b95aea4377..d04e1e80f7c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc @@ -124,14 +124,14 @@ hb_buffer_t::enlarge (unsigned int size) hb_glyph_info_t *new_info = nullptr; bool separate_out = out_info != info; - if (unlikely (_hb_unsigned_int_mul_overflows (size, sizeof (info[0])))) + if (unlikely (hb_unsigned_mul_overflows (size, sizeof (info[0])))) goto done; while (size >= new_allocated) new_allocated += (new_allocated >> 1) + 32; static_assert ((sizeof (info[0]) == sizeof (pos[0])), ""); - if (unlikely (_hb_unsigned_int_mul_overflows (new_allocated, sizeof (info[0])))) + if (unlikely (hb_unsigned_mul_overflows (new_allocated, sizeof (info[0])))) goto done; new_pos = (hb_glyph_position_t *) realloc (pos, new_allocated * sizeof (pos[0])); 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 a67fcf85e3d..243c2163ef1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc @@ -28,8 +28,6 @@ #include "hb-private.hh" -#include "hb-mutex-private.hh" -#include "hb-object-private.hh" #include #ifdef HAVE_XLOCALE_H @@ -545,6 +543,7 @@ hb_script_get_horizontal_direction (hb_script_t script) /* https://github.com/harfbuzz/harfbuzz/issues/1000 */ case HB_SCRIPT_OLD_ITALIC: + case HB_SCRIPT_RUNIC: return HB_DIRECTION_INVALID; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index 61f9c35a110..3bdc3f784cd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -29,7 +29,6 @@ #define HB_SHAPER coretext #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-shaper-impl-private.hh" #include "hb-coretext.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh index c244347b348..ae0b6774d80 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh @@ -28,6 +28,7 @@ #define HB_DEBUG_HH #include "hb-private.hh" +#include "hb-dsalgs.hh" #ifndef HB_DEBUG diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc index 187ab3f9da9..7c688494f07 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc @@ -23,7 +23,6 @@ */ #include "hb-private.hh" -#include "hb-debug.hh" #define HB_SHAPER directwrite #include "hb-shaper-impl-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh index 9586871947f..6a8ddaa995b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh @@ -30,6 +30,243 @@ #include "hb-private.hh" +/* Void! For when we need a expression-type of void. */ +typedef const struct _hb_void_t *hb_void_t; +#define HB_VOID ((const _hb_void_t *) nullptr) + + +/* + * Bithacks. + */ + +/* Return the number of 1 bits in v. */ +template +static inline HB_CONST_FUNC unsigned int +hb_popcount (T v) +{ +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && defined(__OPTIMIZE__) + if (sizeof (T) <= sizeof (unsigned int)) + return __builtin_popcount (v); + + if (sizeof (T) <= sizeof (unsigned long)) + return __builtin_popcountl (v); + + if (sizeof (T) <= sizeof (unsigned long long)) + return __builtin_popcountll (v); +#endif + + if (sizeof (T) <= 4) + { + /* "HACKMEM 169" */ + uint32_t y; + y = (v >> 1) &033333333333; + y = v - y - ((y >>1) & 033333333333); + return (((y + (y >> 3)) & 030707070707) % 077); + } + + if (sizeof (T) == 8) + { + unsigned int shift = 32; + return hb_popcount ((uint32_t) v) + hb_popcount ((uint32_t) (v >> shift)); + } + + if (sizeof (T) == 16) + { + unsigned int shift = 64; + return hb_popcount ((uint64_t) v) + hb_popcount ((uint64_t) (v >> shift)); + } + + assert (0); + return 0; /* Shut up stupid compiler. */ +} + +/* Returns the number of bits needed to store number */ +template +static inline HB_CONST_FUNC unsigned int +hb_bit_storage (T v) +{ + if (unlikely (!v)) return 0; + +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) + if (sizeof (T) <= sizeof (unsigned int)) + return sizeof (unsigned int) * 8 - __builtin_clz (v); + + if (sizeof (T) <= sizeof (unsigned long)) + return sizeof (unsigned long) * 8 - __builtin_clzl (v); + + if (sizeof (T) <= sizeof (unsigned long long)) + return sizeof (unsigned long long) * 8 - __builtin_clzll (v); +#endif + +#if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__) + if (sizeof (T) <= sizeof (unsigned int)) + { + unsigned long where; + _BitScanReverse (&where, v); + return 1 + where; + } +# if _WIN64 + if (sizeof (T) <= 8) + { + unsigned long where; + _BitScanReverse64 (&where, v); + return 1 + where; + } +# endif +#endif + + if (sizeof (T) <= 4) + { + /* "bithacks" */ + const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; + const unsigned int S[] = {1, 2, 4, 8, 16}; + unsigned int r = 0; + for (int i = 4; i >= 0; i--) + if (v & b[i]) + { + v >>= S[i]; + r |= S[i]; + } + return r + 1; + } + if (sizeof (T) <= 8) + { + /* "bithacks" */ + const uint64_t b[] = {0x2ULL, 0xCULL, 0xF0ULL, 0xFF00ULL, 0xFFFF0000ULL, 0xFFFFFFFF00000000ULL}; + const unsigned int S[] = {1, 2, 4, 8, 16, 32}; + unsigned int r = 0; + for (int i = 5; i >= 0; i--) + if (v & b[i]) + { + v >>= S[i]; + r |= S[i]; + } + return r + 1; + } + if (sizeof (T) == 16) + { + unsigned int shift = 64; + return (v >> shift) ? hb_bit_storage ((uint64_t) (v >> shift)) + shift : + hb_bit_storage ((uint64_t) v); + } + + assert (0); + return 0; /* Shut up stupid compiler. */ +} + +/* Returns the number of zero bits in the least significant side of v */ +template +static inline HB_CONST_FUNC unsigned int +hb_ctz (T v) +{ + if (unlikely (!v)) return 0; + +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) + if (sizeof (T) <= sizeof (unsigned int)) + return __builtin_ctz (v); + + if (sizeof (T) <= sizeof (unsigned long)) + return __builtin_ctzl (v); + + if (sizeof (T) <= sizeof (unsigned long long)) + return __builtin_ctzll (v); +#endif + +#if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__) + if (sizeof (T) <= sizeof (unsigned int)) + { + unsigned long where; + _BitScanForward (&where, v); + return where; + } +# if _WIN64 + if (sizeof (T) <= 8) + { + unsigned long where; + _BitScanForward64 (&where, v); + return where; + } +# endif +#endif + + if (sizeof (T) <= 4) + { + /* "bithacks" */ + unsigned int c = 32; + v &= - (int32_t) v; + if (v) c--; + if (v & 0x0000FFFF) c -= 16; + if (v & 0x00FF00FF) c -= 8; + if (v & 0x0F0F0F0F) c -= 4; + if (v & 0x33333333) c -= 2; + if (v & 0x55555555) c -= 1; + return c; + } + if (sizeof (T) <= 8) + { + /* "bithacks" */ + unsigned int c = 64; + v &= - (int64_t) (v); + if (v) c--; + if (v & 0x00000000FFFFFFFFULL) c -= 32; + if (v & 0x0000FFFF0000FFFFULL) c -= 16; + if (v & 0x00FF00FF00FF00FFULL) c -= 8; + if (v & 0x0F0F0F0F0F0F0F0FULL) c -= 4; + if (v & 0x3333333333333333ULL) c -= 2; + if (v & 0x5555555555555555ULL) c -= 1; + return c; + } + if (sizeof (T) == 16) + { + unsigned int shift = 64; + return (uint64_t) v ? hb_bit_storage ((uint64_t) v) : + hb_bit_storage ((uint64_t) (v >> shift)) + shift; + } + + assert (0); + return 0; /* Shut up stupid compiler. */ +} + + +/* + * Tiny stuff. + */ + +#undef MIN +template +static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; } + +#undef MAX +template +static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; } + +static inline unsigned int DIV_CEIL (const unsigned int a, unsigned int b) +{ return (a + (b - 1)) / b; } + + +#undef ARRAY_LENGTH +template +static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; } +/* A const version, but does not detect erratically being called on pointers. */ +#define ARRAY_LENGTH_CONST(__array) ((signed int) (sizeof (__array) / sizeof (__array[0]))) + +static inline bool +hb_unsigned_mul_overflows (unsigned int count, unsigned int size) +{ + return (size > 0) && (count >= ((unsigned int) -1) / size); +} + +static inline unsigned int +hb_ceil_to_4 (unsigned int v) +{ + return ((v - 1) | 3) + 1; +} + + +/* + * Sort and search. + */ + static inline void * hb_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size, @@ -53,7 +290,6 @@ hb_bsearch_r (const void *key, const void *base, } - /* From https://github.com/noporpoise/sort_r */ /* Isaac Turner 29 April 2014 Public Domain */ @@ -158,4 +394,471 @@ static inline void hb_sort_r(void *base, size_t nel, size_t width, sort_r_simple(base, nel, width, compar, arg); } + +template static inline void +hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *), T2 *array2) +{ + for (unsigned int i = 1; i < len; i++) + { + unsigned int j = i; + while (j && compar (&array[j - 1], &array[i]) > 0) + j--; + if (i == j) + continue; + /* Move item i to occupy place for item j, shift what's in between. */ + { + T t = array[i]; + memmove (&array[j + 1], &array[j], (i - j) * sizeof (T)); + array[j] = t; + } + if (array2) + { + T2 t = array2[i]; + memmove (&array2[j + 1], &array2[j], (i - j) * sizeof (T2)); + array2[j] = t; + } + } +} + +template static inline void +hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *)) +{ + hb_stable_sort (array, len, compar, (int *) nullptr); +} + +static inline hb_bool_t +hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *out) +{ + /* Pain because we don't know whether s is nul-terminated. */ + char buf[64]; + len = MIN (ARRAY_LENGTH (buf) - 1, len); + strncpy (buf, s, len); + buf[len] = '\0'; + + char *end; + errno = 0; + unsigned long v = strtoul (buf, &end, base); + if (errno) return false; + if (*end) return false; + *out = v; + return true; +} + + +#define HB_VECTOR_INIT {0, 0, false, nullptr} +template +struct hb_vector_t +{ + unsigned int len; + unsigned int allocated; + bool successful; + Type *arrayZ; + Type static_array[StaticSize]; + + void init (void) + { + len = 0; + allocated = ARRAY_LENGTH (static_array); + successful = true; + arrayZ = static_array; + } + + inline Type& operator [] (unsigned int i) + { + if (unlikely (i >= len)) + return Crap (Type); + return arrayZ[i]; + } + inline const Type& operator [] (unsigned int i) const + { + if (unlikely (i >= len)) + return Null(Type); + return arrayZ[i]; + } + + inline Type *push (void) + { + if (unlikely (!resize (len + 1))) + return &Crap(Type); + return &arrayZ[len - 1]; + } + inline Type *push (const Type& v) + { + Type *p = push (); + *p = v; + return p; + } + + /* Allocate for size but don't adjust len. */ + inline bool alloc (unsigned int size) + { + if (unlikely (!successful)) + return false; + + if (likely (size <= allocated)) + return true; + + /* Reallocate */ + + unsigned int new_allocated = allocated; + while (size >= new_allocated) + new_allocated += (new_allocated >> 1) + 8; + + Type *new_array = nullptr; + + if (arrayZ == static_array) + { + new_array = (Type *) calloc (new_allocated, sizeof (Type)); + if (new_array) + memcpy (new_array, arrayZ, len * sizeof (Type)); + } + else + { + bool overflows = (new_allocated < allocated) || hb_unsigned_mul_overflows (new_allocated, sizeof (Type)); + if (likely (!overflows)) + new_array = (Type *) realloc (arrayZ, new_allocated * sizeof (Type)); + } + + if (unlikely (!new_array)) + { + successful = false; + return false; + } + + arrayZ = new_array; + allocated = new_allocated; + + return true; + } + + inline bool resize (int size_) + { + unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; + if (!alloc (size)) + return false; + + if (size > len) + memset (arrayZ + len, 0, (size - len) * sizeof (*arrayZ)); + + len = size; + return true; + } + + inline void pop (void) + { + if (!len) return; + len--; + } + + inline void remove (unsigned int i) + { + if (unlikely (i >= len)) + return; + memmove (static_cast (&arrayZ[i]), + static_cast (&arrayZ[i + 1]), + (len - i - 1) * sizeof (Type)); + len--; + } + + inline void shrink (int size_) + { + unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; + if (size < len) + len = size; + } + + template + inline Type *find (T v) { + for (unsigned int i = 0; i < len; i++) + if (arrayZ[i] == v) + return &arrayZ[i]; + return nullptr; + } + template + inline const Type *find (T v) const { + for (unsigned int i = 0; i < len; i++) + if (arrayZ[i] == v) + return &arrayZ[i]; + return nullptr; + } + + inline void qsort (int (*cmp)(const void*, const void*)) + { + ::qsort (arrayZ, len, sizeof (Type), cmp); + } + + inline void qsort (void) + { + ::qsort (arrayZ, len, sizeof (Type), Type::cmp); + } + + inline void qsort (unsigned int start, unsigned int end) + { + ::qsort (arrayZ + start, end - start, sizeof (Type), Type::cmp); + } + + template + inline Type *lsearch (const T &x) + { + for (unsigned int i = 0; i < len; i++) + if (0 == this->arrayZ[i].cmp (&x)) + return &arrayZ[i]; + return nullptr; + } + + template + inline Type *bsearch (const T &x) + { + unsigned int i; + return bfind (x, &i) ? &arrayZ[i] : nullptr; + } + template + inline const Type *bsearch (const T &x) const + { + unsigned int i; + return bfind (x, &i) ? &arrayZ[i] : nullptr; + } + template + inline bool bfind (const T &x, unsigned int *i) const + { + int min = 0, max = (int) this->len - 1; + while (min <= max) + { + int mid = (min + max) / 2; + int c = this->arrayZ[mid].cmp (&x); + if (c < 0) + max = mid - 1; + else if (c > 0) + min = mid + 1; + else + { + *i = mid; + return true; + } + } + if (max < 0 || (max < (int) this->len && this->arrayZ[max].cmp (&x) > 0)) + max++; + *i = max; + return false; + } + + inline void fini (void) + { + if (arrayZ != static_array) + free (arrayZ); + arrayZ = nullptr; + allocated = len = 0; + } +}; + + +#define HB_LOCKABLE_SET_INIT {HB_VECTOR_INIT} +template +struct hb_lockable_set_t +{ + hb_vector_t items; + + inline void init (void) { items.init (); } + + template + inline item_t *replace_or_insert (T v, lock_t &l, bool replace) + { + l.lock (); + item_t *item = items.find (v); + if (item) { + if (replace) { + item_t old = *item; + *item = v; + l.unlock (); + old.fini (); + } + else { + item = nullptr; + l.unlock (); + } + } else { + item = items.push (v); + l.unlock (); + } + return item; + } + + template + inline void remove (T v, lock_t &l) + { + l.lock (); + item_t *item = items.find (v); + if (item) { + item_t old = *item; + *item = items[items.len - 1]; + items.pop (); + l.unlock (); + old.fini (); + } else { + l.unlock (); + } + } + + template + inline bool find (T v, item_t *i, lock_t &l) + { + l.lock (); + item_t *item = items.find (v); + if (item) + *i = *item; + l.unlock (); + return !!item; + } + + template + inline item_t *find_or_insert (T v, lock_t &l) + { + l.lock (); + item_t *item = items.find (v); + if (!item) { + item = items.push (v); + } + l.unlock (); + return item; + } + + inline void fini (lock_t &l) + { + if (!items.len) { + /* No need for locking. */ + items.fini (); + return; + } + l.lock (); + while (items.len) { + item_t old = items[items.len - 1]; + items.pop (); + l.unlock (); + old.fini (); + l.lock (); + } + items.fini (); + l.unlock (); + } + +}; + + +template +struct hb_auto_t : Type +{ + hb_auto_t (void) { Type::init (); } + ~hb_auto_t (void) { Type::fini (); } + private: /* Hide */ + void init (void) {} + void fini (void) {} +}; + +struct hb_bytes_t +{ + inline hb_bytes_t (void) : bytes (nullptr), len (0) {} + inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {} + + inline int cmp (const hb_bytes_t &a) const + { + if (len != a.len) + return (int) a.len - (int) len; + + return memcmp (a.bytes, bytes, len); + } + static inline int cmp (const void *pa, const void *pb) + { + hb_bytes_t *a = (hb_bytes_t *) pa; + hb_bytes_t *b = (hb_bytes_t *) pb; + return b->cmp (*a); + } + + const char *bytes; + unsigned int len; +}; + + +struct HbOpOr +{ + static const bool passthru_left = true; + static const bool passthru_right = true; + template static void process (T &o, const T &a, const T &b) { o = a | b; } +}; +struct HbOpAnd +{ + static const bool passthru_left = false; + static const bool passthru_right = false; + template static void process (T &o, const T &a, const T &b) { o = a & b; } +}; +struct HbOpMinus +{ + static const bool passthru_left = true; + static const bool passthru_right = false; + template static void process (T &o, const T &a, const T &b) { o = a & ~b; } +}; +struct HbOpXor +{ + static const bool passthru_left = true; + static const bool passthru_right = true; + template static void process (T &o, const T &a, const T &b) { o = a ^ b; } +}; + + +/* Compiler-assisted vectorization. */ + +/* Type behaving similar to vectorized vars defined using __attribute__((vector_size(...))), + * using vectorized operations if HB_VECTOR_SIZE is set to **bit** numbers (eg 128). + * Define that to 0 to disable. */ +template +struct hb_vector_size_t +{ + elt_t& operator [] (unsigned int i) { return u.v[i]; } + const elt_t& operator [] (unsigned int i) const { return u.v[i]; } + + template + inline hb_vector_size_t process (const hb_vector_size_t &o) const + { + hb_vector_size_t r; +#if HB_VECTOR_SIZE + if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE) + for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++) + Op::process (r.u.vec[i], u.vec[i], o.u.vec[i]); + else +#endif + for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++) + Op::process (r.u.v[i], u.v[i], o.u.v[i]); + return r; + } + inline hb_vector_size_t operator | (const hb_vector_size_t &o) const + { return process (o); } + inline hb_vector_size_t operator & (const hb_vector_size_t &o) const + { return process (o); } + inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const + { return process (o); } + inline hb_vector_size_t operator ~ () const + { + hb_vector_size_t r; +#if HB_VECTOR_SIZE && 0 + if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE) + for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++) + r.u.vec[i] = ~u.vec[i]; + else +#endif + for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++) + r.u.v[i] = ~u.v[i]; + return r; + } + + private: + static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size, ""); + union { + elt_t v[byte_size / sizeof (elt_t)]; +#if HB_VECTOR_SIZE + typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8))); + vec_t vec[byte_size / sizeof (vec_t)]; +#endif + } u; +}; + + #endif /* HB_DSALGS_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh index 43e7b1cb3ff..fe3b8b240c8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh @@ -31,7 +31,6 @@ #include "hb-private.hh" -#include "hb-object-private.hh" #include "hb-shaper-private.hh" #include "hb-shape-plan-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh index 7ba16cdefaf..9f657db6062 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh @@ -31,7 +31,6 @@ #include "hb-private.hh" -#include "hb-object-private.hh" #include "hb-face-private.hh" #include "hb-shaper-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc index 7caafba839f..6670d9a60de 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc @@ -28,7 +28,6 @@ */ #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-ft.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh index d3d4ddeda70..00f089e8151 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh @@ -28,7 +28,6 @@ #define HB_MAP_PRIVATE_HH #include "hb-private.hh" -#include "hb-object-private.hh" template @@ -89,7 +88,7 @@ struct hb_map_t { if (unlikely (!successful)) return false; - unsigned int power = _hb_bit_storage (population * 2 + 8); + unsigned int power = hb_bit_storage (population * 2 + 8); unsigned int new_size = 1u << power; item_t *new_items = (item_t *) malloc ((size_t) new_size * sizeof (item_t)); if (unlikely (!new_items)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh index fc48a91b755..fcdc9256d9b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh @@ -33,8 +33,6 @@ #define HB_OBJECT_PRIVATE_HH #include "hb-private.hh" -#include "hb-debug.hh" - #include "hb-atomic-private.hh" #include "hb-mutex-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh index 9a4835b8920..207f6e0e204 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh @@ -30,7 +30,6 @@ #define HB_OPEN_TYPE_PRIVATE_HH #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-blob-private.hh" #include "hb-face-private.hh" @@ -230,7 +229,7 @@ struct hb_sanitize_context_t : inline bool check_array (const void *base, unsigned int record_size, unsigned int len) const { const char *p = (const char *) base; - bool overflows = _hb_unsigned_int_mul_overflows (len, record_size); + bool overflows = hb_unsigned_mul_overflows (len, record_size); unsigned int array_size = record_size * len; bool ok = !overflows && this->check_range (base, array_size); @@ -1178,7 +1177,7 @@ struct BinSearchHeader { len.set (v); assert (len == v); - entrySelector.set (MAX (1u, _hb_bit_storage (v)) - 1); + entrySelector.set (MAX (1u, hb_bit_storage (v)) - 1); searchRange.set (16 * (1u << entrySelector)); rangeShift.set (v * 16 > searchRange ? 16 * v - searchRange diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh index c1903f6e303..0ea37209a5a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh @@ -89,7 +89,7 @@ struct CmapSubtableFormat4 this->length.set (get_sub_table_size (segments)); this->segCountX2.set (segments.len * 2); - this->entrySelector.set (MAX (1u, _hb_bit_storage (segments.len)) - 1); + this->entrySelector.set (MAX (1u, hb_bit_storage (segments.len)) - 1); this->searchRange.set (2 * (1u << this->entrySelector)); this->rangeShift.set (segments.len * 2 > this->searchRange ? 2 * segments.len - this->searchRange diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh index d406e3e21cd..0951871ce97 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh @@ -199,7 +199,7 @@ struct hdmx { TRACE_SANITIZE (this); return_trace (c->check_struct (this) && version == 0 && - !_hb_unsigned_int_mul_overflows (num_records, size_device_record) && + !hb_unsigned_mul_overflows (num_records, size_device_record) && size_device_record >= DeviceRecord::min_size && c->check_range (this, get_size())); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh index ff9c5650f69..21a8382c3a8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh @@ -30,7 +30,6 @@ #define HB_OT_LAYOUT_COMMON_PRIVATE_HH #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-ot-layout-private.hh" #include "hb-open-type-private.hh" #include "hb-set-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh index 182c8d90984..b52c0144f14 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh @@ -99,7 +99,7 @@ struct ValueFormat : HBUINT16 #endif inline unsigned int get_len (void) const - { return _hb_popcount ((unsigned int) *this); } + { return hb_popcount ((unsigned int) *this); } inline unsigned int get_size (void) const { return get_len () * Value::static_size; } @@ -374,7 +374,7 @@ struct AnchorMatrix { TRACE_SANITIZE (this); if (!c->check_struct (this)) return_trace (false); - if (unlikely (_hb_unsigned_int_mul_overflows (rows, cols))) return_trace (false); + if (unlikely (hb_unsigned_mul_overflows (rows, cols))) return_trace (false); unsigned int count = rows * cols; if (!c->check_array (matrixZ, matrixZ[0].static_size, count)) return_trace (false); for (unsigned int i = 0; i < count; i++) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh index bd72fe6bf6c..91b898b63af 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh @@ -511,7 +511,7 @@ struct AlternateSubstFormat1 hb_mask_t lookup_mask = c->lookup_mask; /* Note: This breaks badly if two features enabled this lookup together. */ - unsigned int shift = _hb_ctz (lookup_mask); + unsigned int shift = hb_ctz (lookup_mask); unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift); if (unlikely (alt_index > alt_set.len || alt_index == 0)) return_trace (false); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh index 661085d515b..aed00f15121 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh @@ -30,7 +30,6 @@ #define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-buffer-private.hh" #include "hb-map-private.hh" #include "hb-ot-layout-gdef-table.hh" @@ -388,7 +387,7 @@ struct hb_ot_apply_context_t : inline bool prev (void) { assert (num_items > 0); - while (idx >= num_items) + while (idx > num_items - 1) { idx--; const hb_glyph_info_t &info = c->buffer->out_info[idx]; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc index 46bf2db0c08..f26cac9b102 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc @@ -145,7 +145,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, { static_assert ((!(HB_GLYPH_FLAG_DEFINED & (HB_GLYPH_FLAG_DEFINED + 1))), ""); unsigned int global_bit_mask = HB_GLYPH_FLAG_DEFINED + 1; - unsigned int global_bit_shift = _hb_popcount (HB_GLYPH_FLAG_DEFINED); + unsigned int global_bit_shift = hb_popcount (HB_GLYPH_FLAG_DEFINED); m.global_mask = global_bit_mask; @@ -209,7 +209,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, bits_needed = 0; else /* Limit to 8 bits per feature. */ - bits_needed = MIN(8u, _hb_bit_storage (info->max_value)); + bits_needed = MIN(8u, hb_bit_storage (info->max_value)); if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t)) continue; /* Feature disabled, or not enough bits. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh index 9b32cfabbc8..cb1260784d5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh @@ -28,7 +28,6 @@ #define HB_OT_OS2_UNICODE_RANGES_HH #include "hb-private.hh" -#include "hb-dsalgs.hh" namespace OT { 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 5f42751d89d..d05fc091c4e 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 @@ -28,7 +28,6 @@ #define HB_OT_POST_TABLE_HH #include "hb-open-type-private.hh" -#include "hb-dsalgs.hh" #include "hb-subset-plan.hh" #define HB_STRING_ARRAY_NAME format1_names diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc index 124a67f3271..b1cba1c711d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc @@ -25,7 +25,6 @@ */ #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-ot-shape-complex-arabic-private.hh" #include "hb-ot-shape-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc index 8377dae979a..b8d9a3acf0a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc @@ -1127,6 +1127,24 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * defined as “after last standalone halant glyph, after initial matra * position and before the main consonant”. If ZWJ or ZWNJ follow this * halant, position is moved after it. + * + * IMPLEMENTATION NOTES: + * + * It looks like the last sentence is wrong. Testing, with Windows 7 Uniscribe + * and Devanagari shows that the behavior is best described as: + * + * "If ZWJ follows this halant, matra is NOT repositioned after this halant. + * If ZWNJ follows this halant, position is moved after it." + * + * Test case, with Adobe Devanagari or Nirmala UI: + * + * U+091F,U+094D,U+200C,U+092F,U+093F + * (Matra moves to the middle, after ZWNJ.) + * + * U+091F,U+094D,U+200D,U+092F,U+093F + * (Matra does NOT move, stays to the left.) + * + * https://github.com/harfbuzz/harfbuzz/issues/1070 */ if (start + 1 < end && start < base) /* Otherwise there can't be any pre-base matra characters. */ @@ -1140,6 +1158,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, */ if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL) { + search: while (new_pos > start && !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H))))) new_pos--; @@ -1150,9 +1169,27 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (is_halant (info[new_pos]) && info[new_pos].indic_position() != POS_PRE_M) { +#if 0 // See comment above /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ if (new_pos + 1 < end && is_joiner (info[new_pos + 1])) new_pos++; +#endif + if (new_pos + 1 < end) + { + /* -> If ZWJ follows this halant, matra is NOT repositioned after this halant. */ + if (info[new_pos + 1].indic_category() == OT_ZWJ) + { + /* Keep searching. */ + if (new_pos > start) + { + new_pos--; + goto search; + } + } + /* -> If ZWNJ follows this halant, position is moved after it. */ + if (info[new_pos + 1].indic_category() == OT_ZWNJ) + new_pos++; + } } else new_pos = start; /* No move. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc index 14315338cf2..25f7bf42709 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc @@ -560,7 +560,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* Grantha */ - /* 11300 */ VMAbv, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, O, B, + /* 11300 */ VMAbv, VMAbv, VMAbv, VMPst, O, B, B, B, B, B, B, B, B, O, O, B, /* 11310 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11320 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, /* 11330 */ B, O, B, B, O, B, B, B, B, B, O, CMBlw, CMBlw, B, VPst, VPst, @@ -673,7 +673,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11C10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11C20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VPst, /* 11C30 */ VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VBlw, O, VAbv, VAbv, VAbv, VAbv, VMAbv, VMAbv, VMPst, H, - /* 11C40 */ B, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 11C40 */ B, O, O, O, GB, GB, O, O, O, O, O, O, O, O, O, O, /* 11C50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11C60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc index 36e0bf9c3cf..1189b2075b2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc @@ -829,12 +829,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) { c->buffer->deallocate_var_all (); c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT; - if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR))) + if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR))) { c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR, (unsigned) HB_BUFFER_MAX_LEN_MIN); } - if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR))) + if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR))) { c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR, (unsigned) HB_BUFFER_MAX_OPS_MIN); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh index 91162f93a8a..ff339df4dca 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh @@ -58,6 +58,7 @@ #define HB_PASTE1(a,b) a##b #define HB_PASTE(a,b) HB_PASTE1(a,b) + /* Compile-time custom allocator support. */ #if defined(hb_malloc_impl) \ @@ -72,18 +73,41 @@ extern "C" void hb_free_impl(void *ptr); #define calloc hb_calloc_impl #define realloc hb_realloc_impl #define free hb_free_impl + +#if defined(hb_memalign_impl) +extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size); +#define posix_memalign hb_memalign_impl +#else +#undef HAVE_POSIX_MEMALIGN +#endif + #endif /* Compiler attributes */ +template +struct _hb_alignof +{ + struct s + { + char c; + T t; + }; + static constexpr unsigned int value = offsetof (s, t); +}; + #if __cplusplus < 201103L #ifndef nullptr #define nullptr NULL #endif +#ifndef constexpr +#define constexpr const +#endif + // Static assertions #ifndef static_assert #define static_assert(e, msg) \ @@ -98,6 +122,10 @@ extern "C" void hb_free_impl(void *ptr); #define thread_local #endif +#ifndef alignof +#define alignof(x) (_hb_alignof::value) +#endif // alignof + #endif // __cplusplus < 201103L #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) @@ -251,26 +279,6 @@ static int errno = 0; /* Use something better? */ # undef HB_USE_ATEXIT #endif -/* Basics */ - -#undef MIN -template -static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; } - -#undef MAX -template -static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; } - -static inline unsigned int DIV_CEIL (const unsigned int a, unsigned int b) -{ return (a + (b - 1)) / b; } - - -#undef ARRAY_LENGTH -template -static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; } -/* A const version, but does not detect erratically being called on pointers. */ -#define ARRAY_LENGTH_CONST(__array) ((signed int) (sizeof (__array) / sizeof (__array[0]))) - #define HB_STMT_START do #define HB_STMT_END while (0) @@ -322,223 +330,6 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); # define ASSERT_POD() _ASSERT_POD0 (__LINE__) - -/* Tiny functions */ - -/* - * Void! - */ -typedef const struct _hb_void_t *hb_void_t; -#define HB_VOID ((const _hb_void_t *) nullptr) - -/* Return the number of 1 bits in v. */ -template -static inline HB_CONST_FUNC unsigned int -_hb_popcount (T v) -{ -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && defined(__OPTIMIZE__) - if (sizeof (T) <= sizeof (unsigned int)) - return __builtin_popcount (v); - - if (sizeof (T) <= sizeof (unsigned long)) - return __builtin_popcountl (v); - - if (sizeof (T) <= sizeof (unsigned long long)) - return __builtin_popcountll (v); -#endif - - if (sizeof (T) <= 4) - { - /* "HACKMEM 169" */ - uint32_t y; - y = (v >> 1) &033333333333; - y = v - y - ((y >>1) & 033333333333); - return (((y + (y >> 3)) & 030707070707) % 077); - } - - if (sizeof (T) == 8) - { - unsigned int shift = 32; - return _hb_popcount ((uint32_t) v) + _hb_popcount ((uint32_t) (v >> shift)); - } - - if (sizeof (T) == 16) - { - unsigned int shift = 64; - return _hb_popcount ((uint64_t) v) + _hb_popcount ((uint64_t) (v >> shift)); - } - - assert (0); - return 0; /* Shut up stupid compiler. */ -} - -/* Returns the number of bits needed to store number */ -template -static inline HB_CONST_FUNC unsigned int -_hb_bit_storage (T v) -{ - if (unlikely (!v)) return 0; - -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) - if (sizeof (T) <= sizeof (unsigned int)) - return sizeof (unsigned int) * 8 - __builtin_clz (v); - - if (sizeof (T) <= sizeof (unsigned long)) - return sizeof (unsigned long) * 8 - __builtin_clzl (v); - - if (sizeof (T) <= sizeof (unsigned long long)) - return sizeof (unsigned long long) * 8 - __builtin_clzll (v); -#endif - -#if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__) - if (sizeof (T) <= sizeof (unsigned int)) - { - unsigned long where; - _BitScanReverse (&where, v); - return 1 + where; - } -# if _WIN64 - if (sizeof (T) <= 8) - { - unsigned long where; - _BitScanReverse64 (&where, v); - return 1 + where; - } -# endif -#endif - - if (sizeof (T) <= 4) - { - /* "bithacks" */ - const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; - const unsigned int S[] = {1, 2, 4, 8, 16}; - unsigned int r = 0; - for (int i = 4; i >= 0; i--) - if (v & b[i]) - { - v >>= S[i]; - r |= S[i]; - } - return r + 1; - } - if (sizeof (T) <= 8) - { - /* "bithacks" */ - const uint64_t b[] = {0x2ULL, 0xCULL, 0xF0ULL, 0xFF00ULL, 0xFFFF0000ULL, 0xFFFFFFFF00000000ULL}; - const unsigned int S[] = {1, 2, 4, 8, 16, 32}; - unsigned int r = 0; - for (int i = 5; i >= 0; i--) - if (v & b[i]) - { - v >>= S[i]; - r |= S[i]; - } - return r + 1; - } - if (sizeof (T) == 16) - { - unsigned int shift = 64; - return (v >> shift) ? _hb_bit_storage ((uint64_t) (v >> shift)) + shift : - _hb_bit_storage ((uint64_t) v); - } - - assert (0); - return 0; /* Shut up stupid compiler. */ -} - -/* Returns the number of zero bits in the least significant side of v */ -template -static inline HB_CONST_FUNC unsigned int -_hb_ctz (T v) -{ - if (unlikely (!v)) return 0; - -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) - if (sizeof (T) <= sizeof (unsigned int)) - return __builtin_ctz (v); - - if (sizeof (T) <= sizeof (unsigned long)) - return __builtin_ctzl (v); - - if (sizeof (T) <= sizeof (unsigned long long)) - return __builtin_ctzll (v); -#endif - -#if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__) - if (sizeof (T) <= sizeof (unsigned int)) - { - unsigned long where; - _BitScanForward (&where, v); - return where; - } -# if _WIN64 - if (sizeof (T) <= 8) - { - unsigned long where; - _BitScanForward64 (&where, v); - return where; - } -# endif -#endif - - if (sizeof (T) <= 4) - { - /* "bithacks" */ - unsigned int c = 32; - v &= - (int32_t) v; - if (v) c--; - if (v & 0x0000FFFF) c -= 16; - if (v & 0x00FF00FF) c -= 8; - if (v & 0x0F0F0F0F) c -= 4; - if (v & 0x33333333) c -= 2; - if (v & 0x55555555) c -= 1; - return c; - } - if (sizeof (T) <= 8) - { - /* "bithacks" */ - unsigned int c = 64; - v &= - (int64_t) (v); - if (v) c--; - if (v & 0x00000000FFFFFFFFULL) c -= 32; - if (v & 0x0000FFFF0000FFFFULL) c -= 16; - if (v & 0x00FF00FF00FF00FFULL) c -= 8; - if (v & 0x0F0F0F0F0F0F0F0FULL) c -= 4; - if (v & 0x3333333333333333ULL) c -= 2; - if (v & 0x5555555555555555ULL) c -= 1; - return c; - } - if (sizeof (T) == 16) - { - unsigned int shift = 64; - return (uint64_t) v ? _hb_bit_storage ((uint64_t) v) : - _hb_bit_storage ((uint64_t) v >> shift) + shift; - } - - assert (0); - return 0; /* Shut up stupid compiler. */ -} - -static inline bool -_hb_unsigned_int_mul_overflows (unsigned int count, unsigned int size) -{ - return (size > 0) && (count >= ((unsigned int) -1) / size); -} - -static inline unsigned int -_hb_ceil_to_4 (unsigned int v) -{ - return ((v - 1) | 3) + 1; -} - - - -/* - * - * Utility types - * - */ - #define HB_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) @@ -620,321 +411,6 @@ struct CrapOrNull { #define CrapOrNull(Type) CrapOrNull::get () - -/* arrays and maps */ - - -#define HB_PREALLOCED_ARRAY_INIT {0, 0, nullptr} -template -struct hb_vector_t -{ - unsigned int len; - unsigned int allocated; - bool successful; - Type *arrayZ; - Type static_array[StaticSize]; - - void init (void) - { - len = 0; - allocated = ARRAY_LENGTH (static_array); - successful = true; - arrayZ = static_array; - } - - inline Type& operator [] (unsigned int i) - { - if (unlikely (i >= len)) - return Crap (Type); - return arrayZ[i]; - } - inline const Type& operator [] (unsigned int i) const - { - if (unlikely (i >= len)) - return Null(Type); - return arrayZ[i]; - } - - inline Type *push (void) - { - if (unlikely (!resize (len + 1))) - return &Crap(Type); - return &arrayZ[len - 1]; - } - inline Type *push (const Type& v) - { - Type *p = push (); - *p = v; - return p; - } - - /* Allocate for size but don't adjust len. */ - inline bool alloc (unsigned int size) - { - if (unlikely (!successful)) - return false; - - if (likely (size <= allocated)) - return true; - - /* Reallocate */ - - unsigned int new_allocated = allocated; - while (size >= new_allocated) - new_allocated += (new_allocated >> 1) + 8; - - Type *new_array = nullptr; - - if (arrayZ == static_array) - { - new_array = (Type *) calloc (new_allocated, sizeof (Type)); - if (new_array) - memcpy (new_array, arrayZ, len * sizeof (Type)); - } - else - { - bool overflows = (new_allocated < allocated) || _hb_unsigned_int_mul_overflows (new_allocated, sizeof (Type)); - if (likely (!overflows)) - new_array = (Type *) realloc (arrayZ, new_allocated * sizeof (Type)); - } - - if (unlikely (!new_array)) - { - successful = false; - return false; - } - - arrayZ = new_array; - allocated = new_allocated; - - return true; - } - - inline bool resize (int size_) - { - unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; - if (!alloc (size)) - return false; - - if (size > len) - memset (arrayZ + len, 0, (size - len) * sizeof (*arrayZ)); - - len = size; - return true; - } - - inline void pop (void) - { - if (!len) return; - len--; - } - - inline void remove (unsigned int i) - { - if (unlikely (i >= len)) - return; - memmove (static_cast (&arrayZ[i]), - static_cast (&arrayZ[i + 1]), - (len - i - 1) * sizeof (Type)); - len--; - } - - inline void shrink (int size_) - { - unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; - if (size < len) - len = size; - } - - template - inline Type *find (T v) { - for (unsigned int i = 0; i < len; i++) - if (arrayZ[i] == v) - return &arrayZ[i]; - return nullptr; - } - template - inline const Type *find (T v) const { - for (unsigned int i = 0; i < len; i++) - if (arrayZ[i] == v) - return &arrayZ[i]; - return nullptr; - } - - inline void qsort (int (*cmp)(const void*, const void*)) - { - ::qsort (arrayZ, len, sizeof (Type), cmp); - } - - inline void qsort (void) - { - ::qsort (arrayZ, len, sizeof (Type), Type::cmp); - } - - inline void qsort (unsigned int start, unsigned int end) - { - ::qsort (arrayZ + start, end - start, sizeof (Type), Type::cmp); - } - - template - inline Type *lsearch (const T &x) - { - for (unsigned int i = 0; i < len; i++) - if (0 == this->arrayZ[i].cmp (&x)) - return &arrayZ[i]; - return nullptr; - } - - template - inline Type *bsearch (const T &x) - { - unsigned int i; - return bfind (x, &i) ? &arrayZ[i] : nullptr; - } - template - inline const Type *bsearch (const T &x) const - { - unsigned int i; - return bfind (x, &i) ? &arrayZ[i] : nullptr; - } - template - inline bool bfind (const T &x, unsigned int *i) const - { - int min = 0, max = (int) this->len - 1; - while (min <= max) - { - int mid = (min + max) / 2; - int c = this->arrayZ[mid].cmp (&x); - if (c < 0) - max = mid - 1; - else if (c > 0) - min = mid + 1; - else - { - *i = mid; - return true; - } - } - if (max < 0 || (max < (int) this->len && this->arrayZ[max].cmp (&x) > 0)) - max++; - *i = max; - return false; - } - - inline void fini (void) - { - if (arrayZ != static_array) - free (arrayZ); - arrayZ = nullptr; - allocated = len = 0; - } -}; - -template -struct hb_auto_t : Type -{ - hb_auto_t (void) { Type::init (); } - ~hb_auto_t (void) { Type::fini (); } - private: /* Hide */ - void init (void) {} - void fini (void) {} -}; -template -struct hb_auto_array_t : hb_auto_t > {}; - - -#define HB_LOCKABLE_SET_INIT {HB_PREALLOCED_ARRAY_INIT} -template -struct hb_lockable_set_t -{ - hb_vector_t items; - - inline void init (void) { items.init (); } - - template - inline item_t *replace_or_insert (T v, lock_t &l, bool replace) - { - l.lock (); - item_t *item = items.find (v); - if (item) { - if (replace) { - item_t old = *item; - *item = v; - l.unlock (); - old.fini (); - } - else { - item = nullptr; - l.unlock (); - } - } else { - item = items.push (v); - l.unlock (); - } - return item; - } - - template - inline void remove (T v, lock_t &l) - { - l.lock (); - item_t *item = items.find (v); - if (item) { - item_t old = *item; - *item = items[items.len - 1]; - items.pop (); - l.unlock (); - old.fini (); - } else { - l.unlock (); - } - } - - template - inline bool find (T v, item_t *i, lock_t &l) - { - l.lock (); - item_t *item = items.find (v); - if (item) - *i = *item; - l.unlock (); - return !!item; - } - - template - inline item_t *find_or_insert (T v, lock_t &l) - { - l.lock (); - item_t *item = items.find (v); - if (!item) { - item = items.push (v); - } - l.unlock (); - return item; - } - - inline void fini (lock_t &l) - { - if (!items.len) { - /* No need for locking. */ - items.fini (); - return; - } - l.lock (); - while (items.len) { - item_t old = items[items.len - 1]; - items.pop (); - l.unlock (); - old.fini (); - l.lock (); - } - items.fini (); - l.unlock (); - } - -}; - - /* ASCII tag/character handling */ static inline bool ISALPHA (unsigned char c) @@ -1027,144 +503,28 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3) #define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x)) -template static inline void -hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *), T2 *array2) -{ - for (unsigned int i = 1; i < len; i++) - { - unsigned int j = i; - while (j && compar (&array[j - 1], &array[i]) > 0) - j--; - if (i == j) - continue; - /* Move item i to occupy place for item j, shift what's in between. */ - { - T t = array[i]; - memmove (&array[j + 1], &array[j], (i - j) * sizeof (T)); - array[j] = t; - } - if (array2) - { - T2 t = array2[i]; - memmove (&array2[j + 1], &array2[j], (i - j) * sizeof (T2)); - array2[j] = t; - } - } -} - -template static inline void -hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *)) -{ - hb_stable_sort (array, len, compar, (int *) nullptr); -} - -static inline hb_bool_t -hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *out) -{ - /* Pain because we don't know whether s is nul-terminated. */ - char buf[64]; - len = MIN (ARRAY_LENGTH (buf) - 1, len); - strncpy (buf, s, len); - buf[len] = '\0'; - - char *end; - errno = 0; - unsigned long v = strtoul (buf, &end, base); - if (errno) return false; - if (*end) return false; - *out = v; - return true; -} - - -/* Vectorization */ - -struct HbOpOr -{ - static const bool passthru_left = true; - static const bool passthru_right = true; - template static void process (T &o, const T &a, const T &b) { o = a | b; } -}; -struct HbOpAnd -{ - static const bool passthru_left = false; - static const bool passthru_right = false; - template static void process (T &o, const T &a, const T &b) { o = a & b; } -}; -struct HbOpMinus -{ - static const bool passthru_left = true; - static const bool passthru_right = false; - template static void process (T &o, const T &a, const T &b) { o = a & ~b; } -}; -struct HbOpXor -{ - static const bool passthru_left = true; - static const bool passthru_right = true; - template static void process (T &o, const T &a, const T &b) { o = a ^ b; } -}; - /* Compiler-assisted vectorization. */ -/* The `vector_size' attribute was introduced in gcc 3.1. */ -#if defined( __GNUC__ ) && ( __GNUC__ >= 4 ) -#define HB_VECTOR_SIZE 128 -#elif !defined(HB_VECTOR_SIZE) -#define HB_VECTOR_SIZE 0 +/* + * Disable vectorization for now. To correctly use them, we should + * use posix_memalign() to allocate them. Otherwise, can cause + * misaligned access. + * + * https://bugs.chromium.org/p/chromium/issues/detail?id=860184 + */ +#if !defined(HB_VECTOR_SIZE) +# define HB_VECTOR_SIZE 0 #endif -/* Type behaving similar to vectorized vars defined using __attribute__((vector_size(...))). */ -template -struct hb_vector_size_t -{ - elt_t& operator [] (unsigned int i) { return u.v[i]; } - const elt_t& operator [] (unsigned int i) const { return u.v[i]; } - - template - inline hb_vector_size_t process (const hb_vector_size_t &o) const - { - hb_vector_size_t r; -#if HB_VECTOR_SIZE - if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE) - for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++) - Op::process (r.u.vec[i], u.vec[i], o.u.vec[i]); - else -#endif - for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++) - Op::process (r.u.v[i], u.v[i], o.u.v[i]); - return r; - } - inline hb_vector_size_t operator | (const hb_vector_size_t &o) const - { return process (o); } - inline hb_vector_size_t operator & (const hb_vector_size_t &o) const - { return process (o); } - inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const - { return process (o); } - inline hb_vector_size_t operator ~ () const - { - hb_vector_size_t r; -#if HB_VECTOR_SIZE && 0 - if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE) - for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++) - r.u.vec[i] = ~u.vec[i]; - else -#endif - for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++) - r.u.v[i] = ~u.v[i]; - return r; - } - - private: - static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size, ""); - union { - elt_t v[byte_size / sizeof (elt_t)]; -#if HB_VECTOR_SIZE - typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8))); - vec_t vec[byte_size / sizeof (vec_t)]; +/* The `vector_size' attribute was introduced in gcc 3.1. */ +#if !defined(HB_VECTOR_SIZE) +# if defined( __GNUC__ ) && ( __GNUC__ >= 4 ) +# define HB_VECTOR_SIZE 128 +# else +# define HB_VECTOR_SIZE 0 +# endif #endif - } u; -}; /* Global runtime options. */ @@ -1199,34 +559,7 @@ hb_options (void) #define VAR 1 -/* String type. */ - -struct hb_bytes_t -{ - inline hb_bytes_t (void) : bytes (nullptr), len (0) {} - inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {} - - inline int cmp (const hb_bytes_t &a) const - { - if (len != a.len) - return (int) a.len - (int) len; - - return memcmp (a.bytes, bytes, len); - } - static inline int cmp (const void *pa, const void *pb) - { - hb_bytes_t *a = (hb_bytes_t *) pa; - hb_bytes_t *b = (hb_bytes_t *) pb; - return b->cmp (*a); - } - - const char *bytes; - unsigned int len; -}; - - /* fallback for round() */ -#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND) static inline double _hb_round (double x) { @@ -1235,8 +568,43 @@ _hb_round (double x) else return ceil (x - 0.5); } +#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND) #define round(x) _hb_round(x) #endif +/* fallback for posix_memalign() */ +static inline int +_hb_memalign(void **memptr, size_t alignment, size_t size) +{ + if (unlikely (0 != (alignment & (alignment - 1)) || + !alignment || + 0 != (alignment & (sizeof (void *) - 1)))) + return EINVAL; + + char *p = (char *) malloc (size + alignment - 1); + if (unlikely (!p)) + return ENOMEM; + + size_t off = (size_t) p & (alignment - 1); + if (off) + p += alignment - off; + + *memptr = (void *) p; + + return 0; +} +#if !defined(posix_memalign) && !defined(HAVE_POSIX_MEMALIGN) +#define posix_memalign _hb_memalign +#endif + + +/* Headers we include for everyone. Keep sorted. They express dependency amongst + * themselves, but no other file should include them.*/ +#include "hb-atomic-private.hh" +#include "hb-debug.hh" +#include "hb-dsalgs.hh" +#include "hb-mutex-private.hh" +#include "hb-object-private.hh" + #endif /* HB_PRIVATE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh index ccd4d8df5f7..032ddb1ee20 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh @@ -28,7 +28,6 @@ #define HB_SET_PRIVATE_HH #include "hb-private.hh" -#include "hb-object-private.hh" /* @@ -94,7 +93,7 @@ struct hb_set_t { unsigned int pop = 0; for (unsigned int i = 0; i < len (); i++) - pop += _hb_popcount (v[i]); + pop += hb_popcount (v[i]); return pop; } @@ -161,8 +160,8 @@ struct hb_set_t static const unsigned int PAGE_BITS = 512; static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, ""); - static inline unsigned int elt_get_min (const elt_t &elt) { return _hb_ctz (elt); } - static inline unsigned int elt_get_max (const elt_t &elt) { return _hb_bit_storage (elt) - 1; } + static inline unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); } + static inline unsigned int elt_get_max (const elt_t &elt) { return hb_bit_storage (elt) - 1; } typedef hb_vector_size_t vector_t; @@ -405,6 +404,7 @@ struct hb_set_t if (get_population () > larger_set->get_population ()) return false; + /* TODO Optimize to use pages. */ hb_codepoint_t c = INVALID; while (next (&c)) if (!larger_set->has (c)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan-private.hh index aa0413a272d..c2c4987e527 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan-private.hh @@ -28,7 +28,6 @@ #define HB_SHAPE_PLAN_PRIVATE_HH #include "hb-private.hh" -#include "hb-object-private.hh" #include "hb-shaper-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc index 6eeba2b3d1f..37ff1a6e6c4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc @@ -25,7 +25,6 @@ */ #include "hb-private.hh" -#include "hb-debug.hh" #include "hb-shape-plan-private.hh" #include "hb-shaper-private.hh" #include "hb-font-private.hh" 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 39c5ac4f297..74470fd1fa5 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 @@ -24,7 +24,6 @@ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod */ -#include "hb-object-private.hh" #include "hb-subset-private.hh" #include "hb-set-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh index f4b261df0d0..7501294d702 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh @@ -32,7 +32,6 @@ #include "hb-subset.h" #include "hb-subset-private.hh" -#include "hb-object-private.hh" #include "hb-map-private.hh" struct hb_subset_plan_t diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc index b97c7633eb8..a65b58d26f7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc @@ -25,7 +25,6 @@ */ #include "hb-private.hh" -#include "hb-object-private.hh" #include "hb-open-type-private.hh" #include "hb-subset-glyf.hh" @@ -154,7 +153,7 @@ _hb_subset_face_data_reference_blob (hb_subset_face_data_t *data) unsigned int face_length = table_count * 16 + 12; for (unsigned int i = 0; i < table_count; i++) - face_length += _hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); + face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); char *buf = (char *) malloc (face_length); if (unlikely (!buf)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh index 5472ece2f2b..b2c203d260e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh @@ -32,7 +32,6 @@ #define HB_UNICODE_PRIVATE_HH #include "hb-private.hh" -#include "hb-object-private.hh" extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256]; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc index 6d6afe80a0e..b17fa31ca27 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc @@ -25,7 +25,6 @@ */ #include "hb-private.hh" -#include "hb-debug.hh" #define HB_SHAPER uniscribe #include "hb-shaper-impl-private.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc index 8f322bcb10d..f7a87b5abf9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc @@ -24,9 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-atomic-private.hh" -#include "hb-mutex-private.hh" - +#include "hb-private.hh" #if defined(HB_ATOMIC_INT_NIL) #error "Could not find any system to define atomic_int macros, library WILL NOT be thread-safe" diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index 6284bdc6794..f9ad64a1155 100644 --- a/Build/source/libs/harfbuzz/version.ac +++ b/Build/source/libs/harfbuzz/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current harfbuzz version -m4_define([harfbuzz_version], [1.8.2]) +m4_define([harfbuzz_version], [1.8.3]) -- cgit v1.2.3