diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2019-01-31 23:16:40 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2019-01-31 23:16:40 +0000 |
commit | 2cd8b0fe12bfff91766553466c373294ad80e2d9 (patch) | |
tree | b63bdcc28ac89c7a54dd25dba31b18ea6eca1aca /Build/source/libs/harfbuzz | |
parent | 19697bbcefd2b6c4339efb559af609f1b9da8c9d (diff) |
harfbuzz 2.3.1
git-svn-id: svn://tug.org/texlive/trunk@49891 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz')
114 files changed, 4303 insertions, 1812 deletions
diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index ce3909402fa..f2e30853435 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2019-01-31 Akira Kakuto <kakuto@w32tex.org> + + Import harfbuzz-2.3.1. + * version.ac, Makefile.am: Adjusted. + 2018-12-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import harfbuzz-2.3.0. diff --git a/Build/source/libs/harfbuzz/Makefile.am b/Build/source/libs/harfbuzz/Makefile.am index 0e666d65d1e..5009540af52 100644 --- a/Build/source/libs/harfbuzz/Makefile.am +++ b/Build/source/libs/harfbuzz/Makefile.am @@ -50,6 +50,7 @@ libharfbuzz_a_SOURCES = \ @HARFBUZZ_TREE@/src/hb-face.cc \ @HARFBUZZ_TREE@/src/hb-font.hh \ @HARFBUZZ_TREE@/src/hb-font.cc \ + @HARFBUZZ_TREE@/src/hb-iter.hh \ @HARFBUZZ_TREE@/src/hb-kern.hh \ @HARFBUZZ_TREE@/src/hb-map.hh \ @HARFBUZZ_TREE@/src/hb-map.cc \ diff --git a/Build/source/libs/harfbuzz/Makefile.in b/Build/source/libs/harfbuzz/Makefile.in index c3f835233ae..acd3995cd80 100644 --- a/Build/source/libs/harfbuzz/Makefile.in +++ b/Build/source/libs/harfbuzz/Makefile.in @@ -730,8 +730,8 @@ libharfbuzz_a_SOURCES = @HARFBUZZ_TREE@/src/hb-atomic.hh \ @HARFBUZZ_TREE@/src/hb-dsalgs.hh \ @HARFBUZZ_TREE@/src/hb-face.hh @HARFBUZZ_TREE@/src/hb-face.cc \ @HARFBUZZ_TREE@/src/hb-font.hh @HARFBUZZ_TREE@/src/hb-font.cc \ - @HARFBUZZ_TREE@/src/hb-kern.hh @HARFBUZZ_TREE@/src/hb-map.hh \ - @HARFBUZZ_TREE@/src/hb-map.cc \ + @HARFBUZZ_TREE@/src/hb-iter.hh @HARFBUZZ_TREE@/src/hb-kern.hh \ + @HARFBUZZ_TREE@/src/hb-map.hh @HARFBUZZ_TREE@/src/hb-map.cc \ @HARFBUZZ_TREE@/src/hb-machinery.hh \ @HARFBUZZ_TREE@/src/hb-mutex.hh @HARFBUZZ_TREE@/src/hb-null.hh \ @HARFBUZZ_TREE@/src/hb-object.hh \ diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index 9c359303c5c..de7e3351a76 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2019-01-31 Akira Kakuto <kakuto@w32tex.org> + + Imported harfbuzz-2.3.1 source tree from: + http://www.freedesktop.org/software/harfbuzz/release/ + 2018-12-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Imported harfbuzz-2.3.0 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index c25f50191e8..757f1b35291 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-2.3.0/ tree as obtained from: +Changes applied to the harfbuzz-2.3.1/ tree as obtained from: http://www.freedesktop.org/software/harfbuzz/release/ Removed: diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index 54ed1d52c94..fd818d667bf 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) 2.3.0. +# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 2.3.1. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='2.3.0' -PACKAGE_STRING='harfbuzz (TeX Live) 2.3.0' +PACKAGE_VERSION='2.3.1' +PACKAGE_STRING='harfbuzz (TeX Live) 2.3.1' 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) 2.3.0 to adapt to many kinds of systems. +\`configure' configures harfbuzz (TeX Live) 2.3.1 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) 2.3.0:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 2.3.1:";; 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 2.3.0 +harfbuzz (TeX Live) configure 2.3.1 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 2.3.0, which was +It was created by harfbuzz (TeX Live) $as_me 2.3.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4055,7 +4055,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='2.3.0' + VERSION='2.3.1' # Some tools Automake needs. @@ -4249,8 +4249,8 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags HB_VERSION_MAJOR=2 HB_VERSION_MINOR=3 -HB_VERSION_MICRO=0 -HB_VERSION=2.3.0 +HB_VERSION_MICRO=1 +HB_VERSION=2.3.1 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -8155,7 +8155,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 2.3.0, which was +This file was extended by harfbuzz (TeX Live) $as_me 2.3.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8221,7 +8221,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 2.3.0 +harfbuzz (TeX Live) config.status 2.3.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt index b6241e93772..6a1a36dfb8e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt @@ -552,7 +552,7 @@ endif () if (UNIX OR MINGW) # Make symbols link locally include (CheckCXXCompilerFlag) - check_cxx_compiler_flag(-Bsymbolic-functions CXX_SUPPORTS_FLAG_BSYMB_FUNCS) + CHECK_CXX_COMPILER_FLAG(-Bsymbolic-functions CXX_SUPPORTS_FLAG_BSYMB_FUNCS) if (CXX_SUPPORTS_FLAG_BSYMB_FUNCS) link_libraries(-Bsymbolic-functions) endif () @@ -570,8 +570,16 @@ if (UNIX OR MINGW) # No threadsafe statics as we do it ourselves set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics") endif () + + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + if (COMPILER_SUPPORTS_CXX11) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + endif() endif () + ## Define harfbuzz-gobject library if (HB_HAVE_GOBJECT) add_library(harfbuzz-gobject diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 35148210668..135b034831d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,2176 @@ +commit fe532923101586e316b300d419a337d357cd93da +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 20:47:58 2019 -0500 + + [CI] Peg CircleCI badge link to master branch + + [skip ci] + + README.md | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 9569819e24f72926a5b26e4c8a86d815c0132745 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 20:43:43 2019 -0500 + + [ci] Peg build status badges to master branch + + [skip ci] + + README.md | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 1e29906a77c275c34a440a416654a514810485e1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 20:38:15 2019 -0500 + + Switch README / README.md + + [skip ci] + + README | 19 +------------------ + README.md | 19 ++++++++++++++++++- + 2 files changed, 19 insertions(+), 19 deletions(-) + +commit 9a1df82e3f13fbd4488ee9955814bbb5d0957074 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 14:15:18 2019 -0500 + + [uniscribe] Whitelist function type cast + + src/hb-uniscribe.cc | 3 +++ + 1 file changed, 3 insertions(+) + +commit 6e1c3eaf7005d06c89f0807f693aadd835aa0468 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 14:12:41 2019 -0500 + + Fix sign comparison error + + src/hb-open-file.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 9db7a7da6339eacbb6c699fa1939bbd7e9e148f5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 14:09:59 2019 -0500 + + Fix warning + + c:\projects\harfbuzz\src\hb-ot-color-cbdt-table.hh(59): warning C4146: + unary minus operator applied to unsigned type, result still unsigned + [C:\projects\harfbuzz\build\harfbuzz.vcxproj] + + src/hb-ot-color-cbdt-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 51b584880e550545ced3aa8ba4ccad3cf79bb53e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 28 14:09:45 2019 -0500 + + [pragma] Silence MSVC unknown-pragma warning + + src/hb.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit 60022ecced202760daa7f75516bba6a4689a49de +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Jan 26 14:04:51 2019 +0100 + + Fix -Wcast-function-type warnings in util/ with gcc 4.8 + + src/hb.hh | 1 + + util/options.hh | 5 ++++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +commit a9321cb5f88cae1dafbd623b8bf7c68a82a3c211 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 25 16:11:45 2019 +0100 + + Fix mac test + + test/shaping/data/in-house/tests/macos.tests | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit f39809752909f193a9c60f4357a88ea1c3ce1162 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 25 16:08:25 2019 +0100 + + More static constexpr + + src/hb-machinery.hh | 10 +++++----- + src/hb-set-digest.hh | 14 +++++++------- + 2 files changed, 12 insertions(+), 12 deletions(-) + +commit 06358ae9746ae72c0917e8a5f294d14fd695f380 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 25 15:11:47 2019 +0100 + + [AAT] Add test for recent Ligature stack fix, using Zapfino on Mac + + test/shaping/data/in-house/tests/macos.tests | 2 ++ + 1 file changed, 2 insertions(+) + +commit e970de48bcbdccd29350f331288c0a98f7846c16 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 18:16:17 2019 +0100 + + [AAT] Minor sign + + src/hb-aat-layout-morx-table.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit a371a28cda23805cbea22867e0a3ed53ecb811ed +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 18:12:25 2019 +0100 + + [AAT] Use a ring buffer for ligature stack + + I think Apple does very similarly, but probably with a stack size + of 16. + We do it with a stack size that is currently set to 64. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1531 + + src/hb-aat-layout-morx-table.hh | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +commit 7886b1578fceee368ae5afe206ff98f50e1c42e3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 18:06:17 2019 +0100 + + Whitespace + + src/hb-aat-layout-morx-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b976940243bf1f174bd6abb85955789ef2631d24 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 18:01:07 2019 +0100 + + [AAT] Handle transition errors during machine operation + + Before we used to give up. Now, just ignore error and continue + processing. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1531 + + src/hb-aat-layout-common.hh | 3 +-- + src/hb-aat-layout-kerx-table.hh | 21 +++++++-------------- + src/hb-aat-layout-morx-table.hh | 34 +++++++++++++--------------------- + 3 files changed, 21 insertions(+), 37 deletions(-) + +commit e234bb6a428cd6c8ddf57eb078cd51b9d1f25ba8 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 17:23:11 2019 +0100 + + [AAT] Ignore machine errors and continue + + src/hb-aat-layout-common.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 1ec90514f69efc329691186466f62373efa863b1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 17:21:41 2019 +0100 + + [AAT] Minor + + src/hb-aat-layout-common.hh | 12 ++++---- + src/hb-aat-layout-kerx-table.hh | 38 +++++++++++------------ + src/hb-aat-layout-morx-table.hh | 68 + ++++++++++++++++++++--------------------- + 3 files changed, 59 insertions(+), 59 deletions(-) + +commit 299eca0c3b28c99add006420bc667431d874fb2e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 17:17:00 2019 +0100 + + [AAT] Handle out-of-bounds classes + + src/hb-aat-layout-common.hh | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +commit c4623db4a3f963394db940449007fa3312460993 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 17:10:12 2019 +0100 + + [AAT] Minor + + src/hb-aat-layout-common.hh | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +commit c4e36f97b6df1eb5fba588b09ae1630bb5c49589 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 17:06:16 2019 +0100 + + [AAT] Minor + + src/hb-aat-layout-common.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit f60282c5bff4a317ba3180e3519274963c6e8849 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 16:29:09 2019 +0100 + + More pragma control + + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=924848 + + src/hb.hh | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +commit fd0889f903ac1ba2da06e77eed8424395ea85a90 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 16:12:52 2019 +0100 + + Comment + + src/hb-ot-shape.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 00f06d1aa61e9a6d01b5943ce55ba2b0c40237ee +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 16:11:05 2019 +0100 + + Fix test + + test/shaping/data/in-house/tests/cluster.tests | 1 - + test/shaping/data/in-house/tests/emoji.tests | 3 ++- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 9f314177336f9551756944e0e555614c9189c7a5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 16:08:33 2019 +0100 + + Form cluster for Emoji sub-region tag sequences + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1556 + + src/hb-ot-shape.cc | 13 + +++++++++++++ + .../fonts/8d9c4b193808b8bde94389ba7831c1fc6f9e794e.ttf | Bin 0 -> + 1548 bytes + test/shaping/data/in-house/tests/cluster.tests | 1 + + 3 files changed, 14 insertions(+) + +commit 5034f8f2ab8f53eb0395e6f6ce2f8da69a08460d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 12:50:38 2019 +0100 + + Fix macos tests with previous commit + + test/shaping/data/in-house/tests/macos.tests | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 3ecda71041a7239ca37ec7b888809efe8f595a19 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 24 12:08:23 2019 +0100 + + Adjust mark offsets when zeroing from fallback mark positioning code + + Adjust tests. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1532 + + src/hb-ot-shape-fallback.cc | 31 + +++++++++++++++------- + src/hb-ot-shape-fallback.hh | 3 ++- + src/hb-ot-shape.cc | 3 ++- + .../in-house/tests/arabic-fallback-shaping.tests | 2 +- + test/shaping/data/in-house/tests/cluster.tests | 2 +- + .../data/in-house/tests/fallback-positioning.tests | 4 +-- + 6 files changed, 30 insertions(+), 15 deletions(-) + +commit 36fb2b4da9718a86978fa07c99ba4345f7ca9b4b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jan 23 20:53:57 2019 +0100 + + [AAT] In InsertionChain, set mark to previous-position if inserting + + Fixes MORX-31 + + src/hb-aat-layout-morx-table.hh | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +commit cbe0ed117ac86179183c389977d15981d26524f7 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jan 23 20:45:18 2019 +0100 + + [AAT] Re-enable tests MORX-31 and MORX-41 + + test/shaping/data/text-rendering-tests/DISABLED | 3 --- + test/shaping/data/text-rendering-tests/Makefile.sources | 2 ++ + 2 files changed, 2 insertions(+), 3 deletions(-) + +commit baf4d6a68a031bf65e17ccd5dac15fe7d0df33b6 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jan 23 20:36:07 2019 +0100 + + [AAT] Remove mark_set from InsertionChain + + src/hb-aat-layout-morx-table.hh | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +commit 410731d3fb678365c07a4d1745b72b6bb3142b70 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jan 23 20:30:48 2019 +0100 + + [test/text-rendering-tests] Update from upstream + + test/shaping/data/text-rendering-tests/extract-tests.py | 2 +- + test/shaping/data/text-rendering-tests/tests/MORX-14.tests | 2 +- + test/shaping/data/text-rendering-tests/tests/MORX-32.tests | 8 ++++---- + test/shaping/data/text-rendering-tests/tests/MORX-41.tests | 4 ++-- + 4 files changed, 8 insertions(+), 8 deletions(-) + +commit 0b2fa342de88bbe609b2147444e56c94680cbd38 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 16:36:00 2019 +0100 + + More of previous + + src/hb-subset-cff1.cc | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +commit a5e5dd8b42b40c3647e06e6bb62580af77bed42b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 16:30:07 2019 +0100 + + Fix sign-compare error resulted from promoting unsigned integers to + signed larger ints + + Clang and gcc know not to warn in these cases, but not nonmainstream + compilers + + src/hb-subset-cff2.cc | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +commit 32379bbf10726bb7ed2e507d0a6b5917c350e056 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:55:29 2019 +0100 + + Cast HB_UNTAG results to uint8_t + + src/hb-common.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 83d4aa5ca9a39dbe66db9b81b34f5b568503bd7e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:52:23 2019 +0100 + + More -Wcast-error fix + + src/hb-dsalgs.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit 447323b85a7b68bd41561a87c91431cd05227b97 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:45:40 2019 +0100 + + Better fix for -Wcast-align errors + + src/hb-font.cc | 33 +++++++++------------------------ + src/hb-ft.cc | 14 ++++---------- + src/hb-machinery.hh | 16 ++++++++++++++++ + src/hb-ot-cmap-table.hh | 7 ++----- + src/hb-ot-font.cc | 14 ++++---------- + 5 files changed, 35 insertions(+), 49 deletions(-) + +commit 81ec543d800c4a94b5e608fd87e84d33d7dae8ac +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:43:12 2019 +0100 + + More -Wcast-error fixes + + src/hb-font.cc | 8 ++++---- + src/hb-ft.cc | 2 +- + src/hb-ot-font.cc | 4 ++-- + 3 files changed, 7 insertions(+), 7 deletions(-) + +commit 90772725493108c79487a67620f0240e5d68f4ee +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:40:18 2019 +0100 + + pragma GCC diagnostic error "-Wsign-compare" + + src/hb.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 8d05bf7dc0094e75be07ca1f7ef852a1e45d0687 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:34:05 2019 +0100 + + Fix cast-align error + + If compiler doesn't inline StructAtOffset, this was an error since we + only disable cast-align at call-site. So, move the cast out. + + ../src/hb-machinery.hh: In instantiation of 'const Type& + StructAtOffset(const void*, unsigned int) [with Type = unsigned int]': + ../src/hb-font.cc:146:85: required from here + ../src/hb-machinery.hh:63:12: error: cast from 'const char*' to + 'const unsigned int*' increases required alignment of target type + [-Werror=cast-align] + { return * reinterpret_cast<const Type*> ((const char *) P + + offset); } + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ../src/hb-machinery.hh: In instantiation of 'Type& + StructAtOffset(void*, unsigned int) [with Type = unsigned int]': + ../src/hb-font.cc:147:79: required from here + ../src/hb-machinery.hh:66:12: error: cast from 'char*' to 'unsigned + int*' increases required alignment of target type [-Werror=cast-align] + { return * reinterpret_cast<Type*> ((char *) P + offset); } + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + src/hb-font.cc | 8 ++++---- + src/hb-ft.cc | 6 +++--- + src/hb-ot-cmap-table.hh | 4 ++-- + src/hb-ot-font.cc | 4 ++-- + 4 files changed, 11 insertions(+), 11 deletions(-) + +commit b270cee6c5800c019aafb55e9ca9d7e92a92d3ec +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:29:05 2019 +0100 + + [CI] Remove gcc 4.2 bots + + We don't support that version anymore. + + .circleci/config.yml | 25 ------------------------- + 1 file changed, 25 deletions(-) + +commit 70a52d6bd8c45630ca90e945fc4d716fe9114010 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:15:23 2019 +0100 + + Convert all other enum class consts to static constexpr + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1553 + + src/hb-cff-interp-common.hh | 2 +- + src/hb-iter.hh | 2 +- + src/hb-machinery.hh | 12 ++++++------ + src/hb-open-type.hh | 8 ++++---- + src/hb-set-digest.hh | 4 ++-- + src/hb-set.hh | 10 +++++----- + src/hb-vector.hh | 2 +- + 7 files changed, 20 insertions(+), 20 deletions(-) + +commit 5d4b0377b99ddc4112b8ffb2b787eac0b383081c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:11:24 2019 +0100 + + Convert unsigned enum class consts to static constexpr + + Part of https://github.com/harfbuzz/harfbuzz/issues/1553 + + src/hb-aat-layout-common.hh | 6 +++--- + src/hb-aat-layout-kerx-table.hh | 2 +- + src/hb-buffer.hh | 2 +- + src/hb-open-type.hh | 2 +- + src/hb-ot-kern-table.hh | 4 ++-- + src/hb-ot-layout-common.hh | 2 +- + src/hb-ot-layout.cc | 4 ++-- + 7 files changed, 11 insertions(+), 11 deletions(-) + +commit ef00654962204ae706b276871e2b6758fbbf69e0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:08:57 2019 +0100 + + Convert tag enum class consts to static constexpr + + Part of https://github.com/harfbuzz/harfbuzz/issues/1553 + + src/hb-aat-fdsc-table.hh | 2 +- + src/hb-aat-layout-ankr-table.hh | 2 +- + src/hb-aat-layout-bsln-table.hh | 2 +- + src/hb-aat-layout-feat-table.hh | 2 +- + src/hb-aat-layout-just-table.hh | 2 +- + src/hb-aat-layout-kerx-table.hh | 2 +- + src/hb-aat-layout-lcar-table.hh | 2 +- + src/hb-aat-layout-morx-table.hh | 6 +++--- + src/hb-aat-layout-trak-table.hh | 2 +- + src/hb-aat-ltag-table.hh | 2 +- + src/hb-ot-cff1-table.hh | 2 +- + src/hb-ot-cff2-table.hh | 2 +- + src/hb-ot-cmap-table.hh | 2 +- + src/hb-ot-color-cbdt-table.hh | 4 ++-- + src/hb-ot-color-colr-table.hh | 2 +- + src/hb-ot-color-cpal-table.hh | 2 +- + src/hb-ot-color-sbix-table.hh | 2 +- + src/hb-ot-color-svg-table.hh | 2 +- + src/hb-ot-gasp-table.hh | 2 +- + src/hb-ot-glyf-table.hh | 4 ++-- + src/hb-ot-hdmx-table.hh | 2 +- + src/hb-ot-head-table.hh | 2 +- + src/hb-ot-hhea-table.hh | 4 ++-- + src/hb-ot-hmtx-table.hh | 12 ++++++------ + src/hb-ot-kern-table.hh | 6 +++--- + src/hb-ot-layout-base-table.hh | 2 +- + src/hb-ot-layout-gdef-table.hh | 2 +- + src/hb-ot-layout-gpos-table.hh | 2 +- + src/hb-ot-layout-gsub-table.hh | 2 +- + src/hb-ot-layout-jstf-table.hh | 2 +- + src/hb-ot-math-table.hh | 2 +- + src/hb-ot-maxp-table.hh | 2 +- + src/hb-ot-name-table.hh | 2 +- + src/hb-ot-os2-table.hh | 2 +- + src/hb-ot-post-table.hh | 2 +- + src/hb-ot-stat-table.hh | 2 +- + src/hb-ot-var-avar-table.hh | 2 +- + src/hb-ot-var-fvar-table.hh | 2 +- + src/hb-ot-var-hvar-table.hh | 8 ++++---- + src/hb-ot-var-mvar-table.hh | 2 +- + src/hb-ot-vorg-table.hh | 2 +- + 41 files changed, 56 insertions(+), 56 deletions(-) + +commit 39e1b6d03f71ccb8f18d64dfbff64acfaf02970b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:07:43 2019 +0100 + + Convert boolean enum class consts to static constexpr + + Part of https://github.com/harfbuzz/harfbuzz/issues/1553 + + src/hb-aat-layout-common.hh | 4 ++-- + src/hb-aat-layout-kerx-table.hh | 4 ++-- + src/hb-aat-layout-morx-table.hh | 8 ++++---- + src/hb-dsalgs.hh | 16 ++++++++-------- + src/hb-ot-kern-table.hh | 4 ++-- + src/hb-ot-layout.cc | 4 ++-- + 6 files changed, 20 insertions(+), 20 deletions(-) + +commit 271cb7c1c0f49c7af786daa5d5310b9f08142148 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:05:35 2019 +0100 + + Make some enum constants unsigned + + src/hb-aat-layout-common.hh | 6 +++--- + src/hb-buffer.hh | 2 +- + src/hb-ot-layout.cc | 8 ++++---- + 3 files changed, 8 insertions(+), 8 deletions(-) + +commit 3d9a6e62662fb769e0f785fa7a43df806988d2a2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:02:06 2019 +0100 + + Whitespace + + src/hb-ot-layout-gsubgpos.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit c81f02fd06fcbc4426c9e3255833f8d7057cc97a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 22 12:00:44 2019 +0100 + + pragma GCC diagnostic error "-Wvla" + + src/hb.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ff98109455bfbf92f7633262bc570b05d15d5d01 +Author: Alfie John <alfie@alfie.wtf> +Date: Tue Jan 22 19:58:36 2019 +1100 + + Fix grammar + + docs/usermanual-clusters.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit e9c0f5e714cc62bcf6349b86b13e1c031f9bb764 +Author: Alfie John <alfie@alfie.wtf> +Date: Tue Jan 22 00:03:02 2019 +0000 + + Grammar fix + + docs/usermanual-clusters.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 789396ed6bf2c76c1bb955e80efb43f75e3c61d2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Jan 20 20:09:10 2019 -0500 + + Remove wrongly added files + + test/api/test-ot-extents-cff | Bin 8574336 -> + 0 bytes + .../test-ot-extents-cff.dSYM/Contents/Info.plist | 20 + -------------------- + .../Contents/Resources/DWARF/test-ot-extents-cff | Bin 7650053 -> + 0 bytes + 3 files changed, 20 deletions(-) + +commit 380c3cffb9353083913a3bb505c2c62367613096 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Jan 20 19:51:08 2019 -0500 + + Use enum for class constant + + src/hb-cff-interp-common.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 6d042a18e7079e07a2b2f465a6a56483a42ef189 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Jan 20 19:49:59 2019 -0500 + + [CFF] Use enum for tableTag + + src/hb-ot-cff1-table.hh | 2 +- + src/hb-ot-cff2-table.hh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit c1cbbb94595641f0609cc8d2dbe8415540c10f77 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Jan 20 19:47:52 2019 -0500 + + Use static constexpr for large class constants + + src/hb-map.hh | 2 +- + src/hb-set.hh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 30ae62779f1a68c5657ab27bc7e77496ba8a906c +Author: Khaled Hosny <khaledhosny@eglug.org> +Date: Mon Jan 21 16:44:48 2019 +0200 + + Regular spaces will do + + docs/usermanual-getting-started.xml | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit ed62551d67ac5bb8dbfaf3fa5eb51013157b214a +Author: Alfie John <alfie@alfie.wtf> +Date: Mon Jan 21 05:00:01 2019 +0000 + + Adding leading space for code example + + docs/usermanual-getting-started.xml | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit 3e332544db35ca08de767ecab01b489a9905c559 +Author: Alfie John <alfie@alfie.wtf> +Date: Mon Jan 21 04:54:27 2019 +0000 + + Fix description of example + + docs/usermanual-getting-started.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 2144ca9f01d01b6de386d17ada73a288372ee553 +Author: Alfie John <alfie@alfie.wtf> +Date: Mon Jan 21 04:47:05 2019 +0000 + + Added option to build docs to docs + + docs/usermanual-install-harfbuzz.xml | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +commit 043b610fa698ed247347dfaa042f032f3fd3f572 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Jan 19 09:20:46 2019 -0500 + + Fix sign compare warnings + + ../../third_party/harfbuzz-ng/src/src/hb-map.hh(56,45): warning: + comparison of integers of different signs: 'const hb_codepoint_t' + (aka 'const unsigned int') and 'hb_map_t::(anonymous enum + at ../../third_party/harfbuzz-ng/src/src/hb-map.hh:169:3)' + [-Wsign-compare] + bool is_unused () const { return key == INVALID; } + + src/hb-map.hh | 2 +- + src/hb-set.hh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit ce317d032061d81c520180a338172ce38b427135 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Jan 19 09:18:03 2019 -0500 + + Fix warning + + warning: '_WIN64' is not defined, evaluates to 0 [-Wundef] + + src/hb-dsalgs.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 0c2bd1b160fda4e77919889ac80f9460967fa251 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jan 19 16:30:07 2019 +0330 + + [dwrite] Fix delete-non-virtual-dtor warning (#1550) + + src/hb-directwrite.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 89bcfb204c736f5962d377896af2c1350f179882 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 14:59:18 2019 -0500 + + Remove TRACE_COLLECT_GLYPHS + + src/hb-debug.hh | 13 ------------- + src/hb-ot-layout-gpos-table.hh | 26 ++++---------------------- + src/hb-ot-layout-gsub-table.hh | 21 +++------------------ + src/hb-ot-layout-gsubgpos.hh | 12 +----------- + 4 files changed, 8 insertions(+), 64 deletions(-) + +commit f13b6786f0aefd2060ca976f7e42db7387b49450 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 14:53:54 2019 -0500 + + [pragma] Only add if GCC or clang + + src/hb.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit c2ea7a9da463c567d321233b23813c59762841bb +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 13:45:33 2019 -0500 + + [directwrite] More fix + + src/hb-directwrite.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 9714d3ec5c45b2fe460fa6b21bdb3487c62029d3 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jan 18 21:55:21 2019 +0330 + + [dwrite] Try to fix delete-non-virtual-dtor warnings + + Fixes #1548 hopefully + + src/hb-directwrite.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 0772c06f96c3f5a319485c390416531b8125251b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 12:53:06 2019 -0500 + + Remove tracing from closure + + src/hb-debug.hh | 13 ------------- + src/hb-ot-layout-gsub-table.hh | 15 ++------------- + src/hb-ot-layout-gsubgpos.hh | 14 +------------- + 3 files changed, 3 insertions(+), 39 deletions(-) + +commit d9f6be3a61edfe9e1bce01ea9b11e2bcb16f9618 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 12:48:01 2019 -0500 + + Fix -Wundef errors with __GNUC__ + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1549 + + src/hb-common.h | 4 ++-- + src/hb.hh | 10 +++++----- + 2 files changed, 7 insertions(+), 7 deletions(-) + +commit 28917e58f973e5875d3ef3004c16e1ee1a5a973c +Author: Michiharu Ariza <ariza@adobe.com> +Date: Fri Jan 18 09:43:51 2019 -0800 + + init interp_env_t::hintmask_size + + fixes issue #1547 + + src/hb-cff-interp-cs-common.hh | 1 + + test/api/test-ot-extents-cff | Bin 0 -> + 8574336 bytes + .../test-ot-extents-cff.dSYM/Contents/Info.plist | 20 + ++++++++++++++++++++ + .../Contents/Resources/DWARF/test-ot-extents-cff | Bin 0 -> + 7650053 bytes + 4 files changed, 21 insertions(+) + +commit 9b4e51b2e44d7dea026b1f9201d2f83277bab1cf +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 12:23:02 2019 -0500 + + [pragma] Enable error -Wdelete-non-virtual-dtor + + Currently fails directwrite backend. + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit e65272281c71d416f0ff886a55536597665b9dc3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 12:22:07 2019 -0500 + + [directwrite] Fix error + + hb-directwrite.cc: In constructor 'TextAnalysis::TextAnalysis(const + wchar_t*, uint32_t, const wchar_t*, DWRITE_READING_DIRECTION)': + hb-directwrite.cc:489:18: error: 'TextAnalysis::mText' will be + initialized after [-Werror=reorder] + const wchar_t* mText; + ^~~~~ + hb-directwrite.cc:488:12: error: 'uint32_t + TextAnalysis::mTextLength' [-Werror=reorder] + uint32_t mTextLength; + ^~~~~~~~~~~ + hb-directwrite.cc:282:3: error: when initialized here + [-Werror=reorder] + TextAnalysis (const wchar_t* text, uint32_t textLength, + ^~~~~~~~~~~~ + hb-directwrite.cc: In function 'hb_bool_t + _hb_directwrite_shape_full(hb_shape_plan_t*, hb_font_t*, hb_buffer_t*, + const hb_feature_t*, unsigned int, float)': + + src/hb-directwrite.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b900f78088abb87ebec263474b2802593afa0264 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 10:08:23 2019 -0500 + + [pragma] More cast-align whitelist + + src/hb-font.cc | 20 +++++++++++++++----- + src/hb-ft.cc | 6 ++++++ + src/hb-ot-cmap-table.hh | 3 +++ + src/hb-ot-font.cc | 6 ++++++ + 4 files changed, 30 insertions(+), 5 deletions(-) + +commit 0d8b931bbeee9743d2e3bd37dd2fa9dffb807eaa +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 10:03:43 2019 -0500 + + [pragma] Allow cast-align in hb-font.cc + + ../src/hb-machinery.hh: In instantiation of 'const Type& + StructAtOffset(const void*, unsigned int) [with Type = unsigned int]': + ../src/hb-font.cc:144:85: required from here + ../src/hb-machinery.hh:63:12: error: cast from 'const char*' to + 'const unsigned int*' increases required alignment of target type + [-Werror=cast-align] + { return * reinterpret_cast<const Type*> ((const char *) P + + offset); } + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ../src/hb-machinery.hh: In instantiation of 'Type& + StructAtOffset(void*, unsigned int) [with Type = unsigned int]': + ../src/hb-font.cc:145:79: required from here + ../src/hb-machinery.hh:66:12: error: cast from 'char*' to 'unsigned + int*' increases required alignment of target type [-Werror=cast-align] + { return * reinterpret_cast<Type*> ((char *) P + offset); } + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ../src/hb-machinery.hh: In instantiation of 'Type& + StructAtOffset(void*, unsigned int) [with Type = int]': + + src/hb-font.cc | 5 +++++ + 1 file changed, 5 insertions(+) + +commit a25174a56b8fc334a050aa63be3654f53a7d8893 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 09:59:36 2019 -0500 + + [pragma] GCC diagnostic error "-Wreorder" + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 4660090569efbf64d3acc99ef6fa33e01abc9701 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 09:53:16 2019 -0500 + + [pragma] GCC diagnostic warning "-Wmaybe-uninitialized" + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 7a634d7d5b859eb1121acd0b17c727c541a7f540 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 09:49:14 2019 -0500 + + [pragma] Massage more + + src/hb.hh | 106 + ++++++++++++++++++++++++++++++++------------------------------ + 1 file changed, 55 insertions(+), 51 deletions(-) + +commit 16e5ba85b1822ff9d2b2f85f45ddd44f1a05f4b1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 09:46:17 2019 -0500 + + [pragma] More + + src/hb.hh | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +commit 2bd530d59883cce437a5093323625f94b9618d89 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 09:28:22 2019 -0500 + + [pragma] Reorg again + + https://github.com/harfbuzz/harfbuzz/issues/1546 + + src/hb.hh | 91 + ++++++++++++++++++++++++++++++++------------------------------- + 1 file changed, 46 insertions(+), 45 deletions(-) + +commit c04272fac81cac48b6310182d58d54569117f298 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jan 18 08:49:45 2019 -0500 + + [pragma] GCC diagnostic ignored "-Wunknown-warning-option" + + Try at fixing https://github.com/harfbuzz/harfbuzz/issues/1546 + + src/hb.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 4d3c8f9685b1744077ab264ffc0e0457d63c4b9a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:58:54 2019 -0500 + + [uniscribe] More warnings + + src/hb-uniscribe.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 6a5d2b21d8457001a59537e85596461feba3dbd5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:57:17 2019 -0500 + + [uniscribe] Fix warnings + + src/hb-uniscribe.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 5b13e458c34d16fef6540a9389225e0597a99df5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:52:32 2019 -0500 + + Fix build + + src/hb-directwrite.cc | 1 - + 1 file changed, 1 deletion(-) + +commit a77bd6bb8960ecff35aac07f221653c65d08e58e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:33:41 2019 -0500 + + [pragma] GCC diagnostic ignored "-Wclass-memaccess" + + src/hb.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit e1302842d9c589ccbed90d29c953fea503d3901f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:12:07 2019 -0500 + + [ci] Remove unnecessary warning declarations + + clang -Weverything still left to be ported to pragmas + + .circleci/config.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 436c7b294ab12ae338aaa879fe4280caae6c6155 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:03:33 2019 -0500 + + [pragma] ignored -Wunsafe-loop-optimizations // TODO fix + + src/hb.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit e3b3181e9ddd8b76428d7eaca64a3e03a99fcdd5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 19:02:06 2019 -0500 + + [pragma] error -Wclass-memaccess + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 1a6b97a491f2ba4f84e52c89517b7a02faa70cc3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 18:55:03 2019 -0500 + + [pragma] More + + src/hb.hh | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +commit 06e8091661352873c4d6040fd06a940136497e6f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 18:47:32 2019 -0500 + + [pragma] More + + src/hb.hh | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +commit 1077e40bf12f998976df4bf509c69df9f9e2a590 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 18:36:10 2019 -0500 + + [pragma] Flesh out more + + src/hb.hh | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +commit 7e6bd510fc695c423a7fa6b25c15805482f7d185 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 18:24:18 2019 -0500 + + Use NNOffsetTo<> in rest of places + + src/hb-aat-layout-common.hh | 8 ++++---- + src/hb-aat-layout-kerx-table.hh | 22 +++++++++++----------- + src/hb-aat-layout-morx-table.hh | 10 +++++----- + 3 files changed, 20 insertions(+), 20 deletions(-) + +commit b1152d5e66d7463a30af8ca2a485f75e0c8e6ffd +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 18:17:04 2019 -0500 + + Use NNOffsetTo<> + + src/hb-aat-layout-ankr-table.hh | 6 +++--- + src/hb-aat-layout-trak-table.hh | 2 +- + src/hb-aat-ltag-table.hh | 2 +- + src/hb-open-file.hh | 10 +++++----- + src/hb-ot-cff2-table.hh | 6 +++--- + src/hb-ot-color-cbdt-table.hh | 2 +- + src/hb-ot-color-colr-table.hh | 4 ++-- + src/hb-ot-color-cpal-table.hh | 8 ++++---- + src/hb-ot-color-svg-table.hh | 2 +- + src/hb-ot-name-table.hh | 2 +- + src/hb-ot-stat-table.hh | 4 ++-- + 11 files changed, 24 insertions(+), 24 deletions(-) + +commit 205d72a198805ba276c1d0e63b1ca313c7bd517f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 18:10:38 2019 -0500 + + Add NNOffsetTo<> + + src/hb-open-type.hh | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +commit c99d13d860e3d34e16cd2c070070d4f5d7d58cf4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 17:56:27 2019 -0500 + + [AAT] Comment + + src/hb-aat-layout-common.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f39b5603ffa0452528b2366f8641e7e770960847 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 17:49:55 2019 -0500 + + Comment + + src/hb-ot-layout-gpos-table.hh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 347ad454b88b89fc4bc30fca86c9ca37bea0be5b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 17:47:29 2019 -0500 + + [AAT] Remove unused code + + src/hb-aat-layout-ankr-table.hh | 3 +-- + src/hb-aat-layout-common.hh | 3 +-- + src/hb-aat-layout-kerx-table.hh | 6 ++---- + src/hb-aat-layout.cc | 14 +++----------- + 4 files changed, 7 insertions(+), 19 deletions(-) + +commit b344d4385af5bc9adac2a24850cb963929d4ae9e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 17:44:39 2019 -0500 + + [AAT] Allow null in ankr lookupTable offset + + src/hb-aat-layout-ankr-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 14a560a245109376b7314c949895968d0a54452c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 17:42:44 2019 -0500 + + [pragma GCC] Ignore -Wtype-limits + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 41b4312e936a0dfc396e6f0ef13c2c691dac6e40 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 16:07:27 2019 -0500 + + [ci] Remove -Werror from Travis + + hb-machinery.hh:111:37: warning: comparison of unsigned expression >= + 0 is always true [-Wtype-limits] + + Also ignore -Wtype-limits. + + .travis.yml | 2 -- + 1 file changed, 2 deletions(-) + +commit 3f2daae63073bd536bceb1ae71dffd3187afce11 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 15:27:31 2019 -0500 + + More GCC pragmas + + src/hb.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit d6c5473e1f86cae7f1060abe18f73ccb8e536d6c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 15:22:46 2019 -0500 + + Rename macro + + src/hb.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit a9946b7cfef185d53304e804169d6e53e9d522a0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 15:22:28 2019 -0500 + + Add more GCC warning pragmas + + src/hb.hh | 6 ++++++ + 1 file changed, 6 insertions(+) + +commit 868b0c0c2e2f1a2dea9b0d3c8eb6e56ded8b1a14 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 15:08:36 2019 -0500 + + Move -Wcast-align to hb.hh + + configure.ac | 3 --- + src/hb.hh | 4 ++++ + 2 files changed, 4 insertions(+), 3 deletions(-) + +commit 8874eef8ff70de6416266d719fa74eec39e5d8f9 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 15:04:44 2019 -0500 + + Add pragram GCC diagnostic ignored "-Wunused-macros" + + src/gen-indic-table.py | 3 +++ + src/gen-use-table.py | 3 +++ + src/hb-blob.cc | 3 +++ + src/hb-ot-shape-complex-indic-table.cc | 3 +++ + src/hb-ot-shape-complex-use-table.cc | 3 +++ + 5 files changed, 15 insertions(+) + +commit cc8e9a436fa408a1c63f4b9afb7643cea76a079c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 14:54:32 2019 -0500 + + [AAT] Fully sanitize ankr table at sanitize time + + Third try to fix access. Followup + 6879efc2c1596d11a6a6ad296f80063b558d5e0f + + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12532 + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=922303 + + src/hb-aat-layout-ankr-table.hh | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +commit 6879efc2c1596d11a6a6ad296f80063b558d5e0f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 14:06:37 2019 -0500 + + [AAT] Fix anchor bound checking, again + + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12532 + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=922303 + + src/hb-aat-layout-ankr-table.hh | 3 ++- + ...zz-testcase-minimized-harfbuzz_fuzzer-5166320261529600 | Bin 0 -> + 393 bytes + ...zz-testcase-minimized-hb-shape-fuzzer-5667182741028864 | Bin 0 -> + 407 bytes + 3 files changed, 2 insertions(+), 1 deletion(-) + +commit a262eb3d0b7009aabd9e0beebc77e5c0a2a65548 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jan 17 14:06:32 2019 -0500 + + [aat] Minor + + src/hb-aat-layout-kerx-table.hh | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit c986ca15a6320d78471adf950394f391e8729b15 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jan 15 13:58:19 2019 -0500 + + Improve overflow avoidance + + Better fix for 480406cd3ef9e5ab8476ddfa04498bf23906c508 + This way we behave the same on 32bit and 64bit archs. + + src/hb-machinery.hh | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +commit 0d2727f4fe734af146785df10a44e3505e410ba1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 14 18:23:17 2019 -0800 + + fix FDSelect fuzzing bug (#1539) + + Rewrote struct FDSelect3_4.ranges as ArrayOf + Updated FDSelect3_4::sanitize () to call ranges.sanitize () + nRanges now a function to return a reference to ranges.len + + src/hb-ot-cff-common.hh | 29 +++++++++++++++-------------- + src/hb-subset-cff-common.cc | 2 +- + 2 files changed, 16 insertions(+), 15 deletions(-) + +commit 9f6172d669d53abbf3bf2a3546429cb5036e3d5f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 14 20:45:31 2019 -0500 + + Move _POSIX_SOURCE definition + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1308 + + src/hb-blob.cc | 9 +++++++++ + src/hb.hh | 4 ---- + 2 files changed, 9 insertions(+), 4 deletions(-) + +commit 91d774712fa76dd26c441526712bddddca5b4bdd +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 14 15:31:31 2019 -0500 + + [test] Add test for previous commit + + ...uzz-testcase-minimized-harfbuzz_fuzzer-5662548265009152 | Bin 0 -> + 28 bytes + 1 file changed, 0 insertions(+), 0 deletions(-) + +commit 480406cd3ef9e5ab8476ddfa04498bf23906c508 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 14 15:27:34 2019 -0500 + + Fix assertion on address overflow + + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=917031 + + src/hb-machinery.hh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +commit 7a6686a589ed6bf17a5af0b8012501e4d4ee2ded +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 14 15:09:14 2019 -0500 + + [AAT] Fix mort ContextualSubtable offset access + + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12312 + + src/hb-aat-layout-morx-table.hh | 3 ++- + ...zz-testcase-minimized-hb-shape-fuzzer-5631444412530688 | Bin 0 -> + 336 bytes + 2 files changed, 2 insertions(+), 1 deletion(-) + +commit a3fa7d33360a58df5333dbbd121328e580f08849 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jan 14 14:37:36 2019 -0500 + + [AAT] Fix ankr table access + + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=918340 + + src/hb-aat-layout-ankr-table.hh | 7 ++++--- + ...z-testcase-minimized-harfbuzz_fuzzer-5126525414014976 | Bin 0 -> + 1141 bytes + 2 files changed, 4 insertions(+), 3 deletions(-) + +commit 760303d411b1561533f8f08c7c15db331c71ece8 +Author: Michiharu Ariza <ariza@adobe.com> +Date: Fri Jan 11 15:27:35 2019 -0800 + + deleted a duplicate fontdicts_mod.fini() call (#1538) + + src/hb-subset-cff1.cc | 1 - + 1 file changed, 1 deletion(-) + +commit 5110f3da9a4711a35bfb780ea06cda677cc00209 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jan 9 16:01:11 2019 +0330 + + Add an initial .clang-format config + + There are things can be improved on clang-format side I guess before + the full assertion, but is the best we can get for now I guess. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1536 + + .clang-format | 38 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +commit 099bca6d406af9c8e12a66b93fcc9a38ff7914f9 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jan 9 15:56:32 2019 +0330 + + Minor, hack .editorconfig for vscode use + + As VSCode and Atom https://github.com/Microsoft/vscode/issues/44438 + don't support it + + .editorconfig | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +commit 7b48641aa8551115d21c534940ac4fb364e5ab92 +Author: Michiharu Ariza <ariza@adobe.com> +Date: Tue Jan 8 12:37:48 2019 -0800 + + fix leak in subset_enc_supp_codes (#1537) + + oss-fuzz issue 12310 + + src/hb-subset-cff1.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 97f67a3c3d499959d33e66aeed449e2957a14bc6 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jan 4 23:10:39 2019 +0330 + + [ci] Enable more of GCC compile warnings (#1533) + + .circleci/config.yml | 16 ++++++++-------- + src/hb-gobject-structs.cc | 4 ++-- + 2 files changed, 10 insertions(+), 10 deletions(-) + +commit ad954870383a880262edcd01acd8e171c4614a68 +Author: Nathan Willis <nwillis@glyphography.com> +Date: Mon Dec 3 12:49:44 2018 -0600 + + Usermanual: small formatting and wording fixes. + + docs/usermanual-getting-started.xml | 3 +++ + docs/usermanual-install-harfbuzz.xml | 30 ++++++++++++++---------------- + docs/usermanual-what-is-harfbuzz.xml | 11 ++++++----- + 3 files changed, 23 insertions(+), 21 deletions(-) + +commit ed13caddf2de68312608e12c37d0e6287c1ac0a0 +Author: Nathan Willis <nwillis@glyphography.com> +Date: Wed Nov 28 13:48:38 2018 -0600 + + Usermanual: small updates. + + ...anual-buffers-language-script-and-direction.xml | 7 +- + docs/usermanual-clusters.xml | 279 + ++++++++++++++++----- + docs/usermanual-getting-started.xml | 91 ++++++- + docs/usermanual-install-harfbuzz.xml | 3 +- + docs/usermanual-shaping-concepts.xml | 11 +- + 5 files changed, 314 insertions(+), 77 deletions(-) + +commit 26c5b54fb09fb45e02c9c4618bcea4958c698953 +Author: cclauss <cclauss@me.com> +Date: Mon Dec 31 04:30:43 2018 +0100 + + CircleCI: Test for Python 3 syntax errors and undefined names (#1522) + + Catch missing imports and errors like #1520 and #1521 + + __E901,E999,F821,F822,F823__ are the "_showstopper_" + [flake8](http://flake8.pycqa.org) issues that can halt the runtime + with a SyntaxError, NameError, etc. Most other flake8 issues are + merely "style violations" -- useful for readability but they do not + effect runtime safety. + * F821: undefined name `name` + * F822: undefined name `name` in `__all__` + * F823: local variable name referenced before assignment + * E901: SyntaxError or IndentationError + * E999: SyntaxError -- failed to compile a file into an Abstract + Syntax Tree + + .circleci/config.yml | 3 ++- + src/gen-use-table.py | 4 +++- + test/subset/subset_test_suite.py | 2 +- + 3 files changed, 6 insertions(+), 3 deletions(-) + +commit 686e6f2e40da378e031b4c9871a471599c6d61cf +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Dec 30 11:27:42 2018 -0500 + + Fix automake warnings + + [skip ci] + + test/api/Makefile.am | 1 - + test/subset/data/Makefile.am | 2 +- + 2 files changed, 1 insertion(+), 2 deletions(-) + +commit b5c12b9f4d2c32a5013c340f7e40649cb5f2b41a +Author: cclauss <cclauss@me.com> +Date: Sun Dec 30 13:07:28 2018 +0100 + + print() is a function in Python 3 (#1520) + + test/subset/generate-expected-outputs.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +commit f4da28b1f153ccf293b367363a1a4d83c056e4e1 +Author: cclauss <cclauss@me.com> +Date: Sun Dec 30 12:58:34 2018 +0100 + + Python 3 fixes to gen-os2-unicode-ranges.py (#1521) + + In Python 3, __reload()__ was moved and __sys.setdefaultencoding()__ + because the default is already utf-8. Also __Error()__ is an + _undefined name_ and __Exception()__ creates a generic exception. + + src/gen-os2-unicode-ranges.py | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +commit e5989e0962309b27b2486d8fd20f3cbc05c3d79a +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Dec 30 10:23:47 2018 +0330 + + [cmake] Enable C++11 on CMake (#1519) + + CMakeLists.txt | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +commit d092fb27198f24423e51ce07375ebd6d486f64d3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Dec 30 01:53:03 2018 -0500 + + Ouch! Fix build on C++<11 + + src/hb.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 89949ed28db96edabeb09433fcc09f28168163d2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Dec 30 01:52:19 2018 -0500 + + Fix ubsan with passing nullptr to qsort() + + src/hb-array.hh | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +commit 357a0a7ad344caf898eb1697fcdb859d118b7a13 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 27 18:29:23 2018 -0500 + + Fix build on C++ < 11 + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 54c0a1731069a17ae4f3b79b419af75709f03f5b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 27 18:27:36 2018 -0500 + + [vector] Fix warning + + src/hb-vector.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 1043ddbee878a14df0ad8d83fbaa893370ef5a75 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 27 18:27:11 2018 -0500 + + [aat] Minor + + src/hb-aat-layout-morx-table.hh | 2 +- + src/hb-aat-map.hh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 71da9ca62fa87bd3e0fa9d40924bb4c220313a03 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 27 18:01:06 2018 -0500 + + [vector] Remove use of arrayZ() by using casts + + src/hb-ot-name-table.hh | 2 +- + src/hb-ot-name.cc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit fa333e34d6230210bc73a88b0ba6df2102dcda51 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 27 17:56:22 2018 -0500 + + [vector] Remove static_array + + Was good idea, but with C++ types with constructor/destructor, + was getting in + the way as compiler was destructing those items where it was not + desired. + Since C++ does not allow zero-sized arrays, just remove it... + + src/hb-aat-map.hh | 4 ++-- + src/hb-cff-interp-common.hh | 2 +- + src/hb-face.cc | 2 +- + src/hb-object.hh | 2 +- + src/hb-ot-cff-common.hh | 2 +- + src/hb-ot-layout-gsubgpos.hh | 2 +- + src/hb-ot-map.hh | 10 +++++----- + src/hb-ot-post-table.hh | 2 +- + src/hb-set.hh | 4 ++-- + src/hb-vector.hh | 34 +++++++++++----------------------- + src/hb.hh | 3 +++ + 11 files changed, 29 insertions(+), 38 deletions(-) + +commit ab2258a419abbace9ff27916143b46f88e8ccef3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 27 17:45:05 2018 -0500 + + [vector] Use allocated = -1 to signify failure + + src/hb-vector.hh | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +commit 09fa536d89d969998fe6bbe274a9964c73d1d982 +Author: Michiharu Ariza <ariza@adobe.com> +Date: Thu Dec 27 08:33:09 2018 -0800 + + fix lealk with cff2::accelerator_templ_t::topDict (#1517) + + src/hb-ot-cff2-table.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 3b81442cd5c11099ae9245074d24ef679b4473fa +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Dec 24 11:31:04 2018 -0500 + + [vector] Change pre-alloced count from 8 to 2 + + I'm thinking about dropping it to zero, but that needs slight code + changes. + + src/hb-vector.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit d25a2f1496d13846ddaea123ac6fb9807dc5669a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Dec 23 20:19:52 2018 -0500 + + Fix a few warnings + + src/hb-aat-layout-common.hh | 12 ++++++------ + src/hb-iter.hh | 8 ++++---- + src/hb-null.hh | 2 +- + src/hb-ot-cff1-table.hh | 2 +- + src/hb-ot-cff2-table.hh | 2 +- + src/hb-subset-cff-common.hh | 3 ++- + src/hb.hh | 3 ++- + 7 files changed, 17 insertions(+), 15 deletions(-) + +commit 85003b594b3aa1f6638e274bc89f18999a5de9f5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 22 16:19:10 2018 -0500 + + [iter] Fix warning + + src/hb-iter.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit e4355b1ca177200db6769136ead1ee25da86ec85 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 22 16:11:22 2018 -0500 + + [set] Add iter_t as alias to const_iter_t + + src/hb-set.hh | 6 ++++-- + src/test-iter.cc | 2 ++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +commit 33f8de61863efa538c488121c476fd0e907020d0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 22 15:10:18 2018 -0500 + + [set] Change to const_iter + + src/hb-set.hh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit f88fed5cd8787e3deeec05dac4353337dc02abdd +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 22 11:11:10 2018 -0500 + + [set] Cache length in iterator + + src/hb-set.hh | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +commit d0a706c7fdb72a1d224b4a5bdbad0fb8c90e3186 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Dec 22 19:47:48 2018 +0330 + + Minor, remove redundant inline + + src/hb-ot-layout.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit ae6e348d642194585543f0d548fb94d210575fe4 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Dec 22 19:47:29 2018 +0330 + + Minor, tweak spaces + + src/hb-ot-glyf-table.hh | 8 ++++---- + src/hb-subset-cff-common.hh | 15 ++++++--------- + 2 files changed, 10 insertions(+), 13 deletions(-) + +commit 29f0b6bce7da4c599f54066f7e7f6000f10d2f29 +Author: Michiharu Ariza <ariza@adobe.com> +Date: Sat Dec 22 07:47:04 2018 -0800 + + CFF renaming (#1507) + + * reimplement ByteStr as byte_str_t based on hb_ubytes_t + + Unuse start_embed<ByteStr> + Also renamed SubByteStr to byte_str_ref_t + More renaming to come + + * substr renamed to str_ref in line with its type byte_str_ref_t + + * uncamelize non-table struct names + + * uncamelized non-struct types OpCode etc + + * add byte_str_t copy ctor + + * test + + * test2 + + * undo tests + + * fix bot failure + + * undo the previous change + + * fixed tabs, added inline + + * Revert "fixed tabs, added inline" + + This reverts commit 21163c30e9d18759414f7fe2518628241599f039. + + * fix tabs + + src/hb-cff-interp-common.hh | 215 +++++++++++++++------------------ + src/hb-cff-interp-cs-common.hh | 250 + +++++++++++++++++++-------------------- + src/hb-cff-interp-dict-common.hh | 64 +++++----- + src/hb-cff1-interp-cs.hh | 26 ++-- + src/hb-cff2-interp-cs.hh | 56 ++++----- + src/hb-ot-cff-common.hh | 59 ++++----- + src/hb-ot-cff1-table.cc | 56 ++++----- + src/hb-ot-cff1-table.hh | 147 ++++++++++++----------- + src/hb-ot-cff2-table.cc | 28 ++--- + src/hb-ot-cff2-table.hh | 128 ++++++++++---------- + src/hb-subset-cff-common.cc | 10 +- + src/hb-subset-cff-common.hh | 232 + ++++++++++++++++++------------------ + src/hb-subset-cff1.cc | 244 + +++++++++++++++++++------------------- + src/hb-subset-cff2.cc | 100 ++++++++-------- + 14 files changed, 796 insertions(+), 819 deletions(-) + +commit 89d04129e2f4dedb865635dcb8f0fd020e4218c2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 20:07:52 2018 -0500 + + [set] Actually derive iterator from hb_sorted_iter_t<> + + src/hb-set.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit fc35919d015c5b8d231933d6bc6ea640c83af6b2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 20:06:17 2018 -0500 + + [set] Implement unified iterator + + src/hb-set.hh | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +commit 4911e67d2d2188ee9bdc0315e121e51d9967b567 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 20:00:52 2018 -0500 + + [set] Mark some internals protected + + src/hb-set.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit 954b985422a8964f6e7da9f71ab7a68074017111 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 19:55:02 2018 -0500 + + [iter] Add hb_sorted_iter_t<> + + src/hb-array.hh | 2 +- + src/hb-iter.hh | 11 +++++++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +commit b205105c9e1c6295b17cfd88ffb8ca7d963ef173 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 19:48:21 2018 -0500 + + [iter] Change operator[] operand to be signed + + To fix older compilers again (this was the case in hb_array_t). + + hb-ot-layout-common.hh:1353: note: candidate 2: operator[](T*, + int) <built-in> + hb-ot-layout-common.hh:1354: error: ISO C++ says that these are + ambiguous, even though the worst conversion for the first is better + than the worst conversion for the second: + hb-iter.hh:63: note: candidate 1: Item& hb_iter_t<Iter, + Item>::operator[](unsigned int) const [with Iter = hb_array_t<const + OT::IntType<short unsigned int, 2u> >, Item = const OT::IntType<short + unsigned int, 2u>] + hb-ot-layout-common.hh:1354: note: candidate 2: operator[](T*, + int) <built-in> + hb-ot-layout-common.hh: In member function 'bool + OT::ClassDef::serialize(hb_serialize_context_t*, hb_array_t<const + OT::IntType<short unsigned int, 2u> >, hb_array_t<const + OT::IntType<short unsigned int, 2u> >)': + hb-ot-layout-common.hh:1490: error: ISO C++ says that these are + ambiguous, even though the worst conversion for the first is better + than the worst conversion for the second: + hb-iter.hh:63: note: candidate 1: Item& hb_iter_t<Iter, + Item>::operator[](unsigned int) const [with Iter = hb_array_t<const + OT::IntType<short unsigned int, 2u> >, Item = const OT::IntType<short + unsigned int, 2u>] + hb-ot-layout-common.hh:1490: note: candidate 2: operator[](T*, + int) <built-in> + + src/hb-iter.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 25786f49c1df36fdb5f78681055a1f4aa4b17f86 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 19:29:00 2018 -0500 + + [array] Port to hb_iter_t<> + + hb_array_t is its own iterator... + + src/hb-array.hh | 75 + +++++++++++++++++++++++++-------------------------------- + src/hb-iter.hh | 5 ++-- + 2 files changed, 36 insertions(+), 44 deletions(-) + +commit 2a33ab0560a13cb8fef5983bfe0f6d68dfd47b14 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 18:49:27 2018 -0500 + + [iter] Change __more__ to fallback to __len__ + + src/hb-iter.hh | 15 ++++++--------- + src/test-iter.cc | 1 - + 2 files changed, 6 insertions(+), 10 deletions(-) + +commit 474a12058d681f2d7cef84db0cf20f9f784fa400 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 18:46:51 2018 -0500 + + [array/vector] Rename len to length + + src/hb-aat-layout-feat-table.hh | 5 ++- + src/hb-aat-layout-lcar-table.hh | 2 +- + src/hb-aat-map.cc | 4 +-- + src/hb-array.hh | 72 + ++++++++++++++++++++--------------------- + src/hb-cff-interp-common.hh | 10 +++--- + src/hb-cff2-interp-cs.hh | 6 ++-- + src/hb-coretext.cc | 12 +++---- + src/hb-face.cc | 4 +-- + src/hb-object.hh | 23 +++++++------ + src/hb-open-file.hh | 4 +-- + src/hb-open-type.hh | 8 ++--- + src/hb-ot-cff-common.hh | 38 +++++++++++----------- + src/hb-ot-cff1-table.hh | 28 ++++++++-------- + src/hb-ot-cmap-table.hh | 24 +++++++------- + src/hb-ot-color-colr-table.hh | 6 ++-- + src/hb-ot-hdmx-table.hh | 6 ++-- + src/hb-ot-hmtx-table.hh | 8 ++--- + src/hb-ot-layout-common.hh | 32 +++++++++--------- + src/hb-ot-layout-gdef-table.hh | 4 +-- + src/hb-ot-layout-gsub-table.hh | 24 +++++++------- + src/hb-ot-layout-gsubgpos.hh | 2 +- + src/hb-ot-layout.cc | 2 +- + src/hb-ot-map.cc | 22 ++++++------- + src/hb-ot-map.hh | 4 +-- + src/hb-ot-math-table.hh | 4 +-- + src/hb-ot-maxp-table.hh | 2 +- + src/hb-ot-name-table.hh | 8 ++--- + src/hb-ot-name.cc | 4 +-- + src/hb-ot-post-table.hh | 8 ++--- + src/hb-ot-var-fvar-table.hh | 2 +- + src/hb-ot-vorg-table.hh | 10 +++--- + src/hb-set.hh | 36 ++++++++++----------- + src/hb-subset-cff-common.cc | 8 ++--- + src/hb-subset-cff-common.hh | 50 ++++++++++++++-------------- + src/hb-subset-cff1.cc | 48 +++++++++++++-------------- + src/hb-subset-cff2.cc | 16 ++++----- + src/hb-subset-glyf.cc | 14 ++++---- + src/hb-subset-plan.cc | 2 +- + src/hb-uniscribe.cc | 26 +++++++-------- + src/hb-vector.hh | 56 ++++++++++++++++---------------- + src/test-iter.cc | 4 +-- + 41 files changed, 325 insertions(+), 323 deletions(-) + +commit 2fc1860a5b40f5deba720c0c1099fdd0450b77c0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 18:09:45 2018 -0500 + + [iter] Split hb_iter_t<> into hb_iter_t<> and hb_iter_mixin_t<> + + src/hb-iter.hh | 31 ++++++++++++++++++++----------- + src/test-iter.cc | 2 +- + 2 files changed, 21 insertions(+), 12 deletions(-) + +commit 865deeb3be1cb40efe3d7c42db48b0cdf977de47 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 17:35:58 2018 -0500 + + Adjust internal header dependencies + + src/hb-array.hh | 5 ++++- + src/hb-dsalgs.hh | 1 - + src/hb-iter.hh | 1 + + src/hb-vector.hh | 1 + + src/hb.hh | 15 +++++++++------ + src/test-iter.cc | 1 + + src/test-unicode-ranges.cc | 1 + + 7 files changed, 17 insertions(+), 8 deletions(-) + +commit 8e5c2bc60bd9a800dacc96cc29c6ff831a852ae3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 17:29:11 2018 -0500 + + [Makefile.am] Minor + + src/Makefile.am | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +commit f419cef4174c5447bf5031e771483f3274ae4dce +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 17:22:09 2018 -0500 + + [iter] Include from hb.hh + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 7557e34872c846433c2465b21b99bf7c5f961673 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 17:21:19 2018 -0500 + + [iter] Move hb_fill() and hb_copy() to hb-iter.hh + + src/hb-iter.hh | 18 ++++++++++++++++++ + src/test-iter.cc | 16 ---------------- + 2 files changed, 18 insertions(+), 16 deletions(-) + +commit 5e1840e031cff1127842fc5cc8ee93e5959f02d5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 16:39:57 2018 -0500 + + [iter] Disallow copy-construction or assignment of hb_iter_t<> + + Should only be done by subclass. + + src/hb-iter.hh | 5 +++++ + 1 file changed, 5 insertions(+) + +commit 65e8bd56ad26912636fbdc400a83cc48db2a13ce +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 16:20:30 2018 -0500 + + [iter] Fix hb_copy() return value + + src/test-iter.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 40d71211a8969ec4414d2476a209e60d0a3525d3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 16:19:44 2018 -0500 + + [iter] Add const_iter_t / const_iter() + + src/hb-iter.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit aaddfaa57a841726a8b49653af3f8b702831da1b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 16:04:38 2018 -0500 + + [iter] Make hb_fill() take collection type, not iter + + Starting to get the hang of when take which. + + src/test-iter.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 7b4eea853c36fd59db6e5d68bbef9b8cebad760e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 16:02:16 2018 -0500 + + [array] Add more hb_array() / hb_sorted_array() variants + + src/hb-array.hh | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +commit 09740148e310021a4a690666c2e2836c2005353d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 15:56:01 2018 -0500 + + [serialize] Use component_list by reference, as a supplier + + src/hb-ot-layout-gsub-table.hh | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +commit 3dbe1e364c19d82ab436b9ea7b41c9754d43e923 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 15:53:09 2018 -0500 + + [iter] Add .random_access() + + src/hb-iter.hh | 4 ++++ + src/test-iter.cc | 1 + + 2 files changed, 5 insertions(+) + +commit 20f14b4aa6311d8fb2ed80c47bb15e8d87d2f6b3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 15:19:22 2018 -0500 + + [iter] Fix __end__() + + src/hb-iter.hh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 95265aeab7da54f31d4f68590af7730054b6be16 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 15:12:55 2018 -0500 + + [array] Remove copy constructor + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1502 + + src/hb-array.hh | 1 - + 1 file changed, 1 deletion(-) + +commit 69d232eaea323b8c42e5fa1788553ac4e8bf3a50 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 15:08:06 2018 -0500 + + Fix bot + + C:\projects\harfbuzz\src\hb-uniscribe.cc(709): error C2666: + 'hb_vector_t<OPENTYPE_FEATURE_RECORD,8>::operator + +': 3 overloads have similar conversions + [C:\projects\harfbuzz\build\harfbuzz.vcxproj] + + src/hb-uniscribe.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b9a51f531009ce201b86a0326aff662fd19a68a1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 15:05:00 2018 -0500 + + Minor + + src/hb-ot-layout-gpos-table.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit bdb6da72267c8fa4802a2183ba69a1535653378b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 11:20:27 2018 -0500 + + [iter] Fix test again + + src/test-iter.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit e9520752489298e0ce1a08da10ec3d439f9356d9 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 11:15:16 2018 -0500 + + Minor + + src/Makefile.am | 6 +++--- + src/test-iter.cc | 1 - + 2 files changed, 3 insertions(+), 4 deletions(-) + +commit 35503d7d7324293162b605ffe0bd712656dd52b8 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 03:03:46 2018 -0500 + + [iter] More prototyping + + src/test-iter.cc | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +commit 73c7a896d1395539e3c9e71b073ce5094c835aa0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 02:48:28 2018 -0500 + + [iter] Make hb_fill() and hb_copy() take iterators + + I'm still going back and force... + + src/test-iter.cc | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +commit 12e506fda4bfd82d67e4beede29ae7dbc02ad8f4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 02:47:04 2018 -0500 + + [iter] Add hb_fill() + + src/test-iter.cc | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +commit ad3ed58de5297930826c67d18b99991b93d29654 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 02:12:55 2018 -0500 + + [iter] Start prototyping hb_copy() + + src/test-iter.cc | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +commit 44af738d19486095c0fbc2ef2b359a298126ac2b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 01:59:37 2018 -0500 + + [iter] Showcase implicit casts + + src/test-iter.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +commit 879faa2aee74e237594901426096ceeb78a716a4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 01:57:40 2018 -0500 + + Rename + + src/hb-array.hh | 2 +- + src/hb-open-type.hh | 4 ++-- + src/hb-vector.hh | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +commit aeb696a91cd1cdc73bf5b87e56163c7f64778616 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 01:57:02 2018 -0500 + + [iter] Rename + + src/hb-iter.hh | 44 ++++++++++++++++++++++---------------------- + 1 file changed, 22 insertions(+), 22 deletions(-) + +commit 8001e00a470ad06f0307002b4cade5612ee7b521 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 01:53:27 2018 -0500 + + [iter] First sample use + + src/Makefile.am | 5 ++++- + src/hb-iter.hh | 25 +++++++++++-------------- + src/test-iter.cc | 25 ++++++++++++++++++++----- + 3 files changed, 35 insertions(+), 20 deletions(-) + +commit 19d2b5013d8ac7aa45b3b8e8c61ad90773c86925 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 01:17:35 2018 -0500 + + [iter] Add bidirectionality + + src/hb-iter.hh | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +commit 314d8698d0746416efd332f5fae45aecb26df7ee +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 00:54:55 2018 -0500 + + [iter] Sketch new iterator design + + src/hb-iter.hh | 154 + +++++++++++++++++++------------------------------------ + src/test-iter.cc | 16 ++++++ + 2 files changed, 69 insertions(+), 101 deletions(-) + +commit f6d5f1e91ced2b6b1114ad765f568f799dd3612f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 00:23:34 2018 -0500 + + [iter] Add empty test + + src/Makefile.am | 7 +++++-- + src/hb-machinery.hh | 1 - + src/test-iter.cc | 33 +++++++++++++++++++++++++++++++++ + src/test-unicode-ranges.cc | 2 -- + 4 files changed, 38 insertions(+), 5 deletions(-) + +commit b80b97b549dacc10d314bf8b5fd4ace596ccdfe1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 21 00:08:05 2018 -0500 + + Revert "Remove unused hb-iter.hh" + + This reverts commit 969ff3c7aadbe721cdd414488eb170433f10d00c. + + src/Makefile.sources | 1 + + src/hb-iter.hh | 146 + +++++++++++++++++++++++++++++++++++++++++++++++++++ + src/hb-machinery.hh | 1 + + 3 files changed, 148 insertions(+) + +commit a728c63a98281fd4a0661e17fc01171bc3205b27 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 20 23:15:49 2018 -0500 + + [vector] Add operator bool + + src/hb-vector.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit bd369773921b4891996bd21f325702e490f47ca4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 20 23:14:24 2018 -0500 + + Rename + + src/hb-array.hh | 2 +- + src/hb-open-type.hh | 4 ++-- + src/hb-vector.hh | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +commit e6ebc9b6f89e62d888b3bcf926afd624f16f3e95 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 20 23:13:36 2018 -0500 + + Remove unused typedef + + src/hb-machinery.hh | 3 --- + 1 file changed, 3 deletions(-) + +commit 4941e95f10fe0fe658752134a42b58896fb19c42 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Dec 20 21:48:57 2018 -0500 + + 2.3.0 + + NEWS | 15 +++++++++++++++ + configure.ac | 2 +- + src/hb-aat-layout.cc | 6 +++--- + src/hb-version.h | 4 ++-- + 4 files changed, 21 insertions(+), 6 deletions(-) + commit 87f7c83fffb7e64970be23c8e3c620d32a3b8f5b Author: Behdad Esfahbod <behdad@behdad.org> Date: Thu Dec 20 15:54:17 2018 -0500 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index 890c258d83c..ef87dad76c1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,10 @@ +Overview of changes leading to 2.3.1 +Wednesday, January 30, 2019 +==================================== +- AAT bug fixes. +- Misc internal housekeeping cleanup. + + Overview of changes leading to 2.3.0 Thursday, December 20, 2018 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/README b/Build/source/libs/harfbuzz/harfbuzz-src/README index e50f8f06e5d..fd93be84fe8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/README +++ b/Build/source/libs/harfbuzz/harfbuzz-src/README @@ -1,6 +1,6 @@ -[![Travis Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz) -[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz) -[![CircleCI Build Status](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz) +[![Travis Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg?branch=master)](https://travis-ci.org/harfbuzz/harfbuzz) +[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true&branch=master)](https://ci.appveyor.com/project/harfbuzz/harfbuzz) +[![CircleCI Build Status](https://circleci.com/gh/harfbuzz/harfbuzz/tree/master.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz/tree/master) [![Coverity Code Health](https://img.shields.io/coverity/scan/5450.svg)](https://scan.coverity.com/projects/behdad-harfbuzz) [![Codacy Code Health](https://api.codacy.com/project/badge/Grade/f17f1708783c447488bc8dd317150eaa)](https://app.codacy.com/app/behdad/harfbuzz) [![Codecov Code Coverage](https://codecov.io/gh/harfbuzz/harfbuzz/branch/master/graph/badge.svg)](https://codecov.io/gh/harfbuzz/harfbuzz) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index 03155372bfb..b7827a62a11 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], - [2.3.0], + [2.3.1], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) @@ -102,9 +102,6 @@ if test "x$GCC" = "xyes"; then # by overriding CXXFLAGS. CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics" - # Assorted warnings - CXXFLAGS="$CXXFLAGS -Wcast-align" - case "$host" in *-*-mingw*) ;; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am index 3618d03a2c7..4a130e1524c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am @@ -384,15 +384,23 @@ dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc dump_use_data_CPPFLAGS = $(HBCFLAGS) dump_use_data_LDADD = libharfbuzz.la $(HBLIBS) -check_PROGRAMS += test-ot-tag test-unicode-ranges -TESTS += test-ot-tag test-unicode-ranges +COMPILED_TESTS = test-iter test-ot-tag test-unicode-ranges +COMPILED_TESTS_CPPFLAGS = $(HBCFLAGS) -DMAIN -UNDEBUG +COMPILED_TESTS_LDADD = libharfbuzz.la $(HBLIBS) +check_PROGRAMS += $(COMPILED_TESTS) +TESTS += $(COMPILED_TESTS) + +test_iter_SOURCES = test-iter.cc hb-static.cc +test_iter_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_iter_LDADD = $(COMPILED_TESTS_LDADD) test_ot_tag_SOURCES = hb-ot-tag.cc -test_ot_tag_CPPFLAGS = $(HBCFLAGS) -DMAIN -test_ot_tag_LDADD = libharfbuzz.la $(HBLIBS) +test_ot_tag_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_ot_tag_LDADD = $(COMPILED_TESTS_LDADD) test_unicode_ranges_SOURCES = test-unicode-ranges.cc -test_unicode_ranges_LDADD = libharfbuzz.la $(HBLIBS) +test_unicode_ranges_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_unicode_ranges_LDADD = $(COMPILED_TESTS_LDADD) TESTS_ENVIRONMENT = \ srcdir="$(srcdir)" \ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources index 98b62288978..0da4abe05b1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources @@ -36,6 +36,7 @@ HB_BASE_sources = \ hb-face.hh \ hb-font.cc \ hb-font.hh \ + hb-iter.hh \ hb-kern.hh \ hb-machinery.hh \ hb-map.cc \ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py index e65b9814adf..6532ee7e0f7 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py @@ -131,6 +131,8 @@ for i in range (2): what = ["INDIC_SYLLABIC_CATEGORY", "INDIC_MATRA_CATEGORY"] what_short = ["ISC", "IMC"] +print ('#pragma GCC diagnostic push') +print ('#pragma GCC diagnostic ignored "-Wunused-macros"') for i in range (2): print () vv = sorted (values[i].keys ()) @@ -148,6 +150,7 @@ for i in range (2): (what_short[i], s, what[i], v.upper (), ' '* ((48-1 - len (what[i]) - 1 - len (v)) // 8), values[i][v], v)) +print ('#pragma GCC diagnostic pop') print () print ("#define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M)") print () diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-os2-unicode-ranges.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-os2-unicode-ranges.py index d768313ddde..8cf59858802 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-os2-unicode-ranges.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-os2-unicode-ranges.py @@ -10,8 +10,11 @@ import io import re import sys -reload(sys) -sys.setdefaultencoding('utf-8') +try: + reload(sys) + sys.setdefaultencoding('utf-8') +except NameError: + pass # Python 3 print ("""static OS2Range _hb_os2_unicode_ranges[] = {""") @@ -32,12 +35,12 @@ with io.open(input_file, mode="r", encoding="utf-8") as f: current_bit = fields[0] fields = fields[1:] elif len(fields) > 3: - raise Error("bad input :(.") + raise Exception("bad input :(.") name = fields[0] ranges = re.split("-", fields[1]) if len(ranges) != 2: - raise Error("bad input :(.") + raise Exception("bad input :(.") v = tuple((int(ranges[0], 16), int(ranges[1], 16), int(current_bit), name)) all_ranges.append(v) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py index 099f6a18518..be204b60bce 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py @@ -1,8 +1,10 @@ #!/usr/bin/env python +# flake8: noqa from __future__ import print_function, division, absolute_import -import io, sys +import io +import sys if len (sys.argv) != 5: print ("usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt", file=sys.stderr) @@ -453,6 +455,8 @@ num = 0 offset = 0 starts = [] ends = [] +print ('#pragma GCC diagnostic push') +print ('#pragma GCC diagnostic ignored "-Wunused-macros"') for k,v in sorted(use_mapping.items()): if k in use_positions and use_positions[k]: continue print ("#define %s USE_%s /* %s */" % (k, k, v.__name__[3:])) @@ -461,6 +465,7 @@ for k,v in sorted(use_positions.items()): for suf in v.keys(): tag = k + suf print ("#define %s USE_%s" % (tag, tag)) +print ('#pragma GCC diagnostic pop') print ("") print ("static const USE_TABLE_ELEMENT_TYPE use_table[] = {") for u in uu: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh index a1af595f9ff..1188e352f03 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh @@ -74,7 +74,7 @@ struct FontDescriptor struct fdsc { - enum { tableTag = HB_AAT_TAG_fdsc }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_fdsc; enum { Weight = HB_TAG ('w','g','h','t'), diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh index 4235b363a1f..236e4aaf1e3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh @@ -58,20 +58,16 @@ typedef LArrayOf<Anchor> GlyphAnchors; struct ankr { - enum { tableTag = HB_AAT_TAG_ankr }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_ankr; const Anchor &get_anchor (hb_codepoint_t glyph_id, unsigned int i, - unsigned int num_glyphs, - const char *end) const + unsigned int num_glyphs) const { - const Offset<HBUINT16, false> *offset = (this+lookupTable).get_value (glyph_id, num_glyphs); + const NNOffsetTo<GlyphAnchors> *offset = (this+lookupTable).get_value (glyph_id, num_glyphs); if (!offset) return Null(Anchor); - const GlyphAnchors &anchors = StructAtOffset<GlyphAnchors> (&(this+anchorData), *offset); - /* TODO Use sanitizer; to avoid overflows and more. */ - if (unlikely ((const char *) &anchors + anchors.get_size () > end)) - return Null(Anchor); + const GlyphAnchors &anchors = &(this+anchorData) + *offset; return anchors[i]; } @@ -80,15 +76,15 @@ struct ankr TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this) && version == 0 && - lookupTable.sanitize (c, this))); + lookupTable.sanitize (c, this, &(this+anchorData)))); } protected: HBUINT16 version; /* Version number (set to zero) */ HBUINT16 flags; /* Flags (currently unused; set to zero) */ - LOffsetTo<Lookup<Offset<HBUINT16, false> >, false> + LOffsetTo<Lookup<NNOffsetTo<GlyphAnchors> > > lookupTable; /* Offset to the table's lookup table */ - LOffsetTo<HBUINT8, false> + LNNOffsetTo<HBUINT8> anchorData; /* Offset to the glyph data table */ public: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh index 5bc59cbb10a..9139d28183c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh @@ -116,7 +116,7 @@ struct BaselineTableFormat3Part struct bsln { - enum { tableTag = HB_AAT_TAG_bsln }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_bsln; bool sanitize (hb_sanitize_context_t *c) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh index 95d6b312ab5..27ade28fe19 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh @@ -77,7 +77,7 @@ struct LookupFormat0 template <typename T> struct LookupSegmentSingle { - enum { TerminationWordCount = 2 }; + static constexpr unsigned TerminationWordCount = 2u; int cmp (hb_codepoint_t g) const { return g < first ? -1 : g <= last ? 0 : +1 ; } @@ -136,7 +136,7 @@ struct LookupFormat2 template <typename T> struct LookupSegmentArray { - enum { TerminationWordCount = 2 }; + static constexpr unsigned TerminationWordCount = 2u; const T* get_value (hb_codepoint_t glyph_id, const void *base) const { @@ -164,7 +164,7 @@ struct LookupSegmentArray GlyphID last; /* Last GlyphID in this segment */ GlyphID first; /* First GlyphID in this segment */ - OffsetTo<UnsizedArrayOf<T>, HBUINT16, false> + NNOffsetTo<UnsizedArrayOf<T> > valuesZ; /* A 16-bit offset from the start of * the table to the data. */ public: @@ -207,7 +207,7 @@ struct LookupFormat4 template <typename T> struct LookupSingle { - enum { TerminationWordCount = 1 }; + static constexpr unsigned TerminationWordCount = 1u; int cmp (hb_codepoint_t g) const { return glyph.cmp (g); } @@ -394,7 +394,7 @@ struct Lookup case 4: return_trace (u.format4.sanitize (c, base)); case 6: return_trace (u.format6.sanitize (c, base)); case 8: return_trace (u.format8.sanitize (c, base)); - case 10: return_trace (false); /* No need to support format10 apparently */ + case 10: return_trace (false); /* We don't support format10 here currently. */ default:return_trace (true); } } @@ -511,9 +511,10 @@ struct StateTable const Entry<Extra> *get_entries () const { return (this+entryTable).arrayZ; } - const Entry<Extra> *get_entryZ (int state, unsigned int klass) const + const Entry<Extra> &get_entry (int state, unsigned int klass) const { - if (unlikely (klass >= nClasses)) return nullptr; + if (unlikely (klass >= nClasses)) + klass = StateTable<Types, Entry<Extra> >::CLASS_OUT_OF_BOUNDS; const HBUSHORT *states = (this+stateArrayTable).arrayZ; const Entry<Extra> *entries = (this+entryTable).arrayZ; @@ -521,7 +522,7 @@ struct StateTable unsigned int entry = states[state * nClasses + klass]; DEBUG_MSG (APPLY, nullptr, "e%u", entry); - return &entries[entry]; + return entries[entry]; } bool sanitize (hb_sanitize_context_t *c, @@ -529,6 +530,7 @@ struct StateTable { TRACE_SANITIZE (this); if (unlikely (!(c->check_struct (this) && + nClasses >= 4 /* Ensure pre-defined classes fit. */ && classTable.sanitize (c, this)))) return_trace (false); const HBUSHORT *states = (this+stateArrayTable).arrayZ; @@ -571,7 +573,7 @@ struct StateTable -min_state, row_stride))) return_trace (false); - if ((c->max_ops -= state_neg - min_state) < 0) + if ((c->max_ops -= state_neg - min_state) <= 0) return_trace (false); { /* Sweep new states. */ const HBUSHORT *stop = &states[min_state * num_classes]; @@ -590,7 +592,7 @@ struct StateTable max_state + 1, row_stride))) return_trace (false); - if ((c->max_ops -= max_state - state_pos + 1) < 0) + if ((c->max_ops -= max_state - state_pos + 1) <= 0) return_trace (false); { /* Sweep new states. */ if (unlikely (hb_unsigned_mul_overflows ((max_state + 1), num_classes))) @@ -606,7 +608,7 @@ struct StateTable if (unlikely (!c->check_array (entries, num_entries))) return_trace (false); - if ((c->max_ops -= num_entries - entry) < 0) + if ((c->max_ops -= num_entries - entry) <= 0) return_trace (false); { /* Sweep new entries. */ const Entry<Extra> *stop = &entries[num_entries]; @@ -629,11 +631,11 @@ struct StateTable protected: HBUINT nClasses; /* Number of classes, which is the number of indices * in a single line in the state array. */ - OffsetTo<ClassType, HBUINT, false> + NNOffsetTo<ClassType, HBUINT> classTable; /* Offset to the class table. */ - OffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT> stateArrayTable;/* Offset to the state array. */ - OffsetTo<UnsizedArrayOf<Entry<Extra> >, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<Entry<Extra> >, HBUINT> entryTable; /* Offset to the entry array. */ public: @@ -669,7 +671,7 @@ struct ClassTable struct ObsoleteTypes { - enum { extended = false }; + static constexpr bool extended = false; typedef HBUINT16 HBUINT; typedef HBUINT8 HBUSHORT; typedef ClassTable<HBUINT8> ClassTypeNarrow; @@ -699,7 +701,7 @@ struct ObsoleteTypes }; struct ExtendedTypes { - enum { extended = true }; + static constexpr bool extended = true; typedef HBUINT32 HBUINT; typedef HBUINT16 HBUSHORT; typedef Lookup<HBUINT16> ClassTypeNarrow; @@ -707,22 +709,22 @@ struct ExtendedTypes template <typename T> static unsigned int offsetToIndex (unsigned int offset, - const void *base, - const T *array) + const void *base HB_UNUSED, + const T *array HB_UNUSED) { return offset; } template <typename T> static unsigned int byteOffsetToIndex (unsigned int offset, - const void *base, - const T *array) + const void *base HB_UNUSED, + const T *array HB_UNUSED) { return offset / 2; } template <typename T> static unsigned int wordOffsetToIndex (unsigned int offset, - const void *base, - const T *array) + const void *base HB_UNUSED, + const T *array HB_UNUSED) { return offset; } @@ -745,16 +747,13 @@ struct StateTableDriver buffer->clear_output (); int state = StateTable<Types, EntryData>::STATE_START_OF_TEXT; - bool last_was_dont_advance = false; for (buffer->idx = 0; buffer->successful;) { unsigned int klass = buffer->idx < buffer->len ? machine.get_class (buffer->info[buffer->idx].codepoint, num_glyphs) : (unsigned) StateTable<Types, EntryData>::CLASS_END_OF_TEXT; DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx); - const Entry<EntryData> *entry = machine.get_entryZ (state, klass); - if (unlikely (!entry)) - break; + const Entry<EntryData> &entry = machine.get_entry (state, klass); /* Unsafe-to-break before this if not in state 0, as things might * go differently if we start from state 0 here. @@ -765,31 +764,28 @@ struct StateTableDriver /* If there's no action and we're just epsilon-transitioning to state 0, * safe to break. */ if (c->is_actionable (this, entry) || - !(entry->newState == StateTable<Types, EntryData>::STATE_START_OF_TEXT && - entry->flags == context_t::DontAdvance)) + !(entry.newState == StateTable<Types, EntryData>::STATE_START_OF_TEXT && + entry.flags == context_t::DontAdvance)) buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1); } /* Unsafe-to-break if end-of-text would kick in here. */ if (buffer->idx + 2 <= buffer->len) { - const Entry<EntryData> *end_entry = machine.get_entryZ (state, 0); + const Entry<EntryData> &end_entry = machine.get_entry (state, StateTable<Types, EntryData>::CLASS_END_OF_TEXT); if (c->is_actionable (this, end_entry)) buffer->unsafe_to_break (buffer->idx, buffer->idx + 2); } - if (unlikely (!c->transition (this, entry))) - break; - - last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0; + c->transition (this, entry); - state = machine.new_state (entry->newState); + state = machine.new_state (entry.newState); DEBUG_MSG (APPLY, nullptr, "s%d", state); if (buffer->idx == buffer->len) break; - if (!last_was_dont_advance) + if (!(entry.flags & context_t::DontAdvance) || buffer->max_ops-- <= 0) buffer->next_glyph (); } @@ -825,7 +821,6 @@ struct hb_aat_apply_context_t : hb_buffer_t *buffer; hb_sanitize_context_t sanitizer; const ankr *ankr_table; - const char *ankr_end; /* Unused. For debug tracing only. */ unsigned int lookup_index; @@ -838,7 +833,7 @@ struct hb_aat_apply_context_t : HB_INTERNAL ~hb_aat_apply_context_t (); - HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_, const char *ankr_end_); + HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_); void set_lookup_index (unsigned int i) { lookup_index = i; } }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh index 63c69a20f9f..ab23ee05693 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh @@ -118,11 +118,10 @@ struct FeatureName if (selectors_count) { hb_array_t<const SettingName> arr = settings_table.sub_array (start_offset, selectors_count); - unsigned int count = arr.len; - for (unsigned int i = 0; i < count; i++) + for (unsigned int i = 0; i < arr.length; i++) settings_table[start_offset + i].get_info (&selectors[i], default_selector); } - return settings_table.len; + return settings_table.length; } hb_aat_layout_feature_type_t get_feature_type () const @@ -155,7 +154,7 @@ struct FeatureName struct feat { - enum { tableTag = HB_AAT_TAG_feat }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_feat; bool has_data () const { return version.to_int (); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-just-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-just-table.hh index d39945abd6b..d53f8f19eff 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-just-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-just-table.hh @@ -382,7 +382,7 @@ struct JustificationHeader struct just { - enum { tableTag = HB_AAT_TAG_just }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_just; bool sanitize (hb_sanitize_context_t *c) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh index 291f3e35b40..a64c8073819 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh @@ -170,11 +170,11 @@ struct Format1Entry<true> DEFINE_SIZE_STATIC (2); }; - static bool performAction (const Entry<EntryData> *entry) - { return entry->data.kernActionIndex != 0xFFFF; } + static bool performAction (const Entry<EntryData> &entry) + { return entry.data.kernActionIndex != 0xFFFF; } - static unsigned int kernActionIndex (const Entry<EntryData> *entry) - { return entry->data.kernActionIndex; } + static unsigned int kernActionIndex (const Entry<EntryData> &entry) + { return entry.data.kernActionIndex; } }; template <> struct Format1Entry<false> @@ -192,11 +192,11 @@ struct Format1Entry<false> typedef void EntryData; - static bool performAction (const Entry<EntryData> *entry) - { return entry->flags & Offset; } + static bool performAction (const Entry<EntryData> &entry) + { return entry.flags & Offset; } - static unsigned int kernActionIndex (const Entry<EntryData> *entry) - { return entry->flags & Offset; } + static unsigned int kernActionIndex (const Entry<EntryData> &entry) + { return entry.flags & Offset; } }; template <typename KernSubTableHeader> @@ -210,7 +210,7 @@ struct KerxSubTableFormat1 struct driver_context_t { - enum { in_place = true }; + static constexpr bool in_place = true; enum { DontAdvance = Format1EntryT::DontAdvance, @@ -228,15 +228,15 @@ struct KerxSubTableFormat1 crossStream (table->header.coverage & table->header.CrossStream) {} bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> *entry) + const Entry<EntryData> &entry) { return Format1EntryT::performAction (entry); } - bool transition (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + void transition (StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; + unsigned int flags = entry.flags; if (flags & Format1EntryT::Reset) depth = 0; @@ -259,7 +259,7 @@ struct KerxSubTableFormat1 if (!c->sanitizer.check_array (actions, depth, tuple_count)) { depth = 0; - return false; + return; } hb_mask_t kern_mask = c->plan->kern_mask; @@ -334,8 +334,6 @@ struct KerxSubTableFormat1 } } } - - return true; } private: @@ -374,7 +372,7 @@ struct KerxSubTableFormat1 protected: KernSubTableHeader header; StateTable<Types, EntryData> machine; - OffsetTo<UnsizedArrayOf<FWORD>, HBUINT, false>kernAction; + NNOffsetTo<UnsizedArrayOf<FWORD>, HBUINT> kernAction; public: DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 5 * sizeof (HBUINT)); }; @@ -443,13 +441,13 @@ struct KerxSubTableFormat2 protected: KernSubTableHeader header; HBUINT rowWidth; /* The width, in bytes, of a row in the table. */ - OffsetTo<typename Types::ClassTypeWide, HBUINT, false> + NNOffsetTo<typename Types::ClassTypeWide, HBUINT> leftClassTable; /* Offset from beginning of this subtable to * left-hand class table. */ - OffsetTo<typename Types::ClassTypeWide, HBUINT, false> + NNOffsetTo<typename Types::ClassTypeWide, HBUINT> rightClassTable;/* Offset from beginning of this subtable to * right-hand class table. */ - OffsetTo<UnsizedArrayOf<FWORD>, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<FWORD>, HBUINT> array; /* Offset from beginning of this subtable to * the start of the kerning array. */ public: @@ -471,7 +469,7 @@ struct KerxSubTableFormat4 struct driver_context_t { - enum { in_place = true }; + static constexpr bool in_place = true; enum Flags { Mark = 0x8000, /* If set, remember this glyph as the marked glyph. */ @@ -498,16 +496,16 @@ struct KerxSubTableFormat4 mark (0) {} bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> *entry) + const Entry<EntryData> &entry) { - return entry->data.ankrActionIndex != 0xFFFF; + return entry.data.ankrActionIndex != 0xFFFF; } - bool transition (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + void transition (StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; - if (mark_set && entry->data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len) + if (mark_set && entry.data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len) { hb_glyph_position_t &o = buffer->cur_pos(); switch (action_type) @@ -515,9 +513,8 @@ struct KerxSubTableFormat4 case 0: /* Control Point Actions.*/ { /* indexed into glyph outline. */ - const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex]; - if (!c->sanitizer.check_array (data, 2)) - return false; + const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex]; + if (!c->sanitizer.check_array (data, 2)) return; HB_UNUSED unsigned int markControlPoint = *data++; HB_UNUSED unsigned int currControlPoint = *data++; hb_position_t markX = 0; @@ -532,7 +529,7 @@ struct KerxSubTableFormat4 currControlPoint, HB_DIRECTION_LTR /*XXX*/, &currX, &currY)) - return true; /* True, such that the machine continues. */ + return; o.x_offset = markX - currX; o.y_offset = markY - currY; @@ -542,19 +539,16 @@ struct KerxSubTableFormat4 case 1: /* Anchor Point Actions. */ { /* Indexed into 'ankr' table. */ - const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex]; - if (!c->sanitizer.check_array (data, 2)) - return false; + const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex]; + if (!c->sanitizer.check_array (data, 2)) return; unsigned int markAnchorPoint = *data++; unsigned int currAnchorPoint = *data++; - const Anchor markAnchor = c->ankr_table->get_anchor (c->buffer->info[mark].codepoint, - markAnchorPoint, - c->sanitizer.get_num_glyphs (), - c->ankr_end); - const Anchor currAnchor = c->ankr_table->get_anchor (c->buffer->cur ().codepoint, - currAnchorPoint, - c->sanitizer.get_num_glyphs (), - c->ankr_end); + const Anchor &markAnchor = c->ankr_table->get_anchor (c->buffer->info[mark].codepoint, + markAnchorPoint, + c->sanitizer.get_num_glyphs ()); + const Anchor &currAnchor = c->ankr_table->get_anchor (c->buffer->cur ().codepoint, + currAnchorPoint, + c->sanitizer.get_num_glyphs ()); o.x_offset = c->font->em_scale_x (markAnchor.xCoordinate) - c->font->em_scale_x (currAnchor.xCoordinate); o.y_offset = c->font->em_scale_y (markAnchor.yCoordinate) - c->font->em_scale_y (currAnchor.yCoordinate); @@ -563,9 +557,8 @@ struct KerxSubTableFormat4 case 2: /* Control Point Coordinate Actions. */ { - const FWORD *data = (const FWORD *) &ankrData[entry->data.ankrActionIndex]; - if (!c->sanitizer.check_array (data, 4)) - return false; + const FWORD *data = (const FWORD *) &ankrData[entry.data.ankrActionIndex]; + if (!c->sanitizer.check_array (data, 4)) return; int markX = *data++; int markY = *data++; int currX = *data++; @@ -581,13 +574,11 @@ struct KerxSubTableFormat4 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; } - if (entry->flags & Mark) + if (entry.flags & Mark) { mark_set = true; mark = buffer->idx; } - - return true; } private: @@ -721,18 +712,18 @@ struct KerxSubTableFormat6 { struct Long { - LOffsetTo<Lookup<HBUINT32>, false> rowIndexTable; - LOffsetTo<Lookup<HBUINT32>, false> columnIndexTable; - LOffsetTo<UnsizedArrayOf<FWORD32>, false> array; + LNNOffsetTo<Lookup<HBUINT32> > rowIndexTable; + LNNOffsetTo<Lookup<HBUINT32> > columnIndexTable; + LNNOffsetTo<UnsizedArrayOf<FWORD32> > array; } l; struct Short { - LOffsetTo<Lookup<HBUINT16>, false> rowIndexTable; - LOffsetTo<Lookup<HBUINT16>, false> columnIndexTable; - LOffsetTo<UnsizedArrayOf<FWORD>, false> array; + LNNOffsetTo<Lookup<HBUINT16> > rowIndexTable; + LNNOffsetTo<Lookup<HBUINT16> > columnIndexTable; + LNNOffsetTo<UnsizedArrayOf<FWORD> > array; } s; } u; - LOffsetTo<UnsizedArrayOf<FWORD>, false> vector; + LNNOffsetTo<UnsizedArrayOf<FWORD> > vector; public: DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 24); }; @@ -981,8 +972,8 @@ struct kerx : KerxTable<kerx> { friend struct KerxTable<kerx>; - enum { tableTag = HB_AAT_TAG_kerx }; - enum { minVersion = 2u }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_kerx; + static constexpr unsigned minVersion = 2u; typedef KerxSubTableHeader SubTableHeader; typedef SubTableHeader::Types Types; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh index cac96971721..4be799fbca2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh @@ -40,7 +40,7 @@ typedef ArrayOf<HBINT16> LigCaretClassEntry; struct lcar { - enum { tableTag = HB_AAT_TAG_lcar }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_lcar; unsigned int get_lig_carets (hb_font_t *font, hb_direction_t direction, @@ -55,7 +55,7 @@ struct lcar if (caret_count) { hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count); - unsigned int count = arr.len; + unsigned int count = arr.length; for (unsigned int i = 0; i < count; ++i) switch (format) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh index c7600aa25dc..4a1d959efec 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh @@ -54,7 +54,7 @@ struct RearrangementSubtable struct driver_context_t { - enum { in_place = true }; + static constexpr bool in_place = true; enum Flags { MarkFirst = 0x8000, /* If set, make the current glyph the first @@ -74,15 +74,15 @@ struct RearrangementSubtable start (0), end (0) {} bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> *entry) + const Entry<EntryData> &entry) { - return (entry->flags & Verb) && start < end; + return (entry.flags & Verb) && start < end; } - bool transition (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + void transition (StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; + unsigned int flags = entry.flags; if (flags & MarkFirst) start = buffer->idx; @@ -152,8 +152,6 @@ struct RearrangementSubtable } } } - - return true; } public: @@ -204,7 +202,7 @@ struct ContextualSubtable struct driver_context_t { - enum { in_place = true }; + static constexpr bool in_place = true; enum Flags { SetMark = 0x8000, /* If set, make the current glyph the marked glyph. */ @@ -223,39 +221,39 @@ struct ContextualSubtable subs (table+table->substitutionTables) {} bool is_actionable (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; if (buffer->idx == buffer->len && !mark_set) return false; - return entry->data.markIndex != 0xFFFF || entry->data.currentIndex != 0xFFFF; + return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF; } - bool transition (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + void transition (StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; /* Looks like CoreText applies neither mark nor current substitution for * end-of-text if mark was not explicitly set. */ if (buffer->idx == buffer->len && !mark_set) - return true; + return; const GlyphID *replacement; replacement = nullptr; if (Types::extended) { - if (entry->data.markIndex != 0xFFFF) + if (entry.data.markIndex != 0xFFFF) { - const Lookup<GlyphID> &lookup = subs[entry->data.markIndex]; + const Lookup<GlyphID> &lookup = subs[entry.data.markIndex]; replacement = lookup.get_value (buffer->info[mark].codepoint, driver->num_glyphs); } } else { - unsigned int offset = entry->data.markIndex + buffer->info[mark].codepoint; + unsigned int offset = entry.data.markIndex + buffer->info[mark].codepoint; const UnsizedArrayOf<GlyphID> &subs_old = (const UnsizedArrayOf<GlyphID> &) subs; replacement = &subs_old[Types::wordOffsetToIndex (offset, table, subs_old.arrayZ)]; if (!replacement->sanitize (&c->sanitizer) || !*replacement) @@ -272,15 +270,15 @@ struct ContextualSubtable unsigned int idx = MIN (buffer->idx, buffer->len - 1); if (Types::extended) { - if (entry->data.currentIndex != 0xFFFF) + if (entry.data.currentIndex != 0xFFFF) { - const Lookup<GlyphID> &lookup = subs[entry->data.currentIndex]; + const Lookup<GlyphID> &lookup = subs[entry.data.currentIndex]; replacement = lookup.get_value (buffer->info[idx].codepoint, driver->num_glyphs); } } else { - unsigned int offset = entry->data.currentIndex + buffer->info[idx].codepoint; + unsigned int offset = entry.data.currentIndex + buffer->info[idx].codepoint; const UnsizedArrayOf<GlyphID> &subs_old = (const UnsizedArrayOf<GlyphID> &) subs; replacement = &subs_old[Types::wordOffsetToIndex (offset, table, subs_old.arrayZ)]; if (!replacement->sanitize (&c->sanitizer) || !*replacement) @@ -292,13 +290,11 @@ struct ContextualSubtable ret = true; } - if (entry->flags & SetMark) + if (entry.flags & SetMark) { mark_set = true; mark = buffer->idx; } - - return true; } public: @@ -330,7 +326,8 @@ struct ContextualSubtable unsigned int num_entries = 0; if (unlikely (!machine.sanitize (c, &num_entries))) return_trace (false); - if (!Types::extended) return_trace (true); + if (!Types::extended) + return_trace (substitutionTables.sanitize (c, this, 0)); unsigned int num_lookups = 0; @@ -351,7 +348,7 @@ struct ContextualSubtable protected: StateTable<Types, EntryData> machine; - OffsetTo<UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT, false>, HBUINT, false> + NNOffsetTo<UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT, false>, HBUINT> substitutionTables; public: DEFINE_SIZE_STATIC (20); @@ -384,11 +381,11 @@ struct LigatureEntry<true> DEFINE_SIZE_STATIC (2); }; - static bool performAction (const Entry<EntryData> *entry) - { return entry->flags & PerformAction; } + static bool performAction (const Entry<EntryData> &entry) + { return entry.flags & PerformAction; } - static unsigned int ligActionIndex (const Entry<EntryData> *entry) - { return entry->data.ligActionIndex; } + static unsigned int ligActionIndex (const Entry<EntryData> &entry) + { return entry.data.ligActionIndex; } }; template <> struct LigatureEntry<false> @@ -406,11 +403,11 @@ struct LigatureEntry<false> typedef void EntryData; - static bool performAction (const Entry<EntryData> *entry) - { return entry->flags & Offset; } + static bool performAction (const Entry<EntryData> &entry) + { return entry.flags & Offset; } - static unsigned int ligActionIndex (const Entry<EntryData> *entry) - { return entry->flags & Offset; } + static unsigned int ligActionIndex (const Entry<EntryData> &entry) + { return entry.flags & Offset; } }; @@ -424,7 +421,7 @@ struct LigatureSubtable struct driver_context_t { - enum { in_place = false }; + static constexpr bool in_place = false; enum { DontAdvance = LigatureEntryT::DontAdvance, @@ -452,26 +449,23 @@ struct LigatureSubtable match_length (0) {} bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> *entry) + const Entry<EntryData> &entry) { return LigatureEntryT::performAction (entry); } - bool transition (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + void transition (StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; DEBUG_MSG (APPLY, nullptr, "Ligature transition at %u", buffer->idx); - if (entry->flags & LigatureEntryT::SetComponent) + if (entry.flags & LigatureEntryT::SetComponent) { - if (unlikely (match_length >= ARRAY_LENGTH (match_positions))) - return false; - /* Never mark same index twice, in case DontAdvance was used... */ - if (match_length && match_positions[match_length - 1] == buffer->out_len) + if (match_length && match_positions[(match_length - 1u) % ARRAY_LENGTH (match_positions)] == buffer->out_len) match_length--; - match_positions[match_length++] = buffer->out_len; + match_positions[match_length++ % ARRAY_LENGTH (match_positions)] = buffer->out_len; DEBUG_MSG (APPLY, nullptr, "Set component at %u", buffer->out_len); } @@ -481,10 +475,10 @@ struct LigatureSubtable unsigned int end = buffer->out_len; if (unlikely (!match_length)) - return true; + return; if (buffer->idx >= buffer->len) - return false; // TODO Work on previous instead? + return; /* TODO Work on previous instead? */ unsigned int cursor = match_length; @@ -505,9 +499,9 @@ struct LigatureSubtable } DEBUG_MSG (APPLY, nullptr, "Moving to stack position %u", cursor - 1); - buffer->move_to (match_positions[--cursor]); + buffer->move_to (match_positions[--cursor % ARRAY_LENGTH (match_positions)]); - if (unlikely (!actionData->sanitize (&c->sanitizer))) return false; + if (unlikely (!actionData->sanitize (&c->sanitizer))) break; action = *actionData; uint32_t uoffset = action & LigActionOffset; @@ -517,7 +511,7 @@ struct LigatureSubtable unsigned int component_idx = buffer->cur().codepoint + offset; component_idx = Types::wordOffsetToIndex (component_idx, table, component.arrayZ); const HBUINT16 &componentData = component[component_idx]; - if (unlikely (!componentData.sanitize (&c->sanitizer))) return false; + if (unlikely (!componentData.sanitize (&c->sanitizer))) break; ligature_idx += componentData; DEBUG_MSG (APPLY, nullptr, "Action store %u last %u", @@ -527,23 +521,23 @@ struct LigatureSubtable { ligature_idx = Types::offsetToIndex (ligature_idx, table, ligature.arrayZ); const GlyphID &ligatureData = ligature[ligature_idx]; - if (unlikely (!ligatureData.sanitize (&c->sanitizer))) return false; + if (unlikely (!ligatureData.sanitize (&c->sanitizer))) break; hb_codepoint_t lig = ligatureData; DEBUG_MSG (APPLY, nullptr, "Produced ligature %u", lig); buffer->replace_glyph (lig); - unsigned int lig_end = match_positions[match_length - 1] + 1; + unsigned int lig_end = match_positions[(match_length - 1u) % ARRAY_LENGTH (match_positions)] + 1u; /* Now go and delete all subsequent components. */ - while (match_length - 1 > cursor) + while (match_length - 1u > cursor) { DEBUG_MSG (APPLY, nullptr, "Skipping ligature component"); - buffer->move_to (match_positions[--match_length]); + buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]); buffer->replace_glyph (DELETED_GLYPH); } buffer->move_to (lig_end); - buffer->merge_out_clusters (match_positions[cursor], buffer->out_len); + buffer->merge_out_clusters (match_positions[cursor % ARRAY_LENGTH (match_positions)], buffer->out_len); } actionData++; @@ -551,8 +545,6 @@ struct LigatureSubtable while (!(action & LigActionLast)); buffer->move_to (end); } - - return true; } public: @@ -590,11 +582,11 @@ struct LigatureSubtable protected: StateTable<Types, EntryData> machine; - OffsetTo<UnsizedArrayOf<HBUINT32>, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<HBUINT32>, HBUINT> ligAction; /* Offset to the ligature action table. */ - OffsetTo<UnsizedArrayOf<HBUINT16>, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<HBUINT16>, HBUINT> component; /* Offset to the component table. */ - OffsetTo<UnsizedArrayOf<GlyphID>, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<GlyphID>, HBUINT> ligature; /* Offset to the actual ligature lists. */ public: DEFINE_SIZE_STATIC (28); @@ -660,7 +652,7 @@ struct InsertionSubtable struct driver_context_t { - enum { in_place = false }; + static constexpr bool in_place = false; enum Flags { SetMark = 0x8000, /* If set, mark the current glyph. */ @@ -713,28 +705,29 @@ struct InsertionSubtable hb_aat_apply_context_t *c_) : ret (false), c (c_), - mark_set (false), mark (0), insertionAction (table+table->insertionAction) {} bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, - const Entry<EntryData> *entry) + const Entry<EntryData> &entry) { - return (entry->flags & (CurrentInsertCount | MarkedInsertCount)) && - (entry->data.currentInsertIndex != 0xFFFF ||entry->data.markedInsertIndex != 0xFFFF); + return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) && + (entry.data.currentInsertIndex != 0xFFFF ||entry.data.markedInsertIndex != 0xFFFF); } - bool transition (StateTableDriver<Types, EntryData> *driver, - const Entry<EntryData> *entry) + void transition (StateTableDriver<Types, EntryData> *driver, + const Entry<EntryData> &entry) { hb_buffer_t *buffer = driver->buffer; - unsigned int flags = entry->flags; + unsigned int flags = entry.flags; + + unsigned mark_loc = buffer->out_len; - if (entry->data.markedInsertIndex != 0xFFFF && mark_set) + if (entry.data.markedInsertIndex != 0xFFFF) { unsigned int count = (flags & MarkedInsertCount); - unsigned int start = entry->data.markedInsertIndex; + unsigned int start = entry.data.markedInsertIndex; const GlyphID *glyphs = &insertionAction[start]; - if (unlikely (!c->sanitizer.check_array (glyphs, count))) return false; + if (unlikely (!c->sanitizer.check_array (glyphs, count))) count = 0; bool before = flags & MarkedInsertBefore; @@ -754,12 +747,15 @@ struct InsertionSubtable buffer->unsafe_to_break_from_outbuffer (mark, MIN (buffer->idx + 1, buffer->len)); } - if (entry->data.currentInsertIndex != 0xFFFF) + if (flags & SetMark) + mark = mark_loc; + + if (entry.data.currentInsertIndex != 0xFFFF) { unsigned int count = (flags & CurrentInsertCount) >> 5; - unsigned int start = entry->data.currentInsertIndex; + unsigned int start = entry.data.currentInsertIndex; const GlyphID *glyphs = &insertionAction[start]; - if (unlikely (!c->sanitizer.check_array (glyphs, count))) return false; + if (unlikely (!c->sanitizer.check_array (glyphs, count))) count = 0; bool before = flags & CurrentInsertBefore; @@ -790,21 +786,12 @@ struct InsertionSubtable */ buffer->move_to ((flags & DontAdvance) ? end : end + count); } - - if (flags & SetMark) - { - mark_set = true; - mark = buffer->out_len; - } - - return true; } public: bool ret; private: hb_aat_apply_context_t *c; - bool mark_set; unsigned int mark; const UnsizedArrayOf<GlyphID> &insertionAction; }; @@ -832,7 +819,7 @@ struct InsertionSubtable protected: StateTable<Types, EntryData> machine; - OffsetTo<UnsizedArrayOf<GlyphID>, HBUINT, false> + NNOffsetTo<UnsizedArrayOf<GlyphID>, HBUINT> insertionAction; /* Byte offset from stateHeader to the start of * the insertion glyph table. */ public: @@ -961,7 +948,7 @@ struct Chain hb_aat_layout_feature_type_t type = (hb_aat_layout_feature_type_t) (unsigned int) feature.featureType; hb_aat_layout_feature_selector_t setting = (hb_aat_layout_feature_selector_t) (unsigned int) feature.featureSetting; retry: - const hb_aat_map_builder_t::feature_info_t *info = map->features.bsearch ((uint16_t) type); + const hb_aat_map_builder_t::feature_info_t *info = map->features.bsearch (type); if (info && info->setting == setting) { flags &= feature.disableFlags; @@ -1096,7 +1083,7 @@ struct Chain template <typename Types> struct mortmorx { - enum { tableTag = HB_AAT_TAG_morx }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_morx; bool has_data () const { return version != 0; } @@ -1158,11 +1145,11 @@ struct mortmorx struct morx : mortmorx<ExtendedTypes> { - enum { tableTag = HB_AAT_TAG_morx }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_morx; }; struct mort : mortmorx<ObsoleteTypes> { - enum { tableTag = HB_AAT_TAG_mort }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_mort; }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh index 0648f6175f7..0c8e4558ffc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh @@ -66,7 +66,7 @@ struct TrackTableEntry NameID trackNameID; /* The 'name' table index for this track. * (a short word or phrase like "loose" * or "very tight") */ - OffsetTo<UnsizedArrayOf<FWORD>, HBUINT16, false> + NNOffsetTo<UnsizedArrayOf<FWORD> > valuesZ; /* Offset from start of tracking table to * per-size tracking values for this track. */ @@ -160,7 +160,7 @@ struct TrackData struct trak { - enum { tableTag = HB_AAT_TAG_trak }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_trak; bool has_data () const { return version.to_int (); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc index 8de8205f574..5168a9c85ff 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc @@ -157,7 +157,6 @@ AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *p buffer (buffer_), sanitizer (), ankr_table (&Null(AAT::ankr)), - ankr_end (nullptr), lookup_index (0), debug_depth (0) { @@ -171,12 +170,8 @@ AAT::hb_aat_apply_context_t::~hb_aat_apply_context_t () { sanitizer.end_processing (); } void -AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_, - const char *ankr_end_) -{ - ankr_table = ankr_table_; - ankr_end = ankr_end_; -} +AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_) +{ ankr_table = ankr_table_; } /* @@ -286,11 +281,8 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan, hb_blob_t *kerx_blob = font->face->table.kerx.get_blob (); const AAT::kerx& kerx = *kerx_blob->as<AAT::kerx> (); - hb_blob_t *ankr_blob = font->face->table.ankr.get_blob ();; - const AAT::ankr& ankr = *font->face->table.ankr; - AAT::hb_aat_apply_context_t c (plan, font, buffer, kerx_blob); - c.set_ankr_table (&ankr, ankr_blob->data + ankr_blob->length); + c.set_ankr_table (font->face->table.ankr.get ()); kerx.apply (&c); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh index 3b00b55914e..6f34a0095a0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh @@ -50,7 +50,7 @@ struct FTStringRange } protected: - OffsetTo<UnsizedArrayOf<HBUINT8>, HBUINT16, false> + NNOffsetTo<UnsizedArrayOf<HBUINT8> > tag; /* Offset from the start of the table to * the beginning of the string */ HBUINT16 length; /* String length (in bytes) */ @@ -60,7 +60,7 @@ struct FTStringRange struct ltag { - enum { tableTag = HB_AAT_TAG_ltag }; + static constexpr hb_tag_t tableTag = HB_AAT_TAG_ltag; hb_language_t get_language (unsigned int i) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc index 1c65a6759bc..98c5d7fe4d7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc @@ -54,11 +54,11 @@ void hb_aat_map_builder_t::compile (hb_aat_map_t &m) { /* Sort features and merge duplicates */ - if (features.len) + if (features.length) { features.qsort (); unsigned int j = 0; - for (unsigned int i = 1; i < features.len; i++) + for (unsigned int i = 1; i < features.length; i++) if (features[i].type != features[j].type) features[++j] = features[i]; features.shrink (j + 1); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.hh index fa312dbec39..3d5ad0e642f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.hh @@ -44,7 +44,7 @@ struct hb_aat_map_t void fini () { chain_flags.fini (); } public: - hb_vector_t<hb_mask_t, 1> chain_flags; + hb_vector_t<hb_mask_t> chain_flags; }; struct hb_aat_map_builder_t @@ -74,7 +74,7 @@ struct hb_aat_map_builder_t (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); } - int cmp (unsigned int ty) const + int cmp (hb_aat_layout_feature_type_t ty) const { return (type != ty) ? (type < ty ? -1 : 1) : 0; } @@ -84,7 +84,7 @@ struct hb_aat_map_builder_t hb_face_t *face; public: - hb_vector_t<feature_info_t, 32> features; + hb_vector_t<feature_info_t> features; }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh index d4df16546cd..52b775e9569 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh @@ -28,67 +28,57 @@ #define HB_ARRAY_HH #include "hb.hh" +#include "hb-dsalgs.hh" +#include "hb-iter.hh" +#include "hb-null.hh" template <typename Type> struct hb_sorted_array_t; template <typename Type> -struct hb_array_t +struct hb_array_t : + hb_iter_t<hb_array_t<Type>, Type>, + hb_iter_mixin_t<hb_array_t<Type>, Type> { - typedef Type ItemType; - enum { item_size = hb_static_size (Type) }; - /* * Constructors. */ - hb_array_t () : arrayZ (nullptr), len (0) {} - hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {} - hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {} - template <unsigned int len_> hb_array_t (Type (&array_)[len_]) : arrayZ (array_), len (len_) {} + hb_array_t () : arrayZ (nullptr), length (0) {} + hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_) {} + template <unsigned int length_> hb_array_t (Type (&array_)[length_]) : arrayZ (array_), length (length_) {} + /* - * Operators. + * Iterator implementation. */ - - Type& operator [] (int i_) const + typedef Type __item_type__; + Type& __item_at__ (unsigned i) const { - unsigned int i = (unsigned int) i_; - if (unlikely (i >= len)) return CrapOrNull(Type); + if (unlikely (i >= length)) return CrapOrNull (Type); return arrayZ[i]; } - - explicit_operator bool () const { return len; } - Type * operator & () const { return arrayZ; } - Type & operator * () { return (this->operator [])[0]; } - operator hb_array_t<const Type> () { return hb_array_t<const Type> (arrayZ, len); } - template <typename T> operator T * () const { return arrayZ; } - - hb_array_t<Type> & operator += (unsigned int count) + void __forward__ (unsigned n) { - if (unlikely (count > len)) - count = len; - len -= count; - arrayZ += count; - return *this; + if (unlikely (n > length)) + n = length; + length -= n; + arrayZ += n; } - hb_array_t<Type> & operator -= (unsigned int count) + void __rewind__ (unsigned n) { - if (unlikely (count > len)) - count = len; - len -= count; - return *this; + if (unlikely (n > length)) + n = length; + length -= n; } - hb_array_t<Type> & operator ++ () { *this += 1; } - hb_array_t<Type> & operator -- () { *this -= 1; } - hb_array_t<Type> operator + (unsigned int count) - { hb_array_t<Type> copy (*this); *this += count; return copy; } - hb_array_t<Type> operator - (unsigned int count) - { hb_array_t<Type> copy (*this); *this -= count; return copy; } - hb_array_t<Type> operator ++ (int) - { hb_array_t<Type> copy (*this); ++*this; return copy; } - hb_array_t<Type> operator -- (int) - { hb_array_t<Type> copy (*this); --*this; return copy; } + unsigned __len__ () const { return length; } + bool __random_access__ () const { return true; } + + /* Extra operators. + */ + Type * operator & () const { return arrayZ; } + operator hb_array_t<const Type> () { return hb_array_t<const Type> (arrayZ, length); } + template <typename T> operator T * () const { return arrayZ; } /* * Compare, Sort, and Search. @@ -97,8 +87,8 @@ struct hb_array_t /* Note: our compare is NOT lexicographic; it also does NOT call Type::cmp. */ int cmp (const hb_array_t<Type> &a) const { - if (len != a.len) - return (int) a.len - (int) len; + if (length != a.length) + return (int) a.length - (int) length; return hb_memcmp (a.arrayZ, arrayZ, get_size ()); } static int cmp (const void *pa, const void *pb) @@ -111,7 +101,7 @@ struct hb_array_t template <typename T> Type *lsearch (const T &x, Type *not_found = nullptr) { - unsigned int count = len; + unsigned int count = length; for (unsigned int i = 0; i < count; i++) if (!this->arrayZ[i].cmp (x)) return &this->arrayZ[i]; @@ -120,7 +110,7 @@ struct hb_array_t template <typename T> const Type *lsearch (const T &x, const Type *not_found = nullptr) const { - unsigned int count = len; + unsigned int count = length; for (unsigned int i = 0; i < count; i++) if (!this->arrayZ[i].cmp (x)) return &this->arrayZ[i]; @@ -129,33 +119,36 @@ struct hb_array_t hb_sorted_array_t<Type> qsort (int (*cmp_)(const void*, const void*)) { - ::qsort (arrayZ, len, item_size, cmp_); + if (likely (length)) + ::qsort (arrayZ, length, this->item_size, cmp_); return hb_sorted_array_t<Type> (*this); } hb_sorted_array_t<Type> qsort () { - ::qsort (arrayZ, len, item_size, Type::cmp); + if (likely (length)) + ::qsort (arrayZ, length, this->item_size, Type::cmp); return hb_sorted_array_t<Type> (*this); } void qsort (unsigned int start, unsigned int end) { - end = MIN (end, len); + end = MIN (end, length); assert (start <= end); - ::qsort (arrayZ + start, end - start, item_size, Type::cmp); + if (likely (start < end)) + ::qsort (arrayZ + start, end - start, this->item_size, Type::cmp); } /* * Other methods. */ - unsigned int get_size () const { return len * item_size; } + unsigned int get_size () const { return length * this->item_size; } hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const { if (!start_offset && !seg_count) return *this; - unsigned int count = len; + unsigned int count = length; if (unlikely (start_offset > count)) count = 0; else @@ -169,11 +162,11 @@ struct hb_array_t /* Only call if you allocated the underlying array using malloc() or similar. */ void free () - { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; } + { ::free ((void *) arrayZ); arrayZ = nullptr; length = 0; } template <typename hb_sanitize_context_t> bool sanitize (hb_sanitize_context_t *c) const - { return c->check_array (arrayZ, len); } + { return c->check_array (arrayZ, length); } /* * Members @@ -181,11 +174,14 @@ struct hb_array_t public: Type *arrayZ; - unsigned int len; + unsigned int length; }; -template <typename T> -inline hb_array_t<T> hb_array (T *array, unsigned int len) -{ return hb_array_t<T> (array, len); } +template <typename T> inline hb_array_t<T> +hb_array (T *array, unsigned int length) +{ return hb_array_t<T> (array, length); } +template <typename T, unsigned int length_> inline hb_array_t<T> +hb_array (T (&array_)[length_]) +{ return hb_array_t<T> (array_); } enum hb_bfind_not_found_t @@ -196,11 +192,15 @@ enum hb_bfind_not_found_t }; template <typename Type> -struct hb_sorted_array_t : hb_array_t<Type> +struct hb_sorted_array_t : + hb_sorted_iter_t<hb_sorted_array_t<Type>, Type>, + hb_array_t<Type>, + hb_iter_mixin_t<hb_sorted_array_t<Type>, Type> { hb_sorted_array_t () : hb_array_t<Type> () {} hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {} - hb_sorted_array_t (Type *array_, unsigned int len_) : hb_array_t<Type> (array_, len_) {} + hb_sorted_array_t (Type *array_, unsigned int length_) : hb_array_t<Type> (array_, length_) {} + template <unsigned int length_> hb_sorted_array_t (Type (&array_)[length_]) : hb_array_t<Type> (array_) {} hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int *seg_count /* IN/OUT */) const { return hb_sorted_array_t<Type> (((const hb_array_t<Type> *) (this))->sub_array (start_offset, seg_count)); } @@ -224,7 +224,7 @@ struct hb_sorted_array_t : hb_array_t<Type> hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE, unsigned int to_store = (unsigned int) -1) const { - int min = 0, max = (int) this->len - 1; + int min = 0, max = (int) this->length - 1; const Type *array = this->arrayZ; while (min <= max) { @@ -253,7 +253,7 @@ struct hb_sorted_array_t : hb_array_t<Type> break; case HB_BFIND_NOT_FOUND_STORE_CLOSEST: - if (max < 0 || (max < (int) this->len && array[max].cmp (x) > 0)) + if (max < 0 || (max < (int) this->length && array[max].cmp (x) > 0)) max++; *i = max; break; @@ -262,9 +262,12 @@ struct hb_sorted_array_t : hb_array_t<Type> return false; } }; -template <typename T> -inline hb_sorted_array_t<T> hb_sorted_array (T *array, unsigned int len) -{ return hb_sorted_array_t<T> (array, len); } +template <typename T> inline hb_sorted_array_t<T> +hb_sorted_array (T *array, unsigned int length) +{ return hb_sorted_array_t<T> (array, length); } +template <typename T, unsigned int length_> inline hb_sorted_array_t<T> +hb_sorted_array (T (&array_)[length_]) +{ return hb_sorted_array_t<T> (array_); } typedef hb_array_t<const char> hb_bytes_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 b53b20bd147..bcf381e1aa4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc @@ -25,6 +25,18 @@ * Red Hat Author(s): Behdad Esfahbod */ + +/* https://github.com/harfbuzz/harfbuzz/issues/1308 + * http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html + * https://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html + */ +#ifndef _POSIX_C_SOURCE +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-macros" +#define _POSIX_C_SOURCE 200809L +#pragma GCC diagnostic pop +#endif + #include "hb.hh" #include "hb-blob.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh index 8a3170ca9a5..330f88bacc9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh @@ -119,7 +119,7 @@ struct hb_buffer_t /* Text before / after the main buffer contents. * Always in Unicode, and ordered outward. * Index 0 is for "pre-context", 1 for "post-context". */ - enum { CONTEXT_LENGTH = 5 }; + static constexpr unsigned CONTEXT_LENGTH = 5u; hb_codepoint_t context[2][CONTEXT_LENGTH]; unsigned int context_len[2]; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh index c2be034a1ce..72e9e06c818 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh @@ -30,7 +30,7 @@ namespace CFF { using namespace OT; -typedef unsigned int OpCode; +typedef unsigned int op_code_t; /* === Dict operators === */ @@ -88,11 +88,11 @@ typedef unsigned int OpCode; /* Two byte escape operators 12, (0-41) */ #define OpCode_ESC_Base 256 -#define Make_OpCode_ESC(byte2) ((OpCode)(OpCode_ESC_Base + (byte2))) +#define Make_OpCode_ESC(byte2) ((op_code_t)(OpCode_ESC_Base + (byte2))) -inline OpCode Unmake_OpCode_ESC (OpCode op) { return (OpCode)(op - OpCode_ESC_Base); } -inline bool Is_OpCode_ESC (OpCode op) { return op >= OpCode_ESC_Base; } -inline unsigned int OpCode_Size (OpCode op) { return Is_OpCode_ESC (op) ? 2: 1; } +inline op_code_t Unmake_OpCode_ESC (op_code_t op) { return (op_code_t)(op - OpCode_ESC_Base); } +inline bool Is_OpCode_ESC (op_code_t op) { return op >= OpCode_ESC_Base; } +inline unsigned int OpCode_Size (op_code_t op) { return Is_OpCode_ESC (op) ? 2: 1; } #define OpCode_Copyright Make_OpCode_ESC(0) /* CFF Top */ #define OpCode_isFixedPitch Make_OpCode_ESC(1) /* CFF Top (false) */ @@ -215,7 +215,7 @@ inline unsigned int OpCode_Size (OpCode op) { return Is_OpCode_ESC (op) ? 2: 1; #define OpCode_Invalid 0xFFFFu -struct Number +struct number_t { void init () { set_real (0.0); } void fini () {} @@ -235,19 +235,19 @@ struct Number bool in_int_range () const { return ((double) (int16_t) to_int () == value); } - bool operator > (const Number &n) const + bool operator > (const number_t &n) const { return value > n.to_real (); } - bool operator < (const Number &n) const + bool operator < (const number_t &n) const { return n > *this; } - bool operator >= (const Number &n) const + bool operator >= (const number_t &n) const { return !(*this < n); } - bool operator <= (const Number &n) const + bool operator <= (const number_t &n) const { return !(*this > n); } - const Number &operator += (const Number &n) + const number_t &operator += (const number_t &n) { set_real (to_real () + n.to_real ()); @@ -263,7 +263,7 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8> { // encode 2-byte int (Dict/CharString) or 4-byte int (Dict) template <typename INTTYPE, int minVal, int maxVal> - static bool serialize_int (hb_serialize_context_t *c, OpCode intOp, int value) + static bool serialize_int (hb_serialize_context_t *c, op_code_t intOp, int value) { TRACE_SERIALIZE (this); @@ -290,92 +290,73 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8> /* Defining null_size allows a Null object may be created. Should be safe because: * A descendent struct Dict uses a Null pointer to indicate a missing table, * checked before access. - * ByteStr, a wrapper struct pairing a byte pointer along with its length, always + * byte_str_t, a wrapper struct pairing a byte pointer along with its length, always * checks the length before access. A Null pointer is used as the initial pointer * along with zero length by the default ctor. */ DEFINE_SIZE_MIN(0); }; -struct ByteStr +/* Holder of a section of byte string within a CFFIndex entry */ +struct byte_str_t : hb_ubytes_t { - ByteStr () - : str (&Null(UnsizedByteStr)), len (0) {} - ByteStr (const UnsizedByteStr& s, unsigned int l) - : str (&s), len (l) {} - ByteStr (const char *s, unsigned int l=0) - : str ((const UnsizedByteStr *)s), len (l) {} + byte_str_t () + : hb_ubytes_t () {} + byte_str_t (const UnsizedByteStr& s, unsigned int l) + : hb_ubytes_t ((const unsigned char*)&s, l) {} + byte_str_t (const unsigned char *s, unsigned int l) + : hb_ubytes_t (s, l) {} + byte_str_t (const hb_ubytes_t &ub) /* conversion from hb_ubytes_t */ + : hb_ubytes_t (ub) {} + /* sub-string */ - ByteStr (const ByteStr &bs, unsigned int offset, unsigned int len_) - { - str = (const UnsizedByteStr *)&bs.str[offset]; - len = len_; - } - - bool sanitize (hb_sanitize_context_t *c) const { return str->sanitize (c, len); } - - const HBUINT8& operator [] (unsigned int i) const - { - if (likely (str && (i < len))) - return (*str)[i]; - else - return Null(HBUINT8); - } - - bool serialize (hb_serialize_context_t *c, const ByteStr &src) - { - TRACE_SERIALIZE (this); - HBUINT8 *dest = c->allocate_size<HBUINT8> (src.len); - if (unlikely (dest == nullptr)) - return_trace (false); - memcpy (dest, src.str, src.len); - return_trace (true); - } - - unsigned int get_size () const { return len; } + byte_str_t sub_str (unsigned int offset, unsigned int len_) const + { return byte_str_t (hb_ubytes_t::sub_array (offset, len_)); } bool check_limit (unsigned int offset, unsigned int count) const - { return (offset + count <= len); } - - const UnsizedByteStr *str; - unsigned int len; + { return (offset + count <= length); } }; -struct SubByteStr +/* A byte string associated with the current offset and an error condition */ +struct byte_str_ref_t { - SubByteStr () + byte_str_ref_t () { init (); } void init () { - str = ByteStr (0); + str = byte_str_t (); offset = 0; error = false; } void fini () {} - SubByteStr (const ByteStr &str_, unsigned int offset_ = 0) + byte_str_ref_t (const byte_str_t &str_, unsigned int offset_ = 0) : str (str_), offset (offset_), error (false) {} - void reset (const ByteStr &str_, unsigned int offset_ = 0) + void reset (const byte_str_t &str_, unsigned int offset_ = 0) { str = str_; offset = offset_; error = false; } - const HBUINT8& operator [] (int i) { - if (unlikely ((unsigned int)(offset + i) >= str.len)) + const unsigned char& operator [] (int i) { + if (unlikely ((unsigned int)(offset + i) >= str.length)) { set_error (); - return Null(HBUINT8); + return Null(unsigned char); } else return str[offset + i]; } - operator ByteStr () const { return ByteStr (str, offset, str.len - offset); } + /* Conversion to byte_str_t */ + operator byte_str_t () const { return str.sub_str (offset, str.length - offset); } + + byte_str_t sub_str (unsigned int offset_, unsigned int len_) const + { return str.sub_str (offset_, len_); } bool avail (unsigned int count=1) const { @@ -383,13 +364,13 @@ struct SubByteStr } void inc (unsigned int count=1) { - if (likely (!in_error () && (offset <= str.len) && (offset + count <= str.len))) + if (likely (!in_error () && (offset <= str.length) && (offset + count <= str.length))) { offset += count; } else { - offset = str.len; + offset = str.length; set_error (); } } @@ -397,18 +378,18 @@ struct SubByteStr void set_error () { error = true; } bool in_error () const { return error; } - ByteStr str; + byte_str_t str; unsigned int offset; /* beginning of the sub-string within str */ protected: bool error; }; -typedef hb_vector_t<ByteStr> ByteStrArray; +typedef hb_vector_t<byte_str_t> byte_str_array_t; /* stack */ template <typename ELEM, int LIMIT> -struct Stack +struct stack_t { void init () { @@ -416,7 +397,7 @@ struct Stack count = 0; elements.init (); elements.resize (kSizeLimit); - for (unsigned int i = 0; i < elements.len; i++) + for (unsigned int i = 0; i < elements.length; i++) elements[i].init (); } @@ -433,7 +414,7 @@ struct Stack void push (const ELEM &v) { - if (likely (count < elements.len)) + if (likely (count < elements.length)) elements[count++] = v; else set_error (); @@ -441,7 +422,7 @@ struct Stack ELEM &push () { - if (likely (count < elements.len)) + if (likely (count < elements.length)) return elements[count++]; else { @@ -482,7 +463,7 @@ struct Stack void unpop () { - if (likely (count < elements.len)) + if (likely (count < elements.length)) count++; else set_error (); @@ -496,17 +477,17 @@ struct Stack unsigned int get_count () const { return count; } bool is_empty () const { return count == 0; } - static const unsigned int kSizeLimit = LIMIT; + static constexpr unsigned kSizeLimit = LIMIT; protected: bool error; unsigned int count; - hb_vector_t<ELEM, kSizeLimit> elements; + hb_vector_t<ELEM> elements; }; /* argument stack */ -template <typename ARG=Number> -struct ArgStack : Stack<ARG, 513> +template <typename ARG=number_t> +struct arg_stack_t : stack_t<ARG, 513> { void push_int (int v) { @@ -541,18 +522,18 @@ struct ArgStack : Stack<ARG, 513> return (unsigned)i; } - void push_longint_from_substr (SubByteStr& substr) + void push_longint_from_substr (byte_str_ref_t& str_ref) { - push_int ((substr[0] << 24) | (substr[1] << 16) | (substr[2] << 8) | (substr[3])); - substr.inc (4); + push_int ((str_ref[0] << 24) | (str_ref[1] << 16) | (str_ref[2] << 8) | (str_ref[3])); + str_ref.inc (4); } - bool push_fixed_from_substr (SubByteStr& substr) + bool push_fixed_from_substr (byte_str_ref_t& str_ref) { - if (unlikely (!substr.avail (4))) + if (unlikely (!str_ref.avail (4))) return false; - push_fixed ((int32_t)*(const HBUINT32*)&substr[0]); - substr.inc (4); + push_fixed ((int32_t)*(const HBUINT32*)&str_ref[0]); + str_ref.inc (4); return true; } @@ -562,36 +543,36 @@ struct ArgStack : Stack<ARG, 513> } private: - typedef Stack<ARG, 513> S; + typedef stack_t<ARG, 513> S; }; /* an operator prefixed by its operands in a byte string */ -struct OpStr +struct op_str_t { void init () {} void fini () {} - OpCode op; - ByteStr str; + op_code_t op; + byte_str_t str; }; /* base of OP_SERIALIZER */ -struct OpSerializer +struct op_serializer_t { protected: - bool copy_opstr (hb_serialize_context_t *c, const OpStr& opstr) const + bool copy_opstr (hb_serialize_context_t *c, const op_str_t& opstr) const { TRACE_SERIALIZE (this); - HBUINT8 *d = c->allocate_size<HBUINT8> (opstr.str.len); + HBUINT8 *d = c->allocate_size<HBUINT8> (opstr.str.length); if (unlikely (d == nullptr)) return_trace (false); - memcpy (d, &opstr.str.str[0], opstr.str.len); + memcpy (d, &opstr.str[0], opstr.str.length); return_trace (true); } }; template <typename VAL> -struct ParsedValues +struct parsed_values_t { void init () { @@ -600,30 +581,30 @@ struct ParsedValues } void fini () { values.fini_deep (); } - void add_op (OpCode op, const SubByteStr& substr = SubByteStr ()) + void add_op (op_code_t op, const byte_str_ref_t& str_ref = byte_str_ref_t ()) { VAL *val = values.push (); val->op = op; - val->str = ByteStr (substr.str, opStart, substr.offset - opStart); - opStart = substr.offset; + val->str = str_ref.str.sub_str (opStart, str_ref.offset - opStart); + opStart = str_ref.offset; } - void add_op (OpCode op, const SubByteStr& substr, const VAL &v) + void add_op (op_code_t op, const byte_str_ref_t& str_ref, const VAL &v) { VAL *val = values.push (v); val->op = op; - val->str = ByteStr (substr.str, opStart, substr.offset - opStart); - opStart = substr.offset; + val->str = str_ref.sub_str ( opStart, str_ref.offset - opStart); + opStart = str_ref.offset; } - bool has_op (OpCode op) const + bool has_op (op_code_t op) const { for (unsigned int i = 0; i < get_count (); i++) if (get_value (i).op == op) return true; return false; } - unsigned get_count () const { return values.len; } + unsigned get_count () const { return values.length; } const VAL &get_value (unsigned int i) const { return values[i]; } const VAL &operator [] (unsigned int i) const { return get_value (i); } @@ -631,35 +612,35 @@ struct ParsedValues hb_vector_t<VAL> values; }; -template <typename ARG=Number> -struct InterpEnv +template <typename ARG=number_t> +struct interp_env_t { - void init (const ByteStr &str_) + void init (const byte_str_t &str_) { - substr.reset (str_); + str_ref.reset (str_); argStack.init (); error = false; } void fini () { argStack.fini (); } bool in_error () const - { return error || substr.in_error () || argStack.in_error (); } + { return error || str_ref.in_error () || argStack.in_error (); } void set_error () { error = true; } - OpCode fetch_op () + op_code_t fetch_op () { - OpCode op = OpCode_Invalid; - if (unlikely (!substr.avail ())) + op_code_t op = OpCode_Invalid; + if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = (OpCode)(unsigned char)substr[0]; + op = (op_code_t)(unsigned char)str_ref[0]; if (op == OpCode_escape) { - if (unlikely (!substr.avail ())) + if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = Make_OpCode_ESC(substr[1]); - substr.inc (); + op = Make_OpCode_ESC(str_ref[1]); + str_ref.inc (); } - substr.inc (); + str_ref.inc (); return op; } @@ -683,35 +664,35 @@ struct InterpEnv pop_n_args (argStack.get_count ()); } - SubByteStr substr; - ArgStack<ARG> argStack; + byte_str_ref_t str_ref; + arg_stack_t<ARG> argStack; protected: bool error; }; -typedef InterpEnv<> NumInterpEnv; +typedef interp_env_t<> num_interp_env_t; -template <typename ARG=Number> -struct OpSet +template <typename ARG=number_t> +struct opset_t { - static void process_op (OpCode op, InterpEnv<ARG>& env) + static void process_op (op_code_t op, interp_env_t<ARG>& env) { switch (op) { case OpCode_shortint: - env.argStack.push_int ((int16_t)((env.substr[0] << 8) | env.substr[1])); - env.substr.inc (2); + env.argStack.push_int ((int16_t)((env.str_ref[0] << 8) | env.str_ref[1])); + env.str_ref.inc (2); break; case OpCode_TwoBytePosInt0: case OpCode_TwoBytePosInt1: case OpCode_TwoBytePosInt2: case OpCode_TwoBytePosInt3: - env.argStack.push_int ((int16_t)((op - OpCode_TwoBytePosInt0) * 256 + env.substr[0] + 108)); - env.substr.inc (); + env.argStack.push_int ((int16_t)((op - OpCode_TwoBytePosInt0) * 256 + env.str_ref[0] + 108)); + env.str_ref.inc (); break; case OpCode_TwoByteNegInt0: case OpCode_TwoByteNegInt1: case OpCode_TwoByteNegInt2: case OpCode_TwoByteNegInt3: - env.argStack.push_int ((int16_t)(-(op - OpCode_TwoByteNegInt0) * 256 - env.substr[0] - 108)); - env.substr.inc (); + env.argStack.push_int ((int16_t)(-(op - OpCode_TwoByteNegInt0) * 256 - env.str_ref[0] - 108)); + env.str_ref.inc (); break; default: @@ -730,9 +711,9 @@ struct OpSet }; template <typename ENV> -struct Interpreter { +struct interpreter_t { - ~Interpreter() { fini (); } + ~interpreter_t() { fini (); } void fini () { env.fini (); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh index e78d5571c94..283bdf14afe 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh @@ -33,34 +33,34 @@ namespace CFF { using namespace OT; -enum CSType { +enum cs_type_t { CSType_CharString, CSType_GlobalSubr, CSType_LocalSubr }; -struct CallContext +struct call_context_t { - void init (const SubByteStr substr_=SubByteStr (), CSType type_=CSType_CharString, unsigned int subr_num_=0) + void init (const byte_str_ref_t substr_=byte_str_ref_t (), cs_type_t type_=CSType_CharString, unsigned int subr_num_=0) { - substr = substr_; + str_ref = substr_; type = type_; subr_num = subr_num_; } void fini () {} - SubByteStr substr; - CSType type; + byte_str_ref_t str_ref; + cs_type_t type; unsigned int subr_num; }; /* call stack */ const unsigned int kMaxCallLimit = 10; -struct CallStack : Stack<CallContext, kMaxCallLimit> {}; +struct call_stack_t : stack_t<call_context_t, kMaxCallLimit> {}; template <typename SUBRS> -struct BiasedSubrs +struct biased_subrs_t { void init (const SUBRS &subrs_) { @@ -79,10 +79,10 @@ struct BiasedSubrs unsigned int get_count () const { return (subrs == nullptr)? 0: subrs->count; } unsigned int get_bias () const { return bias; } - ByteStr operator [] (unsigned int index) const + byte_str_t operator [] (unsigned int index) const { if (unlikely ((subrs == nullptr) || index >= subrs->count)) - return Null(ByteStr); + return Null(byte_str_t); else return (*subrs)[index]; } @@ -92,7 +92,7 @@ struct BiasedSubrs const SUBRS *subrs; }; -struct Point +struct point_t { void init () { @@ -106,27 +106,28 @@ struct Point y.set_int (_y); } - void move_x (const Number &dx) { x += dx; } - void move_y (const Number &dy) { y += dy; } - void move (const Number &dx, const Number &dy) { move_x (dx); move_y (dy); } - void move (const Point &d) { move_x (d.x); move_y (d.y); } + void move_x (const number_t &dx) { x += dx; } + void move_y (const number_t &dy) { y += dy; } + void move (const number_t &dx, const number_t &dy) { move_x (dx); move_y (dy); } + void move (const point_t &d) { move_x (d.x); move_y (d.y); } - Number x; - Number y; + number_t x; + number_t y; }; template <typename ARG, typename SUBRS> -struct CSInterpEnv : InterpEnv<ARG> +struct cs_interp_env_t : interp_env_t<ARG> { - void init (const ByteStr &str, const SUBRS &globalSubrs_, const SUBRS &localSubrs_) + void init (const byte_str_t &str, const SUBRS &globalSubrs_, const SUBRS &localSubrs_) { - InterpEnv<ARG>::init (str); + interp_env_t<ARG>::init (str); context.init (str, CSType_CharString); seen_moveto = true; seen_hintmask = false; hstem_count = 0; vstem_count = 0; + hintmask_size = 0; pt.init (); callStack.init (); globalSubrs.init (globalSubrs_); @@ -134,7 +135,7 @@ struct CSInterpEnv : InterpEnv<ARG> } void fini () { - InterpEnv<ARG>::fini (); + interp_env_t<ARG>::fini (); callStack.fini (); globalSubrs.fini (); @@ -146,7 +147,7 @@ struct CSInterpEnv : InterpEnv<ARG> return callStack.in_error () || SUPER::in_error (); } - bool popSubrNum (const BiasedSubrs<SUBRS>& biasedSubrs, unsigned int &subr_num) + bool popSubrNum (const biased_subrs_t<SUBRS>& biasedSubrs, unsigned int &subr_num) { int n = SUPER::argStack.pop_int (); n += biasedSubrs.get_bias (); @@ -157,7 +158,7 @@ struct CSInterpEnv : InterpEnv<ARG> return true; } - void callSubr (const BiasedSubrs<SUBRS>& biasedSubrs, CSType type) + void callSubr (const biased_subrs_t<SUBRS>& biasedSubrs, cs_type_t type) { unsigned int subr_num; @@ -167,19 +168,19 @@ struct CSInterpEnv : InterpEnv<ARG> SUPER::set_error (); return; } - context.substr = SUPER::substr; + context.str_ref = SUPER::str_ref; callStack.push (context); context.init ( biasedSubrs[subr_num], type, subr_num); - SUPER::substr = context.substr; + SUPER::str_ref = context.str_ref; } void returnFromSubr () { - if (unlikely (SUPER::substr.in_error ())) + if (unlikely (SUPER::str_ref.in_error ())) SUPER::set_error (); context = callStack.pop (); - SUPER::substr = context.substr; + SUPER::str_ref = context.str_ref; } void determine_hintmask_size () @@ -195,14 +196,14 @@ struct CSInterpEnv : InterpEnv<ARG> void set_endchar (bool endchar_flag_) { endchar_flag = endchar_flag_; } bool is_endchar () const { return endchar_flag; } - const Number &get_x () const { return pt.x; } - const Number &get_y () const { return pt.y; } - const Point &get_pt () const { return pt; } + const number_t &get_x () const { return pt.x; } + const number_t &get_y () const { return pt.y; } + const point_t &get_pt () const { return pt; } - void moveto (const Point &pt_ ) { pt = pt_; } + void moveto (const point_t &pt_ ) { pt = pt_; } public: - CallContext context; + call_context_t context; bool endchar_flag; bool seen_moveto; bool seen_hintmask; @@ -210,18 +211,18 @@ struct CSInterpEnv : InterpEnv<ARG> unsigned int hstem_count; unsigned int vstem_count; unsigned int hintmask_size; - CallStack callStack; - BiasedSubrs<SUBRS> globalSubrs; - BiasedSubrs<SUBRS> localSubrs; + call_stack_t callStack; + biased_subrs_t<SUBRS> globalSubrs; + biased_subrs_t<SUBRS> localSubrs; private: - Point pt; + point_t pt; - typedef InterpEnv<ARG> SUPER; + typedef interp_env_t<ARG> SUPER; }; template <typename ENV, typename PARAM> -struct PathProcsNull +struct path_procs_null_t { static void rmoveto (ENV &env, PARAM& param) {} static void hmoveto (ENV &env, PARAM& param) {} @@ -236,19 +237,19 @@ struct PathProcsNull static void hhcurveto (ENV &env, PARAM& param) {} static void vhcurveto (ENV &env, PARAM& param) {} static void hvcurveto (ENV &env, PARAM& param) {} - static void moveto (ENV &env, PARAM& param, const Point &pt) {} - static void line (ENV &env, PARAM& param, const Point &pt1) {} - static void curve (ENV &env, PARAM& param, const Point &pt1, const Point &pt2, const Point &pt3) {} + static void moveto (ENV &env, PARAM& param, const point_t &pt) {} + static void line (ENV &env, PARAM& param, const point_t &pt1) {} + static void curve (ENV &env, PARAM& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) {} static void hflex (ENV &env, PARAM& param) {} static void flex (ENV &env, PARAM& param) {} static void hflex1 (ENV &env, PARAM& param) {} static void flex1 (ENV &env, PARAM& param) {} }; -template <typename ARG, typename OPSET, typename ENV, typename PARAM, typename PATH=PathProcsNull<ENV, PARAM> > -struct CSOpSet : OpSet<ARG> +template <typename ARG, typename OPSET, typename ENV, typename PARAM, typename PATH=path_procs_null_t<ENV, PARAM> > +struct cs_opset_t : opset_t<ARG> { - static void process_op (OpCode op, ENV &env, PARAM& param) + static void process_op (op_code_t op, ENV &env, PARAM& param) { switch (op) { @@ -262,7 +263,7 @@ struct CSOpSet : OpSet<ARG> break; case OpCode_fixedcs: - env.argStack.push_fixed_from_substr (env.substr); + env.argStack.push_fixed_from_substr (env.str_ref); break; case OpCode_callsubr: @@ -370,37 +371,37 @@ struct CSOpSet : OpSet<ARG> } } - static void process_hstem (OpCode op, ENV &env, PARAM& param) + static void process_hstem (op_code_t op, ENV &env, PARAM& param) { env.hstem_count += env.argStack.get_count () / 2; OPSET::flush_args_and_op (op, env, param); } - static void process_vstem (OpCode op, ENV &env, PARAM& param) + static void process_vstem (op_code_t op, ENV &env, PARAM& param) { env.vstem_count += env.argStack.get_count () / 2; OPSET::flush_args_and_op (op, env, param); } - static void process_hintmask (OpCode op, ENV &env, PARAM& param) + static void process_hintmask (op_code_t op, ENV &env, PARAM& param) { env.determine_hintmask_size (); - if (likely (env.substr.avail (env.hintmask_size))) + if (likely (env.str_ref.avail (env.hintmask_size))) { OPSET::flush_hintmask (op, env, param); - env.substr.inc (env.hintmask_size); + env.str_ref.inc (env.hintmask_size); } } - static void process_post_flex (OpCode op, ENV &env, PARAM& param) + static void process_post_flex (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args_and_op (op, env, param); } - static void check_width (OpCode op, ENV &env, PARAM& param) + static void check_width (op_code_t op, ENV &env, PARAM& param) {} - static void process_post_move (OpCode op, ENV &env, PARAM& param) + static void process_post_move (op_code_t op, ENV &env, PARAM& param) { if (!env.seen_moveto) { @@ -410,12 +411,12 @@ struct CSOpSet : OpSet<ARG> OPSET::flush_args_and_op (op, env, param); } - static void process_post_path (OpCode op, ENV &env, PARAM& param) + static void process_post_path (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args_and_op (op, env, param); } - static void flush_args_and_op (OpCode op, ENV &env, PARAM& param) + static void flush_args_and_op (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args (env, param); OPSET::flush_op (op, env, param); @@ -426,16 +427,16 @@ struct CSOpSet : OpSet<ARG> env.pop_n_args (env.argStack.get_count ()); } - static void flush_op (OpCode op, ENV &env, PARAM& param) + static void flush_op (op_code_t op, ENV &env, PARAM& param) { } - static void flush_hintmask (OpCode op, ENV &env, PARAM& param) + static void flush_hintmask (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args_and_op (op, env, param); } - static bool is_number_op (OpCode op) + static bool is_number_op (op_code_t op) { switch (op) { @@ -454,31 +455,31 @@ struct CSOpSet : OpSet<ARG> } protected: - typedef OpSet<ARG> SUPER; + typedef opset_t<ARG> SUPER; }; template <typename PATH, typename ENV, typename PARAM> -struct PathProcs +struct path_procs_t { static void rmoveto (ENV &env, PARAM& param) { - Point pt1 = env.get_pt (); - const Number &dy = env.pop_arg (); - const Number &dx = env.pop_arg (); + point_t pt1 = env.get_pt (); + const number_t &dy = env.pop_arg (); + const number_t &dx = env.pop_arg (); pt1.move (dx, dy); PATH::moveto (env, param, pt1); } static void hmoveto (ENV &env, PARAM& param) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move_x (env.pop_arg ()); PATH::moveto (env, param, pt1); } static void vmoveto (ENV &env, PARAM& param) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move_y (env.pop_arg ()); PATH::moveto (env, param, pt1); } @@ -487,7 +488,7 @@ struct PathProcs { for (unsigned int i = 0; i + 2 <= env.argStack.get_count (); i += 2) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (i), env.eval_arg (i+1)); PATH::line (env, param, pt1); } @@ -495,7 +496,7 @@ struct PathProcs static void hlineto (ENV &env, PARAM& param) { - Point pt1; + point_t pt1; unsigned int i = 0; for (; i + 2 <= env.argStack.get_count (); i += 2) { @@ -515,7 +516,7 @@ struct PathProcs static void vlineto (ENV &env, PARAM& param) { - Point pt1; + point_t pt1; unsigned int i = 0; for (; i + 2 <= env.argStack.get_count (); i += 2) { @@ -537,11 +538,11 @@ struct PathProcs { for (unsigned int i = 0; i + 6 <= env.argStack.get_count (); i += 6) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (i), env.eval_arg (i+1)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+2), env.eval_arg (i+3)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move (env.eval_arg (i+4), env.eval_arg (i+5)); PATH::curve (env, param, pt1, pt2, pt3); } @@ -552,17 +553,17 @@ struct PathProcs unsigned int i = 0; for (; i + 6 <= env.argStack.get_count (); i += 6) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (i), env.eval_arg (i+1)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+2), env.eval_arg (i+3)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move (env.eval_arg (i+4), env.eval_arg (i+5)); PATH::curve (env, param, pt1, pt2, pt3); } for (; i + 2 <= env.argStack.get_count (); i += 2) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (i), env.eval_arg (i+1)); PATH::line (env, param, pt1); } @@ -574,17 +575,17 @@ struct PathProcs unsigned int line_limit = (env.argStack.get_count () % 6); for (; i + 2 <= line_limit; i += 2) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (i), env.eval_arg (i+1)); PATH::line (env, param, pt1); } for (; i + 6 <= env.argStack.get_count (); i += 6) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (i), env.eval_arg (i+1)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+2), env.eval_arg (i+3)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move (env.eval_arg (i+4), env.eval_arg (i+5)); PATH::curve (env, param, pt1, pt2, pt3); } @@ -593,15 +594,15 @@ struct PathProcs static void vvcurveto (ENV &env, PARAM& param) { unsigned int i = 0; - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); if ((env.argStack.get_count () & 1) != 0) pt1.move_x (env.eval_arg (i++)); for (; i + 4 <= env.argStack.get_count (); i += 4) { pt1.move_y (env.eval_arg (i)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+1), env.eval_arg (i+2)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move_y (env.eval_arg (i+3)); PATH::curve (env, param, pt1, pt2, pt3); pt1 = env.get_pt (); @@ -611,15 +612,15 @@ struct PathProcs static void hhcurveto (ENV &env, PARAM& param) { unsigned int i = 0; - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); if ((env.argStack.get_count () & 1) != 0) pt1.move_y (env.eval_arg (i++)); for (; i + 4 <= env.argStack.get_count (); i += 4) { pt1.move_x (env.eval_arg (i)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+1), env.eval_arg (i+2)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move_x (env.eval_arg (i+3)); PATH::curve (env, param, pt1, pt2, pt3); pt1 = env.get_pt (); @@ -628,15 +629,15 @@ struct PathProcs static void vhcurveto (ENV &env, PARAM& param) { - Point pt1, pt2, pt3; + point_t pt1, pt2, pt3; unsigned int i = 0; if ((env.argStack.get_count () % 8) >= 4) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move_y (env.eval_arg (i)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+1), env.eval_arg (i+2)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move_x (env.eval_arg (i+3)); i += 4; @@ -689,15 +690,15 @@ struct PathProcs static void hvcurveto (ENV &env, PARAM& param) { - Point pt1, pt2, pt3; + point_t pt1, pt2, pt3; unsigned int i = 0; if ((env.argStack.get_count () % 8) >= 4) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move_x (env.eval_arg (i)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (i+1), env.eval_arg (i+2)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move_y (env.eval_arg (i+3)); i += 4; @@ -749,31 +750,31 @@ struct PathProcs } /* default actions to be overridden */ - static void moveto (ENV &env, PARAM& param, const Point &pt) + static void moveto (ENV &env, PARAM& param, const point_t &pt) { env.moveto (pt); } - static void line (ENV &env, PARAM& param, const Point &pt1) + static void line (ENV &env, PARAM& param, const point_t &pt1) { PATH::moveto (env, param, pt1); } - static void curve (ENV &env, PARAM& param, const Point &pt1, const Point &pt2, const Point &pt3) + static void curve (ENV &env, PARAM& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) { PATH::moveto (env, param, pt3); } static void hflex (ENV &env, PARAM& param) { if (likely (env.argStack.get_count () == 7)) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move_x (env.eval_arg (0)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (1), env.eval_arg (2)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move_x (env.eval_arg (3)); - Point pt4 = pt3; + point_t pt4 = pt3; pt4.move_x (env.eval_arg (4)); - Point pt5 = pt4; + point_t pt5 = pt4; pt5.move_x (env.eval_arg (5)); pt5.y = pt1.y; - Point pt6 = pt5; + point_t pt6 = pt5; pt6.move_x (env.eval_arg (6)); curve2 (env, param, pt1, pt2, pt3, pt4, pt5, pt6); @@ -786,17 +787,17 @@ struct PathProcs { if (likely (env.argStack.get_count () == 13)) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (0), env.eval_arg (1)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (2), env.eval_arg (3)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move (env.eval_arg (4), env.eval_arg (5)); - Point pt4 = pt3; + point_t pt4 = pt3; pt4.move (env.eval_arg (6), env.eval_arg (7)); - Point pt5 = pt4; + point_t pt5 = pt4; pt5.move (env.eval_arg (8), env.eval_arg (9)); - Point pt6 = pt5; + point_t pt6 = pt5; pt6.move (env.eval_arg (10), env.eval_arg (11)); curve2 (env, param, pt1, pt2, pt3, pt4, pt5, pt6); @@ -809,17 +810,17 @@ struct PathProcs { if (likely (env.argStack.get_count () == 9)) { - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (0), env.eval_arg (1)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (2), env.eval_arg (3)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move_x (env.eval_arg (4)); - Point pt4 = pt3; + point_t pt4 = pt3; pt4.move_x (env.eval_arg (5)); - Point pt5 = pt4; + point_t pt5 = pt4; pt5.move (env.eval_arg (6), env.eval_arg (7)); - Point pt6 = pt5; + point_t pt6 = pt5; pt6.move_x (env.eval_arg (8)); pt6.y = env.get_pt ().y; @@ -833,22 +834,22 @@ struct PathProcs { if (likely (env.argStack.get_count () == 11)) { - Point d; + point_t d; d.init (); for (unsigned int i = 0; i < 10; i += 2) d.move (env.eval_arg (i), env.eval_arg (i+1)); - Point pt1 = env.get_pt (); + point_t pt1 = env.get_pt (); pt1.move (env.eval_arg (0), env.eval_arg (1)); - Point pt2 = pt1; + point_t pt2 = pt1; pt2.move (env.eval_arg (2), env.eval_arg (3)); - Point pt3 = pt2; + point_t pt3 = pt2; pt3.move (env.eval_arg (4), env.eval_arg (5)); - Point pt4 = pt3; + point_t pt4 = pt3; pt4.move (env.eval_arg (6), env.eval_arg (7)); - Point pt5 = pt4; + point_t pt5 = pt4; pt5.move (env.eval_arg (8), env.eval_arg (9)); - Point pt6 = pt5; + point_t pt6 = pt5; if (fabs (d.x.to_real ()) > fabs (d.y.to_real ())) { @@ -869,8 +870,8 @@ struct PathProcs protected: static void curve2 (ENV &env, PARAM& param, - const Point &pt1, const Point &pt2, const Point &pt3, - const Point &pt4, const Point &pt5, const Point &pt6) + const point_t &pt1, const point_t &pt2, const point_t &pt3, + const point_t &pt4, const point_t &pt5, const point_t &pt6) { PATH::curve (env, param, pt1, pt2, pt3); PATH::curve (env, param, pt4, pt5, pt6); @@ -878,7 +879,7 @@ struct PathProcs }; template <typename ENV, typename OPSET, typename PARAM> -struct CSInterpreter : Interpreter<ENV> +struct cs_interpreter_t : interpreter_t<ENV> { bool interpret (PARAM& param) { @@ -896,7 +897,7 @@ struct CSInterpreter : Interpreter<ENV> } private: - typedef Interpreter<ENV> SUPER; + typedef interpreter_t<ENV> SUPER; }; } /* namespace CFF */ 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 8000d76b8bd..2c54909a1bc 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,28 +35,28 @@ namespace CFF { using namespace OT; /* an opstr and the parsed out dict value(s) */ -struct DictVal : OpStr +struct dict_val_t : op_str_t { void init () { single_val.set_int (0); } void fini () {} - Number single_val; + number_t single_val; }; -typedef DictVal NumDictVal; +typedef dict_val_t num_dict_val_t; -template <typename VAL> struct DictValues : ParsedValues<VAL> {}; +template <typename VAL> struct dict_values_t : parsed_values_t<VAL> {}; -template <typename OPSTR=OpStr> -struct TopDictValues : DictValues<OPSTR> +template <typename OPSTR=op_str_t> +struct top_dict_values_t : dict_values_t<OPSTR> { void init () { - DictValues<OPSTR>::init (); + dict_values_t<OPSTR>::init (); charStringsOffset = 0; FDArrayOffset = 0; } - void fini () { DictValues<OPSTR>::fini (); } + void fini () { dict_values_t<OPSTR>::fini (); } unsigned int calculate_serialized_op_size (const OPSTR& opstr) const { @@ -67,7 +67,7 @@ struct TopDictValues : DictValues<OPSTR> return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op); default: - return opstr.str.len; + return opstr.str.length; } } @@ -75,26 +75,26 @@ struct TopDictValues : DictValues<OPSTR> unsigned int FDArrayOffset; }; -struct DictOpSet : OpSet<Number> +struct dict_opset_t : opset_t<number_t> { - static void process_op (OpCode op, InterpEnv<Number>& env) + static void process_op (op_code_t op, interp_env_t<number_t>& env) { switch (op) { case OpCode_longintdict: /* 5-byte integer */ - env.argStack.push_longint_from_substr (env.substr); + env.argStack.push_longint_from_substr (env.str_ref); break; case OpCode_BCD: /* real number */ - env.argStack.push_real (parse_bcd (env.substr)); + env.argStack.push_real (parse_bcd (env.str_ref)); break; default: - OpSet<Number>::process_op (op, env); + opset_t<number_t>::process_op (op, env); break; } } - static double parse_bcd (SubByteStr& substr) + static double parse_bcd (byte_str_ref_t& str_ref) { bool neg = false; double int_part = 0; @@ -115,13 +115,13 @@ struct DictOpSet : OpSet<Number> char d; if ((i & 1) == 0) { - if (!substr.avail ()) + if (!str_ref.avail ()) { - substr.set_error (); + str_ref.set_error (); return 0.0; } - byte = substr[0]; - substr.inc (); + byte = str_ref[0]; + str_ref.inc (); d = byte >> 4; } else @@ -130,7 +130,7 @@ struct DictOpSet : OpSet<Number> switch (d) { case RESERVED: - substr.set_error (); + str_ref.set_error (); return value; case END: @@ -162,7 +162,7 @@ struct DictOpSet : OpSet<Number> case NEG: if (i != 0) { - substr.set_error (); + str_ref.set_error (); return 0.0; } neg = true; @@ -171,7 +171,7 @@ struct DictOpSet : OpSet<Number> case DECIMAL: if (part != INT_PART) { - substr.set_error (); + str_ref.set_error (); return value; } part = FRAC_PART; @@ -184,7 +184,7 @@ struct DictOpSet : OpSet<Number> case EXP_POS: if (part == EXP_PART) { - substr.set_error (); + str_ref.set_error (); return value; } part = EXP_PART; @@ -220,7 +220,7 @@ struct DictOpSet : OpSet<Number> return value; } - static bool is_hint_op (OpCode op) + static bool is_hint_op (op_code_t op) { switch (op) { @@ -245,10 +245,10 @@ struct DictOpSet : OpSet<Number> } }; -template <typename VAL=OpStr> -struct TopDictOpSet : DictOpSet +template <typename VAL=op_str_t> +struct top_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, InterpEnv<Number>& env, TopDictValues<VAL> & dictval) + static void process_op (op_code_t op, interp_env_t<number_t>& env, top_dict_values_t<VAL> & dictval) { switch (op) { case OpCode_CharStrings: @@ -263,19 +263,19 @@ struct TopDictOpSet : DictOpSet env.clear_args (); break; default: - DictOpSet::process_op (op, env); + dict_opset_t::process_op (op, env); break; } } }; -template <typename OPSET, typename PARAM, typename ENV=NumInterpEnv> -struct DictInterpreter : Interpreter<ENV> +template <typename OPSET, typename PARAM, typename ENV=num_interp_env_t> +struct dict_interpreter_t : interpreter_t<ENV> { bool interpret (PARAM& param) { param.init (); - while (SUPER::env.substr.avail ()) + while (SUPER::env.str_ref.avail ()) { OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param); if (unlikely (SUPER::env.in_error ())) @@ -286,7 +286,7 @@ struct DictInterpreter : Interpreter<ENV> } private: - typedef Interpreter<ENV> SUPER; + typedef interpreter_t<ENV> SUPER; }; } /* namespace CFF */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh index 68e1d81d762..c7209ed804d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh @@ -33,12 +33,12 @@ namespace CFF { using namespace OT; -typedef BiasedSubrs<CFF1Subrs> CFF1BiasedSubrs; +typedef biased_subrs_t<CFF1Subrs> cff1_biased_subrs_t; -struct CFF1CSInterpEnv : CSInterpEnv<Number, CFF1Subrs> +struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs> { template <typename ACC> - void init (const ByteStr &str, ACC &acc, unsigned int fd) + void init (const byte_str_t &str, ACC &acc, unsigned int fd) { SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs); processed_width = false; @@ -74,20 +74,20 @@ struct CFF1CSInterpEnv : CSInterpEnv<Number, CFF1Subrs> bool processed_width; bool has_width; unsigned int arg_start; - Number width; + number_t width; bool in_seac; private: - typedef CSInterpEnv<Number, CFF1Subrs> SUPER; + typedef cs_interp_env_t<number_t, CFF1Subrs> SUPER; }; -template <typename OPSET, typename PARAM, typename PATH=PathProcsNull<CFF1CSInterpEnv, PARAM> > -struct CFF1CSOpSet : CSOpSet<Number, OPSET, CFF1CSInterpEnv, PARAM, PATH> +template <typename OPSET, typename PARAM, typename PATH=path_procs_null_t<cff1_cs_interp_env_t, PARAM> > +struct cff1_cs_opset_t : cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM, PATH> { /* PostScript-originated legacy opcodes (OpCode_add etc) are unsupported */ /* Type 1-originated deprecated opcodes, seac behavior of endchar and dotsection are supported */ - static void process_op (OpCode op, CFF1CSInterpEnv &env, PARAM& param) + static void process_op (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param) { switch (op) { case OpCode_dotsection: @@ -109,7 +109,7 @@ struct CFF1CSOpSet : CSOpSet<Number, OPSET, CFF1CSInterpEnv, PARAM, PATH> } } - static void check_width (OpCode op, CFF1CSInterpEnv &env, PARAM& param) + static void check_width (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param) { if (!env.processed_width) { @@ -139,22 +139,22 @@ struct CFF1CSOpSet : CSOpSet<Number, OPSET, CFF1CSInterpEnv, PARAM, PATH> } } - static void process_seac (CFF1CSInterpEnv &env, PARAM& param) + static void process_seac (cff1_cs_interp_env_t &env, PARAM& param) { } - static void flush_args (CFF1CSInterpEnv &env, PARAM& param) + static void flush_args (cff1_cs_interp_env_t &env, PARAM& param) { SUPER::flush_args (env, param); env.clear_args (); /* pop off width */ } private: - typedef CSOpSet<Number, OPSET, CFF1CSInterpEnv, PARAM, PATH> SUPER; + typedef cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM, PATH> SUPER; }; template <typename OPSET, typename PARAM> -struct CFF1CSInterpreter : CSInterpreter<CFF1CSInterpEnv, OPSET, PARAM> {}; +struct cff1_cs_interpreter_t : cs_interpreter_t<cff1_cs_interp_env_t, OPSET, PARAM> {}; } /* namespace CFF */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh index 709bdefa1dc..49e5ee7397e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh @@ -33,26 +33,26 @@ namespace CFF { using namespace OT; -struct BlendArg : Number +struct blend_arg_t : number_t { void init () { - Number::init (); + number_t::init (); deltas.init (); } void fini () { - Number::fini (); + number_t::fini (); deltas.fini_deep (); } - void set_int (int v) { reset_blends (); Number::set_int (v); } - void set_fixed (int32_t v) { reset_blends (); Number::set_fixed (v); } - void set_real (double v) { reset_blends (); Number::set_real (v); } + void set_int (int v) { reset_blends (); number_t::set_int (v); } + void set_fixed (int32_t v) { reset_blends (); number_t::set_fixed (v); } + void set_real (double v) { reset_blends (); number_t::set_real (v); } void set_blends (unsigned int numValues_, unsigned int valueIndex_, - unsigned int numBlends, hb_array_t<const BlendArg> blends_) + unsigned int numBlends, hb_array_t<const blend_arg_t> blends_) { numValues = numValues_; valueIndex = valueIndex_; @@ -61,7 +61,7 @@ struct BlendArg : Number deltas[i] = blends_[i]; } - bool blending () const { return deltas.len > 0; } + bool blending () const { return deltas.length > 0; } void reset_blends () { numValues = valueIndex = 0; @@ -70,16 +70,16 @@ struct BlendArg : Number unsigned int numValues; unsigned int valueIndex; - hb_vector_t<Number> deltas; + hb_vector_t<number_t> deltas; }; -typedef InterpEnv<BlendArg> BlendInterpEnv; -typedef BiasedSubrs<CFF2Subrs> CFF2BiasedSubrs; +typedef interp_env_t<blend_arg_t> BlendInterpEnv; +typedef biased_subrs_t<CFF2Subrs> cff2_biased_subrs_t; -struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs> +struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs> { template <typename ACC> - void init (const ByteStr &str, ACC &acc, unsigned int fd, + void init (const byte_str_t &str, ACC &acc, unsigned int fd, const int *coords_=nullptr, unsigned int num_coords_=0) { SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs); @@ -100,9 +100,9 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs> SUPER::fini (); } - OpCode fetch_op () + op_code_t fetch_op () { - if (this->substr.avail ()) + if (this->str_ref.avail ()) return SUPER::fetch_op (); /* make up return or endchar op */ @@ -112,16 +112,16 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs> return OpCode_return; } - const BlendArg& eval_arg (unsigned int i) + const blend_arg_t& eval_arg (unsigned int i) { - BlendArg &arg = argStack[i]; + blend_arg_t &arg = argStack[i]; blend_arg (arg); return arg; } - const BlendArg& pop_arg () + const blend_arg_t& pop_arg () { - BlendArg &arg = argStack.pop (); + blend_arg_t &arg = argStack.pop (); blend_arg (arg); return arg; } @@ -163,14 +163,14 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs> bool seen_vsindex () const { return seen_vsindex_; } protected: - void blend_arg (BlendArg &arg) + void blend_arg (blend_arg_t &arg) { if (do_blend && arg.blending ()) { - if (likely (scalars.len == arg.deltas.len)) + if (likely (scalars.length == arg.deltas.length)) { double v = arg.to_real (); - for (unsigned int i = 0; i < scalars.len; i++) + for (unsigned int i = 0; i < scalars.length; i++) { v += (double)scalars[i] * arg.deltas[i].to_real (); } @@ -191,12 +191,12 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs> bool seen_vsindex_; bool seen_blend; - typedef CSInterpEnv<BlendArg, CFF2Subrs> SUPER; + typedef cs_interp_env_t<blend_arg_t, CFF2Subrs> SUPER; }; -template <typename OPSET, typename PARAM, typename PATH=PathProcsNull<CFF2CSInterpEnv, PARAM> > -struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH> +template <typename OPSET, typename PARAM, typename PATH=path_procs_null_t<cff2_cs_interp_env_t, PARAM> > +struct cff2_cs_opset_t : cs_opset_t<blend_arg_t, OPSET, cff2_cs_interp_env_t, PARAM, PATH> { - static void process_op (OpCode op, CFF2CSInterpEnv &env, PARAM& param) + static void process_op (op_code_t op, cff2_cs_interp_env_t &env, PARAM& param) { switch (op) { case OpCode_callsubr: @@ -228,7 +228,7 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH> } } - static void process_blend (CFF2CSInterpEnv &env, PARAM& param) + static void process_blend (cff2_cs_interp_env_t &env, PARAM& param) { unsigned int n, k; @@ -245,7 +245,7 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH> } for (unsigned int i = 0; i < n; i++) { - const hb_array_t<const BlendArg> blends = env.argStack.get_subarray (start + n + (i * k)); + const hb_array_t<const blend_arg_t> blends = env.argStack.get_subarray (start + n + (i * k)); env.argStack[start + i].set_blends (n, i, k, blends); } @@ -253,18 +253,18 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH> env.argStack.pop (k * n); } - static void process_vsindex (CFF2CSInterpEnv &env, PARAM& param) + static void process_vsindex (cff2_cs_interp_env_t &env, PARAM& param) { env.process_vsindex (); env.clear_args (); } private: - typedef CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH> SUPER; + typedef cs_opset_t<blend_arg_t, OPSET, cff2_cs_interp_env_t, PARAM, PATH> SUPER; }; template <typename OPSET, typename PARAM> -struct CFF2CSInterpreter : CSInterpreter<CFF2CSInterpEnv, OPSET, PARAM> {}; +struct cff2_cs_interpreter_t : cs_interpreter_t<cff2_cs_interp_env_t, OPSET, PARAM> {}; } /* namespace CFF */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.h index ae23698a576..2b29e4441d4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.h @@ -67,7 +67,7 @@ typedef unsigned __int64 uint64_t; # include <stdint.h> #endif -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) #define HB_DEPRECATED __attribute__((__deprecated__)) #elif defined(_MSC_VER) && (_MSC_VER >= 1300) #define HB_DEPRECATED __declspec(deprecated) @@ -75,7 +75,7 @@ typedef unsigned __int64 uint64_t; #define HB_DEPRECATED #endif -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) #define HB_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead"))) #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) #define HB_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead")) @@ -108,7 +108,7 @@ typedef union _hb_var_int_t { typedef uint32_t hb_tag_t; #define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF))) -#define HB_UNTAG(tag) (((tag)>>24)&0xFF), (((tag)>>16)&0xFF), (((tag)>>8)&0xFF), ((tag)&0xFF) +#define HB_UNTAG(tag) (uint8_t)(((tag)>>24)&0xFF), (uint8_t)(((tag)>>16)&0xFF), (uint8_t)(((tag)>>8)&0xFF), (uint8_t)((tag)&0xFF) #define HB_TAG_NONE HB_TAG(0,0,0,0) #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) 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 c181950d21d..42ea3ea2b3f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -527,7 +527,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, /* Scan events and save features for each range. */ hb_vector_t<active_feature_t> active_features; unsigned int last_index = 0; - for (unsigned int i = 0; i < feature_events.len; i++) + for (unsigned int i = 0; i < feature_events.length; i++) { feature_event_t *event = &feature_events[i]; @@ -536,13 +536,13 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, /* Save a snapshot of active features and the range. */ range_record_t *range = range_records.push (); - if (active_features.len) + if (active_features.length) { CFMutableArrayRef features_array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); /* TODO sort and resolve conflicting features? */ /* active_features.qsort (); */ - for (unsigned int j = 0; j < active_features.len; j++) + for (unsigned int j = 0; j < active_features.length; j++) { CFStringRef keys[] = { kCTFontFeatureTypeIdentifierKey, @@ -730,7 +730,7 @@ resize_and_retry: CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len), kCTFontAttributeName, ct_font); - if (num_features && range_records.len) + if (num_features && range_records.length) { unsigned int start = 0; range_record_t *last_range = &range_records[0]; @@ -879,7 +879,7 @@ resize_and_retry: * Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098 */ bool matched = false; - for (unsigned int i = 0; i < range_records.len; i++) + for (unsigned int i = 0; i < range_records.length; i++) if (range_records[i].font && CFEqual (run_ct_font, range_records[i].font)) { matched = true; @@ -1142,7 +1142,7 @@ fail: if (line) CFRelease (line); - for (unsigned int i = 0; i < range_records.len; i++) + for (unsigned int i = 0; i < range_records.length; i++) if (range_records[i].font) CFRelease (range_records[i].font); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh index 41a85b58c10..d7d0165a91f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh @@ -401,30 +401,6 @@ struct hb_no_trace_t { #define TRACE_APPLY(this) hb_no_trace_t<bool> trace #endif -#ifndef HB_DEBUG_CLOSURE -#define HB_DEBUG_CLOSURE (HB_DEBUG+0) -#endif -#if HB_DEBUG_CLOSURE -#define TRACE_CLOSURE(this) \ - hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \ - (&c->debug_depth, c->get_name (), this, HB_FUNC, \ - " ") -#else -#define TRACE_CLOSURE(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED -#endif - -#ifndef HB_DEBUG_COLLECT_GLYPHS -#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0) -#endif -#if HB_DEBUG_COLLECT_GLYPHS -#define TRACE_COLLECT_GLYPHS(this) \ - hb_auto_trace_t<HB_DEBUG_COLLECT_GLYPHS, hb_void_t> trace \ - (&c->debug_depth, c->get_name (), this, HB_FUNC, \ - " ") -#else -#define TRACE_COLLECT_GLYPHS(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED -#endif - #ifndef HB_DEBUG_SANITIZE #define HB_DEBUG_SANITIZE (HB_DEBUG+0) #endif @@ -476,8 +452,6 @@ struct hb_no_trace_t { #ifndef HB_DEBUG_DISPATCH #define HB_DEBUG_DISPATCH ( \ HB_DEBUG_APPLY + \ - HB_DEBUG_CLOSURE + \ - HB_DEBUG_COLLECT_GLYPHS + \ HB_DEBUG_SANITIZE + \ HB_DEBUG_SERIALIZE + \ HB_DEBUG_SUBSET + \ 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 e93cf90a30f..aaf10a1d6e4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc @@ -71,6 +71,8 @@ public: *fontFileStream = mFontFileStream; return S_OK; } + + virtual ~DWriteFontFileLoader() {} }; class DWriteFontFileStream : public IDWriteFontFileStream @@ -122,6 +124,8 @@ public: virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime (OUT UINT64* lastWriteTime) { return E_NOTIMPL; } + + virtual ~DWriteFontFileStream() {} }; @@ -133,8 +137,8 @@ struct hb_directwrite_face_data_t { IDWriteFactory *dwriteFactory; IDWriteFontFile *fontFile; - IDWriteFontFileStream *fontFileStream; - IDWriteFontFileLoader *fontFileLoader; + DWriteFontFileStream *fontFileStream; + DWriteFontFileLoader *fontFileLoader; IDWriteFontFace *fontFace; hb_blob_t *faceBlob; }; @@ -281,7 +285,7 @@ public: public: TextAnalysis (const wchar_t* text, uint32_t textLength, const wchar_t* localeName, DWRITE_READING_DIRECTION readingDirection) - : mText (text), mTextLength (textLength), mLocaleName (localeName), + : mTextLength (textLength), mText (text), mLocaleName (localeName), mReadingDirection (readingDirection), mCurrentRun (nullptr) {} ~TextAnalysis () { @@ -516,7 +520,6 @@ _hb_directwrite_shape_full (hb_shape_plan_t *shape_plan, { hb_face_t *face = font->face; const hb_directwrite_face_data_t *face_data = face->data.directwrite; - const hb_directwrite_font_data_t *font_data = font->data.directwrite; IDWriteFactory *dwriteFactory = face_data->dwriteFactory; IDWriteFontFace *fontFace = face_data->fontFace; @@ -770,7 +773,7 @@ retry_getglyphs: /* Calculate visual-clusters. That's what we ship. */ for (unsigned int i = 0; i < glyphCount; i++) - vis_clusters[i] = -1; + vis_clusters[i] = (uint32_t) -1; for (unsigned int i = 0; i < buffer->len; i++) { uint32_t *p = @@ -778,7 +781,7 @@ retry_getglyphs: *p = MIN (*p, buffer->info[i].cluster); } for (unsigned int i = 1; i < glyphCount; i++) - if (vis_clusters[i] == -1) + if (vis_clusters[i] == (uint32_t) -1) vis_clusters[i] = vis_clusters[i - 1]; #undef utf16_index 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 48ce9897d5e..cb3057c54cd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh @@ -28,7 +28,6 @@ #define HB_DSALGS_HH #include "hb.hh" - #include "hb-null.hh" @@ -107,7 +106,7 @@ hb_bit_storage (T v) _BitScanReverse (&where, v); return 1 + where; } -# if _WIN64 +# if defined(_WIN64) if (sizeof (T) <= 8) { unsigned long where; @@ -181,7 +180,7 @@ hb_ctz (T v) _BitScanForward (&where, v); return where; } -# if _WIN64 +# if defined(_WIN64) if (sizeof (T) <= 8) { unsigned long where; @@ -237,10 +236,13 @@ hb_ctz (T v) template <typename T> static inline T* hb_addressof (T& arg) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-align" /* https://en.cppreference.com/w/cpp/memory/addressof */ return reinterpret_cast<T*>( &const_cast<char&>( reinterpret_cast<const volatile char&>(arg))); +#pragma GCC diagnostic pop } /* ASCII tag/character handling */ @@ -554,26 +556,26 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o struct HbOpOr { - enum { passthru_left = true }; - enum { passthru_right = true }; + static constexpr bool passthru_left = true; + static constexpr bool passthru_right = true; template <typename T> static void process (T &o, const T &a, const T &b) { o = a | b; } }; struct HbOpAnd { - enum { passthru_left = false }; - enum { passthru_right = false }; + static constexpr bool passthru_left = false; + static constexpr bool passthru_right = false; template <typename T> static void process (T &o, const T &a, const T &b) { o = a & b; } }; struct HbOpMinus { - enum { passthru_left = true }; - enum { passthru_right = false }; + static constexpr bool passthru_left = true; + static constexpr bool passthru_right = false; template <typename T> static void process (T &o, const T &a, const T &b) { o = a & ~b; } }; struct HbOpXor { - enum { passthru_left = true }; - enum { passthru_right = true }; + static constexpr bool passthru_left = true; + static constexpr bool passthru_right = true; template <typename T> static void process (T &o, const T &a, const T &b) { o = a ^ b; } }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc index 8bb8c512106..375ef9293a9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc @@ -599,7 +599,7 @@ struct hb_face_builder_data_t hb_blob_t *blob; }; - hb_vector_t<table_entry_t, 32> tables; + hb_vector_t<table_entry_t> tables; }; static hb_face_builder_data_t * @@ -619,7 +619,7 @@ _hb_face_builder_data_destroy (void *user_data) { hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; - for (unsigned int i = 0; i < data->tables.len; i++) + for (unsigned int i = 0; i < data->tables.length; i++) hb_blob_destroy (data->tables[i].blob); data->tables.fini (); @@ -631,7 +631,7 @@ static hb_blob_t * _hb_face_builder_data_reference_blob (hb_face_builder_data_t *data) { - unsigned int table_count = data->tables.len; + unsigned int table_count = data->tables.length; unsigned int face_length = table_count * 16 + 12; for (unsigned int i = 0; i < table_count; i++) 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 0f0bcadc1b5..817a1a7b0ea 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc @@ -139,10 +139,10 @@ hb_font_get_nominal_glyphs_default (hb_font_t *font, for (unsigned int i = 0; i < count; i++) { if (!font->get_nominal_glyph (*first_unicode, first_glyph)) - return i; + return i; - first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); + first_unicode = &StructAtOffsetUnaligned<hb_codepoint_t> (first_unicode, unicode_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); } return count; } @@ -238,8 +238,8 @@ hb_font_get_glyph_h_advances_default (hb_font_t* font, for (unsigned int i = 0; i < count; i++) { *first_advance = font->get_glyph_h_advance (*first_glyph); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } return; } @@ -250,7 +250,7 @@ hb_font_get_glyph_h_advances_default (hb_font_t* font, for (unsigned int i = 0; i < count; i++) { *first_advance = font->parent_scale_x_distance (*first_advance); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } } @@ -270,8 +270,8 @@ hb_font_get_glyph_v_advances_default (hb_font_t* font, for (unsigned int i = 0; i < count; i++) { *first_advance = font->get_glyph_v_advance (*first_glyph); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } return; } @@ -282,7 +282,7 @@ hb_font_get_glyph_v_advances_default (hb_font_t* font, for (unsigned int i = 0; i < count; i++) { *first_advance = font->parent_scale_y_distance (*first_advance); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } } 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 5f6e3808756..1900f30bce2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc @@ -228,8 +228,8 @@ hb_ft_get_nominal_glyphs (hb_font_t *font HB_UNUSED, done < count && (*first_glyph = FT_Get_Char_Index (ft_font->ft_face, *first_unicode)); done++) { - first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); + first_unicode = &StructAtOffsetUnaligned<hb_codepoint_t> (first_unicode, unicode_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); } /* We don't need to do ft_font->symbol dance here, since HB calls the singular * nominal_glyph() for what we don't handle here. */ @@ -292,8 +292,8 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, } *first_advance = (v * mult + (1<<9)) >> 10; - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc index 846240e9322..3cff880aac3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc @@ -64,7 +64,7 @@ hb_gobject_##name##_get_type () \ } #define HB_DEFINE_OBJECT_TYPE(name) \ - HB_DEFINE_BOXED_TYPE (name, hb_##name##_reference, hb_##name##_destroy); + HB_DEFINE_BOXED_TYPE (name, hb_##name##_reference, hb_##name##_destroy) #define HB_DEFINE_VALUE_TYPE(name) \ static hb_##name##_t *_hb_##name##_reference (const hb_##name##_t *l) \ @@ -75,7 +75,7 @@ hb_gobject_##name##_get_type () \ return c; \ } \ static void _hb_##name##_destroy (hb_##name##_t *l) { free (l); } \ - HB_DEFINE_BOXED_TYPE (name, _hb_##name##_reference, _hb_##name##_destroy); + HB_DEFINE_BOXED_TYPE (name, _hb_##name##_reference, _hb_##name##_destroy) HB_DEFINE_OBJECT_TYPE (buffer) HB_DEFINE_OBJECT_TYPE (blob) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh new file mode 100644 index 00000000000..c4ab26dc063 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh @@ -0,0 +1,153 @@ +/* + * Copyright © 2018 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_ITER_HH +#define HB_ITER_HH + +#include "hb.hh" +#include "hb-null.hh" + + +/* Unified iterator object. + * + * The goal of this template is to make the same iterator interface + * available to all types, and make it very easy and compact to use. + * hb_iter_tator objects are small, light-weight, objects that can be + * copied by value. If the collection / object being iterated on + * is writable, then the iterator returns lvalues, otherwise it + * returns rvalues. + */ + +/* Base class for all iterators. */ +template <typename Iter, typename Item = typename Iter::__item_type__> +struct hb_iter_t +{ + typedef Iter iter_t; + typedef iter_t const_iter_t; + typedef Item item_t; + static constexpr unsigned item_size = hb_static_size (Item); + + private: + /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ + const iter_t* thiz () const { return static_cast<const iter_t *> (this); } + iter_t* thiz () { return static_cast< iter_t *> (this); } + public: + + /* Operators. */ + operator iter_t () { return iter(); } + explicit_operator bool () const { return more (); } + item_t& operator * () const { return item (); } + item_t& operator [] (signed i) const { return item_at ((unsigned) i); } + iter_t& operator += (unsigned count) { forward (count); return *thiz(); } + iter_t& operator ++ () { next (); return *thiz(); } + iter_t& operator -= (unsigned count) { rewind (count); return *thiz(); } + iter_t& operator -- () { prev (); return *thiz(); } + iter_t operator + (unsigned count) { iter_t c (*thiz()); c += count; return c; } + iter_t operator ++ (int) { iter_t c (*thiz()); ++*thiz(); return c; } + iter_t operator - (unsigned count) { iter_t c (*thiz()); c -= count; return c; } + iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; } + + /* Methods. */ + iter_t iter () const { return *thiz(); } + const_iter_t const_iter () const { return iter (); } + item_t& item () const { return thiz()->__item__ (); } + item_t& item_at (unsigned i) const { return thiz()->__item_at__ (i); } + bool more () const { return thiz()->__more__ (); } + unsigned len () const { return thiz()->__len__ (); } + void next () { thiz()->__next__ (); } + void forward (unsigned n) { thiz()->__forward__ (n); } + void prev () { thiz()->__prev__ (); } + void rewind (unsigned n) { thiz()->__rewind__ (n); } + bool random_access () const { return thiz()->__random_access__ (); } + + protected: + hb_iter_t () {} + hb_iter_t (const hb_iter_t &o HB_UNUSED) {} + void operator = (const hb_iter_t &o HB_UNUSED) {} +}; + +/* Base class for sorted iterators. Does not enforce anything. + * Just for class taxonomy and requirements. */ +template <typename Iter, typename Item = typename Iter::__item_type__> +struct hb_sorted_iter_t : hb_iter_t<Iter, Item> +{ + protected: + hb_sorted_iter_t () {} + hb_sorted_iter_t (const hb_sorted_iter_t &o) : hb_iter_t<Iter, Item> (o) {} + void operator = (const hb_sorted_iter_t &o HB_UNUSED) {} +}; + +/* Mixin to fill in what the subclass doesn't provide. */ +template <typename iter_t, typename item_t = typename iter_t::__item_type__> +struct hb_iter_mixin_t +{ + private: + /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ + const iter_t* thiz () const { return static_cast<const iter_t *> (this); } + iter_t* thiz () { return static_cast< iter_t *> (this); } + public: + + /* Access: Implement __item__(), or __item_at__() if random-access. */ + item_t& __item__ () const { return thiz()->item_at (0); } + item_t& __item_at__ (unsigned i) const { return *(thiz() + i); } + + /* Termination: Implement __more__(), or __len__() if random-access. */ + bool __more__ () const { return thiz()->__len__ (); } + unsigned __len__ () const + { iter_t c (*thiz()); unsigned l = 0; while (c) { c++; l++; }; return l; } + + /* Advancing: Implement __next__(), or __forward__() if random-access. */ + void __next__ () { thiz()->forward (1); } + void __forward__ (unsigned n) { while (n--) thiz()->next (); } + + /* Rewinding: Implement __prev__() or __rewind__() if bidirectional. */ + void __prev__ () { thiz()->rewind (1); } + void __rewind__ (unsigned n) { while (n--) thiz()->prev (); } + + /* Random access: Return true if item_at(), len(), forward() are fast. */ + bool __random_access__ () const { return false; } +}; + + +/* Functions operating on iterators or iteratables. */ + +template <typename C, typename V> inline void +hb_fill (const C& c, const V &v) +{ + for (typename C::iter_t i (c); i; i++) + hb_assign (*i, v); +} + +template <typename S, typename D> inline bool +hb_copy (hb_iter_t<D> &id, hb_iter_t<S> &is) +{ + for (; id && is; ++id, ++is) + *id = *is; + return !is; +} + + +#endif /* HB_ITER_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery.hh index 9d2ae95556b..b22c2389c3c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery.hh @@ -64,6 +64,22 @@ static inline const Type& StructAtOffset(const void *P, unsigned int offset) template<typename Type> static inline Type& StructAtOffset(void *P, unsigned int offset) { return * reinterpret_cast<Type*> ((char *) P + offset); } +template<typename Type> +static inline const Type& StructAtOffsetUnaligned(const void *P, unsigned int offset) +{ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-align" + return * reinterpret_cast<Type*> ((char *) P + offset); +#pragma GCC diagnostic pop +} +template<typename Type> +static inline Type& StructAtOffsetUnaligned(void *P, unsigned int offset) +{ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-align" + return * reinterpret_cast<Type*> ((char *) P + offset); +#pragma GCC diagnostic pop +} /* StructAfter<T>(X) returns the struct T& that is placed after X. * Works with X of variable size also. X must implement get_size() */ @@ -97,30 +113,30 @@ static inline Type& StructAfter(TObject &X) #define DEFINE_SIZE_STATIC(size) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \ unsigned int get_size () const { return (size); } \ - enum { null_size = (size) }; \ - enum { min_size = (size) }; \ - enum { static_size = (size) } + static constexpr unsigned null_size = (size); \ + static constexpr unsigned min_size = (size); \ + static constexpr unsigned static_size = (size) #define DEFINE_SIZE_UNION(size, _member) \ DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size) \ DEFINE_INSTANCE_ASSERTION (sizeof(this->u._member) == (size)) \ - enum { null_size = (size) }; \ - enum { min_size = (size) } + static constexpr unsigned null_size = (size); \ + static constexpr unsigned min_size = (size) #define DEFINE_SIZE_MIN(size) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)) \ - enum { null_size = (size) }; \ - enum { min_size = (size) } + static constexpr unsigned null_size = (size); \ + static constexpr unsigned min_size = (size) #define DEFINE_SIZE_UNBOUNDED(size) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)) \ - enum { min_size = (size) } + static constexpr unsigned min_size = (size) #define DEFINE_SIZE_ARRAY(size, array) \ DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof ((array)[0])) \ - enum { null_size = (size) }; \ - enum { min_size = (size) } + static constexpr unsigned null_size = (size); \ + static constexpr unsigned min_size = (size) #define DEFINE_SIZE_ARRAY_SIZED(size, array) \ unsigned int get_size () const { return (size - (array).min_size + (array).get_size ()); } \ @@ -134,7 +150,7 @@ static inline Type& StructAfter(TObject &X) template <typename Context, typename Return, unsigned int MaxDebugDepth> struct hb_dispatch_context_t { - enum { max_debug_depth = MaxDebugDepth }; + static constexpr unsigned max_debug_depth = MaxDebugDepth; typedef Return return_t; template <typename T, typename F> bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; } @@ -268,15 +284,12 @@ struct hb_sanitize_context_t : if (!obj) return; const char *obj_start = (const char *) obj; - const char *obj_end = (const char *) obj + obj->get_size (); - assert (obj_start <= obj_end); /* Must not overflow. */ - - if (unlikely (obj_end < this->start || this->end < obj_start)) + if (unlikely (obj_start < this->start || this->end <= obj_start)) this->start = this->end = nullptr; else { - this->start = MAX (this->start, obj_start); - this->end = MIN (this->end , obj_end ); + this->start = obj_start; + this->end = obj_start + MIN<uintptr_t> (this->end - obj_start, obj->get_size ()); } } @@ -667,7 +680,6 @@ template <typename Type> struct BEInt<Type, 1> { public: - typedef Type type; void set (Type V) { v = V; } operator Type () const { return v; } private: uint8_t v; @@ -676,7 +688,6 @@ template <typename Type> struct BEInt<Type, 2> { public: - typedef Type type; void set (Type V) { v[0] = (V >> 8) & 0xFF; @@ -705,7 +716,6 @@ template <typename Type> struct BEInt<Type, 3> { public: - typedef Type type; void set (Type V) { v[0] = (V >> 16) & 0xFF; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh index 3b119daa8e2..02d5406674c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh @@ -166,7 +166,7 @@ struct hb_map_t hb_codepoint_t operator [] (unsigned int key) const { return get (key); } - enum { INVALID = HB_MAP_VALUE_INVALID }; + static constexpr hb_codepoint_t INVALID = HB_MAP_VALUE_INVALID; void clear () { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh index 8a3e0d4056e..204c2fefd83 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh @@ -93,7 +93,7 @@ struct _hb_assign<T, T, _hb_bool_type<(bool) (1 + (unsigned int) T::min_size)> > template <typename T, typename V> static inline void hb_assign (T &o, const V v) -{ _hb_assign<T, V, _hb_bool_type<true> >::value (o, v); }; +{ _hb_assign<T, V, _hb_bool_type<true> >::value (o, v); } /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh index 6eb1173d82f..68520f2a160 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh @@ -45,7 +45,7 @@ template <typename item_t, typename lock_t> struct hb_lockable_set_t { - hb_vector_t <item_t, 1> items; + hb_vector_t<item_t> items; void init () { items.init (); } @@ -77,9 +77,10 @@ struct hb_lockable_set_t { l.lock (); item_t *item = items.find (v); - if (item) { + if (item) + { item_t old = *item; - *item = items[items.len - 1]; + *item = items[items.length - 1]; items.pop (); l.unlock (); old.fini (); @@ -113,18 +114,20 @@ struct hb_lockable_set_t void fini (lock_t &l) { - if (!items.len) { - /* No need for locking. */ + if (!items.length) + { + /* No need to lock. */ items.fini (); return; } l.lock (); - while (items.len) { - item_t old = items[items.len - 1]; - items.pop (); - l.unlock (); - old.fini (); - l.lock (); + while (items.length) + { + item_t old = items[items.length - 1]; + items.pop (); + l.unlock (); + old.fini (); + l.lock (); } items.fini (); l.unlock (); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh index 822a92d3946..32a223cdf34 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh @@ -130,7 +130,7 @@ typedef struct OffsetTable sfnt_version.set (sfnt_tag); /* Take space for numTables, searchRange, entrySelector, RangeShift * and the TableRecords themselves. */ - if (unlikely (!tables.serialize (c, items.len))) return_trace (false); + if (unlikely (!tables.serialize (c, items.length))) return_trace (false); const char *dir_end = (const char *) c->head; HBUINT32 *checksum_adjustment = nullptr; @@ -154,7 +154,8 @@ typedef struct OffsetTable c->align (4); const char *end = (const char *) c->head; - if (items[i].tag == HB_OT_TAG_head && end - start >= head::static_size) + if (items[i].tag == HB_OT_TAG_head && + (unsigned) (end - start) >= head::static_size) { head *h = (head *) start; checksum_adjustment = &h->checkSumAdjustment; @@ -173,7 +174,7 @@ typedef struct OffsetTable /* The following line is a slower version of the following block. */ //checksum.set_for_data (this, (const char *) c->head - (const char *) this); checksum.set_for_data (this, dir_end - (const char *) this); - for (unsigned int i = 0; i < items.len; i++) + for (unsigned int i = 0; i < items.length; i++) { TableRecord &rec = tables.arrayZ[i]; checksum.set (checksum + rec.checkSum); @@ -298,7 +299,7 @@ struct ResourceRecord HBINT16 nameOffset; /* Offset from beginning of resource name list * to resource name, -1 means there is none. */ HBUINT8 attrs; /* Resource attributes */ - OffsetTo<LArrayOf<HBUINT8>, HBUINT24, false> + NNOffsetTo<LArrayOf<HBUINT8>, HBUINT24> offset; /* Offset from beginning of data block to * data for this resource */ HBUINT32 reserved; /* Reserved for handle to resource */ @@ -333,7 +334,7 @@ struct ResourceTypeRecord protected: Tag tag; /* Resource type. */ HBUINT16 resCountM1; /* Number of resources minus 1. */ - OffsetTo<UnsizedArrayOf<ResourceRecord>, HBUINT16, false> + NNOffsetTo<UnsizedArrayOf<ResourceRecord> > resourcesZ; /* Offset from beginning of resource type list * to reference item list for this type. */ public: @@ -389,7 +390,7 @@ struct ResourceMap HBUINT32 reserved1; /* Reserved for handle to next resource map */ HBUINT16 resreved2; /* Reserved for file reference number */ HBUINT16 attrs; /* Resource fork attribute */ - OffsetTo<ArrayOfM1<ResourceTypeRecord>, HBUINT16, false> + NNOffsetTo<ArrayOfM1<ResourceTypeRecord> > typeList; /* Offset from beginning of map to * resource type list */ Offset16 nameList; /* Offset from beginning of map to @@ -421,10 +422,10 @@ struct ResourceForkHeader } protected: - LOffsetTo<UnsizedArrayOf<HBUINT8>, false> + LNNOffsetTo<UnsizedArrayOf<HBUINT8> > data; /* Offset from beginning of resource fork * to resource data */ - LOffsetTo<ResourceMap, false> + LNNOffsetTo<ResourceMap > map; /* Offset from beginning of resource fork * to resource map */ HBUINT32 dataLen; /* Length of resource data */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh index 7f88279a792..6abb898626c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh @@ -159,7 +159,7 @@ typedef HBUINT16 GlyphID; /* Script/language-system/feature index */ struct Index : HBUINT16 { - enum { NOT_FOUND_INDEX = 0xFFFFu }; + static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFu; }; DECLARE_NULL_NAMESPACE_BYTES (OT, Index); @@ -337,7 +337,10 @@ struct OffsetTo : Offset<OffsetType, has_null> } DEFINE_SIZE_STATIC (sizeof (OffsetType)); }; -template <typename Type, bool has_null=true> struct LOffsetTo : OffsetTo<Type, HBUINT32, has_null> {}; +/* Partial specializations. */ +template <typename Type, bool has_null=true> struct LOffsetTo : OffsetTo<Type, HBUINT32, has_null> {}; +template <typename Type, typename OffsetType=HBUINT16 > struct NNOffsetTo : OffsetTo<Type, OffsetType, false> {}; +template <typename Type > struct LNNOffsetTo : OffsetTo<Type, HBUINT32, false> {}; template <typename Base, typename OffsetType, bool has_null, typename Type> static inline const Type& operator + (const Base &base, const OffsetTo<Type, OffsetType, has_null> &offset) { return offset (base); } @@ -352,8 +355,8 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType, has_null> template <typename Type> struct UnsizedArrayOf { - typedef Type ItemType; - enum { item_size = hb_static_size (Type) }; + typedef Type item_t; + static constexpr unsigned item_size = hb_static_size (Type); HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type); @@ -508,8 +511,8 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf<Type> template <typename Type, typename LenType=HBUINT16> struct ArrayOf { - typedef Type ItemType; - enum { item_size = hb_static_size (Type) }; + typedef Type item_t; + static constexpr unsigned item_size = hb_static_size (Type); HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType); @@ -557,8 +560,8 @@ struct ArrayOf bool serialize (hb_serialize_context_t *c, hb_array_t<const T> items) { TRACE_SERIALIZE (this); - if (unlikely (!serialize (c, items.len))) return_trace (false); - for (unsigned int i = 0; i < items.len; i++) + if (unlikely (!serialize (c, items.length))) return_trace (false); + for (unsigned int i = 0; i < items.length; i++) hb_assign (arrayZ[i], items[i]); return_trace (true); } @@ -679,7 +682,7 @@ struct OffsetListOf : OffsetArrayOf<Type> template <typename Type, typename LenType=HBUINT16> struct HeadlessArrayOf { - enum { item_size = Type::static_size }; + static constexpr unsigned item_size = Type::static_size; HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (HeadlessArrayOf, Type, LenType); @@ -703,9 +706,9 @@ struct HeadlessArrayOf { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - lenP1.set (items.len + 1); /* TODO(serialize) Overflow? */ + lenP1.set (items.length + 1); /* TODO(serialize) Overflow? */ if (unlikely (!c->extend (*this))) return_trace (false); - for (unsigned int i = 0; i < items.len; i++) + for (unsigned int i = 0; i < items.length; i++) arrayZ[i] = items[i]; return_trace (true); } @@ -888,7 +891,7 @@ struct VarSizedBinSearchHeader template <typename Type> struct VarSizedBinSearchArrayOf { - enum { item_size = Type::static_size }; + static constexpr unsigned item_size = Type::static_size; HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh index db04b3eb239..c645953e5b9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh @@ -55,27 +55,27 @@ inline unsigned int calcOffSize(unsigned int dataSize) return size; } -struct code_pair +struct code_pair_t { hb_codepoint_t code; hb_codepoint_t glyph; }; -typedef hb_vector_t<char, 1> StrBuff; -struct StrBuffArray : hb_vector_t<StrBuff> +typedef hb_vector_t<unsigned char> str_buff_t; +struct str_buff_vec_t : hb_vector_t<str_buff_t> { void fini () { SUPER::fini_deep (); } unsigned int total_size () const { unsigned int size = 0; - for (unsigned int i = 0; i < len; i++) - size += (*this)[i].len; + for (unsigned int i = 0; i < length; i++) + size += (*this)[i].length; return size; } private: - typedef hb_vector_t<StrBuff> SUPER; + typedef hb_vector_t<str_buff_t> SUPER; }; /* CFF INDEX */ @@ -117,10 +117,10 @@ struct CFFIndex bool serialize (hb_serialize_context_t *c, unsigned int offSize_, - const ByteStrArray &byteArray) + const byte_str_array_t &byteArray) { TRACE_SERIALIZE (this); - if (byteArray.len == 0) + if (byteArray.length == 0) { COUNT *dest = c->allocate_min<COUNT> (); if (unlikely (dest == nullptr)) return_trace (false); @@ -130,15 +130,15 @@ struct CFFIndex { /* serialize CFFIndex header */ if (unlikely (!c->extend_min (*this))) return_trace (false); - this->count.set (byteArray.len); + this->count.set (byteArray.length); this->offSize.set (offSize_); - if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (byteArray.len + 1)))) + if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (byteArray.length + 1)))) return_trace (false); /* serialize indices */ unsigned int offset = 1; unsigned int i = 0; - for (; i < byteArray.len; i++) + for (; i < byteArray.length; i++) { set_offset_at (i, offset); offset += byteArray[i].get_size (); @@ -146,12 +146,13 @@ struct CFFIndex set_offset_at (i, offset); /* serialize data */ - for (unsigned int i = 0; i < byteArray.len; i++) + for (unsigned int i = 0; i < byteArray.length; i++) { - ByteStr *dest = c->start_embed<ByteStr> (); - if (unlikely (dest == nullptr || - !dest->serialize (c, byteArray[i]))) + const byte_str_t &bs = byteArray[i]; + unsigned char *dest = c->allocate_size<unsigned char> (bs.length); + if (unlikely (dest == nullptr)) return_trace (false); + memcpy (dest, &bs[0], bs.length); } } return_trace (true); @@ -159,14 +160,14 @@ struct CFFIndex bool serialize (hb_serialize_context_t *c, unsigned int offSize_, - const StrBuffArray &buffArray) + const str_buff_vec_t &buffArray) { - ByteStrArray byteArray; + byte_str_array_t byteArray; byteArray.init (); - byteArray.resize (buffArray.len); - for (unsigned int i = 0; i < byteArray.len; i++) + byteArray.resize (buffArray.length); + for (unsigned int i = 0; i < byteArray.length; i++) { - byteArray[i] = ByteStr (buffArray[i].arrayZ (), buffArray[i].len); + byteArray[i] = byte_str_t (buffArray[i].arrayZ (), buffArray[i].length); } bool result = this->serialize (c, offSize_, byteArray); byteArray.fini (); @@ -205,17 +206,17 @@ struct CFFIndex return 0; } - const char *data_base () const - { return (const char *)this + min_size + offset_array_size (); } + const unsigned char *data_base () const + { return (const unsigned char *)this + min_size + offset_array_size (); } unsigned int data_size () const { return HBINT8::static_size; } - ByteStr operator [] (unsigned int index) const + byte_str_t operator [] (unsigned int index) const { if (likely (index < count)) - return ByteStr (data_base () + offset_at (index) - 1, length_at (index)); + return byte_str_t (data_base () + offset_at (index) - 1, length_at (index)); else - return Null(ByteStr); + return Null(byte_str_t); } unsigned int get_size () const @@ -255,11 +256,11 @@ struct CFFIndex template <typename COUNT, typename TYPE> struct CFFIndexOf : CFFIndex<COUNT> { - const ByteStr operator [] (unsigned int index) const + const byte_str_t operator [] (unsigned int index) const { if (likely (index < CFFIndex<COUNT>::count)) - return ByteStr (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index)); - return Null(ByteStr); + return byte_str_t (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index)); + return Null(byte_str_t); } template <typename DATA, typename PARAM1, typename PARAM2> @@ -363,7 +364,7 @@ struct Dict : UnsizedByteStr } template <typename INTTYPE, int minVal, int maxVal> - static bool serialize_int_op (hb_serialize_context_t *c, OpCode op, int value, OpCode intOp) + static bool serialize_int_op (hb_serialize_context_t *c, op_code_t op, int value, op_code_t intOp) { // XXX: not sure why but LLVM fails to compile the following 'unlikely' macro invocation if (/*unlikely*/ (!serialize_int<INTTYPE, minVal, maxVal> (c, intOp, value))) @@ -383,18 +384,18 @@ struct Dict : UnsizedByteStr return_trace (true); } - static bool serialize_uint4_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_uint4_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_int_op<HBUINT32, 0, 0x7FFFFFFF> (c, op, value, OpCode_longintdict); } - static bool serialize_uint2_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_uint2_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_int_op<HBUINT16, 0, 0x7FFF> (c, op, value, OpCode_shortint); } - static bool serialize_offset4_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_offset4_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_uint4_op (c, op, value); } - static bool serialize_offset2_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_offset2_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_uint2_op (c, op, value); } @@ -404,7 +405,7 @@ struct TopDict : Dict {}; struct FontDict : Dict {}; struct PrivateDict : Dict {}; -struct TableInfo +struct table_info_t { void init () { offSize = offset = size = 0; } @@ -415,7 +416,7 @@ struct TableInfo /* used to remap font index or SID from fullset to subset. * set to CFF_UNDEF_CODE if excluded from subset */ -struct Remap : hb_vector_t<hb_codepoint_t> +struct remap_t : hb_vector_t<hb_codepoint_t> { void init () { SUPER::init (); } @@ -425,7 +426,7 @@ struct Remap : hb_vector_t<hb_codepoint_t> { if (unlikely (!SUPER::resize (size))) return false; - for (unsigned int i = 0; i < len; i++) + for (unsigned int i = 0; i < length; i++) (*this)[i] = CFF_UNDEF_CODE; count = 0; return true; @@ -436,14 +437,14 @@ struct Remap : hb_vector_t<hb_codepoint_t> if (unlikely (!SUPER::resize (size))) return false; unsigned int i; - for (i = 0; i < len; i++) + for (i = 0; i < length; i++) (*this)[i] = i; count = i; return true; } bool excludes (hb_codepoint_t id) const - { return (id < len) && ((*this)[id] == CFF_UNDEF_CODE); } + { return (id < length) && ((*this)[id] == CFF_UNDEF_CODE); } bool includes (hb_codepoint_t id) const { return !excludes (id); } @@ -476,15 +477,15 @@ struct FDArray : CFFIndexOf<COUNT, FontDict> { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - this->count.set (fontDicts.len); + this->count.set (fontDicts.length); this->offSize.set (offSize_); - if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (fontDicts.len + 1)))) + if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (fontDicts.length + 1)))) return_trace (false); /* serialize font dict offsets */ unsigned int offset = 1; unsigned int fid = 0; - for (; fid < fontDicts.len; fid++) + for (; fid < fontDicts.length; fid++) { CFFIndexOf<COUNT, FontDict>::set_offset_at (fid, offset); offset += FontDict::calculate_serialized_size (fontDicts[fid], opszr); @@ -492,7 +493,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict> CFFIndexOf<COUNT, FontDict>::set_offset_at (fid, offset); /* serialize font dicts */ - for (unsigned int i = 0; i < fontDicts.len; i++) + for (unsigned int i = 0; i < fontDicts.length; i++) { FontDict *dict = c->start_embed<FontDict> (); if (unlikely (!dict->serialize (c, fontDicts[i], opszr, fontDicts[i]))) @@ -507,9 +508,9 @@ struct FDArray : CFFIndexOf<COUNT, FontDict> unsigned int offSize_, const hb_vector_t<DICTVAL> &fontDicts, unsigned int fdCount, - const Remap &fdmap, + const remap_t &fdmap, OP_SERIALIZER& opszr, - const hb_vector_t<TableInfo> &privateInfos) + const hb_vector_t<table_info_t> &privateInfos) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); @@ -521,7 +522,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict> /* serialize font dict offsets */ unsigned int offset = 1; unsigned int fid = 0; - for (unsigned i = 0; i < fontDicts.len; i++) + for (unsigned i = 0; i < fontDicts.length; i++) if (fdmap.includes (i)) { CFFIndexOf<COUNT, FontDict>::set_offset_at (fid++, offset); @@ -530,7 +531,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict> CFFIndexOf<COUNT, FontDict>::set_offset_at (fid, offset); /* serialize font dicts */ - for (unsigned int i = 0; i < fontDicts.len; i++) + for (unsigned int i = 0; i < fontDicts.length; i++) if (fdmap.includes (i)) { FontDict *dict = c->start_embed<FontDict> (); @@ -545,7 +546,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict> static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */, const hb_vector_t<DICTVAL> &fontDicts, unsigned int fdCount, - const Remap &fdmap, + const remap_t &fdmap, OP_SERIALIZER& opszr) { unsigned int dictsSize = 0; @@ -587,10 +588,10 @@ struct FDSelect0 { template <typename GID_TYPE, typename FD_TYPE> struct FDSelect3_4_Range { - bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const + bool sanitize (hb_sanitize_context_t *c, const void */*nullptr*/, unsigned int fdcount) const { TRACE_SANITIZE (this); - return_trace (likely (c->check_struct (this) && (first < c->get_num_glyphs ()) && (fd < fdcount))); + return_trace (first < c->get_num_glyphs () && (fd < fdcount)); } GID_TYPE first; @@ -602,21 +603,21 @@ struct FDSelect3_4_Range { template <typename GID_TYPE, typename FD_TYPE> struct FDSelect3_4 { unsigned int get_size () const - { return GID_TYPE::static_size * 2 + FDSelect3_4_Range<GID_TYPE, FD_TYPE>::static_size * nRanges; } + { return GID_TYPE::static_size * 2 + ranges.get_size (); } bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const { TRACE_SANITIZE (this); - if (unlikely (!(c->check_struct (this) && (nRanges > 0) && (ranges[0].first == 0)))) + if (unlikely (!c->check_struct (this) || !ranges.sanitize (c, nullptr, fdcount) || + (nRanges () == 0) || ranges[0].first != 0)) return_trace (false); - for (unsigned int i = 0; i < nRanges; i++) + for (unsigned int i = 1; i < nRanges (); i++) { - if (unlikely (!ranges[i].sanitize (c, fdcount))) - return_trace (false); - if ((0 < i) && unlikely (ranges[i - 1].first >= ranges[i].first)) - return_trace (false); + if (unlikely (ranges[i - 1].first >= ranges[i].first)) + return_trace (false); } + if (unlikely (!sentinel().sanitize (c) || (sentinel() != c->get_num_glyphs ()))) return_trace (false); @@ -626,18 +627,19 @@ struct FDSelect3_4 { hb_codepoint_t get_fd (hb_codepoint_t glyph) const { unsigned int i; - for (i = 1; i < nRanges; i++) + for (i = 1; i < nRanges (); i++) if (glyph < ranges[i].first) break; return (hb_codepoint_t)ranges[i - 1].fd; } - GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); } - const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); } + GID_TYPE &nRanges () { return ranges.len; } + GID_TYPE nRanges () const { return ranges.len; } + GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges () - 1]); } + const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges () - 1]); } - GID_TYPE nRanges; - FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR]; + ArrayOf<FDSelect3_4_Range<GID_TYPE, FD_TYPE>, GID_TYPE> ranges; /* GID_TYPE sentinel */ DEFINE_SIZE_ARRAY (GID_TYPE::static_size, ranges); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc index 51cecb6f5b4..8773c05a228 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc @@ -161,7 +161,7 @@ hb_codepoint_t OT::cff1::lookup_standard_encoding_for_sid (hb_codepoint_t code) return CFF_UNDEF_SID; } -struct Bounds +struct bounds_t { void init () { @@ -169,7 +169,7 @@ struct Bounds max.set_int (-0x80000000, -0x80000000); } - void update (const Point &pt) + void update (const point_t &pt) { if (pt.x < min.x) min.x = pt.x; if (pt.x > max.x) max.x = pt.x; @@ -177,7 +177,7 @@ struct Bounds if (pt.y > max.y) max.y = pt.y; } - void merge (const Bounds &b) + void merge (const bounds_t &b) { if (empty ()) *this = b; @@ -190,7 +190,7 @@ struct Bounds } } - void offset (const Point &delta) + void offset (const point_t &delta) { if (!empty ()) { @@ -202,11 +202,11 @@ struct Bounds bool empty () const { return (min.x >= max.x) || (min.y >= max.y); } - Point min; - Point max; + point_t min; + point_t max; }; -struct ExtentsParam +struct extents_param_t { void init (const OT::cff1::accelerator_t *_cff) { @@ -220,20 +220,20 @@ struct ExtentsParam bool is_path_open () const { return path_open; } bool path_open; - Bounds bounds; + bounds_t bounds; const OT::cff1::accelerator_t *cff; }; -struct CFF1PathProcs_Extents : PathProcs<CFF1PathProcs_Extents, CFF1CSInterpEnv, ExtentsParam> +struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_cs_interp_env_t, extents_param_t> { - static void moveto (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt) + static void moveto (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt) { param.end_path (); env.moveto (pt); } - static void line (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt1) + static void line (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1) { if (!param.is_path_open ()) { @@ -244,7 +244,7 @@ struct CFF1PathProcs_Extents : PathProcs<CFF1PathProcs_Extents, CFF1CSInterpEnv, param.bounds.update (env.get_pt ()); } - static void curve (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt1, const Point &pt2, const Point &pt3) + static void curve (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) { if (!param.is_path_open ()) { @@ -259,20 +259,20 @@ struct CFF1PathProcs_Extents : PathProcs<CFF1PathProcs_Extents, CFF1CSInterpEnv, } }; -static bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, Bounds &bounds, bool in_seac=false); +static bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac=false); -struct CFF1CSOpSet_Extents : CFF1CSOpSet<CFF1CSOpSet_Extents, ExtentsParam, CFF1PathProcs_Extents> +struct cff1_cs_opset_extents_t : cff1_cs_opset_t<cff1_cs_opset_extents_t, extents_param_t, cff1_path_procs_extents_t> { - static void process_seac (CFF1CSInterpEnv &env, ExtentsParam& param) + static void process_seac (cff1_cs_interp_env_t &env, extents_param_t& param) { unsigned int n = env.argStack.get_count (); - Point delta; + point_t delta; delta.x = env.argStack[n-4]; delta.y = env.argStack[n-3]; hb_codepoint_t base = param.cff->std_code_to_glyph (env.argStack[n-2].to_int ()); hb_codepoint_t accent = param.cff->std_code_to_glyph (env.argStack[n-1].to_int ()); - Bounds base_bounds, accent_bounds; + bounds_t base_bounds, accent_bounds; if (likely (!env.in_seac && base && accent && _get_bounds (param.cff, base, base_bounds, true) && _get_bounds (param.cff, accent, accent_bounds, true))) @@ -286,17 +286,17 @@ struct CFF1CSOpSet_Extents : CFF1CSOpSet<CFF1CSOpSet_Extents, ExtentsParam, CFF1 } }; -bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, Bounds &bounds, bool in_seac) +bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac) { bounds.init (); if (unlikely (!cff->is_valid () || (glyph >= cff->num_glyphs))) return false; unsigned int fd = cff->fdSelect->get_fd (glyph); - CFF1CSInterpreter<CFF1CSOpSet_Extents, ExtentsParam> interp; - const ByteStr str = (*cff->charStrings)[glyph]; + cff1_cs_interpreter_t<cff1_cs_opset_extents_t, extents_param_t> interp; + const byte_str_t str = (*cff->charStrings)[glyph]; interp.env.init (str, *cff, fd); interp.env.set_in_seac (in_seac); - ExtentsParam param; + extents_param_t param; param.init (cff); if (unlikely (!interp.interpret (param))) return false; bounds = param.bounds; @@ -305,7 +305,7 @@ bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, Boun bool OT::cff1::accelerator_t::get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const { - Bounds bounds; + bounds_t bounds; if (!_get_bounds (this, glyph, bounds)) return false; @@ -334,7 +334,7 @@ bool OT::cff1::accelerator_t::get_extents (hb_codepoint_t glyph, hb_glyph_extent return true; } -struct GetSeacParam +struct get_seac_param_t { void init (const OT::cff1::accelerator_t *_cff) { @@ -350,9 +350,9 @@ struct GetSeacParam hb_codepoint_t accent; }; -struct CFF1CSOpSet_Seac : CFF1CSOpSet<CFF1CSOpSet_Seac, GetSeacParam> +struct cff1_cs_opset_seac_t : cff1_cs_opset_t<cff1_cs_opset_seac_t, get_seac_param_t> { - static void process_seac (CFF1CSInterpEnv &env, GetSeacParam& param) + static void process_seac (cff1_cs_interp_env_t &env, get_seac_param_t& param) { unsigned int n = env.argStack.get_count (); hb_codepoint_t base_char = (hb_codepoint_t)env.argStack[n-2].to_int (); @@ -368,10 +368,10 @@ bool OT::cff1::accelerator_t::get_seac_components (hb_codepoint_t glyph, hb_code if (unlikely (!is_valid () || (glyph >= num_glyphs))) return false; unsigned int fd = fdSelect->get_fd (glyph); - CFF1CSInterpreter<CFF1CSOpSet_Seac, GetSeacParam> interp; - const ByteStr str = (*charStrings)[glyph]; + cff1_cs_interpreter_t<cff1_cs_opset_seac_t, get_seac_param_t> interp; + const byte_str_t str = (*charStrings)[glyph]; interp.env.init (str, *this, fd); - GetSeacParam param; + get_seac_param_t param; param.init (this); if (unlikely (!interp.interpret (param))) return false; 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 72dc0ef3e01..1effdf006cd 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 @@ -193,20 +193,20 @@ struct Encoding { bool serialize (hb_serialize_context_t *c, uint8_t format, unsigned int enc_count, - const hb_vector_t<code_pair>& code_ranges, - const hb_vector_t<code_pair>& supp_codes) + const hb_vector_t<code_pair_t>& code_ranges, + const hb_vector_t<code_pair_t>& supp_codes) { TRACE_SERIALIZE (this); Encoding *dest = c->extend_min (*this); if (unlikely (dest == nullptr)) return_trace (false); - dest->format.set (format | ((supp_codes.len > 0)? 0x80: 0)); + dest->format.set (format | ((supp_codes.length > 0)? 0x80: 0)); if (format == 0) { Encoding0 *fmt0 = c->allocate_size<Encoding0> (Encoding0::min_size + HBUINT8::static_size * enc_count); if (unlikely (fmt0 == nullptr)) return_trace (false); fmt0->nCodes.set (enc_count); unsigned int glyph = 0; - for (unsigned int i = 0; i < code_ranges.len; i++) + for (unsigned int i = 0; i < code_ranges.length; i++) { hb_codepoint_t code = code_ranges[i].code; for (int left = (int)code_ranges[i].glyph; left >= 0; left--) @@ -217,10 +217,10 @@ struct Encoding { } else { - Encoding1 *fmt1 = c->allocate_size<Encoding1> (Encoding1::min_size + Encoding1_Range::static_size * code_ranges.len); + Encoding1 *fmt1 = c->allocate_size<Encoding1> (Encoding1::min_size + Encoding1_Range::static_size * code_ranges.length); if (unlikely (fmt1 == nullptr)) return_trace (false); - fmt1->nRanges.set (code_ranges.len); - for (unsigned int i = 0; i < code_ranges.len; i++) + fmt1->nRanges.set (code_ranges.length); + for (unsigned int i = 0; i < code_ranges.length; i++) { if (unlikely (!((code_ranges[i].code <= 0xFF) && (code_ranges[i].glyph <= 0xFF)))) return_trace (false); @@ -228,12 +228,12 @@ struct Encoding { fmt1->ranges[i].nLeft.set (code_ranges[i].glyph); } } - if (supp_codes.len > 0) + if (supp_codes.length > 0) { - CFF1SuppEncData *suppData = c->allocate_size<CFF1SuppEncData> (CFF1SuppEncData::min_size + SuppEncoding::static_size * supp_codes.len); + CFF1SuppEncData *suppData = c->allocate_size<CFF1SuppEncData> (CFF1SuppEncData::min_size + SuppEncoding::static_size * supp_codes.length); if (unlikely (suppData == nullptr)) return_trace (false); - suppData->nSups.set (supp_codes.len); - for (unsigned int i = 0; i < supp_codes.len; i++) + suppData->nSups.set (supp_codes.length); + for (unsigned int i = 0; i < supp_codes.length; i++) { suppData->supps[i].code.set (supp_codes[i].code); suppData->supps[i].glyph.set (supp_codes[i].glyph); /* actually SID */ @@ -467,7 +467,7 @@ struct Charset { bool serialize (hb_serialize_context_t *c, uint8_t format, unsigned int num_glyphs, - const hb_vector_t<code_pair>& sid_ranges) + const hb_vector_t<code_pair_t>& sid_ranges) { TRACE_SERIALIZE (this); Charset *dest = c->extend_min (*this); @@ -478,7 +478,7 @@ struct Charset { Charset0 *fmt0 = c->allocate_size<Charset0> (Charset0::min_size + HBUINT16::static_size * (num_glyphs - 1)); if (unlikely (fmt0 == nullptr)) return_trace (false); unsigned int glyph = 0; - for (unsigned int i = 0; i < sid_ranges.len; i++) + for (unsigned int i = 0; i < sid_ranges.length; i++) { hb_codepoint_t sid = sid_ranges[i].code; for (int left = (int)sid_ranges[i].glyph; left >= 0; left--) @@ -487,9 +487,9 @@ struct Charset { } else if (format == 1) { - Charset1 *fmt1 = c->allocate_size<Charset1> (Charset1::min_size + Charset1_Range::static_size * sid_ranges.len); + Charset1 *fmt1 = c->allocate_size<Charset1> (Charset1::min_size + Charset1_Range::static_size * sid_ranges.length); if (unlikely (fmt1 == nullptr)) return_trace (false); - for (unsigned int i = 0; i < sid_ranges.len; i++) + for (unsigned int i = 0; i < sid_ranges.length; i++) { if (unlikely (!(sid_ranges[i].glyph <= 0xFF))) return_trace (false); @@ -499,9 +499,9 @@ struct Charset { } else /* format 2 */ { - Charset2 *fmt2 = c->allocate_size<Charset2> (Charset2::min_size + Charset2_Range::static_size * sid_ranges.len); + Charset2 *fmt2 = c->allocate_size<Charset2> (Charset2::min_size + Charset2_Range::static_size * sid_ranges.length); if (unlikely (fmt2 == nullptr)) return_trace (false); - for (unsigned int i = 0; i < sid_ranges.len; i++) + for (unsigned int i = 0; i < sid_ranges.length; i++) { if (unlikely (!(sid_ranges[i].glyph <= 0xFFFF))) return_trace (false); @@ -573,7 +573,7 @@ struct Charset { struct CFF1StringIndex : CFF1Index { bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings, - unsigned int offSize_, const Remap &sidmap) + unsigned int offSize_, const remap_t &sidmap) { TRACE_SERIALIZE (this); if (unlikely ((strings.count == 0) || (sidmap.get_count () == 0))) @@ -584,7 +584,7 @@ struct CFF1StringIndex : CFF1Index return_trace (true); } - ByteStrArray bytesArray; + byte_str_array_t bytesArray; bytesArray.init (); if (!bytesArray.resize (sidmap.get_count ())) return_trace (false); @@ -601,7 +601,7 @@ struct CFF1StringIndex : CFF1Index } /* in parallel to above */ - unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const Remap &sidmap) const + unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const remap_t &sidmap) const { offSize = 0; if ((count == 0) || (sidmap.get_count () == 0)) @@ -617,18 +617,18 @@ struct CFF1StringIndex : CFF1Index } }; -struct CFF1TopDictInterpEnv : NumInterpEnv +struct cff1_top_dict_interp_env_t : num_interp_env_t { - CFF1TopDictInterpEnv () - : NumInterpEnv(), prev_offset(0), last_offset(0) {} + cff1_top_dict_interp_env_t () + : num_interp_env_t(), prev_offset(0), last_offset(0) {} unsigned int prev_offset; unsigned int last_offset; }; -struct NameDictValues +struct name_dict_values_t { - enum NameDictValIndex + enum name_dict_val_index_t { version, notice, @@ -657,7 +657,7 @@ struct NameDictValues unsigned int operator[] (unsigned int i) const { assert (i < ValCount); return values[i]; } - static enum NameDictValIndex name_op_to_index (OpCode op) + static enum name_dict_val_index_t name_op_to_index (op_code_t op) { switch (op) { default: // can't happen - just make some compiler happy @@ -685,16 +685,16 @@ struct NameDictValues unsigned int values[ValCount]; }; -struct CFF1TopDictVal : OpStr +struct cff1_top_dict_val_t : op_str_t { unsigned int last_arg_offset; }; -struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal> +struct cff1_top_dict_values_t : top_dict_values_t<cff1_top_dict_val_t> { void init () { - TopDictValues<CFF1TopDictVal>::init (); + top_dict_values_t<cff1_top_dict_val_t>::init (); nameSIDs.init (); ros_supplement = 0; @@ -704,12 +704,12 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal> FDSelectOffset = 0; privateDictInfo.init (); } - void fini () { TopDictValues<CFF1TopDictVal>::fini (); } + void fini () { top_dict_values_t<cff1_top_dict_val_t>::fini (); } bool is_CID () const - { return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; } + { return nameSIDs[name_dict_values_t::registry] != CFF_UNDEF_SID; } - NameDictValues nameSIDs; + name_dict_values_t nameSIDs; unsigned int ros_supplement_offset; unsigned int ros_supplement; unsigned int cidCount; @@ -717,14 +717,14 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal> unsigned int EncodingOffset; unsigned int CharsetOffset; unsigned int FDSelectOffset; - TableInfo privateDictInfo; + table_info_t privateDictInfo; }; -struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal> +struct cff1_top_dict_opset_t : top_dict_opset_t<cff1_top_dict_val_t> { - static void process_op (OpCode op, CFF1TopDictInterpEnv& env, CFF1TopDictValues& dictval) + static void process_op (op_code_t op, cff1_top_dict_interp_env_t& env, cff1_top_dict_values_t& dictval) { - CFF1TopDictVal val; + cff1_top_dict_val_t val; val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */ switch (op) { @@ -736,7 +736,7 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal> case OpCode_Weight: case OpCode_PostScript: case OpCode_BaseFontName: - dictval.nameSIDs[NameDictValues::name_op_to_index (op)] = env.argStack.pop_uint (); + dictval.nameSIDs[name_dict_values_t::name_op_to_index (op)] = env.argStack.pop_uint (); env.clear_args (); break; case OpCode_isFixedPitch: @@ -765,8 +765,8 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal> case OpCode_ROS: dictval.ros_supplement = env.argStack.pop_uint (); - dictval.nameSIDs[NameDictValues::ordering] = env.argStack.pop_uint (); - dictval.nameSIDs[NameDictValues::registry] = env.argStack.pop_uint (); + dictval.nameSIDs[name_dict_values_t::ordering] = env.argStack.pop_uint (); + dictval.nameSIDs[name_dict_values_t::registry] = env.argStack.pop_uint (); env.clear_args (); break; @@ -794,8 +794,8 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal> break; default: - env.last_offset = env.substr.offset; - TopDictOpSet<CFF1TopDictVal>::process_op (op, env, dictval); + env.last_offset = env.str_ref.offset; + top_dict_opset_t<cff1_top_dict_val_t>::process_op (op, env, dictval); /* Record this operand below if stack is empty, otherwise done */ if (!env.argStack.is_empty ()) return; break; @@ -803,27 +803,27 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal> if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr, val); + dictval.add_op (op, env.str_ref, val); } }; -struct CFF1FontDictValues : DictValues<OpStr> +struct cff1_font_dict_values_t : dict_values_t<op_str_t> { void init () { - DictValues<OpStr>::init (); + dict_values_t<op_str_t>::init (); privateDictInfo.init (); fontName = CFF_UNDEF_SID; } - void fini () { DictValues<OpStr>::fini (); } + void fini () { dict_values_t<op_str_t>::fini (); } - TableInfo privateDictInfo; + table_info_t privateDictInfo; unsigned int fontName; }; -struct CFF1FontDictOpSet : DictOpSet +struct cff1_font_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, NumInterpEnv& env, CFF1FontDictValues& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff1_font_dict_values_t& dictval) { switch (op) { case OpCode_FontName: @@ -841,36 +841,36 @@ struct CFF1FontDictOpSet : DictOpSet break; default: - DictOpSet::process_op (op, env); + dict_opset_t::process_op (op, env); if (!env.argStack.is_empty ()) return; break; } if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } }; template <typename VAL> -struct CFF1PrivateDictValues_Base : DictValues<VAL> +struct cff1_private_dict_values_base_t : dict_values_t<VAL> { void init () { - DictValues<VAL>::init (); + dict_values_t<VAL>::init (); subrsOffset = 0; localSubrs = &Null(CFF1Subrs); } - void fini () { DictValues<VAL>::fini (); } + void fini () { dict_values_t<VAL>::fini (); } unsigned int calculate_serialized_size () const { unsigned int size = 0; - for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++) - if (DictValues<VAL>::get_value (i).op == OpCode_Subrs) + for (unsigned int i = 0; i < dict_values_t<VAL>::get_count; i++) + if (dict_values_t<VAL>::get_value (i).op == OpCode_Subrs) size += OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Subrs); else - size += DictValues<VAL>::get_value (i).str.len; + size += dict_values_t<VAL>::get_value (i).str.length; return size; } @@ -878,14 +878,14 @@ struct CFF1PrivateDictValues_Base : DictValues<VAL> const CFF1Subrs *localSubrs; }; -typedef CFF1PrivateDictValues_Base<OpStr> CFF1PrivateDictValues_Subset; -typedef CFF1PrivateDictValues_Base<NumDictVal> CFF1PrivateDictValues; +typedef cff1_private_dict_values_base_t<op_str_t> cff1_private_dict_values_subset_t; +typedef cff1_private_dict_values_base_t<num_dict_val_t> cff1_private_dict_values_t; -struct CFF1PrivateDictOpSet : DictOpSet +struct cff1_private_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_t& dictval) { - NumDictVal val; + num_dict_val_t val; val.init (); switch (op) { @@ -917,20 +917,20 @@ struct CFF1PrivateDictOpSet : DictOpSet break; default: - DictOpSet::process_op (op, env); + dict_opset_t::process_op (op, env); if (!env.argStack.is_empty ()) return; break; } if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr, val); + dictval.add_op (op, env.str_ref, val); } }; -struct CFF1PrivateDictOpSet_Subset : DictOpSet +struct cff1_private_dict_opset_subset : dict_opset_t { - static void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues_Subset& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_subset_t& dictval) { switch (op) { case OpCode_BlueValues: @@ -959,25 +959,24 @@ struct CFF1PrivateDictOpSet_Subset : DictOpSet break; default: - DictOpSet::process_op (op, env); + dict_opset_t::process_op (op, env); if (!env.argStack.is_empty ()) return; break; } if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } }; -typedef DictInterpreter<CFF1TopDictOpSet, CFF1TopDictValues, CFF1TopDictInterpEnv> CFF1TopDict_Interpreter; -typedef DictInterpreter<CFF1FontDictOpSet, CFF1FontDictValues> CFF1FontDict_Interpreter; -typedef DictInterpreter<CFF1PrivateDictOpSet, CFF1PrivateDictValues> CFF1PrivateDict_Interpreter; +typedef dict_interpreter_t<cff1_top_dict_opset_t, cff1_top_dict_values_t, cff1_top_dict_interp_env_t> cff1_top_dict_interpreter_t; +typedef dict_interpreter_t<cff1_font_dict_opset_t, cff1_font_dict_values_t> cff1_font_dict_interpreter_t; typedef CFF1Index CFF1NameIndex; typedef CFF1IndexOf<TopDict> CFF1TopDictIndex; -}; /* namespace CFF */ +} /* namespace CFF */ namespace OT { @@ -985,7 +984,7 @@ using namespace CFF; struct cff1 { - static const hb_tag_t tableTag = HB_OT_TAG_cff1; + static constexpr hb_tag_t tableTag = HB_OT_TAG_cff1; bool sanitize (hb_sanitize_context_t *c) const { @@ -1023,9 +1022,9 @@ struct cff1 { fini (); return; } { /* parse top dict */ - const ByteStr topDictStr = (*topDictIndex)[0]; + const byte_str_t topDictStr = (*topDictIndex)[0]; if (unlikely (!topDictStr.sanitize (&sc))) { fini (); return; } - CFF1TopDict_Interpreter top_interp; + cff1_top_dict_interpreter_t top_interp; top_interp.env.init (topDictStr); topDict.init (); if (unlikely (!top_interp.interpret (topDict))) { fini (); return; } @@ -1082,24 +1081,24 @@ struct cff1 { for (unsigned int i = 0; i < fdCount; i++) { - ByteStr fontDictStr = (*fdArray)[i]; + byte_str_t fontDictStr = (*fdArray)[i]; if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; } - CFF1FontDictValues *font; - CFF1FontDict_Interpreter font_interp; + cff1_font_dict_values_t *font; + cff1_font_dict_interpreter_t font_interp; font_interp.env.init (fontDictStr); font = fontDicts.push (); - if (unlikely (font == &Crap(CFF1FontDictValues))) { fini (); return; } + if (unlikely (font == &Crap(cff1_font_dict_values_t))) { fini (); return; } font->init (); if (unlikely (!font_interp.interpret (*font))) { fini (); return; } PRIVDICTVAL *priv = &privateDicts[i]; - const ByteStr privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size); + const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size); if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } - DictInterpreter<PRIVOPSET, PRIVDICTVAL> priv_interp; + dict_interpreter_t<PRIVOPSET, PRIVDICTVAL> priv_interp; priv_interp.env.init (privDictStr); priv->init (); if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; } - priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (privDictStr.str, priv->subrsOffset); + priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset); if (priv->localSubrs != &Null(CFF1Subrs) && unlikely (!priv->localSubrs->sanitize (&sc))) { fini (); return; } @@ -1107,17 +1106,17 @@ struct cff1 } else /* non-CID */ { - CFF1TopDictValues *font = &topDict; + cff1_top_dict_values_t *font = &topDict; PRIVDICTVAL *priv = &privateDicts[0]; - const ByteStr privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size); + const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size); if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } - DictInterpreter<PRIVOPSET, PRIVDICTVAL> priv_interp; + dict_interpreter_t<PRIVOPSET, PRIVDICTVAL> priv_interp; priv_interp.env.init (privDictStr); priv->init (); if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; } - priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (privDictStr.str, priv->subrsOffset); + priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset); if (priv->localSubrs != &Null(CFF1Subrs) && unlikely (!priv->localSubrs->sanitize (&sc))) { fini (); return; } @@ -1167,20 +1166,20 @@ struct cff1 const CFF1FDSelect *fdSelect; unsigned int fdCount; - CFF1TopDictValues topDict; - hb_vector_t<CFF1FontDictValues> fontDicts; + cff1_top_dict_values_t topDict; + hb_vector_t<cff1_font_dict_values_t> fontDicts; hb_vector_t<PRIVDICTVAL> privateDicts; unsigned int num_glyphs; }; - struct accelerator_t : accelerator_templ_t<CFF1PrivateDictOpSet, CFF1PrivateDictValues> + struct accelerator_t : accelerator_templ_t<cff1_private_dict_opset_t, cff1_private_dict_values_t> { HB_INTERNAL bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const; HB_INTERNAL bool get_seac_components (hb_codepoint_t glyph, hb_codepoint_t *base, hb_codepoint_t *accent) const; }; - struct accelerator_subset_t : accelerator_templ_t<CFF1PrivateDictOpSet_Subset, CFF1PrivateDictValues_Subset> + struct accelerator_subset_t : accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t> { void init (hb_face_t *face) { @@ -1257,7 +1256,7 @@ struct cff1 const Encoding *encoding; private: - typedef accelerator_templ_t<CFF1PrivateDictOpSet_Subset, CFF1PrivateDictValues_Subset> SUPER; + typedef accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t> SUPER; }; bool subset (hb_subset_plan_t *plan) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc index 7188a3bfe86..7daa5365670 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc @@ -29,7 +29,7 @@ using namespace CFF; -struct ExtentsParam +struct extents_param_t { void init () { @@ -44,7 +44,7 @@ struct ExtentsParam void end_path () { path_open = false; } bool is_path_open () const { return path_open; } - void update_bounds (const Point &pt) + void update_bounds (const point_t &pt) { if (pt.x < min_x) min_x = pt.x; if (pt.x > max_x) max_x = pt.x; @@ -53,21 +53,21 @@ struct ExtentsParam } bool path_open; - Number min_x; - Number min_y; - Number max_x; - Number max_y; + number_t min_x; + number_t min_y; + number_t max_x; + number_t max_y; }; -struct CFF2PathProcs_Extents : PathProcs<CFF2PathProcs_Extents, CFF2CSInterpEnv, ExtentsParam> +struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_cs_interp_env_t, extents_param_t> { - static void moveto (CFF2CSInterpEnv &env, ExtentsParam& param, const Point &pt) + static void moveto (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt) { param.end_path (); env.moveto (pt); } - static void line (CFF2CSInterpEnv &env, ExtentsParam& param, const Point &pt1) + static void line (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1) { if (!param.is_path_open ()) { @@ -78,7 +78,7 @@ struct CFF2PathProcs_Extents : PathProcs<CFF2PathProcs_Extents, CFF2CSInterpEnv, param.update_bounds (env.get_pt ()); } - static void curve (CFF2CSInterpEnv &env, ExtentsParam& param, const Point &pt1, const Point &pt2, const Point &pt3) + static void curve (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) { if (!param.is_path_open ()) { @@ -93,7 +93,7 @@ struct CFF2PathProcs_Extents : PathProcs<CFF2PathProcs_Extents, CFF2CSInterpEnv, } }; -struct CFF2CSOpSet_Extents : CFF2CSOpSet<CFF2CSOpSet_Extents, ExtentsParam, CFF2PathProcs_Extents> {}; +struct cff2_cs_opset_extents_t : cff2_cs_opset_t<cff2_cs_opset_extents_t, extents_param_t, cff2_path_procs_extents_t> {}; bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, hb_codepoint_t glyph, @@ -104,10 +104,10 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, unsigned int num_coords; const int *coords = hb_font_get_var_coords_normalized (font, &num_coords); unsigned int fd = fdSelect->get_fd (glyph); - CFF2CSInterpreter<CFF2CSOpSet_Extents, ExtentsParam> interp; - const ByteStr str = (*charStrings)[glyph]; + cff2_cs_interpreter_t<cff2_cs_opset_extents_t, extents_param_t> interp; + const byte_str_t str = (*charStrings)[glyph]; interp.env.init (str, *this, fd, coords, num_coords); - ExtentsParam param; + extents_param_t param; param.init (); if (unlikely (!interp.interpret (param))) return false; 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 25c41ef8cc1..a7b0ba9beb6 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 @@ -136,22 +136,22 @@ struct CFF2VariationStore DEFINE_SIZE_MIN (2 + VariationStore::min_size); }; -struct CFF2TopDictValues : TopDictValues<> +struct cff2_top_dict_values_t : top_dict_values_t<> { void init () { - TopDictValues<>::init (); + top_dict_values_t<>::init (); vstoreOffset = 0; FDSelectOffset = 0; } - void fini () { TopDictValues<>::fini (); } + void fini () { top_dict_values_t<>::fini (); } unsigned int calculate_serialized_size () const { unsigned int size = 0; for (unsigned int i = 0; i < get_count (); i++) { - OpCode op = get_value (i).op; + op_code_t op = get_value (i).op; switch (op) { case OpCode_vstore: @@ -159,7 +159,7 @@ struct CFF2TopDictValues : TopDictValues<> size += OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (op); break; default: - size += TopDictValues<>::calculate_serialized_op_size (get_value (i)); + size += top_dict_values_t<>::calculate_serialized_op_size (get_value (i)); break; } } @@ -170,16 +170,16 @@ struct CFF2TopDictValues : TopDictValues<> unsigned int FDSelectOffset; }; -struct CFF2TopDictOpSet : TopDictOpSet<> +struct cff2_top_dict_opset_t : top_dict_opset_t<> { - static void process_op (OpCode op, NumInterpEnv& env, CFF2TopDictValues& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff2_top_dict_values_t& dictval) { switch (op) { case OpCode_FontMatrix: { - DictVal val; + dict_val_t val; val.init (); - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); env.clear_args (); } break; @@ -201,27 +201,27 @@ struct CFF2TopDictOpSet : TopDictOpSet<> if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } - typedef TopDictOpSet<> SUPER; + typedef top_dict_opset_t<> SUPER; }; -struct CFF2FontDictValues : DictValues<OpStr> +struct cff2_font_dict_values_t : dict_values_t<op_str_t> { void init () { - DictValues<OpStr>::init (); + dict_values_t<op_str_t>::init (); privateDictInfo.init (); } - void fini () { DictValues<OpStr>::fini (); } + void fini () { dict_values_t<op_str_t>::fini (); } - TableInfo privateDictInfo; + table_info_t privateDictInfo; }; -struct CFF2FontDictOpSet : DictOpSet +struct cff2_font_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, NumInterpEnv& env, CFF2FontDictValues& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff2_font_dict_values_t& dictval) { switch (op) { case OpCode_Private: @@ -238,33 +238,33 @@ struct CFF2FontDictOpSet : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } private: - typedef DictOpSet SUPER; + typedef dict_opset_t SUPER; }; template <typename VAL> -struct CFF2PrivateDictValues_Base : DictValues<VAL> +struct cff2_private_dict_values_base_t : dict_values_t<VAL> { void init () { - DictValues<VAL>::init (); + dict_values_t<VAL>::init (); subrsOffset = 0; localSubrs = &Null(CFF2Subrs); ivs = 0; } - void fini () { DictValues<VAL>::fini (); } + void fini () { dict_values_t<VAL>::fini (); } unsigned int calculate_serialized_size () const { unsigned int size = 0; - for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++) - if (DictValues<VAL>::get_value (i).op == OpCode_Subrs) + for (unsigned int i = 0; i < dict_values_t<VAL>::get_count; i++) + if (dict_values_t<VAL>::get_value (i).op == OpCode_Subrs) size += OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Subrs); else - size += DictValues<VAL>::get_value (i).str.len; + size += dict_values_t<VAL>::get_value (i).str.length; return size; } @@ -273,14 +273,14 @@ struct CFF2PrivateDictValues_Base : DictValues<VAL> unsigned int ivs; }; -typedef CFF2PrivateDictValues_Base<OpStr> CFF2PrivateDictValues_Subset; -typedef CFF2PrivateDictValues_Base<NumDictVal> CFF2PrivateDictValues; +typedef cff2_private_dict_values_base_t<op_str_t> cff2_private_dict_values_subset_t; +typedef cff2_private_dict_values_base_t<num_dict_val_t> cff2_private_dict_values_t; -struct CFF2PrivDictInterpEnv : NumInterpEnv +struct cff2_priv_dict_interp_env_t : num_interp_env_t { - void init (const ByteStr &str) + void init (const byte_str_t &str) { - NumInterpEnv::init (str); + num_interp_env_t::init (str); ivs = 0; seen_vsindex = false; } @@ -302,11 +302,11 @@ struct CFF2PrivDictInterpEnv : NumInterpEnv bool seen_vsindex; }; -struct CFF2PrivateDictOpSet : DictOpSet +struct cff2_private_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, CFF2PrivDictInterpEnv& env, CFF2PrivateDictValues& dictval) + static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_t& dictval) { - NumDictVal val; + num_dict_val_t val; val.init (); switch (op) { @@ -341,20 +341,20 @@ struct CFF2PrivateDictOpSet : DictOpSet break; default: - DictOpSet::process_op (op, env); + dict_opset_t::process_op (op, env); if (!env.argStack.is_empty ()) return; break; } if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr, val); + dictval.add_op (op, env.str_ref, val); } }; -struct CFF2PrivateDictOpSet_Subset : DictOpSet +struct cff2_private_dict_opset_subset_t : dict_opset_t { - static void process_op (OpCode op, CFF2PrivDictInterpEnv& env, CFF2PrivateDictValues_Subset& dictval) + static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_subset_t& dictval) { switch (op) { case OpCode_BlueValues: @@ -390,17 +390,17 @@ struct CFF2PrivateDictOpSet_Subset : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } private: - typedef DictOpSet SUPER; + typedef dict_opset_t SUPER; }; -typedef DictInterpreter<CFF2TopDictOpSet, CFF2TopDictValues> CFF2TopDict_Interpreter; -typedef DictInterpreter<CFF2FontDictOpSet, CFF2FontDictValues> CFF2FontDict_Interpreter; +typedef dict_interpreter_t<cff2_top_dict_opset_t, cff2_top_dict_values_t> cff2_top_dict_interpreter_t; +typedef dict_interpreter_t<cff2_font_dict_opset_t, cff2_font_dict_values_t> cff2_font_dict_interpreter_t; -}; /* namespace CFF */ +} /* namespace CFF */ namespace OT { @@ -408,7 +408,7 @@ using namespace CFF; struct cff2 { - static const hb_tag_t tableTag = HB_OT_TAG_cff2; + static constexpr hb_tag_t tableTag = HB_OT_TAG_cff2; bool sanitize (hb_sanitize_context_t *c) const { @@ -438,9 +438,9 @@ struct cff2 { fini (); return; } { /* parse top dict */ - ByteStr topDictStr (cff2 + cff2->topDict, cff2->topDictSize); + byte_str_t topDictStr (cff2 + cff2->topDict, cff2->topDictSize); if (unlikely (!topDictStr.sanitize (&sc))) { fini (); return; } - CFF2TopDict_Interpreter top_interp; + cff2_top_dict_interpreter_t top_interp; top_interp.env.init (topDictStr); topDict.init (); if (unlikely (!top_interp.interpret (topDict))) { fini (); return; } @@ -469,24 +469,24 @@ struct cff2 /* parse font dicts and gather private dicts */ for (unsigned int i = 0; i < fdCount; i++) { - const ByteStr fontDictStr = (*fdArray)[i]; + const byte_str_t fontDictStr = (*fdArray)[i]; if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; } - CFF2FontDictValues *font; - CFF2FontDict_Interpreter font_interp; + cff2_font_dict_values_t *font; + cff2_font_dict_interpreter_t font_interp; font_interp.env.init (fontDictStr); font = fontDicts.push (); - if (unlikely (font == &Crap(CFF2FontDictValues))) { fini (); return; } + if (unlikely (font == &Crap(cff2_font_dict_values_t))) { fini (); return; } font->init (); if (unlikely (!font_interp.interpret (*font))) { fini (); return; } - const ByteStr privDictStr (StructAtOffsetOrNull<UnsizedByteStr> (cff2, font->privateDictInfo.offset), font->privateDictInfo.size); + const byte_str_t privDictStr (StructAtOffsetOrNull<UnsizedByteStr> (cff2, font->privateDictInfo.offset), font->privateDictInfo.size); if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } - DictInterpreter<PRIVOPSET, PRIVDICTVAL, CFF2PrivDictInterpEnv> priv_interp; + dict_interpreter_t<PRIVOPSET, PRIVDICTVAL, cff2_priv_dict_interp_env_t> priv_interp; priv_interp.env.init(privDictStr); privateDicts[i].init (); if (unlikely (!priv_interp.interpret (privateDicts[i]))) { fini (); return; } - privateDicts[i].localSubrs = &StructAtOffsetOrNull<CFF2Subrs> (privDictStr.str, privateDicts[i].subrsOffset); + privateDicts[i].localSubrs = &StructAtOffsetOrNull<CFF2Subrs> (&privDictStr[0], privateDicts[i].subrsOffset); if (privateDicts[i].localSubrs != &Null(CFF2Subrs) && unlikely (!privateDicts[i].localSubrs->sanitize (&sc))) { fini (); return; } @@ -496,6 +496,7 @@ struct cff2 void fini () { sc.end_processing (); + topDict.fini (); fontDicts.fini_deep (); privateDicts.fini_deep (); hb_blob_destroy (blob); @@ -505,32 +506,32 @@ struct cff2 bool is_valid () const { return blob != nullptr; } protected: - hb_blob_t *blob; - hb_sanitize_context_t sc; + hb_blob_t *blob; + hb_sanitize_context_t sc; public: - CFF2TopDictValues topDict; - const CFF2Subrs *globalSubrs; - const CFF2VariationStore *varStore; - const CFF2CharStrings *charStrings; - const CFF2FDArray *fdArray; - const CFF2FDSelect *fdSelect; - unsigned int fdCount; - - hb_vector_t<CFF2FontDictValues> fontDicts; + cff2_top_dict_values_t topDict; + const CFF2Subrs *globalSubrs; + const CFF2VariationStore *varStore; + const CFF2CharStrings *charStrings; + const CFF2FDArray *fdArray; + const CFF2FDSelect *fdSelect; + unsigned int fdCount; + + hb_vector_t<cff2_font_dict_values_t> fontDicts; hb_vector_t<PRIVDICTVAL> privateDicts; - unsigned int num_glyphs; + unsigned int num_glyphs; }; - struct accelerator_t : accelerator_templ_t<CFF2PrivateDictOpSet, CFF2PrivateDictValues> + struct accelerator_t : accelerator_templ_t<cff2_private_dict_opset_t, cff2_private_dict_values_t> { HB_INTERNAL bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const; }; - typedef accelerator_templ_t<CFF2PrivateDictOpSet_Subset, CFF2PrivateDictValues_Subset> accelerator_subset_t; + typedef accelerator_templ_t<cff2_private_dict_opset_subset_t, cff2_private_dict_values_subset_t> accelerator_subset_t; bool subset (hb_subset_plan_t *plan) const { @@ -551,9 +552,9 @@ struct cff2 } public: - FixedVersion<HBUINT8> version; /* Version of CFF2 table. set to 0x0200u */ - OffsetTo<TopDict, HBUINT8, false> topDict; /* headerSize = Offset to Top DICT. */ - HBUINT16 topDictSize; /* Top DICT size */ + FixedVersion<HBUINT8> version; /* Version of CFF2 table. set to 0x0200u */ + NNOffsetTo<TopDict, HBUINT8> topDict; /* headerSize = Offset to Top DICT. */ + HBUINT16 topDictSize; /* Top DICT size */ public: DEFINE_SIZE_STATIC (5); 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 7567e52cf1e..0526c35cb99 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 @@ -92,23 +92,23 @@ struct CmapSubtableFormat4 this->format.set (4); 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->segCountX2.set (segments.length * 2); + this->entrySelector.set (MAX (1u, hb_bit_storage (segments.length)) - 1); this->searchRange.set (2 * (1u << this->entrySelector)); - this->rangeShift.set (segments.len * 2 > this->searchRange - ? 2 * segments.len - this->searchRange + this->rangeShift.set (segments.length * 2 > this->searchRange + ? 2 * segments.length - this->searchRange : 0); - HBUINT16 *end_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.len); + HBUINT16 *end_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length); c->allocate_size<HBUINT16> (HBUINT16::static_size); // 2 bytes of padding. - HBUINT16 *start_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.len); - HBINT16 *id_delta = c->allocate_size<HBINT16> (HBUINT16::static_size * segments.len); - HBUINT16 *id_range_offset = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.len); + HBUINT16 *start_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length); + HBINT16 *id_delta = c->allocate_size<HBINT16> (HBUINT16::static_size * segments.length); + HBUINT16 *id_range_offset = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length); if (id_range_offset == nullptr) return_trace (false); - for (unsigned int i = 0; i < segments.len; i++) + for (unsigned int i = 0; i < segments.length; i++) { end_count[i].set (segments[i].end_code); start_count[i].set (segments[i].start_code); @@ -157,7 +157,7 @@ struct CmapSubtableFormat4 static size_t get_sub_table_size (const hb_vector_t<segment_plan> &segments) { size_t segment_size = 0; - for (unsigned int i = 0; i < segments.len; i++) + for (unsigned int i = 0; i < segments.length; i++) { // Parallel array entries segment_size += @@ -532,7 +532,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12> static size_t get_sub_table_size (const hb_vector_t<CmapSubtableLongGroup> &groups) { - return 16 + 12 * groups.len; + return 16 + 12 * groups.length; } static bool create_sub_table_plan (const hb_subset_plan_t *plan, @@ -560,7 +560,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12> } DEBUG_MSG(SUBSET, nullptr, "cmap"); - for (unsigned int i = 0; i < groups->len; i++) { + for (unsigned int i = 0; i < groups->length; i++) { CmapSubtableLongGroup& group = (*groups)[i]; DEBUG_MSG(SUBSET, nullptr, " %d: U+%04X-U+%04X, gid %d-%d", i, (uint32_t) group.startCharCode, (uint32_t) group.endCharCode, (uint32_t) group.glyphID, (uint32_t) group.glyphID + ((uint32_t) group.endCharCode - (uint32_t) group.startCharCode)); } @@ -841,7 +841,7 @@ struct EncodingRecord struct cmap { - enum { tableTag = HB_OT_TAG_cmap }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap; struct subset_plan { @@ -1054,8 +1054,8 @@ struct cmap done < count && get_glyph_funcZ (get_glyph_data, *first_unicode, first_glyph); done++) { - first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); + first_unicode = &StructAtOffsetUnaligned<hb_codepoint_t> (first_unicode, unicode_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); } return done; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh index b1971a7615b..333ceaaba81 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh @@ -56,7 +56,7 @@ struct SmallGlyphMetrics extents->x_bearing = bearingX; extents->y_bearing = bearingY; extents->width = width; - extents->height = -height; + extents->height = - (hb_position_t) height; } HBUINT8 height; @@ -283,7 +283,7 @@ struct BitmapSizeTable } protected: - LOffsetTo<IndexSubtableArray, false> + LNNOffsetTo<IndexSubtableArray> indexSubtableArrayOffset; HBUINT32 indexTablesSize; HBUINT32 numberOfIndexSubtables; @@ -332,7 +332,7 @@ struct CBLC { friend struct CBDT; - enum { tableTag = HB_OT_TAG_CBLC }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_CBLC; bool sanitize (hb_sanitize_context_t *c) const { @@ -378,7 +378,7 @@ struct CBLC struct CBDT { - enum { tableTag = HB_OT_TAG_CBDT }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_CBDT; struct accelerator_t { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh index 3883604a535..a57911ad0aa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh @@ -87,7 +87,7 @@ struct BaseGlyphRecord struct COLR { - enum { tableTag = HB_OT_TAG_COLR }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR; bool has_data () const { return numBaseGlyphs; } @@ -104,14 +104,14 @@ struct COLR if (count) { hb_array_t<const LayerRecord> segment_layers = glyph_layers.sub_array (start_offset, *count); - *count = segment_layers.len; - for (unsigned int i = 0; i < segment_layers.len; i++) + *count = segment_layers.length; + for (unsigned int i = 0; i < segment_layers.length; i++) { layers[i].glyph = segment_layers.arrayZ[i].glyphId; layers[i].color_index = segment_layers.arrayZ[i].colorIdx; } } - return glyph_layers.len; + return glyph_layers.length; } bool sanitize (hb_sanitize_context_t *c) const @@ -125,9 +125,9 @@ struct COLR protected: HBUINT16 version; /* Table version number (starts at 0). */ HBUINT16 numBaseGlyphs; /* Number of Base Glyph Records. */ - LOffsetTo<SortedUnsizedArrayOf<BaseGlyphRecord>, false> + LNNOffsetTo<SortedUnsizedArrayOf<BaseGlyphRecord> > baseGlyphsZ; /* Offset to Base Glyph records. */ - LOffsetTo<UnsizedArrayOf<LayerRecord>, false> + LNNOffsetTo<UnsizedArrayOf<LayerRecord> > layersZ; /* Offset to Layer Records. */ HBUINT16 numLayers; /* Number of Layer Records. */ public: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh index bd57d8a3591..4070493504b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh @@ -87,15 +87,15 @@ struct CPALV1Tail } protected: - LOffsetTo<UnsizedArrayOf<HBUINT32>, false> + LNNOffsetTo<UnsizedArrayOf<HBUINT32> > paletteFlagsZ; /* Offset from the beginning of CPAL table to * the Palette Type Array. Set to 0 if no array * is provided. */ - LOffsetTo<UnsizedArrayOf<NameID>, false> + LNNOffsetTo<UnsizedArrayOf<NameID> > paletteLabelsZ; /* Offset from the beginning of CPAL table to * the palette labels array. Set to 0 if no * array is provided. */ - LOffsetTo<UnsizedArrayOf<NameID>, false> + LNNOffsetTo<UnsizedArrayOf<NameID> > colorLabelsZ; /* Offset from the beginning of CPAL table to * the color labels array. Set to 0 * if no array is provided. */ @@ -107,7 +107,7 @@ typedef HBUINT32 BGRAColor; struct CPAL { - enum { tableTag = HB_OT_TAG_CPAL }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_CPAL; bool has_data () const { return numPalettes; } @@ -176,7 +176,7 @@ struct CPAL HBUINT16 numPalettes; /* Number of palettes in the table. */ HBUINT16 numColorRecords; /* Total number of color records, combined for * all palettes. */ - LOffsetTo<UnsizedArrayOf<BGRAColor>, false> + LNNOffsetTo<UnsizedArrayOf<BGRAColor> > colorRecordsZ; /* Offset from the beginning of CPAL table to * the first ColorRecord. */ UnsizedArrayOf<HBUINT16> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh index ed93d6526b5..f6bdbb3dde0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh @@ -130,7 +130,7 @@ struct SBIXStrike struct sbix { - enum { tableTag = HB_OT_TAG_sbix }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_sbix; bool has_data () const { return version; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh index 554453f7594..6e8eddf2473 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh @@ -62,7 +62,7 @@ struct SVGDocumentIndexEntry * this index entry. */ HBUINT16 endGlyphID; /* The last glyph ID in the range described by * this index entry. Must be >= startGlyphID. */ - LOffsetTo<UnsizedArrayOf<HBUINT8>, false> + LNNOffsetTo<UnsizedArrayOf<HBUINT8> > svgDoc; /* Offset from the beginning of the SVG Document Index * to an SVG document. Must be non-zero. */ HBUINT32 svgDocLength; /* Length of the SVG document. @@ -73,7 +73,7 @@ struct SVGDocumentIndexEntry struct SVG { - enum { tableTag = HB_OT_TAG_SVG }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_SVG; bool has_data () const { return svgDocEntries; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc index c080f0fd937..20b09df524c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc @@ -112,8 +112,8 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, for (unsigned int i = 0; i < count; i++) { *first_advance = font->em_scale_x (hmtx.get_advance (*first_glyph, font)); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } } @@ -132,8 +132,8 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data, for (unsigned int i = 0; i < count; i++) { *first_advance = font->em_scale_y (-(int) vmtx.get_advance (*first_glyph, font)); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); - first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride); + first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride); + first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride); } } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-gasp-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-gasp-table.hh index d328fd22243..94fff58a158 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-gasp-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-gasp-table.hh @@ -57,7 +57,7 @@ struct GaspRange struct gasp { - enum { tableTag = HB_OT_TAG_gasp }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_gasp; const GaspRange &get_gasp_range (unsigned int i) const { return gaspRanges[i]; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh index a6dec40d240..c2b38b05bae 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh @@ -45,7 +45,7 @@ struct loca { friend struct glyf; - enum { tableTag = HB_OT_TAG_loca }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_loca; bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const { @@ -71,7 +71,7 @@ struct loca struct glyf { - enum { tableTag = HB_OT_TAG_glyf }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_glyf; bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const { @@ -200,8 +200,8 @@ struct glyf }; static bool get_iterator (const char * glyph_data, - unsigned int length, - CompositeGlyphHeader::Iterator *iterator /* OUT */) + unsigned int length, + CompositeGlyphHeader::Iterator *iterator /* OUT */) { if (length < GlyphHeader::static_size) return false; /* Empty glyph; zero extents. */ @@ -355,8 +355,8 @@ struct glyf } bool get_offsets (hb_codepoint_t glyph, - unsigned int *start_offset /* OUT */, - unsigned int *end_offset /* OUT */) const + unsigned int *start_offset /* OUT */, + unsigned int *end_offset /* OUT */) const { if (unlikely (glyph >= num_glyphs)) return false; 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 48421ee2cbb..95229c523b7 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 @@ -57,7 +57,7 @@ struct DeviceRecord } unsigned int len () const - { return this->subset_plan->glyphs.len; } + { return this->subset_plan->glyphs.length; } const HBUINT8* operator [] (unsigned int i) const { @@ -119,7 +119,7 @@ struct DeviceRecord struct hdmx { - enum { tableTag = HB_OT_TAG_hdmx }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_hdmx; unsigned int get_size () const { return min_size + numRecords * sizeDeviceRecord; } @@ -140,7 +140,7 @@ struct hdmx this->version.set (source_hdmx->version); this->numRecords.set (source_hdmx->numRecords); - this->sizeDeviceRecord.set (DeviceRecord::get_size (plan->glyphs.len)); + this->sizeDeviceRecord.set (DeviceRecord::get_size (plan->glyphs.length)); for (unsigned int i = 0; i < source_hdmx->numRecords; i++) { @@ -156,7 +156,7 @@ struct hdmx static size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan) { - return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->glyphs.len); + return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->glyphs.length); } bool subset (hb_subset_plan_t *plan) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh index 41062ca326a..3c0bb3d6ddd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh @@ -45,7 +45,7 @@ struct head { friend struct OffsetTable; - enum { tableTag = HB_OT_TAG_head }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_head; unsigned int get_upem () const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh index 7bc1817eefe..c3155b79eef 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh @@ -86,10 +86,10 @@ struct _hea }; struct hhea : _hea<hhea> { - enum { tableTag = HB_OT_TAG_hhea }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_hhea; }; struct vhea : _hea<vhea> { - enum { tableTag = HB_OT_TAG_vhea }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_vhea; }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh index fa74a0e3858..a95a56f32de 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh @@ -94,7 +94,7 @@ struct hmtxvmtx /* All the trailing glyphs with the same advance can use one LongMetric * and just keep LSB */ hb_vector_t<hb_codepoint_t> &gids = plan->glyphs; - unsigned int num_advances = gids.len; + unsigned int num_advances = gids.length; unsigned int last_advance = _mtx.get_advance (gids[num_advances - 1]); while (num_advances > 1 && last_advance == _mtx.get_advance (gids[num_advances - 2])) @@ -104,14 +104,14 @@ struct hmtxvmtx /* alloc the new table */ size_t dest_sz = num_advances * 4 - + (gids.len - num_advances) * 2; + + (gids.length - num_advances) * 2; void *dest = (void *) malloc (dest_sz); if (unlikely (!dest)) { return false; } DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in src has %d advances, %d lsbs", HB_UNTAG(T::tableTag), _mtx.num_advances, _mtx.num_metrics - _mtx.num_advances); - DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in dest has %d advances, %d lsbs, %u bytes", HB_UNTAG(T::tableTag), num_advances, gids.len - num_advances, (unsigned int) dest_sz); + DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in dest has %d advances, %d lsbs, %u bytes", HB_UNTAG(T::tableTag), num_advances, gids.length - num_advances, (unsigned int) dest_sz); const char *source_table = hb_blob_get_data (_mtx.table.get_blob (), nullptr); // Copy everything over @@ -120,7 +120,7 @@ struct hmtxvmtx char * dest_pos = (char *) dest; bool failed = false; - for (unsigned int i = 0; i < gids.len; i++) + for (unsigned int i = 0; i < gids.length; i++) { /* the last metric or the one for gids[i] */ LongMetric *src_metric = old_metrics + MIN ((hb_codepoint_t) _mtx.num_advances - 1, gids[i]); @@ -323,14 +323,14 @@ struct hmtxvmtx }; struct hmtx : hmtxvmtx<hmtx, hhea> { - enum { tableTag = HB_OT_TAG_hmtx }; - enum { variationsTag = HB_OT_TAG_HVAR }; - enum { os2Tag = HB_OT_TAG_OS2 }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_hmtx; + static constexpr hb_tag_t variationsTag = HB_OT_TAG_HVAR; + static constexpr hb_tag_t os2Tag = HB_OT_TAG_OS2; }; struct vmtx : hmtxvmtx<vmtx, vhea> { - enum { tableTag = HB_OT_TAG_vmtx }; - enum { variationsTag = HB_OT_TAG_VVAR }; - enum { os2Tag = HB_TAG_NONE }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_vmtx; + static constexpr hb_tag_t variationsTag = HB_OT_TAG_VVAR; + static constexpr hb_tag_t os2Tag = HB_TAG_NONE; }; struct hmtx_accelerator_t : hmtx::accelerator_t {}; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh index 5e75d083b76..ec6a3c84c2b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh @@ -160,7 +160,7 @@ struct KernSubTable struct KernOTSubTableHeader { - enum { apple = false }; + static constexpr bool apple = false; typedef AAT::ObsoleteTypes Types; unsigned int tuple_count () const { return 0; } @@ -197,8 +197,8 @@ struct KernOT : AAT::KerxTable<KernOT> { friend struct AAT::KerxTable<KernOT>; - enum { tableTag = HB_OT_TAG_kern }; - enum { minVersion = 0u }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_kern; + static constexpr unsigned minVersion = 0u; typedef KernOTSubTableHeader SubTableHeader; typedef SubTableHeader::Types Types; @@ -215,7 +215,7 @@ struct KernOT : AAT::KerxTable<KernOT> struct KernAATSubTableHeader { - enum { apple = true }; + static constexpr bool apple = true; typedef AAT::ObsoleteTypes Types; unsigned int tuple_count () const { return 0; } @@ -252,8 +252,8 @@ struct KernAAT : AAT::KerxTable<KernAAT> { friend struct AAT::KerxTable<KernAAT>; - enum { tableTag = HB_OT_TAG_kern }; - enum { minVersion = 0x00010000u }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_kern; + static constexpr unsigned minVersion = 0x00010000u; typedef KernAATSubTableHeader SubTableHeader; typedef SubTableHeader::Types Types; @@ -269,7 +269,7 @@ struct KernAAT : AAT::KerxTable<KernAAT> struct kern { - enum { tableTag = HB_OT_TAG_kern }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_kern; bool has_data () const { return u.version32; } unsigned int get_type () const { return u.major; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh index 6c39932670f..dd0fba1ff40 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh @@ -464,7 +464,7 @@ struct Axis struct BASE { - enum { tableTag = HB_OT_TAG_BASE }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_BASE; const Axis &get_axis (hb_direction_t direction) const { return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh index d9f5728b65c..39a8bbabdff 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh @@ -900,14 +900,14 @@ struct CoverageFormat2 TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!glyphs.len)) + if (unlikely (!glyphs.length)) { rangeRecord.len.set (0); return_trace (true); } unsigned int num_ranges = 1; - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) if (glyphs[i - 1] + 1 != glyphs[i]) num_ranges++; rangeRecord.len.set (num_ranges); @@ -916,7 +916,7 @@ struct CoverageFormat2 unsigned int range = 0; rangeRecord[range].start = glyphs[0]; rangeRecord[range].value.set (0); - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) { if (glyphs[i - 1] + 1 != glyphs[i]) { @@ -1048,10 +1048,10 @@ struct Coverage if (unlikely (!c->extend_min (*this))) return_trace (false); unsigned int num_ranges = 1; - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) if (glyphs[i - 1] + 1 != glyphs[i]) num_ranges++; - u.format.set (glyphs.len * 2 < num_ranges * 3 ? 1 : 2); + u.format.set (glyphs.length * 2 < num_ranges * 3 ? 1 : 2); switch (u.format) { @@ -1199,7 +1199,7 @@ struct ClassDefFormat1 TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!glyphs.len)) + if (unlikely (!glyphs.length)) { startGlyph.set (0); classValue.len.set (0); @@ -1207,13 +1207,13 @@ struct ClassDefFormat1 } hb_codepoint_t glyph_min = glyphs[0]; - hb_codepoint_t glyph_max = glyphs[glyphs.len - 1]; + hb_codepoint_t glyph_max = glyphs[glyphs.length - 1]; startGlyph.set (glyph_min); classValue.len.set (glyph_max - glyph_min + 1); if (unlikely (!c->extend (classValue))) return_trace (false); - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) classValue[glyphs[i] - glyph_min] = klasses[i]; return_trace (true); @@ -1239,7 +1239,7 @@ struct ClassDefFormat1 } c->serializer->propagate_error (glyphs, klasses); ClassDef_serialize (c->serializer, glyphs, klasses); - return_trace (glyphs.len); + return_trace (glyphs.length); } bool sanitize (hb_sanitize_context_t *c) const @@ -1335,14 +1335,14 @@ struct ClassDefFormat2 TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!glyphs.len)) + if (unlikely (!glyphs.length)) { rangeRecord.len.set (0); return_trace (true); } unsigned int num_ranges = 1; - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) if (glyphs[i - 1] + 1 != glyphs[i] || klasses[i - 1] != klasses[i]) num_ranges++; @@ -1352,7 +1352,7 @@ struct ClassDefFormat2 unsigned int range = 0; rangeRecord[range].start = glyphs[0]; rangeRecord[range].value.set (klasses[0]); - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) { if (glyphs[i - 1] + 1 != glyphs[i] || klasses[i - 1] != klasses[i]) @@ -1390,7 +1390,7 @@ struct ClassDefFormat2 } c->serializer->propagate_error (glyphs, klasses); ClassDef_serialize (c->serializer, glyphs, klasses); - return_trace (glyphs.len); + return_trace (glyphs.length); } bool sanitize (hb_sanitize_context_t *c) const @@ -1485,13 +1485,13 @@ struct ClassDef if (unlikely (!c->extend_min (*this))) return_trace (false); unsigned int format = 2; - if (glyphs.len) + if (glyphs.length) { hb_codepoint_t glyph_min = glyphs[0]; - hb_codepoint_t glyph_max = glyphs[glyphs.len - 1]; + hb_codepoint_t glyph_max = glyphs[glyphs.length - 1]; unsigned int num_ranges = 1; - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) if (glyphs[i - 1] + 1 != glyphs[i] || klasses[i - 1] != klasses[i]) num_ranges++; @@ -1949,7 +1949,7 @@ struct FeatureVariationRecord struct FeatureVariations { - enum { NOT_FOUND_INDEX = 0xFFFFFFFFu }; + static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFFFFFu; bool find_index (const int *coords, unsigned int coord_len, unsigned int *index) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh index 3099fb96a80..06c26fbb42c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh @@ -64,7 +64,7 @@ struct AttachList if (point_count) { hb_array_t<const HBUINT16> array = points.sub_array (start_offset, point_count); - unsigned int count = array.len; + unsigned int count = array.length; for (unsigned int i = 0; i < count; i++) point_array[i] = array[i]; } @@ -221,7 +221,7 @@ struct LigGlyph if (caret_count) { hb_array_t <const OffsetTo<CaretValue> > array = carets.sub_array (start_offset, caret_count); - unsigned int count = array.len; + unsigned int count = array.length; for (unsigned int i = 0; i < count; i++) caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id, var_store); } @@ -341,7 +341,7 @@ struct MarkGlyphSets struct GDEF { - enum { tableTag = HB_OT_TAG_GDEF }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_GDEF; enum GlyphClasses { UnclassifiedGlyph = 0, 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 b123336109b..e17a2824168 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 @@ -84,16 +84,16 @@ struct ValueFormat : HBUINT16 HBINT16 yAdvance; /* Vertical adjustment for advance--in * design units (only used for vertical * writing) */ - Offset xPlaDevice; /* Offset to Device table for + OffsetTo<Device> xPlaDevice; /* Offset to Device table for * horizontal placement--measured from * beginning of PosTable (may be NULL) */ - Offset yPlaDevice; /* Offset to Device table for vertical + OffsetTo<Device> yPlaDevice; /* Offset to Device table for vertical * placement--measured from beginning * of PosTable (may be NULL) */ - Offset xAdvDevice; /* Offset to Device table for + OffsetTo<Device> xAdvDevice; /* Offset to Device table for * horizontal advance--measured from * beginning of PosTable (may be NULL) */ - Offset yAdvDevice; /* Offset to Device table for vertical + OffsetTo<Device> yAdvDevice; /* Offset to Device table for vertical * advance--measured from beginning of * PosTable (may be NULL) */ #endif @@ -177,13 +177,13 @@ struct ValueFormat : HBUINT16 { return *CastP<OffsetTo<Device> > (value); } static const OffsetTo<Device>& get_device (const Value* value, bool *worked=nullptr) { - if (worked) *worked |= *value; + if (worked) *worked |= bool (*value); return *CastP<OffsetTo<Device> > (value); } static const HBINT16& get_short (const Value* value, bool *worked=nullptr) { - if (worked) *worked |= *value; + if (worked) *worked |= bool (*value); return *CastP<HBINT16> (value); } @@ -472,10 +472,7 @@ struct SinglePosFormat1 { return (this+coverage).intersects (glyphs); } void collect_glyphs (hb_collect_glyphs_context_t *c) const - { - TRACE_COLLECT_GLYPHS (this); - if (unlikely (!(this+coverage).add_coverage (c->input))) return; - } + { if (unlikely (!(this+coverage).add_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -527,10 +524,7 @@ struct SinglePosFormat2 { return (this+coverage).intersects (glyphs); } void collect_glyphs (hb_collect_glyphs_context_t *c) const - { - TRACE_COLLECT_GLYPHS (this); - if (unlikely (!(this+coverage).add_coverage (c->input))) return; - } + { if (unlikely (!(this+coverage).add_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -642,7 +636,6 @@ struct PairSet void collect_glyphs (hb_collect_glyphs_context_t *c, const ValueFormat *valueFormats) const { - TRACE_COLLECT_GLYPHS (this); unsigned int len1 = valueFormats[0].get_len (); unsigned int len2 = valueFormats[1].get_len (); unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); @@ -743,7 +736,6 @@ struct PairPosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = pairSet.len; for (unsigned int i = 0; i < count; i++) @@ -820,7 +812,6 @@ struct PairPosFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; if (unlikely (!(this+classDef2).add_coverage (c->input))) return; } @@ -971,10 +962,7 @@ struct CursivePosFormat1 { return (this+coverage).intersects (glyphs); } void collect_glyphs (hb_collect_glyphs_context_t *c) const - { - TRACE_COLLECT_GLYPHS (this); - if (unlikely (!(this+coverage).add_coverage (c->input))) return; - } + { if (unlikely (!(this+coverage).add_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -1138,7 +1126,6 @@ struct MarkBasePosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+markCoverage).add_coverage (c->input))) return; if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return; } @@ -1260,7 +1247,6 @@ struct MarkLigPosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+markCoverage).add_coverage (c->input))) return; if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return; } @@ -1381,7 +1367,6 @@ struct MarkMarkPosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+mark1Coverage).add_coverage (c->input))) return; if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return; } @@ -1584,10 +1569,7 @@ struct PosLookup : Lookup } hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const - { - TRACE_COLLECT_GLYPHS (this); - return_trace (dispatch (c)); - } + { return dispatch (c); } template <typename set_t> void add_coverage (set_t *glyphs) const @@ -1619,7 +1601,7 @@ struct PosLookup : Lookup struct GPOS : GSUBGPOS { - enum { tableTag = HB_OT_TAG_GPOS }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_GPOS; const PosLookup& get_lookup (unsigned int i) const { return CastR<PosLookup> (GSUBGPOS::get_lookup (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 180e7f2decd..33b8f0ebda1 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 @@ -46,7 +46,6 @@ struct SingleSubstFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. @@ -59,7 +58,6 @@ struct SingleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { @@ -120,7 +118,7 @@ struct SingleSubstFormat1 } c->serializer->propagate_error (from, to); SingleSubst_serialize (c->serializer, from, to); - return_trace (from.len); + return_trace (from.length); } bool sanitize (hb_sanitize_context_t *c) const @@ -147,7 +145,6 @@ struct SingleSubstFormat2 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = substitute.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { @@ -160,7 +157,6 @@ struct SingleSubstFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = substitute.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) @@ -218,7 +214,7 @@ struct SingleSubstFormat2 } c->serializer->propagate_error (from, to); SingleSubst_serialize (c->serializer, from, to); - return_trace (from.len); + return_trace (from.length); } bool sanitize (hb_sanitize_context_t *c) const @@ -249,12 +245,12 @@ struct SingleSubst if (unlikely (!c->extend_min (u.format))) return_trace (false); unsigned int format = 2; int delta = 0; - if (glyphs.len) + if (glyphs.length) { format = 1; /* TODO(serialize) check for wrap-around */ delta = substitutes[0] - glyphs[0]; - for (unsigned int i = 1; i < glyphs.len; i++) + for (unsigned int i = 1; i < glyphs.length; i++) if (delta != (int) (substitutes[i] - glyphs[i])) { format = 2; break; @@ -298,17 +294,13 @@ struct Sequence { void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = substitute.len; for (unsigned int i = 0; i < count; i++) c->out->add (substitute[i]); } void collect_glyphs (hb_collect_glyphs_context_t *c) const - { - TRACE_COLLECT_GLYPHS (this); - c->output->add_array (substitute.arrayZ, substitute.len); - } + { c->output->add_array (substitute.arrayZ, substitute.len); } bool apply (hb_ot_apply_context_t *c) const { @@ -369,7 +361,6 @@ struct MultipleSubstFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = sequence.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { @@ -382,7 +373,6 @@ struct MultipleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = sequence.len; for (unsigned int i = 0; i < count; i++) @@ -414,8 +404,8 @@ struct MultipleSubstFormat1 { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!sequence.serialize (c, glyphs.len))) return_trace (false); - for (unsigned int i = 0; i < glyphs.len; i++) + if (unlikely (!sequence.serialize (c, glyphs.length))) return_trace (false); + for (unsigned int i = 0; i < glyphs.length; i++) { unsigned int substitute_len = substitute_len_list[i]; if (unlikely (!sequence[i].serialize (c, this) @@ -490,17 +480,13 @@ struct AlternateSet { void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = alternates.len; for (unsigned int i = 0; i < count; i++) c->out->add (alternates[i]); } void collect_glyphs (hb_collect_glyphs_context_t *c) const - { - TRACE_COLLECT_GLYPHS (this); - c->output->add_array (alternates.arrayZ, alternates.len); - } + { c->output->add_array (alternates.arrayZ, alternates.len); } bool apply (hb_ot_apply_context_t *c) const { @@ -555,7 +541,6 @@ struct AlternateSubstFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = alternateSet.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { @@ -568,7 +553,6 @@ struct AlternateSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = alternateSet.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) @@ -604,8 +588,8 @@ struct AlternateSubstFormat1 { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!alternateSet.serialize (c, glyphs.len))) return_trace (false); - for (unsigned int i = 0; i < glyphs.len; i++) + if (unlikely (!alternateSet.serialize (c, glyphs.length))) return_trace (false); + for (unsigned int i = 0; i < glyphs.length; i++) { unsigned int alternate_len = alternate_len_list[i]; if (unlikely (!alternateSet[i].serialize (c, this) @@ -690,7 +674,6 @@ struct Ligature void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = component.lenP1; for (unsigned int i = 1; i < count; i++) if (!c->glyphs->has (component[i])) @@ -700,7 +683,6 @@ struct Ligature void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); c->input->add_array (component.arrayZ, component.lenP1 ? component.lenP1 - 1 : 0); c->output->add (ligGlyph); } @@ -798,7 +780,6 @@ struct LigatureSet void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int num_ligs = ligature.len; for (unsigned int i = 0; i < num_ligs; i++) (this+ligature[i]).closure (c); @@ -806,7 +787,6 @@ struct LigatureSet void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); unsigned int num_ligs = ligature.len; for (unsigned int i = 0; i < num_ligs; i++) (this+ligature[i]).collect_glyphs (c); @@ -841,12 +821,12 @@ struct LigatureSet bool serialize (hb_serialize_context_t *c, hb_array_t<const GlyphID> ligatures, hb_array_t<const unsigned int> component_count_list, - hb_array_t<const GlyphID> component_list /* Starting from second for each ligature */) + hb_array_t<const GlyphID> &component_list /* Starting from second for each ligature */) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!ligature.serialize (c, ligatures.len))) return_trace (false); - for (unsigned int i = 0; i < ligatures.len; i++) + if (unlikely (!ligature.serialize (c, ligatures.length))) return_trace (false); + for (unsigned int i = 0; i < ligatures.length; i++) { unsigned int component_count = MAX<int> (component_count_list[i] - 1, 0); if (unlikely (!ligature[i].serialize (c, this) @@ -891,7 +871,6 @@ struct LigatureSubstFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); unsigned int count = ligatureSet.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { @@ -904,7 +883,6 @@ struct LigatureSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = ligatureSet.len; for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) @@ -947,8 +925,8 @@ struct LigatureSubstFormat1 { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!ligatureSet.serialize (c, first_glyphs.len))) return_trace (false); - for (unsigned int i = 0; i < first_glyphs.len; i++) + if (unlikely (!ligatureSet.serialize (c, first_glyphs.length))) return_trace (false); + for (unsigned int i = 0; i < first_glyphs.length; i++) { unsigned int ligature_count = ligature_per_first_glyph_count_list[i]; if (unlikely (!ligatureSet[i].serialize (c, this) @@ -958,8 +936,6 @@ struct LigatureSubstFormat1 component_list))) return_trace (false); ligatures_list += ligature_count; component_count_list += ligature_count; - for (unsigned int i = 0; i < ligature_count; i++) - component_list += MAX<int> (component_count_list[i] - 1, 0); } return_trace (coverage.serialize (c, this).serialize (c, first_glyphs)); } @@ -1070,7 +1046,6 @@ struct ReverseChainSingleSubstFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack); unsigned int count; @@ -1098,7 +1073,6 @@ struct ReverseChainSingleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count; @@ -1304,9 +1278,8 @@ struct SubstLookup : Lookup hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const { - TRACE_CLOSURE (this); if (!c->should_visit_lookup (this_index)) - return_trace (HB_VOID); + return hb_closure_context_t::default_return_value (); c->set_recurse_func (dispatch_closure_recurse_func); @@ -1314,14 +1287,13 @@ struct SubstLookup : Lookup c->flush (); - return_trace (ret); + return ret; } hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); c->set_recurse_func (dispatch_recurse_func<hb_collect_glyphs_context_t>); - return_trace (dispatch (c)); + return dispatch (c); } template <typename set_t> @@ -1438,7 +1410,7 @@ struct SubstLookup : Lookup struct GSUB : GSUBGPOS { - enum { tableTag = HB_OT_TAG_GSUB }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_GSUB; const SubstLookup& get_lookup (unsigned int i) const { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh index ac6e646384f..88d834da4be 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh @@ -59,7 +59,7 @@ struct hb_intersects_context_t : }; struct hb_closure_context_t : - hb_dispatch_context_t<hb_closure_context_t, hb_void_t, HB_DEBUG_CLOSURE> + hb_dispatch_context_t<hb_closure_context_t, hb_void_t, 0> { const char *get_name () { return "CLOSURE"; } typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index); @@ -151,7 +151,7 @@ struct hb_would_apply_context_t : struct hb_collect_glyphs_context_t : - hb_dispatch_context_t<hb_collect_glyphs_context_t, hb_void_t, HB_DEBUG_COLLECT_GLYPHS> + hb_dispatch_context_t<hb_collect_glyphs_context_t, hb_void_t, 0> { const char *get_name () { return "COLLECT_GLYPHS"; } typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index); @@ -643,7 +643,7 @@ struct hb_get_subtables_context_t : hb_set_digest_t digest; }; - typedef hb_vector_t<hb_applicable_t, 2> array_t; + typedef hb_vector_t<hb_applicable_t> array_t; /* Dispatch interface. */ const char *get_name () { return "GET_SUBTABLES"; } @@ -1296,7 +1296,6 @@ struct Rule void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const { - TRACE_CLOSURE (this); const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord> > (inputZ.as_array ((inputCount ? inputCount - 1 : 0))); context_closure_lookup (c, @@ -1308,7 +1307,6 @@ struct Rule void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyphsLookupContext &lookup_context) const { - TRACE_COLLECT_GLYPHS (this); const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord> > (inputZ.as_array (inputCount ? inputCount - 1 : 0)); context_collect_glyphs_lookup (c, @@ -1376,7 +1374,6 @@ struct RuleSet void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const { - TRACE_CLOSURE (this); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) (this+rule[i]).closure (c, lookup_context); @@ -1385,7 +1382,6 @@ struct RuleSet void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyphsLookupContext &lookup_context) const { - TRACE_COLLECT_GLYPHS (this); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) (this+rule[i]).collect_glyphs (c, lookup_context); @@ -1455,8 +1451,6 @@ struct ContextFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); - struct ContextClosureLookupContext lookup_context = { {intersects_glyph}, nullptr @@ -1474,7 +1468,6 @@ struct ContextFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); (this+coverage).add_coverage (c->input); struct ContextCollectGlyphsLookupContext lookup_context = { @@ -1567,7 +1560,6 @@ struct ContextFormat2 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); if (!(this+coverage).intersects (c->glyphs)) return; @@ -1588,7 +1580,6 @@ struct ContextFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); (this+coverage).add_coverage (c->input); const ClassDef &class_def = this+classDef; @@ -1681,7 +1672,6 @@ struct ContextFormat3 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); if (!(this+coverageZ[0]).intersects (c->glyphs)) return; @@ -1698,7 +1688,6 @@ struct ContextFormat3 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); (this+coverageZ[0]).add_coverage (c->input); const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount)); @@ -1950,7 +1939,6 @@ struct ChainRule void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { - TRACE_CLOSURE (this); const HeadlessArrayOf<HBUINT16> &input = StructAfter<HeadlessArrayOf<HBUINT16> > (backtrack); const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); @@ -1965,7 +1953,6 @@ struct ChainRule void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const { - TRACE_COLLECT_GLYPHS (this); const HeadlessArrayOf<HBUINT16> &input = StructAfter<HeadlessArrayOf<HBUINT16> > (backtrack); const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); @@ -2046,7 +2033,6 @@ struct ChainRuleSet } void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { - TRACE_CLOSURE (this); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) (this+rule[i]).closure (c, lookup_context); @@ -2054,7 +2040,6 @@ struct ChainRuleSet void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const { - TRACE_COLLECT_GLYPHS (this); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) (this+rule[i]).collect_glyphs (c, lookup_context); @@ -2119,8 +2104,6 @@ struct ChainContextFormat1 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); - struct ChainContextClosureLookupContext lookup_context = { {intersects_glyph}, {nullptr, nullptr, nullptr} @@ -2138,7 +2121,6 @@ struct ChainContextFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); (this+coverage).add_coverage (c->input); struct ChainContextCollectGlyphsLookupContext lookup_context = { @@ -2232,7 +2214,6 @@ struct ChainContextFormat2 } void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); if (!(this+coverage).intersects (c->glyphs)) return; @@ -2257,7 +2238,6 @@ struct ChainContextFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); (this+coverage).add_coverage (c->input); const ClassDef &backtrack_class_def = this+backtrackClassDef; @@ -2382,7 +2362,6 @@ struct ChainContextFormat3 void closure (hb_closure_context_t *c) const { - TRACE_CLOSURE (this); const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack); if (!(this+input[0]).intersects (c->glyphs)) @@ -2404,7 +2383,6 @@ struct ChainContextFormat3 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - TRACE_COLLECT_GLYPHS (this); const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack); (this+input[0]).add_coverage (c->input); @@ -2636,7 +2614,7 @@ struct hb_ot_layout_lookup_accelerator_t bool apply (hb_ot_apply_context_t *c) const { - for (unsigned int i = 0; i < subtables.len; i++) + for (unsigned int i = 0; i < subtables.length; i++) if (subtables[i].apply (c)) return true; return false; @@ -2686,7 +2664,7 @@ struct GSUBGPOS { return (version.to_int () >= 0x00010001u ? this+featureVars : Null(FeatureVariations)) .find_index (coords, num_coords, index); } const Feature& get_feature_variation (unsigned int feature_index, - unsigned int variations_index) const + unsigned int variations_index) const { if (FeatureVariations::NOT_FOUND_INDEX != variations_index && version.to_int () >= 0x00010001u) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh index 3beedc49b40..1dd31d5b0c5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh @@ -195,7 +195,7 @@ struct JstfScript struct JSTF { - enum { tableTag = HB_OT_TAG_JSTF }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_JSTF; unsigned int get_script_count () const { return scriptList.len; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc index 67ce9235349..d32be04a812 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc @@ -684,7 +684,7 @@ struct hb_collect_features_context_t feature_indexes (feature_indexes_), script_count(0),langsys_count(0) {} - bool inline visited (const OT::Script &s) + bool visited (const OT::Script &s) { /* We might have Null() object here. Don't want to involve * that in the memoize. So, detect empty objects and return. */ @@ -697,7 +697,7 @@ struct hb_collect_features_context_t return visited (s, visited_script); } - bool inline visited (const OT::LangSys &l) + bool visited (const OT::LangSys &l) { /* We might have Null() object here. Don't want to involve * that in the memoize. So, detect empty objects and return. */ @@ -713,7 +713,7 @@ struct hb_collect_features_context_t private: template <typename T> - bool inline visited (const T &p, hb_set_t &visited_set) + bool visited (const T &p, hb_set_t &visited_set) { hb_codepoint_t delta = (hb_codepoint_t) ((uintptr_t) &p - (uintptr_t) &g); if (visited_set.has (delta)) @@ -1299,8 +1299,8 @@ hb_ot_layout_feature_get_characters (hb_face_t *face, struct GSUBProxy { - enum { table_index = 0 }; - enum { inplace = false }; + static constexpr unsigned table_index = 0u; + static constexpr bool inplace = false; typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : @@ -1313,8 +1313,8 @@ struct GSUBProxy struct GPOSProxy { - enum { table_index = 1 }; - enum { inplace = true }; + static constexpr unsigned table_index = 1u; + static constexpr bool inplace = true; typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : @@ -1387,7 +1387,7 @@ apply_string (OT::hb_ot_apply_context_t *c, if (likely (!lookup.is_reverse ())) { /* in/out forward substitution/positioning */ - if (Proxy::table_index == 0) + if (Proxy::table_index == 0u) buffer->clear_output (); buffer->idx = 0; @@ -1404,7 +1404,7 @@ apply_string (OT::hb_ot_apply_context_t *c, else { /* in-place backward substitution/positioning */ - if (Proxy::table_index == 0) + if (Proxy::table_index == 0u) buffer->remove_output (); buffer->idx = buffer->len - 1; @@ -1423,7 +1423,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, OT::hb_ot_apply_context_t c (table_index, font, buffer); c.set_recurse_func (Proxy::Lookup::apply_recurse_func); - for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) { + for (unsigned int stage_index = 0; stage_index < stages[table_index].length; stage_index++) { const stage_map_t *stage = &stages[table_index][stage_index]; for (; i < stage->last_lookup; i++) { 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 884202cb1e2..ef0bcc716df 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 @@ -33,7 +33,7 @@ void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const { - for (unsigned int i = 0; i < lookups[table_index].len; i++) + for (unsigned int i = 0; i < lookups[table_index].length; i++) hb_set_add (lookups_out, lookups[table_index][i].index); } @@ -82,7 +82,7 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, if (unlikely (!tag)) return; feature_info_t *info = feature_infos.push(); info->tag = tag; - info->seq = feature_infos.len; + info->seq = feature_infos.length; info->max_value = value; info->flags = flags; info->default_value = (flags & F_GLOBAL) ? value : 0; @@ -174,11 +174,11 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, } /* Sort features and merge duplicates */ - if (feature_infos.len) + if (feature_infos.length) { feature_infos.qsort (); unsigned int j = 0; - for (unsigned int i = 1; i < feature_infos.len; i++) + for (unsigned int i = 1; i < feature_infos.length; i++) if (feature_infos[i].tag != feature_infos[j].tag) feature_infos[++j] = feature_infos[i]; else { @@ -202,7 +202,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, /* Allocate bits now */ unsigned int next_bit = global_bit_shift + 1; - for (unsigned int i = 0; i < feature_infos.len; i++) + for (unsigned int i = 0; i < feature_infos.length; i++) { const feature_info_t *info = &feature_infos[i]; @@ -292,7 +292,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, key.variations_index[table_index], global_bit_mask); - for (unsigned i = 0; i < m.features.len; i++) + for (unsigned i = 0; i < m.features.length; i++) if (m.features[i].stage[table_index] == stage) add_lookups (m, table_index, m.features[i].index[table_index], @@ -303,12 +303,12 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, m.features[i].random); /* Sort lookups and merge duplicates */ - if (last_num_lookups < m.lookups[table_index].len) + if (last_num_lookups < m.lookups[table_index].length) { - m.lookups[table_index].qsort (last_num_lookups, m.lookups[table_index].len); + m.lookups[table_index].qsort (last_num_lookups, m.lookups[table_index].length); unsigned int j = last_num_lookups; - for (unsigned int i = j + 1; i < m.lookups[table_index].len; i++) + for (unsigned int i = j + 1; i < m.lookups[table_index].length; i++) if (m.lookups[table_index][i].index != m.lookups[table_index][j].index) m.lookups[table_index][++j] = m.lookups[table_index][i]; else @@ -320,9 +320,9 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, m.lookups[table_index].shrink (j + 1); } - last_num_lookups = m.lookups[table_index].len; + last_num_lookups = m.lookups[table_index].length; - if (stage_index < stages[table_index].len && stages[table_index][stage_index].index == stage) { + if (stage_index < stages[table_index].length && stages[table_index][stage_index].index == stage) { hb_ot_map_t::stage_map_t *stage_map = m.stages[table_index].push (); stage_map->last_lookup = last_num_lookups; stage_map->pause_func = stages[table_index][stage_index].pause_func; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh index 35e94934019..28407c2176e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh @@ -145,9 +145,9 @@ struct hb_ot_map_t *lookup_count = 0; return; } - assert (stage <= stages[table_index].len); + assert (stage <= stages[table_index].length); unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0; - unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].last_lookup : lookups[table_index].len; + unsigned int end = stage < stages[table_index].length ? stages[table_index][stage].last_lookup : lookups[table_index].length; *plookups = end == start ? nullptr : &lookups[table_index][start]; *lookup_count = end - start; } @@ -167,9 +167,9 @@ struct hb_ot_map_t hb_mask_t global_mask; - hb_vector_t<feature_map_t, 8> features; - hb_vector_t<lookup_map_t, 16> lookups[2]; /* GSUB/GPOS */ - hb_vector_t<stage_map_t, 4> stages[2]; /* GSUB/GPOS */ + hb_vector_t<feature_map_t> features; + hb_vector_t<lookup_map_t> lookups[2]; /* GSUB/GPOS */ + hb_vector_t<stage_map_t> stages[2]; /* GSUB/GPOS */ }; enum hb_ot_map_feature_flags_t @@ -275,8 +275,8 @@ struct hb_ot_map_builder_t private: unsigned int current_stage[2]; /* GSUB/GPOS */ - hb_vector_t<feature_info_t, 32> feature_infos; - hb_vector_t<stage_info_t, 8> stages[2]; /* GSUB/GPOS */ + hb_vector_t<feature_info_t> feature_infos; + hb_vector_t<stage_info_t> stages[2]; /* GSUB/GPOS */ }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh index 120ab065465..62bf072e94d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh @@ -510,7 +510,7 @@ struct MathGlyphAssembly { int scale = font->dir_scale (direction); hb_array_t<const MathGlyphPartRecord> arr = partRecords.sub_array (start_offset, parts_count); - unsigned int count = arr.len; + unsigned int count = arr.length; for (unsigned int i = 0; i < count; i++) arr[i].extract (parts[i], scale, font); } @@ -555,7 +555,7 @@ struct MathGlyphConstruction { int scale = font->dir_scale (direction); hb_array_t<const MathGlyphVariantRecord> arr = mathGlyphVariantRecord.sub_array (start_offset, variants_count); - unsigned int count = arr.len; + unsigned int count = arr.length; for (unsigned int i = 0; i < count; i++) { variants[i].glyph = arr[i].variantGlyph; @@ -679,7 +679,7 @@ struct MathVariants struct MATH { - enum { tableTag = HB_OT_TAG_MATH }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_MATH; bool has_data () const { return version.to_int (); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh index ba474fd585d..e4b67ab2915 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh @@ -71,7 +71,7 @@ struct maxpV1Tail struct maxp { - enum { tableTag = HB_OT_TAG_maxp }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_maxp; unsigned int get_num_glyphs () const { return numGlyphs; } @@ -105,7 +105,7 @@ struct maxp } maxp *maxp_prime = (maxp *) hb_blob_get_data (maxp_prime_blob, nullptr); - maxp_prime->set_num_glyphs (plan->glyphs.len); + maxp_prime->set_num_glyphs (plan->glyphs.length); if (plan->drop_hints) drop_hint_fields (plan, maxp_prime); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh index 705ae0e9215..c8ababd7b83 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh @@ -151,7 +151,7 @@ _hb_ot_name_entry_cmp (const void *pa, const void *pb) struct name { - enum { tableTag = HB_OT_TAG_name }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_name; unsigned int get_size () const { return min_size + count * nameRecordZ.item_size; } @@ -188,9 +188,9 @@ struct name this->table->count); this->names.init (); - this->names.alloc (all_names.len); + this->names.alloc (all_names.length); - for (unsigned int i = 0; i < all_names.len; i++) + for (unsigned int i = 0; i < all_names.length; i++) { hb_ot_name_entry_t *entry = this->names.push (); @@ -204,7 +204,7 @@ struct name /* Walk and pick best only for each name_id,language pair, * while dropping unsupported encodings. */ unsigned int j = 0; - for (unsigned int i = 0; i < this->names.len; i++) + for (unsigned int i = 0; i < this->names.length; i++) { if (this->names[i].entry_score == UNSUPPORTED || this->names[i].language == HB_LANGUAGE_INVALID) @@ -231,8 +231,8 @@ struct name const hb_ot_name_entry_t key = {name_id, {0}, language}; const hb_ot_name_entry_t *entry = (const hb_ot_name_entry_t *) hb_bsearch (&key, - this->names.arrayZ(), - this->names.len, + (const hb_ot_name_entry_t *) this->names, + this->names.length, sizeof (key), _hb_ot_name_entry_cmp_key); if (!entry) @@ -263,7 +263,7 @@ struct name /* We only implement format 0 for now. */ HBUINT16 format; /* Format selector (=0/1). */ HBUINT16 count; /* Number of name records. */ - OffsetTo<UnsizedArrayOf<HBUINT8>, HBUINT16, false> + NNOffsetTo<UnsizedArrayOf<HBUINT8> > stringOffset; /* Offset to start of string storage (from start of table). */ UnsizedArrayOf<NameRecord> nameRecordZ; /* The name records where count is the number of records. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name.cc index b2eda293137..907ae6ab504 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name.cc @@ -59,8 +59,8 @@ hb_ot_name_list_names (hb_face_t *face, unsigned int *num_entries /* OUT */) { const OT::name_accelerator_t &name = *face->table.name; - if (num_entries) *num_entries = name.names.len; - return name.names.arrayZ(); + if (num_entries) *num_entries = name.names.length; + return (const hb_ot_name_entry_t *) name.names; } @@ -70,7 +70,7 @@ hb_ot_name_convert_utf (hb_bytes_t bytes, unsigned int *text_size /* IN/OUT */, typename out_utf_t::codepoint_t *text /* OUT */) { - unsigned int src_len = bytes.len / sizeof (typename in_utf_t::codepoint_t); + unsigned int src_len = bytes.length / sizeof (typename in_utf_t::codepoint_t); const typename in_utf_t::codepoint_t *src = (const typename in_utf_t::codepoint_t *) bytes.arrayZ; const typename in_utf_t::codepoint_t *src_end = src + src_len; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh index 4c1812c3229..68dd63e01e5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh @@ -92,7 +92,7 @@ struct OS2V5Tail struct OS2 { - enum { tableTag = HB_OT_TAG_OS2 }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_OS2; bool has_data () const { return this != &Null (OS2); } 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 33b7070ee08..43c1143cf58 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 @@ -71,7 +71,7 @@ struct postV2Tail struct post { - enum { tableTag = HB_OT_TAG_post }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_post; bool subset (hb_subset_plan_t *plan) const { @@ -114,7 +114,7 @@ struct post const uint8_t *end = (const uint8_t *) (const void *) table + table_length; for (const uint8_t *data = pool; - index_to_offset.len < 65535 && data < end && data + *data < end; + index_to_offset.length < 65535 && data < end && data + *data < end; data += 1 + *data) index_to_offset.push (data - pool); } @@ -129,9 +129,9 @@ struct post char *buf, unsigned int buf_len) const { hb_bytes_t s = find_glyph_name (glyph); - if (!s.len) return false; + if (!s.length) return false; if (!buf_len) return true; - unsigned int len = MIN (buf_len - 1, s.len); + unsigned int len = MIN (buf_len - 1, s.length); strncpy (buf, s.arrayZ, len); buf[len] = '\0'; return true; @@ -226,7 +226,7 @@ struct post return format1_names (index); index -= NUM_FORMAT1_NAMES; - if (index >= index_to_offset.len) + if (index >= index_to_offset.length) return hb_bytes_t (); unsigned int offset = index_to_offset[index]; @@ -241,7 +241,7 @@ struct post hb_blob_ptr_t<post> table; uint32_t version; const ArrayOf<HBUINT16> *glyphNameIndex; - hb_vector_t<uint32_t, 1> index_to_offset; + hb_vector_t<uint32_t> index_to_offset; const uint8_t *pool; hb_atomic_ptr_t<uint16_t *> gids_sorted_by_name; }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc index b7e4e7c7c0b..43b5ef8b7b8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc @@ -16,6 +16,8 @@ #include "hb-ot-shape-complex-indic.hh" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-macros" #define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 16 chars; Avagraha */ #define ISC_Bi INDIC_SYLLABIC_CATEGORY_BINDU /* 83 chars; Bindu */ @@ -69,6 +71,7 @@ #define IMC_TLR INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT /* 4 chars; Top_And_Left_And_Right */ #define IMC_TR INDIC_MATRA_CATEGORY_TOP_AND_RIGHT /* 13 chars; Top_And_Right */ #define IMC_VOL INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT /* 19 chars; Visual_Order_Left */ +#pragma GCC diagnostic pop #define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M) 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 2f3eb703eaa..835b95bbfc9 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 @@ -17,6 +17,8 @@ #include "hb-ot-shape-complex-use.hh" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-macros" #define B USE_B /* BASE */ #define CGJ USE_CGJ /* CGJ */ #define CS USE_CS /* CONS_WITH_STACKER */ @@ -55,6 +57,7 @@ #define VMBlw USE_VMBlw #define VMPst USE_VMPst #define VMAbv USE_VMAbv +#pragma GCC diagnostic pop static const USE_TABLE_ELEMENT_TYPE use_table[] = { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc index d3afdffaf2c..f9d4a75f51c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc @@ -180,12 +180,18 @@ _hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t static void zero_mark_advances (hb_buffer_t *buffer, unsigned int start, - unsigned int end) + unsigned int end, + bool adjust_offsets_when_zeroing) { hb_glyph_info_t *info = buffer->info; for (unsigned int i = start; i < end; i++) if (_hb_glyph_info_get_general_category (&info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) { + if (adjust_offsets_when_zeroing) + { + buffer->pos[i].x_offset -= buffer->pos[i].x_advance; + buffer->pos[i].y_offset -= buffer->pos[i].y_advance; + } buffer->pos[i].x_advance = 0; buffer->pos[i].y_advance = 0; } @@ -303,7 +309,8 @@ position_around_base (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer, unsigned int base, - unsigned int end) + unsigned int end, + bool adjust_offsets_when_zeroing) { hb_direction_t horiz_dir = HB_DIRECTION_INVALID; @@ -314,11 +321,15 @@ position_around_base (const hb_ot_shape_plan_t *plan, &base_extents)) { /* If extents don't work, zero marks and go home. */ - zero_mark_advances (buffer, base + 1, end); + zero_mark_advances (buffer, base + 1, end, adjust_offsets_when_zeroing); return; } - base_extents.x_bearing += buffer->pos[base].x_offset; base_extents.y_bearing += buffer->pos[base].y_offset; + /* Use horizontal advance for horizontal positioning. + * Generally a better idea. Also works for zero-ink glyphs. See: + * https://github.com/harfbuzz/harfbuzz/issues/1532 */ + base_extents.x_bearing = 0; + base_extents.width = font->get_glyph_h_advance (buffer->info[base].codepoint); unsigned int lig_id = _hb_glyph_info_get_lig_id (&buffer->info[base]); /* Use integer for num_lig_components such that it doesn't convert to unsigned @@ -394,7 +405,8 @@ position_cluster (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer, unsigned int start, - unsigned int end) + unsigned int end, + bool adjust_offsets_when_zeroing) { if (end - start < 2) return; @@ -410,7 +422,7 @@ position_cluster (const hb_ot_shape_plan_t *plan, if (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[j]))) break; - position_around_base (plan, font, buffer, i, j); + position_around_base (plan, font, buffer, i, j, adjust_offsets_when_zeroing); i = j - 1; } @@ -419,7 +431,8 @@ position_cluster (const hb_ot_shape_plan_t *plan, void _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, hb_font_t *font, - hb_buffer_t *buffer) + hb_buffer_t *buffer, + bool adjust_offsets_when_zeroing) { _hb_buffer_assert_gsubgpos_vars (buffer); @@ -428,10 +441,10 @@ _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, hb_glyph_info_t *info = buffer->info; for (unsigned int i = 1; i < count; i++) if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])))) { - position_cluster (plan, font, buffer, start, i); + position_cluster (plan, font, buffer, start, i, adjust_offsets_when_zeroing); start = i; } - position_cluster (plan, font, buffer, start, count); + position_cluster (plan, font, buffer, start, count, adjust_offsets_when_zeroing); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.hh index 12f18ed12f2..5faf5f2dfb1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.hh @@ -34,7 +34,8 @@ HB_INTERNAL void _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, hb_font_t *font, - hb_buffer_t *buffer); + hb_buffer_t *buffer, + bool adjust_offsets_when_zeroing); HB_INTERNAL void _hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t *plan, hb_font_t *font, 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 6e5ce1523a3..e9d97c9b062 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 @@ -428,6 +428,20 @@ hb_set_unicode_props (hb_buffer_t *buffer) _hb_glyph_info_set_continuation (&info[i]); } } + /* Or part of the Other_Grapheme_Extend that is not marks. + * As of Unicode 11 that is just: + * + * 200C ; Other_Grapheme_Extend # Cf ZERO WIDTH NON-JOINER + * FF9E..FF9F ; Other_Grapheme_Extend # Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK + * E0020..E007F ; Other_Grapheme_Extend # Cf [96] TAG SPACE..CANCEL TAG + * + * ZWNJ is special, we don't want to merge it as there's no need, and keeping + * it separate results in more granular clusters. Ignore Katakana for now. + * Tags are used for Emoji sub-region flag sequences: + * https://github.com/harfbuzz/harfbuzz/issues/1556 + */ + else if (unlikely (hb_in_range<hb_codepoint_t> (info[i].codepoint, 0xE0020u, 0xE007Fu))) + _hb_glyph_info_set_continuation (&info[i]); } } @@ -891,7 +905,8 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c) &pos[i].y_offset); if (c->plan->fallback_mark_positioning) - _hb_ot_shape_fallback_mark_position (c->plan, c->font, c->buffer); + _hb_ot_shape_fallback_mark_position (c->plan, c->font, c->buffer, + adjust_offsets_when_zeroing); } static inline void diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh index ffab28c8b10..04a2ee99e8c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh @@ -225,7 +225,7 @@ struct StatAxisRecord struct STAT { - enum { tableTag = HB_OT_TAG_STAT }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_STAT; bool sanitize (hb_sanitize_context_t *c) const { @@ -249,7 +249,7 @@ struct STAT * in the 'fvar' table. In all fonts, must * be greater than zero if axisValueCount * is greater than zero. */ - LOffsetTo<UnsizedArrayOf<StatAxisRecord>, false> + LNNOffsetTo<UnsizedArrayOf<StatAxisRecord> > designAxesOffset; /* Offset in bytes from the beginning of * the STAT table to the start of the design @@ -257,7 +257,7 @@ struct STAT * set to zero; if designAxisCount is greater * than zero, must be greater than zero. */ HBUINT16 axisValueCount; /* The number of axis value tables. */ - LOffsetTo<UnsizedArrayOf<OffsetTo<AxisValue> >, false> + LNNOffsetTo<UnsizedArrayOf<OffsetTo<AxisValue> > > offsetToAxisValueOffsets; /* Offset in bytes from the beginning of * the STAT table to the start of the design diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh index 67a60f5e0c5..c4a192dc918 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh @@ -99,7 +99,7 @@ struct SegmentMaps : ArrayOf<AxisValueMap> struct avar { - enum { tableTag = HB_OT_TAG_avar }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_avar; bool sanitize (hb_sanitize_context_t *c) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh index 76c9eb2cc44..78cb3c867fa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh @@ -96,7 +96,7 @@ struct AxisRecord struct fvar { - enum { tableTag = HB_OT_TAG_fvar }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_fvar; bool has_data () const { return version.to_int (); } @@ -268,7 +268,7 @@ struct fvar { hb_array_t<const Fixed> instanceCoords = instance->get_coordinates (axisCount) .sub_array (0, *coords_length); - for (unsigned int i = 0; i < instanceCoords.len; i++) + for (unsigned int i = 0; i < instanceCoords.length; i++) coords[i] = instanceCoords.arrayZ[i].to_float (); } return axisCount; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh index 2640f07ee19..a8d9fe3c875 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh @@ -100,8 +100,8 @@ struct DeltaSetIndexMap struct HVARVVAR { - enum { HVARTag = HB_OT_TAG_HVAR }; - enum { VVARTag = HB_OT_TAG_VVAR }; + static constexpr hb_tag_t HVARTag = HB_OT_TAG_HVAR; + static constexpr hb_tag_t VVARTag = HB_OT_TAG_VVAR; bool sanitize (hb_sanitize_context_t *c) const { @@ -140,10 +140,10 @@ struct HVARVVAR }; struct HVAR : HVARVVAR { - enum { tableTag = HB_OT_TAG_HVAR }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_HVAR; }; struct VVAR : HVARVVAR { - enum { tableTag = HB_OT_TAG_VVAR }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_VVAR; bool sanitize (hb_sanitize_context_t *c) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh index a5eeddc5427..0dd63e510b4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh @@ -58,7 +58,7 @@ struct VariationValueRecord struct MVAR { - enum { tableTag = HB_OT_TAG_MVAR }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_MVAR; bool sanitize (hb_sanitize_context_t *c) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh index 884d04312ff..0202fcc5658 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh @@ -57,7 +57,7 @@ struct VertOriginMetric struct VORG { - enum { tableTag = HB_OT_TAG_VORG }; + static constexpr hb_tag_t tableTag = HB_OT_TAG_VORG; bool has_data () const { return version.to_int (); } @@ -85,12 +85,12 @@ struct VORG subset_table->version.minor.set (0); subset_table->defaultVertOriginY.set (vorg_table->defaultVertOriginY); - subset_table->vertYOrigins.len.set (subset_metrics.len); + subset_table->vertYOrigins.len.set (subset_metrics.length); bool success = true; - if (subset_metrics.len > 0) + if (subset_metrics.length > 0) { - unsigned int size = VertOriginMetric::static_size * subset_metrics.len; + unsigned int size = VertOriginMetric::static_size * subset_metrics.length; VertOriginMetric *metrics = c.allocate_size<VertOriginMetric> (size); if (likely (metrics != nullptr)) memcpy (metrics, &subset_metrics[0], size); @@ -112,7 +112,7 @@ struct VORG subset_metrics.init (); unsigned int glyph = 0; unsigned int i = 0; - while ((glyph < plan->glyphs.len) && (i < vertYOrigins.len)) + while ((glyph < plan->glyphs.length) && (i < vertYOrigins.len)) { if (plan->glyphs[glyph] > vertYOrigins[i].glyph) i++; @@ -129,7 +129,7 @@ struct VORG } /* alloc the new table */ - unsigned int dest_sz = VORG::min_size + VertOriginMetric::static_size * subset_metrics.len; + unsigned int dest_sz = VORG::min_size + VertOriginMetric::static_size * subset_metrics.length; void *dest = (void *) malloc (dest_sz); if (unlikely (!dest)) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh index 9f49af17810..b97526f7750 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh @@ -48,15 +48,15 @@ template <typename mask_t, unsigned int shift> struct hb_set_digest_lowest_bits_t { - enum { mask_bytes = sizeof (mask_t) }; - enum { mask_bits = sizeof (mask_t) * 8 }; - enum { num_bits = 0 - + (mask_bytes >= 1 ? 3 : 0) - + (mask_bytes >= 2 ? 1 : 0) - + (mask_bytes >= 4 ? 1 : 0) - + (mask_bytes >= 8 ? 1 : 0) - + (mask_bytes >= 16? 1 : 0) - + 0 }; + static constexpr unsigned mask_bytes = sizeof (mask_t); + static constexpr unsigned mask_bits = sizeof (mask_t) * 8; + static constexpr unsigned num_bits = 0 + + (mask_bytes >= 1 ? 3 : 0) + + (mask_bytes >= 2 ? 1 : 0) + + (mask_bytes >= 4 ? 1 : 0) + + (mask_bytes >= 8 ? 1 : 0) + + (mask_bytes >= 16? 1 : 0) + + 0; static_assert ((shift < sizeof (hb_codepoint_t) * 8), ""); static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), ""); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh index 19596880e61..64a136385ff 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh @@ -161,7 +161,7 @@ struct hb_set_t } typedef unsigned long long elt_t; - enum { PAGE_BITS = 512 }; + static constexpr unsigned PAGE_BITS = 512; static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, ""); static unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); } @@ -169,10 +169,10 @@ struct hb_set_t typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t; - enum { ELT_BITS = sizeof (elt_t) * 8 }; - enum { ELT_MASK = ELT_BITS - 1 }; - enum { BITS = sizeof (vector_t) * 8 }; - enum { MASK = BITS - 1 }; + static constexpr unsigned ELT_BITS = sizeof (elt_t) * 8; + static constexpr unsigned ELT_MASK = ELT_BITS - 1; + static constexpr unsigned BITS = sizeof (vector_t) * 8; + static constexpr unsigned MASK = BITS - 1; static_assert ((unsigned) PAGE_BITS == (unsigned) BITS, ""); elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; } @@ -186,8 +186,8 @@ struct hb_set_t hb_object_header_t header; bool successful; /* Allocations successful */ mutable unsigned int population; - hb_vector_t<page_map_t, 1> page_map; - hb_vector_t<page_t, 1> pages; + hb_vector_t<page_map_t> page_map; + hb_vector_t<page_t> pages; void init_shallow () { @@ -220,7 +220,7 @@ struct hb_set_t if (unlikely (!successful)) return false; if (!pages.resize (count) || !page_map.resize (count)) { - pages.resize (page_map.len); + pages.resize (page_map.length); successful = false; return false; } @@ -238,7 +238,7 @@ struct hb_set_t } bool is_empty () const { - unsigned int count = pages.len; + unsigned int count = pages.length; for (unsigned int i = 0; i < count; i++) if (!pages[i].is_empty ()) return false; @@ -373,7 +373,7 @@ struct hb_set_t void set (const hb_set_t *other) { if (unlikely (!successful)) return; - unsigned int count = other->pages.len; + unsigned int count = other->pages.length; if (!resize (count)) return; population = other->population; @@ -386,8 +386,8 @@ struct hb_set_t if (get_population () != other->get_population ()) return false; - unsigned int na = pages.len; - unsigned int nb = other->pages.len; + unsigned int na = pages.length; + unsigned int nb = other->pages.length; unsigned int a = 0, b = 0; for (; a < na && b < nb; ) @@ -429,8 +429,8 @@ struct hb_set_t dirty (); - unsigned int na = pages.len; - unsigned int nb = other->pages.len; + unsigned int na = pages.length; + unsigned int nb = other->pages.length; unsigned int next_page = na; unsigned int count = 0, newCount = 0; @@ -461,7 +461,7 @@ struct hb_set_t if (Op::passthru_right) count += nb - b; - if (count > pages.len) + if (count > pages.length) if (!resize (count)) return; newCount = count; @@ -517,7 +517,7 @@ struct hb_set_t page_at (count).v = other->page_at (b).v; } assert (!count); - if (pages.len > newCount) + if (pages.length > newCount) resize (newCount); } @@ -547,7 +547,7 @@ struct hb_set_t page_map_t map = {get_major (*codepoint), 0}; unsigned int i; page_map.bfind (map, &i, HB_BFIND_NOT_FOUND_STORE_CLOSEST); - if (i < page_map.len && page_map[i].major == map.major) + if (i < page_map.length && page_map[i].major == map.major) { if (pages[page_map[i].index].next (codepoint)) { @@ -556,7 +556,7 @@ struct hb_set_t } i++; } - for (; i < page_map.len; i++) + for (; i < page_map.length; i++) { hb_codepoint_t m = pages[page_map[i].index].get_min (); if (m != INVALID) @@ -578,7 +578,7 @@ struct hb_set_t page_map_t map = {get_major (*codepoint), 0}; unsigned int i; page_map.bfind (map, &i, HB_BFIND_NOT_FOUND_STORE_CLOSEST); - if (i < page_map.len && page_map[i].major == map.major) + if (i < page_map.length && page_map[i].major == map.major) { if (pages[page_map[i].index].previous (codepoint)) { @@ -642,7 +642,7 @@ struct hb_set_t return population; unsigned int pop = 0; - unsigned int count = pages.len; + unsigned int count = pages.length; for (unsigned int i = 0; i < count; i++) pop += pages[i].get_population (); @@ -651,7 +651,7 @@ struct hb_set_t } hb_codepoint_t get_min () const { - unsigned int count = pages.len; + unsigned int count = pages.length; for (unsigned int i = 0; i < count; i++) if (!page_at (i).is_empty ()) return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min (); @@ -659,28 +659,55 @@ struct hb_set_t } hb_codepoint_t get_max () const { - unsigned int count = pages.len; + unsigned int count = pages.length; for (int i = count - 1; i >= 0; i++) if (!page_at (i).is_empty ()) return page_map[(unsigned) i].major * page_t::PAGE_BITS + page_at (i).get_max (); return INVALID; } - static const hb_codepoint_t INVALID = HB_SET_VALUE_INVALID; + static constexpr hb_codepoint_t INVALID = HB_SET_VALUE_INVALID; + + /* + * Iterator implementation. + */ + struct const_iter_t : hb_sorted_iter_t<const_iter_t, const hb_codepoint_t> + { + const_iter_t (const hb_set_t &s_) : + s (s_), v (INVALID), l (s.get_population () + 1) { __next__ (); } + + typedef hb_codepoint_t __item_type__; + hb_codepoint_t __item__ () const { return v; } + bool __more__ () const { return v != INVALID; } + void __next__ () { s.next (&v); if (l) l--; } + void __prev__ () { s.previous (&v); } + unsigned __len__ () { return l; } + + protected: + const hb_set_t &s; + hb_codepoint_t v; + unsigned l; + }; + const_iter_t const_iter () const { return const_iter_t (*this); } + operator const_iter_t () const { return const_iter (); } + typedef const_iter_t iter_t; + iter_t iter () const { return const_iter (); } + + protected: page_t *page_for_insert (hb_codepoint_t g) { - page_map_t map = {get_major (g), pages.len}; + page_map_t map = {get_major (g), pages.length}; unsigned int i; if (!page_map.bfind (map, &i, HB_BFIND_NOT_FOUND_STORE_CLOSEST)) { - if (!resize (pages.len + 1)) + if (!resize (pages.length + 1)) return nullptr; pages[map.index].init0 (); memmove (page_map + i + 1, page_map + i, - (page_map.len - 1 - i) * page_map.item_size); + (page_map.length - 1 - i) * page_map.item_size); page_map[i] = map; } return &pages[page_map[i].index]; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.cc index b6127a9aba1..3e617d58bca 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.cc @@ -49,15 +49,15 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs, unsigned int &subset_fd_count /* OUT */, unsigned int &subset_fdselect_size /* OUT */, unsigned int &subset_fdselect_format /* OUT */, - hb_vector_t<code_pair> &fdselect_ranges /* OUT */, - Remap &fdmap /* OUT */) + hb_vector_t<code_pair_t> &fdselect_ranges /* OUT */, + remap_t &fdmap /* OUT */) { subset_fd_count = 0; subset_fdselect_size = 0; subset_fdselect_format = 0; unsigned int num_ranges = 0; - unsigned int subset_num_glyphs = glyphs.len; + unsigned int subset_num_glyphs = glyphs.length; if (subset_num_glyphs == 0) return true; @@ -76,7 +76,7 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs, { num_ranges++; prev_fd = fd; - code_pair pair = { fd, i }; + code_pair_t pair = { fd, i }; fdselect_ranges.push (pair); } } @@ -106,7 +106,7 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs, } /* update each font dict index stored as "code" in fdselect_ranges */ - for (unsigned int i = 0; i < fdselect_ranges.len; i++) + for (unsigned int i = 0; i < fdselect_ranges.length; i++) fdselect_ranges[i].code = fdmap[fdselect_ranges[i].code]; } @@ -148,13 +148,13 @@ serialize_fdselect_3_4 (hb_serialize_context_t *c, const unsigned int num_glyphs, const FDSelect &src, unsigned int size, - const hb_vector_t<code_pair> &fdselect_ranges) + const hb_vector_t<code_pair_t> &fdselect_ranges) { TRACE_SERIALIZE (this); FDSELECT3_4 *p = c->allocate_size<FDSELECT3_4> (size); if (unlikely (p == nullptr)) return_trace (false); - p->nRanges.set (fdselect_ranges.len); - for (unsigned int i = 0; i < fdselect_ranges.len; i++) + p->nRanges ().set (fdselect_ranges.length); + for (unsigned int i = 0; i < fdselect_ranges.length; i++) { p->ranges[i].first.set (fdselect_ranges[i].glyph); p->ranges[i].fd.set (fdselect_ranges[i].code); @@ -174,7 +174,7 @@ hb_serialize_cff_fdselect (hb_serialize_context_t *c, unsigned int fd_count, unsigned int fdselect_format, unsigned int size, - const hb_vector_t<code_pair> &fdselect_ranges) + const hb_vector_t<code_pair_t> &fdselect_ranges) { TRACE_SERIALIZE (this); FDSelect *p = c->allocate_min<FDSelect> (); 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 820a0908509..915b4c45287 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 @@ -35,16 +35,16 @@ namespace CFF { /* Used for writing a temporary charstring */ -struct StrEncoder +struct str_encoder_t { - StrEncoder (StrBuff &buff_) + str_encoder_t (str_buff_t &buff_) : buff (buff_), error (false) {} void reset () { buff.resize (0); } void encode_byte (unsigned char b) { - if (unlikely (buff.push ((const char)b) == &Crap(char))) + if (unlikely (buff.push (b) == &Crap(unsigned char))) set_error (); } @@ -79,7 +79,7 @@ struct StrEncoder } } - void encode_num (const Number& n) + void encode_num (const number_t& n) { if (n.in_int_range ()) { @@ -96,7 +96,7 @@ struct StrEncoder } } - void encode_op (OpCode op) + void encode_op (op_code_t op) { if (Is_OpCode_ESC (op)) { @@ -107,16 +107,16 @@ struct StrEncoder encode_byte (op); } - void copy_str (const ByteStr &str) + void copy_str (const byte_str_t &str) { - unsigned int offset = buff.len; - buff.resize (offset + str.len); - if (unlikely (buff.len < offset + str.len)) + unsigned int offset = buff.length; + buff.resize (offset + str.length); + if (unlikely (buff.length < offset + str.length)) { set_error (); return; } - memcpy (&buff[offset], &str.str[0], str.len); + memcpy (&buff[offset], &str[0], str.length); } bool is_error () const { return error; } @@ -124,12 +124,12 @@ struct StrEncoder protected: void set_error () { error = true; } - StrBuff &buff; + str_buff_t &buff; bool error; }; -struct CFFSubTableOffsets { - CFFSubTableOffsets () : privateDictsOffset (0) +struct cff_sub_table_offsets_t { + cff_sub_table_offsets_t () : privateDictsOffset (0) { topDictInfo.init (); FDSelectInfo.init (); @@ -139,23 +139,23 @@ struct CFFSubTableOffsets { localSubrsInfos.init (); } - ~CFFSubTableOffsets () { localSubrsInfos.fini (); } + ~cff_sub_table_offsets_t () { localSubrsInfos.fini (); } - TableInfo topDictInfo; - TableInfo FDSelectInfo; - TableInfo FDArrayInfo; - TableInfo charStringsInfo; + table_info_t topDictInfo; + table_info_t FDSelectInfo; + table_info_t FDArrayInfo; + table_info_t charStringsInfo; unsigned int privateDictsOffset; - TableInfo globalSubrsInfo; - hb_vector_t<TableInfo> localSubrsInfos; + table_info_t globalSubrsInfo; + hb_vector_t<table_info_t> localSubrsInfos; }; -template <typename OPSTR=OpStr> -struct CFFTopDict_OpSerializer : OpSerializer +template <typename OPSTR=op_str_t> +struct cff_top_dict_op_serializer_t : op_serializer_t { bool serialize (hb_serialize_context_t *c, const OPSTR &opstr, - const CFFSubTableOffsets &offsets) const + const cff_sub_table_offsets_t &offsets) const { TRACE_SERIALIZE (this); @@ -186,16 +186,16 @@ struct CFFTopDict_OpSerializer : OpSerializer return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op); default: - return opstr.str.len; + return opstr.str.length; } } }; -struct CFFFontDict_OpSerializer : OpSerializer +struct cff_font_dict_op_serializer_t : op_serializer_t { bool serialize (hb_serialize_context_t *c, - const OpStr &opstr, - const TableInfo &privateDictInfo) const + const op_str_t &opstr, + const table_info_t &privateDictInfo) const { TRACE_SERIALIZE (this); @@ -215,34 +215,34 @@ struct CFFFontDict_OpSerializer : OpSerializer } else { - HBUINT8 *d = c->allocate_size<HBUINT8> (opstr.str.len); + HBUINT8 *d = c->allocate_size<HBUINT8> (opstr.str.length); if (unlikely (d == nullptr)) return_trace (false); - memcpy (d, &opstr.str.str[0], opstr.str.len); + memcpy (d, &opstr.str[0], opstr.str.length); } return_trace (true); } - unsigned int calculate_serialized_size (const OpStr &opstr) const + unsigned int calculate_serialized_size (const op_str_t &opstr) const { if (opstr.op == OpCode_Private) return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Private); else - return opstr.str.len; + return opstr.str.length; } }; -struct CFFPrivateDict_OpSerializer : OpSerializer +struct cff_private_dict_op_serializer_t : op_serializer_t { - CFFPrivateDict_OpSerializer (bool desubroutinize_, bool drop_hints_) + 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 OpStr &opstr, + const op_str_t &opstr, const unsigned int subrsOffset) const { TRACE_SERIALIZE (this); - if (drop_hints && DictOpSet::is_hint_op (opstr.op)) + if (drop_hints && dict_opset_t::is_hint_op (opstr.op)) return true; if (opstr.op == OpCode_Subrs) { @@ -255,10 +255,10 @@ struct CFFPrivateDict_OpSerializer : OpSerializer return_trace (copy_opstr (c, opstr)); } - unsigned int calculate_serialized_size (const OpStr &opstr, + unsigned int calculate_serialized_size (const op_str_t &opstr, bool has_localsubr=true) const { - if (drop_hints && DictOpSet::is_hint_op (opstr.op)) + if (drop_hints && dict_opset_t::is_hint_op (opstr.op)) return 0; if (opstr.op == OpCode_Subrs) { @@ -268,7 +268,7 @@ struct CFFPrivateDict_OpSerializer : OpSerializer return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (opstr.op); } else - return opstr.str.len; + return opstr.str.length; } protected: @@ -276,39 +276,36 @@ struct CFFPrivateDict_OpSerializer : OpSerializer const bool drop_hints; }; -struct FlattenParam +struct flatten_param_t { - StrBuff &flatStr; + str_buff_t &flatStr; bool drop_hints; }; template <typename ACC, typename ENV, typename OPSET> -struct SubrFlattener +struct subr_flattener_t { - SubrFlattener (const ACC &acc_, - const hb_vector_t<hb_codepoint_t> &glyphs_, - bool drop_hints_) - : acc (acc_), - glyphs (glyphs_), - drop_hints (drop_hints_) - {} + subr_flattener_t (const ACC &acc_, + const hb_vector_t<hb_codepoint_t> &glyphs_, + bool drop_hints_) : acc (acc_), glyphs (glyphs_), + drop_hints (drop_hints_) {} - bool flatten (StrBuffArray &flat_charstrings) + bool flatten (str_buff_vec_t &flat_charstrings) { - if (!flat_charstrings.resize (glyphs.len)) + if (!flat_charstrings.resize (glyphs.length)) return false; - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) flat_charstrings[i].init (); - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) { hb_codepoint_t glyph = glyphs[i]; - const ByteStr str = (*acc.charStrings)[glyph]; + const byte_str_t str = (*acc.charStrings)[glyph]; unsigned int fd = acc.fdSelect->get_fd (glyph); if (unlikely (fd >= acc.fdCount)) return false; - CSInterpreter<ENV, OPSET, FlattenParam> interp; + cs_interpreter_t<ENV, OPSET, flatten_param_t> interp; interp.env.init (str, acc, fd); - FlattenParam param = { flat_charstrings[i], drop_hints }; + flatten_param_t param = { flat_charstrings[i], drop_hints }; if (unlikely (!interp.interpret (param))) return false; } @@ -320,9 +317,9 @@ struct SubrFlattener bool drop_hints; }; -struct SubrClosures +struct subr_closures_t { - SubrClosures () : valid (false), global_closure (nullptr) + subr_closures_t () : valid (false), global_closure (nullptr) { local_closures.init (); } void init (unsigned int fd_count) @@ -334,7 +331,7 @@ struct SubrClosures if (!local_closures.resize (fd_count)) valid = false; - for (unsigned int i = 0; i < local_closures.len; i++) + for (unsigned int i = 0; i < local_closures.length; i++) { local_closures[i] = hb_set_create (); if (local_closures[i] == hb_set_get_empty ()) @@ -345,7 +342,7 @@ struct SubrClosures void fini () { hb_set_destroy (global_closure); - for (unsigned int i = 0; i < local_closures.len; i++) + for (unsigned int i = 0; i < local_closures.length; i++) hb_set_destroy (local_closures[i]); local_closures.fini (); } @@ -353,7 +350,7 @@ struct SubrClosures void reset () { hb_set_clear (global_closure); - for (unsigned int i = 0; i < local_closures.len; i++) + for (unsigned int i = 0; i < local_closures.length; i++) hb_set_clear (local_closures[i]); } @@ -363,18 +360,18 @@ struct SubrClosures hb_vector_t<hb_set_t *> local_closures; }; -struct ParsedCSOp : OpStr +struct parsed_cs_op_t : op_str_t { void init (unsigned int subr_num_ = 0) { - OpStr::init (); + op_str_t::init (); subr_num = subr_num_; drop_flag = false; keep_flag = false; skip_flag = false; } - void fini () { OpStr::fini (); } + void fini () { op_str_t::fini (); } bool for_drop () const { return drop_flag; } void set_drop () { if (!for_keep ()) drop_flag = true; } @@ -393,7 +390,7 @@ struct ParsedCSOp : OpStr bool skip_flag : 1; }; -struct ParsedCStr : ParsedValues<ParsedCSOp> +struct parsed_cs_str_t : parsed_values_t<parsed_cs_op_t> { void init () { @@ -403,13 +400,13 @@ struct ParsedCStr : ParsedValues<ParsedCSOp> has_prefix_ = false; } - void add_op (OpCode op, const SubByteStr& substr) + void add_op (op_code_t op, const byte_str_ref_t& str_ref) { if (!is_parsed ()) - SUPER::add_op (op, substr); + SUPER::add_op (op, str_ref); } - void add_call_op (OpCode op, const SubByteStr& substr, unsigned int subr_num) + void add_call_op (op_code_t op, const byte_str_ref_t& str_ref, unsigned int subr_num) { if (!is_parsed ()) { @@ -417,13 +414,13 @@ struct ParsedCStr : ParsedValues<ParsedCSOp> if (likely (parsed_len > 0)) values[parsed_len-1].set_skip (); - ParsedCSOp val; + parsed_cs_op_t val; val.init (subr_num); - SUPER::add_op (op, substr, val); + SUPER::add_op (op, str_ref, val); } } - void set_prefix (const Number &num, OpCode op = OpCode_Invalid) + void set_prefix (const number_t &num, op_code_t op = OpCode_Invalid) { has_prefix_ = true; prefix_op_ = op; @@ -432,7 +429,7 @@ struct ParsedCStr : ParsedValues<ParsedCSOp> bool at_end (unsigned int pos) const { - return ((pos + 1 >= values.len) /* CFF2 */ + return ((pos + 1 >= values.length) /* CFF2 */ || (values[pos + 1].op == OpCode_return)); } @@ -446,42 +443,42 @@ struct ParsedCStr : ParsedValues<ParsedCSOp> void set_vsindex_dropped () { vsindex_dropped = true; } bool has_prefix () const { return has_prefix_; } - OpCode prefix_op () const { return prefix_op_; } - const Number &prefix_num () const { return prefix_num_; } + op_code_t prefix_op () const { return prefix_op_; } + const number_t &prefix_num () const { return prefix_num_; } protected: bool parsed; bool hint_dropped; bool vsindex_dropped; bool has_prefix_; - OpCode prefix_op_; - Number prefix_num_; + op_code_t prefix_op_; + number_t prefix_num_; private: - typedef ParsedValues<ParsedCSOp> SUPER; + typedef parsed_values_t<parsed_cs_op_t> SUPER; }; -struct ParsedCStrs : hb_vector_t<ParsedCStr> +struct parsed_cs_str_vec_t : hb_vector_t<parsed_cs_str_t> { void init (unsigned int len_ = 0) { SUPER::init (); resize (len_); - for (unsigned int i = 0; i < len; i++) + for (unsigned int i = 0; i < length; i++) (*this)[i].init (); } void fini () { SUPER::fini_deep (); } private: - typedef hb_vector_t<ParsedCStr> SUPER; + typedef hb_vector_t<parsed_cs_str_t> SUPER; }; -struct SubrSubsetParam +struct subr_subset_param_t { - void init (ParsedCStr *parsed_charstring_, - ParsedCStrs *parsed_global_subrs_, ParsedCStrs *parsed_local_subrs_, - hb_set_t *global_closure_, hb_set_t *local_closure_, - bool drop_hints_) + void init (parsed_cs_str_t *parsed_charstring_, + parsed_cs_str_vec_t *parsed_global_subrs_, parsed_cs_str_vec_t *parsed_local_subrs_, + hb_set_t *global_closure_, hb_set_t *local_closure_, + bool drop_hints_) { parsed_charstring = parsed_charstring_; current_parsed_str = parsed_charstring; @@ -492,7 +489,7 @@ struct SubrSubsetParam drop_hints = drop_hints_; } - ParsedCStr *get_parsed_str_for_context (CallContext &context) + parsed_cs_str_t *get_parsed_str_for_context (call_context_t &context) { switch (context.type) { @@ -500,12 +497,12 @@ struct SubrSubsetParam return parsed_charstring; case CSType_LocalSubr: - if (likely (context.subr_num < parsed_local_subrs->len)) + if (likely (context.subr_num < parsed_local_subrs->length)) return &(*parsed_local_subrs)[context.subr_num]; break; case CSType_GlobalSubr: - if (likely (context.subr_num < parsed_global_subrs->len)) + if (likely (context.subr_num < parsed_global_subrs->length)) return &(*parsed_global_subrs)[context.subr_num]; break; } @@ -515,13 +512,13 @@ struct SubrSubsetParam template <typename ENV> void set_current_str (ENV &env, bool calling) { - ParsedCStr *parsed_str = get_parsed_str_for_context (env.context); + parsed_cs_str_t *parsed_str = get_parsed_str_for_context (env.context); if (likely (parsed_str != nullptr)) { /* If the called subroutine is parsed partially but not completely yet, * it must be because we are calling it recursively. * Handle it as an error. */ - if (unlikely (calling && !parsed_str->is_parsed () && (parsed_str->values.len > 0))) + if (unlikely (calling && !parsed_str->is_parsed () && (parsed_str->values.length > 0))) env.set_error (); else current_parsed_str = parsed_str; @@ -530,17 +527,17 @@ struct SubrSubsetParam env.set_error (); } - ParsedCStr *current_parsed_str; + parsed_cs_str_t *current_parsed_str; - ParsedCStr *parsed_charstring; - ParsedCStrs *parsed_global_subrs; - ParsedCStrs *parsed_local_subrs; + parsed_cs_str_t *parsed_charstring; + parsed_cs_str_vec_t *parsed_global_subrs; + parsed_cs_str_vec_t *parsed_local_subrs; hb_set_t *global_closure; hb_set_t *local_closure; bool drop_hints; }; -struct SubrRemap : Remap +struct subr_remap_t : remap_t { void create (hb_set_t *closure) { @@ -548,7 +545,7 @@ struct SubrRemap : Remap * no optimization based on usage counts. fonttools doesn't appear doing that either. */ reset (closure->get_max () + 1); - for (hb_codepoint_t old_num = 0; old_num < len; old_num++) + for (hb_codepoint_t old_num = 0; old_num < length; old_num++) { if (hb_set_has (closure, old_num)) add (old_num); @@ -564,10 +561,10 @@ struct SubrRemap : Remap hb_codepoint_t operator[] (unsigned int old_num) const { - if (old_num >= len) + if (old_num >= length) return CFF_UNDEF_CODE; else - return Remap::operator[] (old_num); + return remap_t::operator[] (old_num); } int biased_num (unsigned int old_num) const @@ -580,15 +577,15 @@ struct SubrRemap : Remap int bias; }; -struct SubrRemaps +struct subr_remap_ts { - SubrRemaps () + subr_remap_ts () { global_remap.init (); local_remaps.init (); } - ~SubrRemaps () { fini (); } + ~subr_remap_ts () { fini (); } void init (unsigned int fdCount) { @@ -597,10 +594,10 @@ struct SubrRemaps local_remaps[i].init (); } - void create (SubrClosures& closures) + void create (subr_closures_t& closures) { global_remap.create (closures.global_closure); - for (unsigned int i = 0; i < local_remaps.len; i++) + for (unsigned int i = 0; i < local_remaps.length; i++) local_remaps[i].create (closures.local_closures[i]); } @@ -610,21 +607,21 @@ struct SubrRemaps local_remaps.fini_deep (); } - SubrRemap global_remap; - hb_vector_t<SubrRemap> local_remaps; + subr_remap_t global_remap; + hb_vector_t<subr_remap_t> local_remaps; }; template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET> -struct SubrSubsetter +struct subr_subsetter_t { - SubrSubsetter () + subr_subsetter_t () { parsed_charstrings.init (); parsed_global_subrs.init (); parsed_local_subrs.init (); } - ~SubrSubsetter () + ~subr_subsetter_t () { closures.fini (); remaps.fini (); @@ -652,7 +649,7 @@ struct SubrSubsetter closures.init (acc.fdCount); remaps.init (acc.fdCount); - parsed_charstrings.init (glyphs.len); + parsed_charstrings.init (glyphs.length); parsed_global_subrs.init (acc.globalSubrs->count); parsed_local_subrs.resize (acc.fdCount); for (unsigned int i = 0; i < acc.fdCount; i++) @@ -663,18 +660,18 @@ struct SubrSubsetter return false; /* phase 1 & 2 */ - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) { hb_codepoint_t glyph = glyphs[i]; - const ByteStr str = (*acc.charStrings)[glyph]; + const byte_str_t str = (*acc.charStrings)[glyph]; unsigned int fd = acc.fdSelect->get_fd (glyph); if (unlikely (fd >= acc.fdCount)) return false; - CSInterpreter<ENV, OPSET, SubrSubsetParam> interp; + cs_interpreter_t<ENV, OPSET, subr_subset_param_t> interp; interp.env.init (str, acc, fd); - SubrSubsetParam param; + subr_subset_param_t param; param.init (&parsed_charstrings[i], &parsed_global_subrs, &parsed_local_subrs[fd], closures.global_closure, closures.local_closures[fd], @@ -690,18 +687,18 @@ struct SubrSubsetter if (drop_hints) { /* mark hint ops and arguments for drop */ - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) { unsigned int fd = acc.fdSelect->get_fd (glyphs[i]); if (unlikely (fd >= acc.fdCount)) return false; - SubrSubsetParam param; + subr_subset_param_t param; param.init (&parsed_charstrings[i], &parsed_global_subrs, &parsed_local_subrs[fd], closures.global_closure, closures.local_closures[fd], drop_hints); - DropHintsParam drop; + drop_hints_param_t drop; if (drop_hints_in_str (parsed_charstrings[i], param, drop)) { parsed_charstrings[i].set_hint_dropped (); @@ -712,12 +709,12 @@ struct SubrSubsetter /* after dropping hints recreate closures of actually used subrs */ closures.reset (); - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) { unsigned int fd = acc.fdSelect->get_fd (glyphs[i]); if (unlikely (fd >= acc.fdCount)) return false; - SubrSubsetParam param; + subr_subset_param_t param; param.init (&parsed_charstrings[i], &parsed_global_subrs, &parsed_local_subrs[fd], closures.global_closure, closures.local_closures[fd], @@ -731,11 +728,11 @@ struct SubrSubsetter return true; } - bool encode_charstrings (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, StrBuffArray &buffArray) const + bool encode_charstrings (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, str_buff_vec_t &buffArray) const { - if (unlikely (!buffArray.resize (glyphs.len))) + if (unlikely (!buffArray.resize (glyphs.length))) return false; - for (unsigned int i = 0; i < glyphs.len; i++) + for (unsigned int i = 0; i < glyphs.length; i++) { unsigned int fd = acc.fdSelect->get_fd (glyphs[i]); if (unlikely (fd >= acc.fdCount)) @@ -746,13 +743,13 @@ struct SubrSubsetter return true; } - bool encode_subrs (const ParsedCStrs &subrs, const SubrRemap& remap, unsigned int fd, StrBuffArray &buffArray) const + bool encode_subrs (const parsed_cs_str_vec_t &subrs, const subr_remap_t& remap, unsigned int fd, str_buff_vec_t &buffArray) const { unsigned int count = remap.get_count (); if (unlikely (!buffArray.resize (count))) return false; - for (unsigned int old_num = 0; old_num < subrs.len; old_num++) + for (unsigned int old_num = 0; old_num < subrs.length; old_num++) { hb_codepoint_t new_num = remap[old_num]; if (new_num != CFF_UNDEF_CODE) @@ -764,20 +761,20 @@ struct SubrSubsetter return true; } - bool encode_globalsubrs (StrBuffArray &buffArray) + bool encode_globalsubrs (str_buff_vec_t &buffArray) { return encode_subrs (parsed_global_subrs, remaps.global_remap, 0, buffArray); } - bool encode_localsubrs (unsigned int fd, StrBuffArray &buffArray) const + bool encode_localsubrs (unsigned int fd, str_buff_vec_t &buffArray) const { return encode_subrs (parsed_local_subrs[fd], remaps.local_remaps[fd], fd, buffArray); } protected: - struct DropHintsParam + struct drop_hints_param_t { - DropHintsParam () + drop_hints_param_t () : seen_moveto (false), ends_in_hint (false), vsindex_dropped (false) {} @@ -787,9 +784,9 @@ struct SubrSubsetter bool vsindex_dropped; }; - bool drop_hints_in_subr (ParsedCStr &str, unsigned int pos, - ParsedCStrs &subrs, unsigned int subr_num, - const SubrSubsetParam ¶m, DropHintsParam &drop) + bool drop_hints_in_subr (parsed_cs_str_t &str, unsigned int pos, + parsed_cs_str_vec_t &subrs, unsigned int subr_num, + const subr_subset_param_t ¶m, drop_hints_param_t &drop) { drop.ends_in_hint = false; bool has_hint = drop_hints_in_str (subrs[subr_num], param, drop); @@ -809,11 +806,11 @@ struct SubrSubsetter } /* returns true if it sees a hint op before the first moveto */ - bool drop_hints_in_str (ParsedCStr &str, const SubrSubsetParam ¶m, DropHintsParam &drop) + bool drop_hints_in_str (parsed_cs_str_t &str, const subr_subset_param_t ¶m, drop_hints_param_t &drop) { bool seen_hint = false; - for (unsigned int pos = 0; pos < str.values.len; pos++) + for (unsigned int pos = 0; pos < str.values.length; pos++) { bool has_hint = false; switch (str.values[pos].op) @@ -868,7 +865,7 @@ struct SubrSubsetter { for (int i = pos - 1; i >= 0; i--) { - ParsedCSOp &csop = str.values[(unsigned)i]; + parsed_cs_op_t &csop = str.values[(unsigned)i]; if (csop.for_drop ()) break; csop.set_drop (); @@ -882,18 +879,18 @@ struct SubrSubsetter return seen_hint; } - void collect_subr_refs_in_subr (ParsedCStr &str, unsigned int pos, - unsigned int subr_num, ParsedCStrs &subrs, + void collect_subr_refs_in_subr (parsed_cs_str_t &str, unsigned int pos, + unsigned int subr_num, parsed_cs_str_vec_t &subrs, hb_set_t *closure, - const SubrSubsetParam ¶m) + const subr_subset_param_t ¶m) { hb_set_add (closure, subr_num); collect_subr_refs_in_str (subrs[subr_num], param); } - void collect_subr_refs_in_str (ParsedCStr &str, const SubrSubsetParam ¶m) + void collect_subr_refs_in_str (parsed_cs_str_t &str, const subr_subset_param_t ¶m) { - for (unsigned int pos = 0; pos < str.values.len; pos++) + for (unsigned int pos = 0; pos < str.values.length; pos++) { if (!str.values[pos].for_drop ()) { @@ -917,10 +914,10 @@ struct SubrSubsetter } } - bool encode_str (const ParsedCStr &str, const unsigned int fd, StrBuff &buff) const + bool encode_str (const parsed_cs_str_t &str, const unsigned int fd, str_buff_t &buff) const { buff.init (); - StrEncoder encoder (buff); + str_encoder_t encoder (buff); encoder.reset (); /* if a prefix (CFF1 width or CFF2 vsindex) has been removed along with hints, * re-insert it at the beginning of charstreing */ @@ -932,7 +929,7 @@ struct SubrSubsetter } for (unsigned int i = 0; i < str.get_count(); i++) { - const ParsedCSOp &opstr = str.values[i]; + const parsed_cs_op_t &opstr = str.values[i]; if (!opstr.for_drop () && !opstr.for_skip ()) { switch (opstr.op) @@ -957,18 +954,19 @@ struct SubrSubsetter } protected: - SubrClosures closures; + subr_closures_t closures; - ParsedCStrs parsed_charstrings; - ParsedCStrs parsed_global_subrs; - hb_vector_t<ParsedCStrs> parsed_local_subrs; + parsed_cs_str_vec_t parsed_charstrings; + parsed_cs_str_vec_t parsed_global_subrs; + hb_vector_t<parsed_cs_str_vec_t> parsed_local_subrs; - SubrRemaps remaps; + subr_remap_ts remaps; private: typedef typename SUBRS::count_type subr_count_type; }; -}; /* namespace CFF */ + +} /* namespace CFF */ HB_INTERNAL bool hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs, @@ -977,8 +975,8 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs, unsigned int &subset_fd_count /* OUT */, unsigned int &subset_fdselect_size /* OUT */, unsigned int &subset_fdselect_format /* OUT */, - hb_vector_t<CFF::code_pair> &fdselect_ranges /* OUT */, - CFF::Remap &fdmap /* OUT */); + hb_vector_t<CFF::code_pair_t> &fdselect_ranges /* OUT */, + CFF::remap_t &fdmap /* OUT */); HB_INTERNAL bool hb_serialize_cff_fdselect (hb_serialize_context_t *c, @@ -987,6 +985,6 @@ hb_serialize_cff_fdselect (hb_serialize_context_t *c, unsigned int fd_count, unsigned int fdselect_format, unsigned int size, - const hb_vector_t<CFF::code_pair> &fdselect_ranges); + const hb_vector_t<CFF::code_pair_t> &fdselect_ranges); #endif /* HB_SUBSET_CFF_COMMON_HH */ 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 09364a22cea..5133a4de65c 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 @@ -34,12 +34,12 @@ using namespace CFF; -struct RemapSID : Remap +struct remap_sid_t : remap_t { unsigned int add (unsigned int sid) { if ((sid != CFF_UNDEF_SID) && !is_std_std (sid)) - return offset_sid (Remap::add (unoffset_sid (sid))); + return offset_sid (remap_t::add (unoffset_sid (sid))); else return sid; } @@ -49,7 +49,7 @@ struct RemapSID : Remap if (is_std_std (sid) || (sid == CFF_UNDEF_SID)) return sid; else - return offset_sid (Remap::operator [] (unoffset_sid (sid))); + return offset_sid (remap_t::operator [] (unoffset_sid (sid))); } static const unsigned int num_std_strings = 391; @@ -59,10 +59,10 @@ struct RemapSID : Remap static unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; } }; -struct CFF1SubTableOffsets : CFFSubTableOffsets +struct cff1_sub_table_offsets_t : cff_sub_table_offsets_t { - CFF1SubTableOffsets () - : CFFSubTableOffsets (), + cff1_sub_table_offsets_t () + : cff_sub_table_offsets_t (), nameIndexOffset (0), encodingOffset (0) { @@ -72,16 +72,16 @@ struct CFF1SubTableOffsets : CFFSubTableOffsets } unsigned int nameIndexOffset; - TableInfo stringIndexInfo; + table_info_t stringIndexInfo; unsigned int encodingOffset; - TableInfo charsetInfo; - TableInfo privateDictInfo; + table_info_t charsetInfo; + table_info_t privateDictInfo; }; -/* a copy of a parsed out CFF1TopDictValues augmented with additional operators */ -struct CFF1TopDictValuesMod : CFF1TopDictValues +/* a copy of a parsed out cff1_top_dict_values_t augmented with additional operators */ +struct cff1_top_dict_values_mod_t : cff1_top_dict_values_t { - void init (const CFF1TopDictValues *base_= &Null(CFF1TopDictValues)) + void init (const cff1_top_dict_values_t *base_= &Null(cff1_top_dict_values_t)) { SUPER::init (); base = base_; @@ -90,47 +90,47 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues void fini () { SUPER::fini (); } unsigned get_count () const { return base->get_count () + SUPER::get_count (); } - const CFF1TopDictVal &get_value (unsigned int i) const + const cff1_top_dict_val_t &get_value (unsigned int i) const { if (i < base->get_count ()) return (*base)[i]; else return SUPER::values[i - base->get_count ()]; } - const CFF1TopDictVal &operator [] (unsigned int i) const { return get_value (i); } + const cff1_top_dict_val_t &operator [] (unsigned int i) const { return get_value (i); } - void reassignSIDs (const RemapSID& sidmap) + void reassignSIDs (const remap_sid_t& sidmap) { - for (unsigned int i = 0; i < NameDictValues::ValCount; i++) + for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++) nameSIDs[i] = sidmap[base->nameSIDs[i]]; } protected: - typedef CFF1TopDictValues SUPER; - const CFF1TopDictValues *base; + typedef cff1_top_dict_values_t SUPER; + const cff1_top_dict_values_t *base; }; -struct TopDictModifiers +struct top_dict_modifiers_t { - TopDictModifiers (const CFF1SubTableOffsets &offsets_, - const unsigned int (&nameSIDs_)[NameDictValues::ValCount]) + top_dict_modifiers_t (const cff1_sub_table_offsets_t &offsets_, + const unsigned int (&nameSIDs_)[name_dict_values_t::ValCount]) : offsets (offsets_), nameSIDs (nameSIDs_) {} - const CFF1SubTableOffsets &offsets; - const unsigned int (&nameSIDs)[NameDictValues::ValCount]; + const cff1_sub_table_offsets_t &offsets; + const unsigned int (&nameSIDs)[name_dict_values_t::ValCount]; }; -struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal> +struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dict_val_t> { bool serialize (hb_serialize_context_t *c, - const CFF1TopDictVal &opstr, - const TopDictModifiers &mod) const + const cff1_top_dict_val_t &opstr, + const top_dict_modifiers_t &mod) const { TRACE_SERIALIZE (this); - OpCode op = opstr.op; + op_code_t op = opstr.op; switch (op) { case OpCode_charset: @@ -160,31 +160,30 @@ struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal> case OpCode_PostScript: case OpCode_BaseFontName: case OpCode_FontName: - return_trace (FontDict::serialize_offset2_op(c, op, mod.nameSIDs[NameDictValues::name_op_to_index (op)])); + return_trace (FontDict::serialize_offset2_op(c, op, mod.nameSIDs[name_dict_values_t::name_op_to_index (op)])); case OpCode_ROS: { /* for registry & ordering, reassigned SIDs are serialized * for supplement, the original byte string is copied along with the op code */ - OpStr supp_op; + op_str_t supp_op; supp_op.op = op; - supp_op.str.str = opstr.str.str + opstr.last_arg_offset; - if ( unlikely (!(opstr.str.len >= opstr.last_arg_offset + 3))) + if ( unlikely (!(opstr.str.length >= opstr.last_arg_offset + 3))) return_trace (false); - supp_op.str.len = opstr.str.len - opstr.last_arg_offset; - return_trace (UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValues::registry]) && - UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValues::ordering]) && + supp_op.str = byte_str_t (&opstr.str + opstr.last_arg_offset, opstr.str.length - opstr.last_arg_offset); + return_trace (UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[name_dict_values_t::registry]) && + UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[name_dict_values_t::ordering]) && copy_opstr (c, supp_op)); } default: - return_trace (CFFTopDict_OpSerializer<CFF1TopDictVal>::serialize (c, opstr, mod.offsets)); + return_trace (cff_top_dict_op_serializer_t<cff1_top_dict_val_t>::serialize (c, opstr, mod.offsets)); } return_trace (true); } - unsigned int calculate_serialized_size (const CFF1TopDictVal &opstr) const + unsigned int calculate_serialized_size (const cff1_top_dict_val_t &opstr) const { - OpCode op = opstr.op; + op_code_t op = opstr.op; switch (op) { case OpCode_charset: @@ -206,19 +205,19 @@ struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal> return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (op); case OpCode_ROS: - return ((OpCode_Size (OpCode_shortint) + 2) * 2) + (opstr.str.len - opstr.last_arg_offset)/* supplement + op */; + return ((OpCode_Size (OpCode_shortint) + 2) * 2) + (opstr.str.length - opstr.last_arg_offset)/* supplement + op */; default: - return CFFTopDict_OpSerializer<CFF1TopDictVal>::calculate_serialized_size (opstr); + return cff_top_dict_op_serializer_t<cff1_top_dict_val_t>::calculate_serialized_size (opstr); } } }; -struct FontDictValuesMod +struct font_dict_values_mod_t { - void init (const CFF1FontDictValues *base_, + void init (const cff1_font_dict_values_t *base_, unsigned int fontName_, - const TableInfo &privateDictInfo_) + const table_info_t &privateDictInfo_) { base = base_; fontName = fontName_; @@ -227,18 +226,18 @@ struct FontDictValuesMod unsigned get_count () const { return base->get_count (); } - const OpStr &operator [] (unsigned int i) const { return (*base)[i]; } + const op_str_t &operator [] (unsigned int i) const { return (*base)[i]; } - const CFF1FontDictValues *base; - TableInfo privateDictInfo; + const cff1_font_dict_values_t *base; + table_info_t privateDictInfo; unsigned int fontName; }; -struct CFF1FontDict_OpSerializer : CFFFontDict_OpSerializer +struct cff1_font_dict_op_serializer_t : cff_font_dict_op_serializer_t { bool serialize (hb_serialize_context_t *c, - const OpStr &opstr, - const FontDictValuesMod &mod) const + const op_str_t &opstr, + const font_dict_values_mod_t &mod) const { TRACE_SERIALIZE (this); @@ -248,7 +247,7 @@ struct CFF1FontDict_OpSerializer : CFFFontDict_OpSerializer return_trace (SUPER::serialize (c, opstr, mod.privateDictInfo)); } - unsigned int calculate_serialized_size (const OpStr &opstr) const + unsigned int calculate_serialized_size (const op_str_t &opstr) const { if (opstr.op == OpCode_FontName) return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_FontName); @@ -257,12 +256,12 @@ struct CFF1FontDict_OpSerializer : CFFFontDict_OpSerializer } private: - typedef CFFFontDict_OpSerializer SUPER; + typedef cff_font_dict_op_serializer_t SUPER; }; -struct CFF1CSOpSet_Flatten : CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam> +struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatten_param_t> { - static void flush_args_and_op (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param) + static void flush_args_and_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param) { if (env.arg_start > 0) flush_width (env, param); @@ -288,51 +287,51 @@ struct CFF1CSOpSet_Flatten : CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam> break; } } - static void flush_args (CFF1CSInterpEnv &env, FlattenParam& param) + static void flush_args (cff1_cs_interp_env_t &env, flatten_param_t& param) { - StrEncoder encoder (param.flatStr); + 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)); SUPER::flush_args (env, param); } - static void flush_op (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param) + static void flush_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param) { - StrEncoder encoder (param.flatStr); + str_encoder_t encoder (param.flatStr); encoder.encode_op (op); } - static void flush_width (CFF1CSInterpEnv &env, FlattenParam& param) + static void flush_width (cff1_cs_interp_env_t &env, flatten_param_t& param) { assert (env.has_width); - StrEncoder encoder (param.flatStr); + str_encoder_t encoder (param.flatStr); encoder.encode_num (env.width); } - static void flush_hintmask (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param) + static void flush_hintmask (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param) { SUPER::flush_hintmask (op, env, param); if (!param.drop_hints) { - StrEncoder encoder (param.flatStr); + str_encoder_t encoder (param.flatStr); for (unsigned int i = 0; i < env.hintmask_size; i++) - encoder.encode_byte (env.substr[i]); + encoder.encode_byte (env.str_ref[i]); } } private: - typedef CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam> SUPER; + typedef cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatten_param_t> SUPER; }; -struct RangeList : hb_vector_t<code_pair> +struct range_list_t : hb_vector_t<code_pair_t> { /* replace the first glyph ID in the "glyph" field each range with a nLeft value */ bool finalize (unsigned int last_glyph) { bool two_byte = false; - for (unsigned int i = (*this).len; i > 0; i--) + for (unsigned int i = (*this).length; i > 0; i--) { - code_pair &pair = (*this)[i - 1]; + code_pair_t &pair = (*this)[i - 1]; unsigned int nLeft = last_glyph - pair.glyph - 1; if (nLeft >= 0x100) two_byte = true; @@ -343,21 +342,21 @@ struct RangeList : hb_vector_t<code_pair> } }; -struct CFF1CSOpSet_SubrSubset : CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetParam> +struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t, subr_subset_param_t> { - static void process_op (OpCode op, CFF1CSInterpEnv &env, SubrSubsetParam& param) + static void process_op (op_code_t op, cff1_cs_interp_env_t &env, subr_subset_param_t& param) { switch (op) { case OpCode_return: - param.current_parsed_str->add_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); param.current_parsed_str->set_parsed (); env.returnFromSubr (); param.set_current_str (env, false); break; case OpCode_endchar: - param.current_parsed_str->add_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); param.current_parsed_str->set_parsed (); SUPER::process_op (op, env, param); break; @@ -372,30 +371,30 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetPa default: SUPER::process_op (op, env, param); - param.current_parsed_str->add_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); break; } } protected: - static void process_call_subr (OpCode op, CSType type, - CFF1CSInterpEnv &env, SubrSubsetParam& param, - CFF1BiasedSubrs& subrs, hb_set_t *closure) + static void process_call_subr (op_code_t op, cs_type_t type, + cff1_cs_interp_env_t &env, subr_subset_param_t& param, + cff1_biased_subrs_t& subrs, hb_set_t *closure) { - SubByteStr substr = env.substr; + byte_str_ref_t str_ref = env.str_ref; env.callSubr (subrs, type); - param.current_parsed_str->add_call_op (op, substr, env.context.subr_num); + param.current_parsed_str->add_call_op (op, str_ref, env.context.subr_num); hb_set_add (closure, env.context.subr_num); param.set_current_str (env, true); } private: - typedef CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetParam> SUPER; + typedef cff1_cs_opset_t<cff1_cs_opset_subr_subset_t, subr_subset_param_t> SUPER; }; -struct CFF1SubrSubsetter : SubrSubsetter<CFF1SubrSubsetter, CFF1Subrs, const OT::cff1::accelerator_subset_t, CFF1CSInterpEnv, CFF1CSOpSet_SubrSubset> +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> { - static void finalize_parsed_str (CFF1CSInterpEnv &env, SubrSubsetParam& param, ParsedCStr &charstring) + static void finalize_parsed_str (cff1_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring) { /* insert width at the beginning of the charstring as necessary */ if (env.has_width) @@ -407,7 +406,7 @@ struct CFF1SubrSubsetter : SubrSubsetter<CFF1SubrSubsetter, CFF1Subrs, const OT: param.current_parsed_str->set_parsed (); for (unsigned int i = 0; i < env.callStack.get_count (); i++) { - ParsedCStr *parsed_str = param.get_parsed_str_for_context (env.callStack[i]); + parsed_cs_str_t *parsed_str = param.get_parsed_str_for_context (env.callStack[i]); if (likely (parsed_str != nullptr)) parsed_str->set_parsed (); else @@ -439,7 +438,7 @@ struct cff_subset_plan { subset_enc_supp_codes.init (); subset_charset_ranges.init (); sidmap.init (); - for (unsigned int i = 0; i < NameDictValues::ValCount; i++) + for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++) topDictModSIDs[i] = CFF_UNDEF_SID; } @@ -454,10 +453,9 @@ struct cff_subset_plan { subset_localsubrs.fini_deep (); fontdicts_mod.fini (); subset_enc_code_ranges.fini (); - subset_enc_supp_codes.init (); + subset_enc_supp_codes.fini (); subset_charset_ranges.fini (); sidmap.fini (); - fontdicts_mod.fini (); } unsigned int plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan) @@ -471,9 +469,9 @@ struct cff_subset_plan { supp_size = 0; supp_codes.init (); - subset_enc_num_codes = plan->glyphs.len - 1; + subset_enc_num_codes = plan->glyphs.length - 1; unsigned int glyph; - for (glyph = 1; glyph < plan->glyphs.len; glyph++) + for (glyph = 1; glyph < plan->glyphs.length; glyph++) { hb_codepoint_t orig_glyph = plan->glyphs[glyph]; code = acc.glyph_to_code (orig_glyph); @@ -485,7 +483,7 @@ struct cff_subset_plan { if (code != last_code + 1) { - code_pair pair = { code, glyph }; + code_pair_t pair = { code, glyph }; subset_enc_code_ranges.push (pair); } last_code = code; @@ -494,12 +492,12 @@ struct cff_subset_plan { { hb_codepoint_t sid = acc.glyph_to_sid (orig_glyph); encoding->get_supplement_codes (sid, supp_codes); - for (unsigned int i = 0; i < supp_codes.len; i++) + for (unsigned int i = 0; i < supp_codes.length; i++) { - code_pair pair = { supp_codes[i], sid }; + code_pair_t pair = { supp_codes[i], sid }; subset_enc_supp_codes.push (pair); } - supp_size += SuppEncoding::static_size * supp_codes.len; + supp_size += SuppEncoding::static_size * supp_codes.length; } } supp_codes.fini (); @@ -508,7 +506,7 @@ struct cff_subset_plan { assert (subset_enc_num_codes <= 0xFF); size0 = Encoding0::min_size + HBUINT8::static_size * subset_enc_num_codes; - size1 = Encoding1::min_size + Encoding1_Range::static_size * subset_enc_code_ranges.len; + size1 = Encoding1::min_size + Encoding1_Range::static_size * subset_enc_code_ranges.length; if (size0 < size1) subset_enc_format = 0; @@ -517,8 +515,8 @@ struct cff_subset_plan { return Encoding::calculate_serialized_size ( subset_enc_format, - subset_enc_format? subset_enc_code_ranges.len: subset_enc_num_codes, - subset_enc_supp_codes.len); + subset_enc_format? subset_enc_code_ranges.length: subset_enc_num_codes, + subset_enc_supp_codes.length); } unsigned int plan_subset_charset (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan) @@ -528,7 +526,7 @@ struct cff_subset_plan { subset_charset_ranges.resize (0); unsigned int glyph; - for (glyph = 1; glyph < plan->glyphs.len; glyph++) + for (glyph = 1; glyph < plan->glyphs.length; glyph++) { hb_codepoint_t orig_glyph = plan->glyphs[glyph]; sid = acc.glyph_to_sid (orig_glyph); @@ -538,7 +536,7 @@ struct cff_subset_plan { if (sid != last_sid + 1) { - code_pair pair = { sid, glyph }; + code_pair_t pair = { sid, glyph }; subset_charset_ranges.push (pair); } last_sid = sid; @@ -546,11 +544,11 @@ struct cff_subset_plan { bool two_byte = subset_charset_ranges.finalize (glyph); - size0 = Charset0::min_size + HBUINT16::static_size * (plan->glyphs.len - 1); + size0 = Charset0::min_size + HBUINT16::static_size * (plan->glyphs.length - 1); if (!two_byte) - size_ranges = Charset1::min_size + Charset1_Range::static_size * subset_charset_ranges.len; + size_ranges = Charset1::min_size + Charset1_Range::static_size * subset_charset_ranges.length; else - size_ranges = Charset2::min_size + Charset2_Range::static_size * subset_charset_ranges.len; + size_ranges = Charset2::min_size + Charset2_Range::static_size * subset_charset_ranges.length; if (size0 < size_ranges) subset_charset_format = 0; @@ -561,7 +559,7 @@ struct cff_subset_plan { return Charset::calculate_serialized_size ( subset_charset_format, - subset_charset_format? subset_charset_ranges.len: plan->glyphs.len); + subset_charset_format? subset_charset_ranges.length: plan->glyphs.length); } bool collect_sids_in_dicts (const OT::cff1::accelerator_subset_t &acc) @@ -569,7 +567,7 @@ struct cff_subset_plan { if (unlikely (!sidmap.reset (acc.stringIndex->count))) return false; - for (unsigned int i = 0; i < NameDictValues::ValCount; i++) + for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++) { unsigned int sid = acc.topDict.nameSIDs[i]; if (sid != CFF_UNDEF_SID) @@ -591,17 +589,17 @@ struct cff_subset_plan { hb_subset_plan_t *plan) { /* make sure notdef is first */ - if ((plan->glyphs.len == 0) || (plan->glyphs[0] != 0)) return false; + if ((plan->glyphs.length == 0) || (plan->glyphs[0] != 0)) return false; final_size = 0; - num_glyphs = plan->glyphs.len; + num_glyphs = plan->glyphs.length; orig_fdcount = acc.fdCount; drop_hints = plan->drop_hints; desubroutinize = plan->desubroutinize; /* check whether the subset renumbers any glyph IDs */ gid_renum = false; - for (unsigned int glyph = 0; glyph < plan->glyphs.len; glyph++) + for (unsigned int glyph = 0; glyph < plan->glyphs.length; glyph++) { if (plan->glyphs[glyph] != glyph) { gid_renum = true; @@ -633,12 +631,12 @@ struct cff_subset_plan { topdict_mod.add_op (OpCode_charset); } offsets.topDictInfo.offset = final_size; - CFF1TopDict_OpSerializer topSzr; + cff1_top_dict_op_serializer_t topSzr; unsigned int topDictSize = TopDict::calculate_serialized_size (topdict_mod, topSzr); offsets.topDictInfo.offSize = calcOffSize(topDictSize); if (unlikely (offsets.topDictInfo.offSize > 4)) return false; - final_size += CFF1IndexOf<TopDict>::calculate_serialized_size<CFF1TopDictValuesMod> + final_size += CFF1IndexOf<TopDict>::calculate_serialized_size<cff1_top_dict_values_mod_t> (offsets.topDictInfo.offSize, &topdict_mod, 1, topdict_sizes, topSzr); } @@ -682,7 +680,7 @@ struct cff_subset_plan { if (desubroutinize) { /* Flatten global & local subrs */ - SubrFlattener<const OT::cff1::accelerator_subset_t, CFF1CSInterpEnv, CFF1CSOpSet_Flatten> + subr_flattener_t<const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_flatten_t> flattener(acc, plan->glyphs, plan->drop_hints); if (!flattener.flatten (subset_charstrings)) return false; @@ -708,7 +706,7 @@ struct cff_subset_plan { offsets.globalSubrsInfo.offSize = calcOffSize (dataSize); if (unlikely (offsets.globalSubrsInfo.offSize > 4)) return false; - offsets.globalSubrsInfo.size = CFF1Subrs::calculate_serialized_size (offsets.globalSubrsInfo.offSize, subset_globalsubrs.len, dataSize); + offsets.globalSubrsInfo.size = CFF1Subrs::calculate_serialized_size (offsets.globalSubrsInfo.offSize, subset_globalsubrs.length, dataSize); /* local subrs */ if (!offsets.localSubrsInfos.resize (orig_fdcount)) @@ -731,7 +729,7 @@ struct cff_subset_plan { offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize); if (unlikely (offsets.localSubrsInfos[fd].offSize > 4)) return false; - offsets.localSubrsInfos[fd].size = CFF1Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].len, dataSize); + offsets.localSubrsInfos[fd].size = CFF1Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].length, dataSize); } } } @@ -767,9 +765,9 @@ struct cff_subset_plan { /* FDArray (FDIndex) */ if (acc.fdArray != &Null(CFF1FDArray)) { offsets.FDArrayInfo.offset = final_size; - CFF1FontDict_OpSerializer fontSzr; + cff1_font_dict_op_serializer_t fontSzr; unsigned int dictsSize = 0; - for (unsigned int i = 0; i < acc.fontDicts.len; i++) + for (unsigned int i = 0; i < acc.fontDicts.length; i++) if (fdmap.includes (i)) dictsSize += FontDict::calculate_serialized_size (acc.fontDicts[i], fontSzr); @@ -786,7 +784,7 @@ struct cff_subset_plan { offsets.charStringsInfo.offSize = calcOffSize (dataSize); if (unlikely (offsets.charStringsInfo.offSize > 4)) return false; - final_size += CFF1CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->glyphs.len, dataSize); + final_size += CFF1CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->glyphs.length, dataSize); } /* private dicts & local subrs */ @@ -796,12 +794,12 @@ struct cff_subset_plan { if (fdmap.includes (i)) { bool has_localsubrs = offsets.localSubrsInfos[i].size > 0; - CFFPrivateDict_OpSerializer privSzr (desubroutinize, plan->drop_hints); + cff_private_dict_op_serializer_t privSzr (desubroutinize, plan->drop_hints); unsigned int priv_size = PrivateDict::calculate_serialized_size (acc.privateDicts[i], privSzr, has_localsubrs); - TableInfo privInfo = { final_size, priv_size, 0 }; - FontDictValuesMod fontdict_mod; + table_info_t privInfo = { final_size, priv_size, 0 }; + font_dict_values_mod_t fontdict_mod; if (!acc.is_CID ()) - fontdict_mod.init ( &Null(CFF1FontDictValues), CFF_UNDEF_SID, privInfo ); + fontdict_mod.init ( &Null(cff1_font_dict_values_t), CFF_UNDEF_SID, privInfo ); else fontdict_mod.init ( &acc.fontDicts[i], sidmap[acc.fontDicts[i].fontName], privInfo ); fontdicts_mod.push (fontdict_mod); @@ -818,50 +816,50 @@ struct cff_subset_plan { if (!acc.is_CID ()) offsets.privateDictInfo = fontdicts_mod[0].privateDictInfo; - return ((subset_charstrings.len == plan->glyphs.len) - && (fontdicts_mod.len == subset_fdcount)); + return ((subset_charstrings.length == plan->glyphs.length) + && (fontdicts_mod.length == subset_fdcount)); } unsigned int get_final_size () const { return final_size; } unsigned int final_size; - hb_vector_t<unsigned int> topdict_sizes; - CFF1TopDictValuesMod topdict_mod; - CFF1SubTableOffsets offsets; + hb_vector_t<unsigned int> topdict_sizes; + cff1_top_dict_values_mod_t topdict_mod; + cff1_sub_table_offsets_t offsets; unsigned int num_glyphs; unsigned int orig_fdcount; unsigned int subset_fdcount; unsigned int subset_fdselect_format; - hb_vector_t<code_pair> subset_fdselect_ranges; + hb_vector_t<code_pair_t> subset_fdselect_ranges; /* font dict index remap table from fullset FDArray to subset FDArray. * set to CFF_UNDEF_CODE if excluded from subset */ - Remap fdmap; + remap_t fdmap; - StrBuffArray subset_charstrings; - StrBuffArray subset_globalsubrs; - hb_vector_t<StrBuffArray> subset_localsubrs; - hb_vector_t<FontDictValuesMod> fontdicts_mod; + str_buff_vec_t subset_charstrings; + str_buff_vec_t subset_globalsubrs; + hb_vector_t<str_buff_vec_t> subset_localsubrs; + hb_vector_t<font_dict_values_mod_t> fontdicts_mod; - bool drop_hints; + bool drop_hints; - bool gid_renum; - bool subset_encoding; - uint8_t subset_enc_format; - unsigned int subset_enc_num_codes; - RangeList subset_enc_code_ranges; - hb_vector_t<code_pair> subset_enc_supp_codes; + bool gid_renum; + bool subset_encoding; + uint8_t subset_enc_format; + unsigned int subset_enc_num_codes; + range_list_t subset_enc_code_ranges; + hb_vector_t<code_pair_t> subset_enc_supp_codes; - uint8_t subset_charset_format; - RangeList subset_charset_ranges; - bool subset_charset; + uint8_t subset_charset_format; + range_list_t subset_charset_ranges; + bool subset_charset; - RemapSID sidmap; - unsigned int topDictModSIDs[NameDictValues::ValCount]; + remap_sid_t sidmap; + unsigned int topDictModSIDs[name_dict_values_t::ValCount]; - bool desubroutinize; - CFF1SubrSubsetter subr_subsetter; + bool desubroutinize; + cff1_subr_subsetter_t subr_subsetter; }; static inline bool _write_cff1 (const cff_subset_plan &plan, @@ -872,9 +870,6 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, { hb_serialize_context_t c (dest, dest_sz); - char RETURN_OP[1] = { OpCode_return }; - const ByteStr NULL_SUBR (RETURN_OP, 1); - OT::cff1 *cff = c.start_serialize<OT::cff1> (); if (unlikely (!c.extend_min (*cff))) return false; @@ -887,7 +882,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* name INDEX */ { - assert (cff->nameIndex == c.head - c.start); + assert (cff->nameIndex == (unsigned) (c.head - c.start)); CFF1NameIndex *dest = c.start_embed<CFF1NameIndex> (); if (unlikely (dest == nullptr)) return false; if (unlikely (!dest->serialize (&c, *acc.nameIndex))) @@ -899,11 +894,11 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* top dict INDEX */ { - assert (plan.offsets.topDictInfo.offset == c.head - c.start); + assert (plan.offsets.topDictInfo.offset == (unsigned) (c.head - c.start)); CFF1IndexOf<TopDict> *dest = c.start_embed< CFF1IndexOf<TopDict> > (); if (dest == nullptr) return false; - CFF1TopDict_OpSerializer topSzr; - TopDictModifiers modifier (plan.offsets, plan.topDictModSIDs); + cff1_top_dict_op_serializer_t topSzr; + top_dict_modifiers_t modifier (plan.offsets, plan.topDictModSIDs); if (unlikely (!dest->serialize (&c, plan.offsets.topDictInfo.offSize, &plan.topdict_mod, 1, plan.topdict_sizes, topSzr, modifier))) @@ -915,7 +910,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* String INDEX */ { - assert (plan.offsets.stringIndexInfo.offset == c.head - c.start); + assert (plan.offsets.stringIndexInfo.offset == (unsigned) (c.head - c.start)); CFF1StringIndex *dest = c.start_embed<CFF1StringIndex> (); if (unlikely (dest == nullptr)) return false; if (unlikely (!dest->serialize (&c, *acc.stringIndex, plan.offsets.stringIndexInfo.offSize, plan.sidmap))) @@ -928,7 +923,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* global subrs */ { assert (plan.offsets.globalSubrsInfo.offset != 0); - assert (plan.offsets.globalSubrsInfo.offset == c.head - c.start); + assert (plan.offsets.globalSubrsInfo.offset == (unsigned) (c.head - c.start)); CFF1Subrs *dest = c.start_embed <CFF1Subrs> (); if (unlikely (dest == nullptr)) return false; @@ -942,7 +937,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* Encoding */ if (plan.subset_encoding) { - assert (plan.offsets.encodingOffset == c.head - c.start); + assert (plan.offsets.encodingOffset == (unsigned) (c.head - c.start)); Encoding *dest = c.start_embed<Encoding> (); if (unlikely (dest == nullptr)) return false; if (unlikely (!dest->serialize (&c, @@ -959,7 +954,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* Charset */ if (plan.subset_charset) { - assert (plan.offsets.charsetInfo.offset == c.head - c.start); + assert (plan.offsets.charsetInfo.offset == (unsigned) (c.head - c.start)); Charset *dest = c.start_embed<Charset> (); if (unlikely (dest == nullptr)) return false; if (unlikely (!dest->serialize (&c, @@ -975,9 +970,9 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* FDSelect */ if (acc.fdSelect != &Null(CFF1FDSelect)) { - assert (plan.offsets.FDSelectInfo.offset == c.head - c.start); + assert (plan.offsets.FDSelectInfo.offset == (unsigned) (c.head - c.start)); - if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.len, *acc.fdSelect, acc.fdCount, + if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.length, *acc.fdSelect, acc.fdCount, plan.subset_fdselect_format, plan.offsets.FDSelectInfo.size, plan.subset_fdselect_ranges))) { @@ -989,10 +984,10 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* FDArray (FD Index) */ if (acc.fdArray != &Null(CFF1FDArray)) { - assert (plan.offsets.FDArrayInfo.offset == c.head - c.start); + assert (plan.offsets.FDArrayInfo.offset == (unsigned) (c.head - c.start)); CFF1FDArray *fda = c.start_embed<CFF1FDArray> (); if (unlikely (fda == nullptr)) return false; - CFF1FontDict_OpSerializer fontSzr; + cff1_font_dict_op_serializer_t fontSzr; if (unlikely (!fda->serialize (&c, plan.offsets.FDArrayInfo.offSize, plan.fontdicts_mod, fontSzr))) @@ -1004,7 +999,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* CharStrings */ { - assert (plan.offsets.charStringsInfo.offset == c.head - c.start); + assert (plan.offsets.charStringsInfo.offset == (unsigned) (c.head - c.start)); CFF1CharStrings *cs = c.start_embed<CFF1CharStrings> (); if (unlikely (cs == nullptr)) return false; if (unlikely (!cs->serialize (&c, plan.offsets.charStringsInfo.offSize, plan.subset_charstrings))) @@ -1015,8 +1010,8 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, } /* private dicts & local subrs */ - assert (plan.offsets.privateDictInfo.offset == c.head - c.start); - for (unsigned int i = 0; i < acc.privateDicts.len; i++) + assert (plan.offsets.privateDictInfo.offset == (unsigned) (c.head - c.start)); + for (unsigned int i = 0; i < acc.privateDicts.length; i++) { if (plan.fdmap.includes (i)) { @@ -1024,7 +1019,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, if (unlikely (pd == nullptr)) return false; unsigned int priv_size = plan.fontdicts_mod[plan.fdmap[i]].privateDictInfo.size; bool result; - CFFPrivateDict_OpSerializer privSzr (plan.desubroutinize, plan.drop_hints); + cff_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 */ unsigned int subroffset = (plan.offsets.localSubrsInfos[i].size > 0)? priv_size: 0; result = pd->serialize (&c, acc.privateDicts[i], privSzr, subroffset); @@ -1054,9 +1049,9 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, static bool _hb_subset_cff1 (const OT::cff1::accelerator_subset_t &acc, - const char *data, - hb_subset_plan_t *plan, - hb_blob_t **prime /* OUT */) + const char *data, + hb_subset_plan_t *plan, + hb_blob_t **prime /* OUT */) { cff_subset_plan cff_plan; 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 5a5f29d3569..73a292d0655 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 @@ -34,21 +34,21 @@ using namespace CFF; -struct CFF2SubTableOffsets : CFFSubTableOffsets +struct cff2_sub_table_offsets_t : cff_sub_table_offsets_t { - CFF2SubTableOffsets () - : CFFSubTableOffsets (), + cff2_sub_table_offsets_t () + : cff_sub_table_offsets_t (), varStoreOffset (0) {} unsigned int varStoreOffset; }; -struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<> +struct cff2_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<> { bool serialize (hb_serialize_context_t *c, - const OpStr &opstr, - const CFF2SubTableOffsets &offsets) const + const op_str_t &opstr, + const cff2_sub_table_offsets_t &offsets) const { TRACE_SERIALIZE (this); @@ -58,11 +58,11 @@ struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<> return_trace (FontDict::serialize_offset4_op(c, opstr.op, offsets.varStoreOffset)); default: - return_trace (CFFTopDict_OpSerializer<>::serialize (c, opstr, offsets)); + return_trace (cff_top_dict_op_serializer_t<>::serialize (c, opstr, offsets)); } } - unsigned int calculate_serialized_size (const OpStr &opstr) const + unsigned int calculate_serialized_size (const op_str_t &opstr) const { switch (opstr.op) { @@ -70,14 +70,14 @@ struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<> return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op); default: - return CFFTopDict_OpSerializer<>::calculate_serialized_size (opstr); + return cff_top_dict_op_serializer_t<>::calculate_serialized_size (opstr); } } }; -struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> +struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatten_param_t> { - static void flush_args_and_op (OpCode op, CFF2CSInterpEnv &env, FlattenParam& param) + static void flush_args_and_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param) { switch (op) { @@ -105,11 +105,11 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> } } - static void flush_args (CFF2CSInterpEnv &env, FlattenParam& param) + static void flush_args (cff2_cs_interp_env_t &env, flatten_param_t& param) { for (unsigned int i = 0; i < env.argStack.get_count ();) { - const BlendArg &arg = env.argStack[i]; + const blend_arg_t &arg = env.argStack[i]; if (arg.blending ()) { if (unlikely (!((arg.numValues > 0) && (env.argStack.get_count () >= arg.numValues)))) @@ -122,7 +122,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> } else { - StrEncoder encoder (param.flatStr); + str_encoder_t encoder (param.flatStr); encoder.encode_num (arg); i++; } @@ -130,15 +130,15 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> SUPER::flush_args (env, param); } - static void flatten_blends (const BlendArg &arg, unsigned int i, CFF2CSInterpEnv &env, FlattenParam& param) + static void flatten_blends (const blend_arg_t &arg, unsigned int i, cff2_cs_interp_env_t &env, flatten_param_t& param) { /* flatten the default values */ - StrEncoder encoder (param.flatStr); + str_encoder_t encoder (param.flatStr); for (unsigned int j = 0; j < arg.numValues; j++) { - const BlendArg &arg1 = env.argStack[i + j]; + const blend_arg_t &arg1 = env.argStack[i + j]; if (unlikely (!((arg1.blending () && (arg.numValues == arg1.numValues) && (arg1.valueIndex == j) && - (arg1.deltas.len == env.get_region_count ()))))) + (arg1.deltas.length == env.get_region_count ()))))) { env.set_error (); return; @@ -148,8 +148,8 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> /* flatten deltas for each value */ for (unsigned int j = 0; j < arg.numValues; j++) { - const BlendArg &arg1 = env.argStack[i + j]; - for (unsigned int k = 0; k < arg1.deltas.len; k++) + 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]); } /* flatten the number of values followed by blend operator */ @@ -157,7 +157,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> encoder.encode_op (OpCode_blendcs); } - static void flush_op (OpCode op, CFF2CSInterpEnv &env, FlattenParam& param) + static void flush_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param) { switch (op) { @@ -165,19 +165,19 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> case OpCode_endchar: return; default: - StrEncoder encoder (param.flatStr); + str_encoder_t encoder (param.flatStr); encoder.encode_op (op); } } private: - typedef CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam> SUPER; - typedef CSOpSet<BlendArg, CFF2CSOpSet_Flatten, CFF2CSOpSet_Flatten, CFF2CSInterpEnv, FlattenParam> CSOPSET; + typedef cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatten_param_t> SUPER; + typedef cs_opset_t<blend_arg_t, cff2_cs_opset_flatten_t, cff2_cs_opset_flatten_t, cff2_cs_interp_env_t, flatten_param_t> CSOPSET; }; -struct CFF2CSOpSet_SubrSubset : CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetParam> +struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t, subr_subset_param_t> { - static void process_op (OpCode op, CFF2CSInterpEnv &env, SubrSubsetParam& param) + static void process_op (op_code_t op, cff2_cs_interp_env_t &env, subr_subset_param_t& param) { switch (op) { @@ -202,35 +202,35 @@ struct CFF2CSOpSet_SubrSubset : CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetPa default: SUPER::process_op (op, env, param); - param.current_parsed_str->add_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); break; } } protected: - static void process_call_subr (OpCode op, CSType type, - CFF2CSInterpEnv &env, SubrSubsetParam& param, - CFF2BiasedSubrs& subrs, hb_set_t *closure) + static void process_call_subr (op_code_t op, cs_type_t type, + cff2_cs_interp_env_t &env, subr_subset_param_t& param, + cff2_biased_subrs_t& subrs, hb_set_t *closure) { - SubByteStr substr = env.substr; + byte_str_ref_t str_ref = env.str_ref; env.callSubr (subrs, type); - param.current_parsed_str->add_call_op (op, substr, env.context.subr_num); + param.current_parsed_str->add_call_op (op, str_ref, env.context.subr_num); hb_set_add (closure, env.context.subr_num); param.set_current_str (env, true); } private: - typedef CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetParam> SUPER; + typedef cff2_cs_opset_t<cff2_cs_opset_subr_subset_t, subr_subset_param_t> SUPER; }; -struct CFF2SubrSubsetter : SubrSubsetter<CFF2SubrSubsetter, CFF2Subrs, const OT::cff2::accelerator_subset_t, CFF2CSInterpEnv, CFF2CSOpSet_SubrSubset> +struct cff2_subr_subsetter_t : subr_subsetter_t<cff2_subr_subsetter_t, CFF2Subrs, const OT::cff2::accelerator_subset_t, cff2_cs_interp_env_t, cff2_cs_opset_subr_subset_t> { - static void finalize_parsed_str (CFF2CSInterpEnv &env, SubrSubsetParam& param, ParsedCStr &charstring) + static void finalize_parsed_str (cff2_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring) { /* vsindex is inserted at the beginning of the charstring as necessary */ if (env.seen_vsindex ()) { - Number ivs; + number_t ivs; ivs.set_int ((int)env.get_ivs ()); charstring.set_prefix (ivs, OpCode_vsindexcs); } @@ -278,7 +278,7 @@ struct cff2_subset_plan { /* top dict */ { - CFF2TopDict_OpSerializer topSzr; + cff2_top_dict_op_serializer_t topSzr; offsets.topDictInfo.size = TopDict::calculate_serialized_size (acc.topDict, topSzr); final_size += offsets.topDictInfo.size; } @@ -286,7 +286,7 @@ struct cff2_subset_plan { if (desubroutinize) { /* Flatten global & local subrs */ - SubrFlattener<const OT::cff2::accelerator_subset_t, CFF2CSInterpEnv, CFF2CSOpSet_Flatten> + subr_flattener_t<const OT::cff2::accelerator_subset_t, cff2_cs_interp_env_t, cff2_cs_opset_flatten_t> flattener(acc, plan->glyphs, plan->drop_hints); if (!flattener.flatten (subset_charstrings)) return false; @@ -310,7 +310,7 @@ struct cff2_subset_plan { /* global subrs */ unsigned int dataSize = subset_globalsubrs.total_size (); offsets.globalSubrsInfo.offSize = calcOffSize (dataSize); - offsets.globalSubrsInfo.size = CFF2Subrs::calculate_serialized_size (offsets.globalSubrsInfo.offSize, subset_globalsubrs.len, dataSize); + offsets.globalSubrsInfo.size = CFF2Subrs::calculate_serialized_size (offsets.globalSubrsInfo.offSize, subset_globalsubrs.length, dataSize); /* local subrs */ if (!offsets.localSubrsInfos.resize (orig_fdcount)) @@ -331,7 +331,7 @@ struct cff2_subset_plan { { offsets.localSubrsInfos[fd].offset = final_size; offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize); - offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].len, dataSize); + offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].length, dataSize); } } } @@ -370,9 +370,9 @@ struct cff2_subset_plan { /* FDArray (FDIndex) */ { offsets.FDArrayInfo.offset = final_size; - CFFFontDict_OpSerializer fontSzr; + cff_font_dict_op_serializer_t fontSzr; unsigned int dictsSize = 0; - for (unsigned int i = 0; i < acc.fontDicts.len; i++) + for (unsigned int i = 0; i < acc.fontDicts.length; i++) if (fdmap.includes (i)) dictsSize += FontDict::calculate_serialized_size (acc.fontDicts[i], fontSzr); @@ -385,7 +385,7 @@ struct cff2_subset_plan { offsets.charStringsInfo.offset = final_size; unsigned int dataSize = subset_charstrings.total_size (); offsets.charStringsInfo.offSize = calcOffSize (dataSize); - final_size += CFF2CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->glyphs.len, dataSize); + final_size += CFF2CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->glyphs.length, dataSize); } /* private dicts & local subrs */ @@ -395,9 +395,9 @@ struct cff2_subset_plan { if (fdmap.includes (i)) { bool has_localsubrs = offsets.localSubrsInfos[i].size > 0; - CFFPrivateDict_OpSerializer privSzr (desubroutinize, drop_hints); + cff_private_dict_op_serializer_t privSzr (desubroutinize, drop_hints); unsigned int priv_size = PrivateDict::calculate_serialized_size (acc.privateDicts[i], privSzr, has_localsubrs); - TableInfo privInfo = { final_size, priv_size, 0 }; + table_info_t privInfo = { final_size, priv_size, 0 }; privateDictInfos.push (privInfo); final_size += privInfo.size; @@ -415,23 +415,23 @@ struct cff2_subset_plan { unsigned int get_final_size () const { return final_size; } unsigned int final_size; - CFF2SubTableOffsets offsets; + cff2_sub_table_offsets_t offsets; unsigned int orig_fdcount; unsigned int subset_fdcount; unsigned int subset_fdselect_format; - hb_vector_t<code_pair> subset_fdselect_ranges; + hb_vector_t<code_pair_t> subset_fdselect_ranges; - Remap fdmap; + remap_t fdmap; - StrBuffArray subset_charstrings; - StrBuffArray subset_globalsubrs; - hb_vector_t<StrBuffArray> subset_localsubrs; - hb_vector_t<TableInfo> privateDictInfos; + str_buff_vec_t subset_charstrings; + str_buff_vec_t subset_globalsubrs; + hb_vector_t<str_buff_vec_t> subset_localsubrs; + hb_vector_t<table_info_t> privateDictInfos; bool drop_hints; bool desubroutinize; - CFF2SubrSubsetter subr_subsetter; + cff2_subr_subsetter_t subr_subsetter; }; static inline bool _write_cff2 (const cff2_subset_plan &plan, @@ -453,10 +453,10 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, /* top dict */ { - assert (cff2->topDict == c.head - c.start); + assert (cff2->topDict == (unsigned) (c.head - c.start)); cff2->topDictSize.set (plan.offsets.topDictInfo.size); TopDict &dict = cff2 + cff2->topDict; - CFF2TopDict_OpSerializer topSzr; + cff2_top_dict_op_serializer_t topSzr; if (unlikely (!dict.serialize (&c, acc.topDict, topSzr, plan.offsets))) { DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 top dict"); @@ -466,7 +466,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, /* global subrs */ { - assert (cff2->topDict + plan.offsets.topDictInfo.size == c.head - c.start); + assert (cff2->topDict + plan.offsets.topDictInfo.size == (unsigned) (c.head - c.start)); CFF2Subrs *dest = c.start_embed <CFF2Subrs> (); if (unlikely (dest == nullptr)) return false; if (unlikely (!dest->serialize (&c, plan.offsets.globalSubrsInfo.offSize, plan.subset_globalsubrs))) @@ -479,7 +479,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, /* variation store */ if (acc.varStore != &Null(CFF2VariationStore)) { - assert (plan.offsets.varStoreOffset == c.head - c.start); + assert (plan.offsets.varStoreOffset == (unsigned) (c.head - c.start)); CFF2VariationStore *dest = c.start_embed<CFF2VariationStore> (); if (unlikely (!dest->serialize (&c, acc.varStore))) { @@ -491,9 +491,9 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, /* FDSelect */ if (acc.fdSelect != &Null(CFF2FDSelect)) { - assert (plan.offsets.FDSelectInfo.offset == c.head - c.start); + assert (plan.offsets.FDSelectInfo.offset == (unsigned) (c.head - c.start)); - if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.len, *(const FDSelect *)acc.fdSelect, acc.fdArray->count, + if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.length, *(const FDSelect *)acc.fdSelect, acc.fdArray->count, plan.subset_fdselect_format, plan.offsets.FDSelectInfo.size, plan.subset_fdselect_ranges))) { @@ -504,10 +504,10 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, /* FDArray (FD Index) */ { - assert (plan.offsets.FDArrayInfo.offset == c.head - c.start); + assert (plan.offsets.FDArrayInfo.offset == (unsigned) (c.head - c.start)); CFF2FDArray *fda = c.start_embed<CFF2FDArray> (); if (unlikely (fda == nullptr)) return false; - CFFFontDict_OpSerializer fontSzr; + cff_font_dict_op_serializer_t fontSzr; if (unlikely (!fda->serialize (&c, plan.offsets.FDArrayInfo.offSize, acc.fontDicts, plan.subset_fdcount, plan.fdmap, fontSzr, plan.privateDictInfos))) @@ -519,7 +519,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, /* CharStrings */ { - assert (plan.offsets.charStringsInfo.offset == c.head - c.start); + assert (plan.offsets.charStringsInfo.offset == (unsigned) (c.head - c.start)); CFF2CharStrings *cs = c.start_embed<CFF2CharStrings> (); if (unlikely (cs == nullptr)) return false; if (unlikely (!cs->serialize (&c, plan.offsets.charStringsInfo.offSize, plan.subset_charstrings))) @@ -530,8 +530,8 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, } /* private dicts & local subrs */ - assert (plan.offsets.privateDictsOffset == c.head - c.start); - for (unsigned int i = 0; i < acc.privateDicts.len; i++) + assert (plan.offsets.privateDictsOffset == (unsigned) (c.head - c.start)); + for (unsigned int i = 0; i < acc.privateDicts.length; i++) { if (plan.fdmap.includes (i)) { @@ -539,7 +539,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, if (unlikely (pd == nullptr)) return false; unsigned int priv_size = plan.privateDictInfos[plan.fdmap[i]].size; bool result; - CFFPrivateDict_OpSerializer privSzr (plan.desubroutinize, plan.drop_hints); + cff_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 */ unsigned int subroffset = (plan.offsets.localSubrsInfos[i].size > 0)? priv_size: 0; result = pd->serialize (&c, acc.privateDicts[i], privSzr, subroffset); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc index 2219d379c1e..cca364d1de0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc @@ -39,17 +39,17 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf, hb_vector_t<unsigned int> *instruction_ranges /* OUT */) { unsigned int total = 0; - for (unsigned int i = 0; i < glyph_ids.len; i++) + for (unsigned int i = 0; i < glyph_ids.length; i++) { hb_codepoint_t next_glyph = glyph_ids[i]; - if (!instruction_ranges->resize (instruction_ranges->len + 2)) + if (!instruction_ranges->resize (instruction_ranges->length + 2)) { DEBUG_MSG(SUBSET, nullptr, "Failed to resize instruction_ranges."); return false; } - unsigned int *instruction_start = &(*instruction_ranges)[instruction_ranges->len - 2]; + unsigned int *instruction_start = &(*instruction_ranges)[instruction_ranges->length - 2]; *instruction_start = 0; - unsigned int *instruction_end = &(*instruction_ranges)[instruction_ranges->len - 1]; + unsigned int *instruction_end = &(*instruction_ranges)[instruction_ranges->length - 1]; *instruction_end = 0; unsigned int start_offset, end_offset; @@ -79,7 +79,7 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf, *glyf_size = total; *use_short_loca = (total <= 131070); - *loca_size = (glyph_ids.len + 1) + *loca_size = (glyph_ids.length + 1) * (*use_short_loca ? sizeof (OT::HBUINT16) : sizeof (OT::HBUINT32)); DEBUG_MSG(SUBSET, nullptr, "preparing to subset glyf: final size %d, loca size %d, using %s loca", @@ -167,7 +167,7 @@ _write_glyf_and_loca_prime (hb_subset_plan_t *plan, char *glyf_prime_data_next = glyf_prime_data; bool success = true; - for (unsigned int i = 0; i < glyph_ids.len; i++) + for (unsigned int i = 0; i < glyph_ids.length; i++) { unsigned int start_offset, end_offset; if (unlikely (!(glyf.get_offsets (glyph_ids[i], &start_offset, &end_offset) && @@ -215,7 +215,7 @@ _write_glyf_and_loca_prime (hb_subset_plan_t *plan, glyf_prime_data_next += length + (length % 2); // Align to 2 bytes for short loca. } - success = success && _write_loca_entry (glyph_ids.len, + success = success && _write_loca_entry (glyph_ids.length, glyf_prime_data_next - glyf_prime_data, use_short_loca, loca_prime_data, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc index 5c0983b7160..cff3426707a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc @@ -159,7 +159,7 @@ static void _create_old_gid_to_new_gid_map (const hb_vector_t<hb_codepoint_t> &glyphs, hb_map_t *glyph_map) { - for (unsigned int i = 0; i < glyphs.len; i++) { + for (unsigned int i = 0; i < glyphs.length; i++) { glyph_map->set (glyphs[i], i); } } 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 8d0473d95fb..31c50dfeb7b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc @@ -215,9 +215,12 @@ struct hb_uniscribe_shaper_funcs_t hinstLib = GetModuleHandle (TEXT ("usp10.dll")); if (hinstLib) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" this->ScriptItemizeOpenType = (SIOT) GetProcAddress (hinstLib, "ScriptItemizeOpenType"); this->ScriptShapeOpenType = (SSOT) GetProcAddress (hinstLib, "ScriptShapeOpenType"); this->ScriptPlaceOpenType = (SPOT) GetProcAddress (hinstLib, "ScriptPlaceOpenType"); +#pragma GCC diagnostic pop } if (!this->ScriptItemizeOpenType || !this->ScriptShapeOpenType || @@ -652,7 +655,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan, /* Scan events and save features for each range. */ hb_vector_t<active_feature_t> active_features; unsigned int last_index = 0; - for (unsigned int i = 0; i < feature_events.len; i++) + for (unsigned int i = 0; i < feature_events.length; i++) { feature_event_t *event = &feature_events[i]; @@ -661,26 +664,26 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan, /* Save a snapshot of active features and the range. */ range_record_t *range = range_records.push (); - unsigned int offset = feature_records.len; + unsigned int offset = feature_records.length; active_features.qsort (); - for (unsigned int j = 0; j < active_features.len; j++) + for (unsigned int j = 0; j < active_features.length; j++) { - if (!j || active_features[j].rec.tagFeature != feature_records[feature_records.len - 1].tagFeature) + if (!j || active_features[j].rec.tagFeature != feature_records[feature_records.length - 1].tagFeature) { feature_records.push (active_features[j].rec); } else { /* Overrides value for existing feature. */ - feature_records[feature_records.len - 1].lParameter = active_features[j].rec.lParameter; + feature_records[feature_records.length - 1].lParameter = active_features[j].rec.lParameter; } } /* Will convert to pointer after all is ready, since feature_records.array * may move as we grow it. */ range->props.potfRecords = reinterpret_cast<OPENTYPE_FEATURE_RECORD *> (offset); - range->props.cotfRecords = feature_records.len - offset; + range->props.cotfRecords = feature_records.length - offset; range->index_first = last_index; range->index_last = event->index - 1; @@ -699,14 +702,14 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan, } } - if (!range_records.len) /* No active feature found. */ + if (!range_records.length) /* No active feature found. */ num_features = 0; /* Fixup the pointers. */ - for (unsigned int i = 0; i < range_records.len; i++) + for (unsigned int i = 0; i < range_records.length; i++) { range_record_t *range = &range_records[i]; - range->props.potfRecords = feature_records + reinterpret_cast<uintptr_t> (range->props.potfRecords); + range->props.potfRecords = (OPENTYPE_FEATURE_RECORD *) feature_records + reinterpret_cast<uintptr_t> (range->props.potfRecords); } } @@ -817,7 +820,7 @@ retry: script_tags, &item_count); if (unlikely (FAILED (hr))) - FAIL ("ScriptItemizeOpenType() failed: 0x%08xL", hr); + FAIL ("ScriptItemizeOpenType() failed: 0x%08lx", hr); #undef MAX_ITEMS @@ -853,8 +856,8 @@ retry: range--; while (log_clusters[k] > range->index_last) range++; - if (!range_properties.len || - &range->props != range_properties[range_properties.len - 1]) + if (!range_properties.length || + &range->props != range_properties[range_properties.length - 1]) { TEXTRANGE_PROPERTIES **props = range_properties.push (); int *c = range_char_counts.push (); @@ -869,7 +872,7 @@ retry: } else { - range_char_counts[range_char_counts.len - 1]++; + range_char_counts[range_char_counts.length - 1]++; } last_range = range; @@ -888,7 +891,7 @@ retry: language_tag, range_char_counts.arrayZ (), range_properties.arrayZ (), - range_properties.len, + range_properties.length, pchars + chars_offset, item_chars_len, glyphs_size - glyphs_offset, @@ -916,7 +919,7 @@ retry: } if (unlikely (FAILED (hr))) { - FAIL ("ScriptShapeOpenType() failed: 0x%08xL", hr); + FAIL ("ScriptShapeOpenType() failed: 0x%08lx", hr); } for (unsigned int j = chars_offset; j < chars_offset + item_chars_len; j++) @@ -929,7 +932,7 @@ retry: language_tag, range_char_counts.arrayZ (), range_properties.arrayZ (), - range_properties.len, + range_properties.length, pchars + chars_offset, log_clusters + chars_offset, char_props + chars_offset, @@ -942,7 +945,7 @@ retry: offsets + glyphs_offset, nullptr); if (unlikely (FAILED (hr))) - FAIL ("ScriptPlaceOpenType() failed: 0x%08xL", hr); + FAIL ("ScriptPlaceOpenType() failed: 0x%08lx", hr); if (DEBUG_ENABLED (UNISCRIBE)) fprintf (stderr, "Item %d RTL %d LayoutRTL %d LogicalOrder %d ScriptTag %c%c%c%c\n", @@ -961,13 +964,13 @@ retry: /* Calculate visual-clusters. That's what we ship. */ for (unsigned int i = 0; i < glyphs_len; i++) - vis_clusters[i] = -1; + vis_clusters[i] = (uint32_t) -1; for (unsigned int i = 0; i < buffer->len; i++) { uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]]; *p = MIN (*p, buffer->info[i].cluster); } for (unsigned int i = 1; i < glyphs_len; i++) - if (vis_clusters[i] == -1) + if (vis_clusters[i] == (uint32_t) -1) vis_clusters[i] = vis_clusters[i - 1]; #undef utf16_index diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh index d8e3f4ef109..2fd739b5c1f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh @@ -29,29 +29,28 @@ #include "hb.hh" #include "hb-array.hh" +#include "hb-null.hh" -template <typename Type, unsigned int PreallocedCount=8> +template <typename Type> struct hb_vector_t { - typedef Type ItemType; - enum { item_size = hb_static_size (Type) }; + typedef Type item_t; + static constexpr unsigned item_size = hb_static_size (Type); - HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, PreallocedCount); + HB_NO_COPY_ASSIGN_TEMPLATE (hb_vector_t, Type); hb_vector_t () { init (); } ~hb_vector_t () { fini (); } - unsigned int len; + unsigned int length; private: - unsigned int allocated; /* == 0 means allocation failed. */ + int allocated; /* == -1 means allocation failed. */ Type *arrayZ_; - Type static_array[PreallocedCount]; public: void init () { - len = 0; - allocated = ARRAY_LENGTH (static_array); + allocated = length = 0; arrayZ_ = nullptr; } @@ -59,40 +58,41 @@ struct hb_vector_t { if (arrayZ_) free (arrayZ_); - arrayZ_ = nullptr; - allocated = len = 0; + init (); } void fini_deep () { Type *array = arrayZ(); - unsigned int count = len; + unsigned int count = length; for (unsigned int i = 0; i < count; i++) array[i].fini (); fini (); } - Type * arrayZ () { return arrayZ_ ? arrayZ_ : static_array; } - const Type * arrayZ () const { return arrayZ_ ? arrayZ_ : static_array; } + const Type * arrayZ () const { return arrayZ_; } + Type * arrayZ () { return arrayZ_; } Type& operator [] (int i_) { unsigned int i = (unsigned int) i_; - if (unlikely (i >= len)) + if (unlikely (i >= length)) return Crap (Type); return arrayZ()[i]; } const Type& operator [] (int i_) const { unsigned int i = (unsigned int) i_; - if (unlikely (i >= len)) + if (unlikely (i >= length)) return Null(Type); return arrayZ()[i]; } + explicit_operator bool () const { return length; } + hb_array_t<Type> as_array () - { return hb_array (arrayZ(), len); } + { return hb_array (arrayZ(), length); } hb_array_t<const Type> as_array () const - { return hb_array (arrayZ(), len); } + { return hb_array (arrayZ(), length); } hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const { return as_array ().sub_array (start_offset, count);} @@ -104,9 +104,9 @@ struct hb_vector_t { return as_array ().sub_array (start_offset, count);} hb_sorted_array_t<Type> as_sorted_array () - { return hb_sorted_array (arrayZ(), len); } + { return hb_sorted_array (arrayZ(), length); } hb_sorted_array_t<const Type> as_sorted_array () const - { return hb_sorted_array (arrayZ(), len); } + { return hb_sorted_array (arrayZ(), length); } hb_array_t<const Type> sorted_sub_array (unsigned int start_offset, unsigned int count) const { return as_sorted_array ().sorted_sub_array (start_offset, count);} @@ -127,9 +127,9 @@ struct hb_vector_t Type *push () { - if (unlikely (!resize (len + 1))) + if (unlikely (!resize (length + 1))) return &Crap(Type); - return &arrayZ()[len - 1]; + return &arrayZ()[length - 1]; } Type *push (const Type& v) { @@ -138,15 +138,15 @@ struct hb_vector_t return p; } - bool in_error () const { return allocated == 0; } + bool in_error () const { return allocated < 0; } - /* Allocate for size but don't adjust len. */ + /* Allocate for size but don't adjust length. */ bool alloc (unsigned int size) { - if (unlikely (!allocated)) + if (unlikely (allocated < 0)) return false; - if (likely (size <= allocated)) + if (likely (size <= (unsigned) allocated)) return true; /* Reallocate */ @@ -156,23 +156,16 @@ struct hb_vector_t new_allocated += (new_allocated >> 1) + 8; Type *new_array = nullptr; - - if (!arrayZ_) - { - new_array = (Type *) calloc (new_allocated, sizeof (Type)); - if (new_array) - memcpy (new_array, static_array, 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)); - } + bool overflows = + (int) new_allocated < 0 || + (new_allocated < (unsigned) 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)) { - allocated = 0; + allocated = -1; return false; } @@ -188,42 +181,42 @@ struct hb_vector_t if (!alloc (size)) return false; - if (size > len) - memset (arrayZ() + len, 0, (size - len) * sizeof (*arrayZ())); + if (size > length) + memset (arrayZ() + length, 0, (size - length) * sizeof (*arrayZ())); - len = size; + length = size; return true; } void pop () { - if (!len) return; - len--; + if (!length) return; + length--; } void remove (unsigned int i) { - if (unlikely (i >= len)) + if (unlikely (i >= length)) return; Type *array = arrayZ(); memmove (static_cast<void *> (&array[i]), static_cast<void *> (&array[i + 1]), - (len - i - 1) * sizeof (Type)); - len--; + (length - i - 1) * sizeof (Type)); + length--; } void shrink (int size_) { unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; - if (size < len) - len = size; + if (size < length) + length = size; } template <typename T> Type *find (T v) { Type *array = arrayZ(); - for (unsigned int i = 0; i < len; i++) + for (unsigned int i = 0; i < length; i++) if (array[i] == v) return &array[i]; return nullptr; @@ -232,7 +225,7 @@ struct hb_vector_t const Type *find (T v) const { const Type *array = arrayZ(); - for (unsigned int i = 0; i < len; i++) + for (unsigned int i = 0; i < length; i++) if (array[i] == v) return &array[i]; return nullptr; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh index a55e92d5ddc..5b66ba85d19 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh @@ -29,6 +29,102 @@ #ifndef HB_HH #define HB_HH +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC +#if defined(_MSC_VER) +#pragma warning( disable: 4068 ) /* Unknown pragma */ +#endif +#if defined(__GNUC__) || defined(__clang__) +/* Rules: + * + * - All pragmas are declared GCC even if they are clang ones. Otherwise GCC + * nags, even though we instruct it to ignore -Wunknown-pragmas. ¯\_(ツ)_/¯ + * + * - Within each category, keep sorted. + * + * - Warnings whose scope can be expanded in future compiler versions shall + * be declared as "warning". Otherwise, either ignored or error. + */ + +/* Setup. Don't sort order within this category. */ +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING +#pragma GCC diagnostic warning "-Wall" +#pragma GCC diagnostic warning "-Wextra" +#endif +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wunknown-warning-option" +#endif +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING +//#pragma GCC diagnostic warning "-Weverything" +#endif + +/* Error. Should never happen. */ +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR +#pragma GCC diagnostic error "-Wc++11-narrowing" +#pragma GCC diagnostic error "-Wcast-align" +#pragma GCC diagnostic error "-Wcast-function-type" +#pragma GCC diagnostic error "-Wdelete-non-virtual-dtor" +#pragma GCC diagnostic error "-Wformat-security" +#pragma GCC diagnostic error "-Wimplicit-function-declaration" +#pragma GCC diagnostic error "-Winit-self" +#pragma GCC diagnostic error "-Wmissing-braces" +#pragma GCC diagnostic error "-Wmissing-declarations" +#pragma GCC diagnostic error "-Wmissing-prototypes" +#pragma GCC diagnostic error "-Wnested-externs" +#pragma GCC diagnostic error "-Wold-style-definition" +#pragma GCC diagnostic error "-Wpointer-arith" +#pragma GCC diagnostic error "-Wredundant-decls" +#pragma GCC diagnostic error "-Wreorder" +#pragma GCC diagnostic error "-Wsign-compare" +#pragma GCC diagnostic error "-Wstrict-prototypes" +#pragma GCC diagnostic error "-Wstring-conversion" +#pragma GCC diagnostic error "-Wswitch-enum" +#pragma GCC diagnostic error "-Wtautological-overlap-compare" +#pragma GCC diagnostic error "-Wunneeded-internal-declaration" +#pragma GCC diagnostic error "-Wunused" +#pragma GCC diagnostic error "-Wunused-local-typedefs" +#pragma GCC diagnostic error "-Wunused-value" +#pragma GCC diagnostic error "-Wunused-variable" +#pragma GCC diagnostic error "-Wvla" +#pragma GCC diagnostic error "-Wwrite-strings" +#endif + +/* Warning. To be investigated if happens. */ +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING +#pragma GCC diagnostic warning "-Wbuiltin-macro-redefined" +#pragma GCC diagnostic warning "-Wdisabled-optimization" +#pragma GCC diagnostic warning "-Wformat=2" +#pragma GCC diagnostic warning "-Wignored-pragma-optimize" +#pragma GCC diagnostic warning "-Wlogical-op" +#pragma GCC diagnostic warning "-Wmaybe-uninitialized" +#pragma GCC diagnostic warning "-Wmissing-format-attribute" +#pragma GCC diagnostic warning "-Wundef" +#endif + +/* Ignored currently, but should be fixed at some point. */ +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED +#pragma GCC diagnostic ignored "-Wconversion" // TODO fix +#pragma GCC diagnostic ignored "-Wformat-signedness" // TODO fix +#pragma GCC diagnostic ignored "-Wshadow" // TODO fix +#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" // TODO fix +#pragma GCC diagnostic ignored "-Wunused-parameter" // TODO fix +#endif + +/* Ignored intentionally. */ +#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED +#pragma GCC diagnostic ignored "-Wclass-memaccess" +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#pragma GCC diagnostic ignored "-Wpacked" // Erratic impl in clang +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif + +#endif +#endif + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -59,10 +155,6 @@ # define __EXTENSIONS__ 1 #endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #if defined (_MSC_VER) && defined (HB_DLL_EXPORT) #define HB_EXTERN __declspec (dllexport) extern #endif @@ -137,7 +229,7 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size); HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1] #endif // static_assert -#ifdef __GNUC__ +#if defined(__GNUC__) #if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)) #define thread_local __thread #endif @@ -187,7 +279,7 @@ struct _hb_alignof #define __attribute__(x) #endif -#if __GNUC__ >= 3 +#if defined(__GNUC__) && (__GNUC__ >= 3) #define HB_PURE_FUNC __attribute__((pure)) #define HB_CONST_FUNC __attribute__((const)) #define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx))) @@ -196,7 +288,7 @@ struct _hb_alignof #define HB_CONST_FUNC #define HB_PRINTF_FUNC(format_idx, arg_idx) #endif -#if __GNUC__ >= 4 +#if defined(__GNUC__) && (__GNUC__ >= 4) #define HB_UNUSED __attribute__((unused)) #elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */ #define HB_UNUSED __pragma(warning(suppress: 4100 4101)) @@ -219,7 +311,7 @@ struct _hb_alignof # endif #endif -#if __GNUC__ >= 3 +#if defined(__GNUC__) && (__GNUC__ >= 3) #define HB_FUNC __PRETTY_FUNCTION__ #elif defined(_MSC_VER) #define HB_FUNC __FUNCSIG__ @@ -251,7 +343,7 @@ struct _hb_alignof #if defined(__clang__) && __cplusplus >= 201103L /* clang's fallthrough annotations are only available starting in C++11. */ # define HB_FALLTHROUGH [[clang::fallthrough]] -#elif __GNUC__ >= 7 +#elif defined(__GNUC__) && (__GNUC__ >= 7) /* GNU fallthrough attribute is available from GCC7 */ # define HB_FALLTHROUGH __attribute__((fallthrough)) #elif defined(_MSC_VER) @@ -377,6 +469,9 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); #define HB_NO_COPY_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) +#define HB_NO_COPY_ASSIGN_TEMPLATE(TypeName, T) \ + TypeName(const TypeName<T>&); \ + void operator=(const TypeName<T>&) #define HB_NO_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) \ TypeName(const TypeName<T1, T2>&); \ void operator=(const TypeName<T1, T2>&) @@ -396,6 +491,7 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); #else /* __cpluspplus >= 201103L */ #define HB_NO_COPY_ASSIGN(TypeName) static_assert (true, "") +#define HB_NO_COPY_ASSIGN_TEMPLATE(TypeName, T) static_assert (true, "") #define HB_NO_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) static_assert (true, "") #define HB_NO_CREATE_COPY_ASSIGN(TypeName) static_assert (true, "") #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE(TypeName, T) static_assert (true, "") @@ -468,7 +564,8 @@ typedef uint64_t hb_vector_size_impl_t; static inline T& operator |= (T &l, T r) { l = l | r; return l; } \ static inline T& operator &= (T& l, T r) { l = l & r; return l; } \ static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \ - } + } \ + static_assert (true, "") /* Useful for set-operations on small enums. * For example, for testing "x ∈ {x1, x2, x3}" use: @@ -545,13 +642,17 @@ template <typename T> struct hb_remove_pointer<T *> { typedef T value; }; #define hb_remove_pointer(T) hb_remove_pointer<T>::value -/* Headers we include for everyone. Keep sorted. They express dependency amongst - * themselves, but no other file should include them.*/ +/* Headers we include for everyone. Keep topologically sorted by dependency. + * They express dependency amongst themselves, but no other file should include + * them directly.*/ #include "hb-atomic.hh" -#include "hb-debug.hh" -#include "hb-dsalgs.hh" #include "hb-mutex.hh" #include "hb-null.hh" -#include "hb-object.hh" +#include "hb-dsalgs.hh" // Requires: hb-null +#include "hb-iter.hh" // Requires: hb-null +#include "hb-debug.hh" // Requires: hb-atomic hb-dsalgs +#include "hb-array.hh" // Requires: hb-dsalgs hb-iter hb-null +#include "hb-vector.hh" // Requires: hb-array hb-null +#include "hb-object.hh" // Requires: hb-atomic hb-mutex hb-vector #endif /* HB_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-iter.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-iter.cc new file mode 100644 index 00000000000..05430b009c7 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-iter.cc @@ -0,0 +1,84 @@ +/* + * Copyright © 2018 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +#include "hb.hh" +#include "hb-iter.hh" + +#include "hb-array.hh" +#include "hb-set.hh" + + +template <typename T> +struct array_iter_t : hb_iter_t<array_iter_t<T>, T>, hb_iter_mixin_t<array_iter_t<T>, T> +{ + array_iter_t (hb_array_t<T> arr_) : arr (arr_) {} + + typedef T __item_type__; + T& __item_at__ (unsigned i) const { return arr[i]; } + void __forward__ (unsigned n) { arr += n; } + void __rewind__ (unsigned n) { arr -= n; } + unsigned __len__ () const { return arr.length; } + bool __random_access__ () const { return true; } + + private: + hb_array_t<T> arr; +}; + +template <typename T> +struct some_array_t +{ + some_array_t (hb_array_t<T> arr_) : arr (arr_) {} + + typedef array_iter_t<T> iter_t; + array_iter_t<T> iter () { return array_iter_t<T> (arr); } + operator array_iter_t<T> () { return iter (); } + operator hb_iter_t<array_iter_t<T> > () { return iter (); } + + private: + hb_array_t<T> arr; +}; + +int +main (int argc, char **argv) +{ + const int src[10] = {}; + int dst[20]; + hb_vector_t<int> v; + + array_iter_t<const int> s (src); /* Implicit conversion from static array. */ + array_iter_t<const int> s2 (v); /* Implicit conversion from vector. */ + array_iter_t<int> t (dst); + + some_array_t<const int> a (src); + + s2 = s; + + hb_fill (t, 42); + hb_copy (t, s); + // hb_copy (t, a.iter ()); + + return 0; +} diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc index ec9d17acd23..0eef8c24b50 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc @@ -25,7 +25,6 @@ */ #include "hb.hh" - #include "hb-ot-os2-unicode-ranges.hh" static void diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index b28299de084..4fc4bb733ed 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], [2.3.0]) +m4_define([harfbuzz_version], [2.3.1]) |