diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-12-04 22:53:50 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-12-04 22:53:50 +0000 |
commit | 9a0a15c9b59d9fd8dac7591d467ef27f718e16d6 (patch) | |
tree | 8340685b75516223567426a251813d64ee80f42e /Build/source/libs/harfbuzz/harfbuzz-src | |
parent | 527c20c05260beb1e9851ec5ccb404d6a0dd150f (diff) |
harfbuzz-1.7.2
git-svn-id: svn://tug.org/texlive/trunk@45988 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src')
55 files changed, 1780 insertions, 1128 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/BUILD.md b/Build/source/libs/harfbuzz/harfbuzz-src/BUILD.md index 2107803a28f..9e5a55bd61e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/BUILD.md +++ b/Build/source/libs/harfbuzz/harfbuzz-src/BUILD.md @@ -9,7 +9,7 @@ on Windows, consider using [vcpkg](https://github.com/Microsoft/vcpkg), provided by Microsoft, for building HarfBuzz and other open-source libraries but if you need to build harfbuzz from source, put ragel binary on your PATH and follow appveyor CI's cmake -[build steps](https://github.com/behdad/harfbuzz/blob/master/appveyor.yml). +[build steps](https://github.com/harfbuzz/harfbuzz/blob/master/appveyor.yml). on macOS, using MacPorts: * sudo port install freetype glib2 cairo diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt index 8d2825758ab..2357609902d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt @@ -146,7 +146,7 @@ if (NOT IN_HB_DIST) if (RAGEL) message(STATUS "ragel found at: ${RAGEL}") else () - message(FATAL_ERROR "ragel not found, get it here -- http://www.complang.org/ragel/ or, use harfbuzz releases https://github.com/behdad/harfbuzz/releases") + message(FATAL_ERROR "ragel not found, get it here -- http://www.complang.org/ragel/ or, use harfbuzz releases https://github.com/harfbuzz/harfbuzz/releases") endif () foreach (ragel_output IN ITEMS ${HB_BASE_RAGEL_GENERATED_sources} ${HB_OT_RAGEL_GENERATED_sources}) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index c991bec062e..03b0b158969 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,569 @@ +commit 843f7f70355f62511a5d8be3b905c853bf362629 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Dec 4 08:52:39 2017 -0800 + + 1.7.2 + + NEWS | 10 ++++++++++ + configure.ac | 2 +- + 2 files changed, 11 insertions(+), 1 deletion(-) + +commit eeb26d21d493183f54704487754d53a127b017ae +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 2 15:22:04 2017 -0800 + + [set] Actually commit fixes mentioned in previous commit! + + src/hb-set-private.hh | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +commit 20b4672754baf9751642bb37344a6ff4e224dc37 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 2 15:14:26 2017 -0800 + + [set] Fix recent changes + + Ouch! + + Add tests. + + test/api/test-set.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +commit 0744149cdabd85d632822ff810d3994787bca4b7 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sat Dec 2 15:06:15 2017 -0800 + + [set] Protect against bad input in hb_set_add_range() + + src/hb-set-private.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit d5e29303db47a1868fa9b044ca61e146f882179c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 28 23:11:34 2017 -0800 + + [coretext] Add hb_coretext_font_create() + + Fixes https://github.com/harfbuzz/harfbuzz/issues/628 + + New API: + hb_coretext_font_create() + + src/hb-coretext.cc | 55 + ++++++++++++++++++++++++++++++++++-------------------- + src/hb-coretext.h | 3 +++ + 2 files changed, 38 insertions(+), 20 deletions(-) + +commit 9d0194b3a8e0c562249337fa0cf4d72e89334263 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 1 13:56:06 2017 -0800 + + [set] Optimize add_range() some more + + It's as good as it gets, and seems to be on par with previous set + implementation + in my benchmark. + + Would be great if someone can double-check my bitops. + + src/hb-set-private.hh | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +commit 438c325a256f040c6be840924ed42dcbcd8a049a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 1 13:34:14 2017 -0800 + + [set] Optimize add_range() + + With new set implementation, this became really costy. Optimize it. + There's more to be done, but this shaves off most of the fat. + + Part of fixing + https://bugs.chromium.org/p/chromium/issues/detail?id=782220 + + src/hb-set-private.hh | 56 + +++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 41 insertions(+), 15 deletions(-) + +commit be9e307a889e04d198042ad39949d3971232ab26 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Dec 1 12:36:26 2017 -0800 + + [ot] Ensure layout in hb_ot_layout_table_get_lookup_count() + + src/hb-ot-layout.cc | 1 + + 1 file changed, 1 insertion(+) + +commit d9066afd6bc260d2f2ad5cd5b3e8b196e944d3d8 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Nov 29 16:18:18 2017 -0800 + + Add another test for previous commit + + From https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4273 + + .../sha1sum/bbf4a308c402f0678c3e82844892a4da2ebe598f.ttf | Bin 0 -> + 204 bytes + test/shaping/tests/fuzzed.tests | 1 + + 2 files changed, 1 insertion(+) + +commit 16fba5b2158a0e093e6df32637eba5058942e299 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Nov 29 16:08:11 2017 -0800 + + [ot] Fix Extension type recurse to disallow recursing to another + Extension + + Particularly hazardous if the second layer mixes forward and backward + lookups. + + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4336 + + src/hb-ot-layout-gsub-table.hh | 6 ++++-- + .../sha1sum/9d8a94a67932a3ab75a596fc8b5c6d0392ca9e49.ttf | Bin 0 -> + 4545 bytes + .../sha1sum/ef2511f215aa3ca847cbfffbf861793b42170875.ttf | Bin 0 -> + 1152 bytes + test/shaping/tests/fuzzed.tests | 2 ++ + 4 files changed, 6 insertions(+), 2 deletions(-) + +commit 7ab49de987b856312d7ad1d02639f7306aa0ad2f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Nov 29 14:20:09 2017 -0800 + + Try fixing Mac build with 10.12 + + Related + https://github.com/harfbuzz/harfbuzz/issues/345 + https://github.com/harfbuzz/harfbuzz/pull/629 + + .travis.yml | 1 + + 1 file changed, 1 insertion(+) + +commit d672bcf9d72bb473f5f53089c8af595c4047bc99 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 28 22:20:57 2017 -0800 + + Minor + + docs/Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 23ade70783a17ed6822d13e7a910544de2ef181f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 21 16:36:07 2017 -0800 + + [doc] Optimize HarfBuzz.png; add HarfBuzz.svg + + SVG is unused. Just keeping it here. + + docs/HarfBuzz.png | Bin 14203 -> 8814 bytes + docs/HarfBuzz.svg | 277 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 277 insertions(+) + +commit 77efdecadddbd68bbbc0ff85ac84e24976ad4d4f +Author: Khaled Hosny <khaledhosny@eglug.org> +Date: Wed Nov 22 00:14:29 2017 +0200 + + Improve the docs commit message a bit + + .ci/deploy-docs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit a13c0748c59a92812469ada762d57bce3b02fe34 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Nov 21 09:52:18 2017 +0330 + + Move gh-pages docs to harfbuzz.github.io + + .ci/deploy-docs.sh | 10 +++++----- + README | 2 ++ + docs/HarfBuzz.png | Bin 12710 -> 14203 bytes + docs/circle.yml | 3 --- + 4 files changed, 7 insertions(+), 8 deletions(-) + +commit 9f259769a61f17b47701bbad79e1865571338417 +Author: David Corbett <corbett.dav@husky.neu.edu> +Date: Tue Nov 21 14:16:10 2017 -0500 + + Categorize U+A8B4 as Consonant_Medial + + src/gen-use-table.py | 3 +++ + src/hb-ot-shape-complex-use-table.cc | 2 +- + .../sha1sum/373e67bf41ca264e260a9716162b71a23549e885.ttf | Bin 0 -> + 1164 bytes + test/shaping/tests/use-syllable.tests | 1 + + 4 files changed, 5 insertions(+), 1 deletion(-) + +commit cd8c62fd41ca824c5db3c55fd1faa20318ca0bf9 +Author: ebraminio <ebrahim@gnu.org> +Date: Tue Nov 21 01:07:26 2017 -0500 + + [ci] Add Oracle Developer Studio (former Sun Studio) based compiler + (#621) + + .circleci/config.yml | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +commit 8d55340593ce32e55cfbd86a17c0be8750e8fb72 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Nov 20 19:43:22 2017 -0800 + + Fix fallback positioning of double diacritic marks + + Fixes https://bugzilla.gnome.org/show_bug.cgi?id=787284 + + src/hb-ot-shape-fallback.cc | 4 ++-- + .../sha1sum/856ff9562451293cbeff6f396d4e3877c4f0a436.ttf | Bin 0 -> + 892 bytes + test/shaping/tests/fallback-positioning.tests | 1 + + 3 files changed, 3 insertions(+), 2 deletions(-) + +commit bb7cc4eada06839a3892cea5919f0c310cbaf7c3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Nov 20 19:39:47 2017 -0800 + + Minor + + util/options.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit a0ad0d5bb8260cb297ff114adca7c8d05b6128bb +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Nov 20 15:07:48 2017 -0800 + + [docs] s/Harfbuzz/HarfBuzz/g + + docs/harfbuzz-docs.xml | 2 +- + ...anual-buffers-language-script-and-direction.xml | 10 +++---- + docs/usermanual-fonts-and-faces.xml | 2 +- + docs/usermanual-hello-harfbuzz.xml | 34 + +++++++++++----------- + docs/usermanual-install-harfbuzz.xml | 2 +- + docs/usermanual-what-is-harfbuzz.xml | 20 ++++++------- + 6 files changed, 35 insertions(+), 35 deletions(-) + +commit 87d74605f5f9db685bef7329f498437b4d868e6f +Author: David Corbett <corbett.dav@husky.neu.edu> +Date: Mon Nov 20 13:19:34 2017 -0500 + + Categorize U+0C80 as Consonant_Placeholder + + src/hb-ot-shape-complex-indic.cc | 1 + + .../sha1sum/81c368a33816fb20e9f647e8f24e2180f4720263.ttf | Bin 0 -> + 1152 bytes + test/shaping/tests/indic-syllable.tests | 1 + + 3 files changed, 2 insertions(+) + +commit 7c6937e7c7b62602fef10ac4b2e164d0c67c932b +Author: ebraminio <ebrahim@gnu.org> +Date: Mon Nov 20 14:49:22 2017 -0500 + + Move all references of old url to the new address (#622) + + .travis.yml | 2 +- + BUILD.md | 2 +- + CMakeLists.txt | 2 +- + NEWS | 20 ++++++++++---------- + README | 8 ++++---- + RELEASING.md | 2 +- + configure.ac | 2 +- + docs/HarfBuzz.png | Bin 3419 -> 12710 bytes + docs/harfbuzz-docs.xml | 2 +- + docs/usermanual-install-harfbuzz.xml | 2 +- + harfbuzz.doap | 2 +- + src/gen-use-table.py | 4 ++-- + src/hb-coretext.cc | 2 +- + src/hb-debug.hh | 2 +- + src/hb-ot-layout-gsub-table.hh | 22 +++++++++++----------- + src/hb-ot-layout-gsubgpos-private.hh | 2 +- + src/hb-ot-layout-private.hh | 8 ++++---- + src/hb-ot-shape-complex-arabic.cc | 4 ++-- + src/hb-ot-shape-complex-hebrew.cc | 2 +- + src/hb-ot-shape-complex-indic-private.hh | 2 +- + src/hb-ot-shape-complex-indic.cc | 8 ++++---- + src/hb-ot-shape-complex-use-machine.rl | 2 +- + src/hb-ot-shape.cc | 2 +- + src/hb-private.hh | 2 +- + src/hb-unicode-private.hh | 2 +- + src/sample.py | 2 +- + test/api/test-set.c | 2 +- + test/fuzzing/README | 2 +- + 28 files changed, 57 insertions(+), 57 deletions(-) + +commit baf7779d2d6e4810168a8f036bbf8f9e6493dd1a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 21:53:48 2017 -0800 + + Limit how much recursion GSUB/GPOS does + + This only counts recursions right now. Good start. + + Hopefully... + Fixes https://github.com/behdad/harfbuzz/issues/429 + + src/Makefile.am | 5 ++++- + src/hb-buffer-private.hh | 15 +++++++++++++-- + src/hb-buffer.cc | 2 ++ + src/hb-ot-layout-gsubgpos-private.hh | 5 ++++- + src/hb-ot-shape.cc | 10 ++++++++-- + test/shaping/tests/fuzzed.tests | 2 +- + 6 files changed, 32 insertions(+), 7 deletions(-) + +commit 173dab6300d9b492f2d1c68f9e8f7817211a3462 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 21:27:24 2017 -0800 + + Minor move + + src/hb-buffer-private.hh | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +commit c6173a392cfaa3d339c768836e8cddf3ae4adc53 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 21:09:03 2017 -0800 + + Add Offset16 and Offset32 + + src/hb-open-type-private.hh | 5 ++++- + src/hb-ot-layout-common-private.hh | 4 ++-- + src/hb-ot-name-table.hh | 2 +- + src/hb-ot-var-fvar-table.hh | 2 +- + 4 files changed, 8 insertions(+), 5 deletions(-) + +commit 6f335ed1e52c6161fa0b0295776856fc07f7f46f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 21:06:07 2017 -0800 + + Replace USHORT/SHORT/ULONG/etc with UINT16/INT16/UINT32/etc + + src/hb-open-file-private.hh | 6 +- + src/hb-open-type-private.hh | 67 ++++++------ + src/hb-ot-cbdt-table.hh | 78 +++++++------- + src/hb-ot-cmap-table.hh | 90 ++++++++-------- + src/hb-ot-glyf-table.hh | 10 +- + src/hb-ot-head-table.hh | 28 ++--- + src/hb-ot-hhea-table.hh | 18 ++-- + src/hb-ot-kern-table.hh | 36 +++---- + src/hb-ot-layout-common-private.hh | 118 ++++++++++---------- + src/hb-ot-layout-gdef-table.hh | 22 ++-- + src/hb-ot-layout-gpos-table.hh | 94 ++++++++-------- + src/hb-ot-layout-gsub-table.hh | 30 +++--- + src/hb-ot-layout-gsubgpos-private.hh | 172 + +++++++++++++++--------------- + src/hb-ot-math-table.hh | 26 ++--- + src/hb-ot-maxp-table.hh | 2 +- + src/hb-ot-name-table.hh | 16 +-- + src/hb-ot-os2-table.hh | 70 ++++++------ + src/hb-ot-post-table.hh | 16 +-- + src/hb-ot-shape-complex-arabic-win1256.hh | 32 +++--- + src/hb-ot-var-avar-table.hh | 4 +- + src/hb-ot-var-fvar-table.hh | 20 ++-- + src/hb-ot-var-hvar-table.hh | 8 +- + src/hb-ot-var-mvar-table.hh | 10 +- + 23 files changed, 486 insertions(+), 487 deletions(-) + +commit a130ee6df50a50f541d0e8018deea9cee8c6738a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:30:03 2017 -0800 + + Remove a couple of unused consts + + src/hb-ot-hhea-table.hh | 5 ----- + src/hb-ot-layout-gsubgpos-private.hh | 3 --- + src/main.cc | 4 ++-- + 3 files changed, 2 insertions(+), 10 deletions(-) + +commit e20e47eaa1b7dd33ac63ab0eaa8f5ea1bf7775c2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:25:29 2017 -0800 + + [glyf] Try fixing undefined-behavior + + Might fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1463 + + src/hb-ot-glyf-table.hh | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +commit 7b40876a58d331200e1d7cda1dec72578139ff9c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:22:05 2017 -0800 + + [ot] Remove unneeded TODO item + + Looks like hb-ot-font is complete after all! + + CFF font names and CFF glyph metrics don't work though... + + src/hb-ot-font.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit eab4feb5e221b8219c071ea882de79405aca4e84 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:16:45 2017 -0800 + + [hmtx] Use curiously recurring template pattern + + https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern + + src/hb-ot-font.cc | 11 ++++------- + src/hb-ot-hmtx-table.hh | 29 +++++++++++++++-------------- + 2 files changed, 19 insertions(+), 21 deletions(-) + +commit 977ddff1f1e0f0f71a46c60ba713d160b96f5a3c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:06:19 2017 -0800 + + [ot] Move hb_ot_face_cmap_accelerator_t + + src/hb-ot-cmap-table.hh | 149 + +++++++++++++++++++++++++++++++++++++++++++++--- + src/hb-ot-font.cc | 130 +----------------------------------------- + 2 files changed, 142 insertions(+), 137 deletions(-) + +commit a7f15959b5e6e14e5241a3155c413ff70e7d1eb3 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:02:24 2017 -0800 + + Shuffle + + src/hb-ot-hmtx-table.hh | 76 + ++++++++++++++++++++++++------------------------- + 1 file changed, 38 insertions(+), 38 deletions(-) + +commit a85d7ead04aff81d2f9df9110316892dbbefe1c2 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 20:00:34 2017 -0800 + + [ot] Move hb_ot_face_metrics_accelerator_t + + src/hb-ot-font.cc | 108 + +----------------------------------------------- + src/hb-ot-hmtx-table.hh | 108 + +++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 109 insertions(+), 107 deletions(-) + +commit f00a94e1ec73c08d4bde1f50bff57d2dc9583ca8 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 19:54:48 2017 -0800 + + Adjust privacy for recent changes + + src/hb-ot-cbdt-table.hh | 6 ++++-- + src/hb-ot-glyf-table.hh | 6 ++++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +commit 7e2839c438beea216c7c8a3881e88961940e67be +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 19:52:09 2017 -0800 + + [ot] Move hb_ot_face_glyf_accelerator_t + + src/hb-ot-font.cc | 75 +---------------------------------- + src/hb-ot-glyf-table.hh | 103 + +++++++++++++++++++++++++++++++++++++++++------- + 2 files changed, 90 insertions(+), 88 deletions(-) + +commit c4e18e54dc5ffecac7b327bde9f52dd0927d6a08 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 19:47:31 2017 -0800 + + [ot] Move hb_ot_face_cbdt_accelerator_t + + src/hb-ot-cbdt-table.hh | 85 + +++++++++++++++++++++++++++++++++++++++++++++++ + src/hb-ot-font.cc | 87 + +------------------------------------------------ + src/hb-ot-post-table.hh | 1 + + 3 files changed, 87 insertions(+), 86 deletions(-) + +commit 9b04b0384fe746bdb1885c57e1ce73c4c6cae9e5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 19:31:50 2017 -0800 + + [ot] Fold hb_ot_face_post_accelerator_t + + src/hb-ot-font.cc | 35 +---------------------------------- + src/hb-ot-post-table.hh | 9 +++++++-- + 2 files changed, 8 insertions(+), 36 deletions(-) + +commit 702d86ba6b4a2e41cbee46fea18b3f8eb8986dc9 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 19:25:38 2017 -0800 + + [ot] Fold hb_ot_face_kern_accelerator_t + + src/hb-ot-font.cc | 23 +---------------------- + src/hb-ot-kern-table.hh | 13 +++++++++---- + 2 files changed, 10 insertions(+), 26 deletions(-) + +commit 909de95a112ffe4d05ddcfed97a235763e8af068 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 16:22:52 2017 -0800 + + Minor build fix + + src/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +commit b9c96b5d7cce80ef75cbdf0f0c47d1db62797c55 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 15:56:21 2017 -0800 + + Add test for previous commit + + At some point we should run tests under valgrind... + + .../sha1sum/dd9f0c7c7c36f75a18be0cab1cddf8f3ab0f366b.ttf | Bin 0 -> + 2786 bytes + test/shaping/tests/fuzzed.tests | 3 ++- + 2 files changed, 2 insertions(+), 1 deletion(-) + +commit e5930722d485207ca158612a2b08816337fed7e8 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 15:47:55 2017 -0800 + + Fix invalid buffer access in OOM times + + Hopefully fully fixes + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1856 + + src/hb-ot-layout-gsubgpos-private.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit fcd6c338ff4968a0d7fc297da1c6d8058823aaa1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 14:40:21 2017 -0800 + + Fix more compiler warnings + + src/hb-debug.hh | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +commit 7fdf16b2ceb709b78654f99e6513fa878cd4d575 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Nov 14 14:40:11 2017 -0800 + + Fix compiler warning + + src/hb-string-array.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 87f0ad183c489ef3208cf454d43c448638316092 +Author: David Corbett <corbett.dav@husky.neu.edu> +Date: Thu Nov 2 10:59:25 2017 -0400 + + Allow U+20F0 in USE clusters + + src/gen-use-table.py | 4 +++ + src/hb-ot-shape-complex-use-table.cc | 34 + +++++++++++++-------- + .../074a5ae6b19de8f29772fdd5df2d3d833f81f5e6.ttf | Bin 0 -> 2296 bytes + test/shaping/tests/use-syllable.tests | 1 + + 4 files changed, 26 insertions(+), 13 deletions(-) + commit f93c6f8bfa228e95311d8d6d02dcc64b603c6e36 Author: Behdad Esfahbod <behdad@behdad.org> Date: Tue Nov 14 11:09:19 2017 -0800 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index ba9a886682a..6242ee5c33c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,13 @@ +Overview of changes leading to 1.7.2 +Monday, December 4, 2017 +==================================== + +- Optimize hb_set_add_range(). +- Misc fixes. +- New API: +hb_coretext_font_create() + + Overview of changes leading to 1.7.1 Tuesday, November 14, 2017 ==================================== @@ -33,7 +43,7 @@ Monday, October 23nd, 2017 - Yesterday's release had a bad crasher; don't use it. That's what happens when one works on Sunday... - https://github.com/behdad/harfbuzz/issues/578 + https://github.com/harfbuzz/harfbuzz/issues/578 - Build fixes for FreeBSD and Chrome Android. @@ -42,7 +52,7 @@ Sunday, October 22nd, 2017 ==================================== - Don't skip over COMBINING GRAPHEME JOINER when ligating, etc. - To be refined: https://github.com/behdad/harfbuzz/issues/554 + To be refined: https://github.com/harfbuzz/harfbuzz/issues/554 - Faster hb_set_t implementation. - Don't use deprecated ICU API. - Fix undefined-behavior in Myanmar shaper, introduced in 1.6.0 @@ -443,7 +453,7 @@ Tuesday, February 23, 2016 - CoreText: Drastically speed up font initialization. - CoreText: Fix tiny leak. - Group ZWJ/ZWNJ with previous syllable under cluster-level=0. - https://github.com/behdad/harfbuzz/issues/217 + https://github.com/harfbuzz/harfbuzz/issues/217 - Add test/shaping/README.md about how to add tests to the suite. @@ -459,8 +469,8 @@ Friday, February 19, 2016 - Allow GPOS cursive connection on marks, and fix the interaction with mark attachment. This work resulted in some changes to how mark attachments work. See: - https://github.com/behdad/harfbuzz/issues/211 - https://github.com/behdad/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2 + https://github.com/harfbuzz/harfbuzz/issues/211 + https://github.com/harfbuzz/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2 - Graphite2 shaper: improved negative advance handling (eg. Nastaliq). - Add nmake-based build system for Windows. - Minor speedup. @@ -501,7 +511,7 @@ Wednesday, November 26, 2015 ==================================== - Fix badly-broken fallback shaper that affected terminology. - https://github.com/behdad/harfbuzz/issues/187 + https://github.com/harfbuzz/harfbuzz/issues/187 - Fix y_scaling in Graphite shaper. - API changes: * An unset glyph_h_origin() function in font-funcs now (sensibly) @@ -523,11 +533,11 @@ Wednesday, November 18, 2015 ==================================== - Implement 'stch' stretch feature for Syriac Abbreviation Mark. - https://github.com/behdad/harfbuzz/issues/141 + https://github.com/harfbuzz/harfbuzz/issues/141 - Disable use of decompose_compatibility() callback. - Implement "shaping" of various Unicode space characters, even if the font does not support them. - https://github.com/behdad/harfbuzz/issues/153 + https://github.com/harfbuzz/harfbuzz/issues/153 - If font does not support U+2011 NO-BREAK HYPHEN, fallback to U+2010 HYPHEN. - Changes resulting from libFuzzer continuous fuzzing: @@ -550,7 +560,7 @@ Thursday, October 15, 2015 - Revert default load-flags of fonts created using hb_ft_font_create() back to FT_LOAD_DEFAULT|FT_LOAD_NO_HINTING. This was changed in last release (1.0.5), but caused major issues, so revert. - https://github.com/behdad/harfbuzz/issues/143 + https://github.com/harfbuzz/harfbuzz/issues/143 Overview of changes leading to 1.0.5 @@ -558,7 +568,7 @@ Tuesday, October 13, 2015 ==================================== - Fix multiple memory access bugs discovered using libFuzzer. - https://github.com/behdad/harfbuzz/issues/139 + https://github.com/harfbuzz/harfbuzz/issues/139 Everyone should upgrade to this version as soon as possible. We now have continuous fuzzing set up, to avoid issues like these creeping in again. diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/README b/Build/source/libs/harfbuzz/harfbuzz-src/README index 0fa35b03eb3..4303222a4eb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/README +++ b/Build/source/libs/harfbuzz/harfbuzz-src/README @@ -1,7 +1,7 @@ -[![Build Status](https://travis-ci.org/behdad/harfbuzz.svg)](https://travis-ci.org/behdad/harfbuzz) -[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/behdad/harfbuzz) -[![CircleCI](https://circleci.com/gh/behdad/harfbuzz.svg?style=svg)](https://circleci.com/gh/behdad/harfbuzz) -[![Coverage Status](https://img.shields.io/coveralls/behdad/harfbuzz.svg)](https://coveralls.io/r/behdad/harfbuzz) +[![Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz) +[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz) +[![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz) +[![Coverage Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz) [ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/) This is HarfBuzz, a text shaping library. @@ -11,3 +11,5 @@ For bug reports, mailing list, and other information please visit: http://harfbuzz.org/ For license information, see the file COPYING. + +Documentation: https://harfbuzz.github.io diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md b/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md index 83302c7fbf6..1863c6e3938 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md +++ b/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md @@ -59,7 +59,7 @@ HarfBuzz release walk-through checklist: 12. Push the commit and tag out: "git push --follow-tags". Make sure it's pushed both to freedesktop repo and github. -13. Go to GitHub release page [here](https://github.com/behdad/harfbuzz/releases), +13. Go to GitHub release page [here](https://github.com/harfbuzz/harfbuzz/releases), edit the tag, upload artefacts and NEWS entry and save. diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index 7c3aa0336f7..6d8b5779bd8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac +++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [1.7.1], - [https://github.com/behdad/harfbuzz/issues/new], + [1.7.2], + [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/harfbuzz.doap b/Build/source/libs/harfbuzz/harfbuzz-src/harfbuzz.doap index 1e3e9abc484..07699697fef 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/harfbuzz.doap +++ b/Build/source/libs/harfbuzz/harfbuzz-src/harfbuzz.doap @@ -13,7 +13,7 @@ <!--download-page rdf:resource=""/--> <bug-database - rdf:resource="https://github.com/behdad/harfbuzz/issues" /> + rdf:resource="https://github.com/harfbuzz/harfbuzz/issues" /> <maintainer> <foaf:Person> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am index df99afee731..685718221f8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am @@ -99,6 +99,9 @@ SUBDIRS += hb-ucdn HBCFLAGS += -I$(srcdir)/hb-ucdn HBLIBS += hb-ucdn/libhb-ucdn.la HBSOURCES += $(HB_UCDN_sources) +hb-ucdn/libhb-ucdn.la: ucdn +ucdn: + @$(MAKE) $(AM_MAKEFLAGS) -C hb-ucdn endif DIST_SUBDIRS += hb-ucdn @@ -135,9 +138,12 @@ FUZZING_CPPFLAGS= \ -DHB_NDEBUG \ -DHB_MAX_NESTING_LEVEL=3 \ -DHB_SANITIZE_MAX_EDITS=3 \ - -DHB_BUFFER_MAX_EXPANSION_FACTOR=3 \ + -DHB_BUFFER_MAX_LEN_FACTOR=3 \ -DHB_BUFFER_MAX_LEN_MIN=8 \ -DHB_BUFFER_MAX_LEN_DEFAULT=128 \ + -DHB_BUFFER_MAX_OPS_FACTOR=8 \ + -DHB_BUFFER_MAX_OPS_MIN=64 \ + -DHB_BUFFER_MAX_OPS_DEFAULT=1024 \ $(NULL) EXTRA_LTLIBRARIES = libharfbuzz-fuzzing.la libharfbuzz_fuzzing_la_LINK = $(libharfbuzz_la_LINK) 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 09cc64fa694..4ded54230e1 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 @@ -44,6 +44,7 @@ defaults = ('Other', 'Not_Applicable', 'Cn', 'No_Block') # TODO Characters that are not in Unicode Indic files, but used in USE data[0][0x034F] = defaults[0] data[0][0x2060] = defaults[0] +data[0][0x20F0] = defaults[0] for u in range (0xFE00, 0xFE0F + 1): data[0][u] = defaults[0] @@ -300,9 +301,15 @@ def map_to_use(data): # the nasalization marks, maybe only for U+1CE9..U+1CF1. if U == 0x1CED: UISC = Tone_Mark - # TODO: https://github.com/behdad/harfbuzz/issues/525 + # TODO: https://github.com/harfbuzz/harfbuzz/issues/525 if U == 0x1A7F: UISC = Consonant_Final; UIPC = Bottom + # TODO: https://github.com/harfbuzz/harfbuzz/pull/609 + if U == 0x20F0: UISC = Cantillation_Mark; UIPC = Top + + # TODO: https://github.com/harfbuzz/harfbuzz/pull/626 + if U == 0xA8B4: UISC = Consonant_Medial + values = [k for k,v in items if v(U,UISC,UGC)] assert len(values) == 1, "%s %s %s %s" % (hex(U), UISC, UGC, values) USE = values[0] diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh index 4913da6a52e..97bdc1be305 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh @@ -35,8 +35,8 @@ #include "hb-unicode-private.hh" -#ifndef HB_BUFFER_MAX_EXPANSION_FACTOR -#define HB_BUFFER_MAX_EXPANSION_FACTOR 32 +#ifndef HB_BUFFER_MAX_LEN_FACTOR +#define HB_BUFFER_MAX_LEN_FACTOR 32 #endif #ifndef HB_BUFFER_MAX_LEN_MIN #define HB_BUFFER_MAX_LEN_MIN 8192 @@ -45,6 +45,16 @@ #define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */ #endif +#ifndef HB_BUFFER_MAX_OPS_FACTOR +#define HB_BUFFER_MAX_OPS_FACTOR 64 +#endif +#ifndef HB_BUFFER_MAX_OPS_MIN +#define HB_BUFFER_MAX_OPS_MIN 1024 +#endif +#ifndef HB_BUFFER_MAX_OPS_DEFAULT +#define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF /* Shaping more than a billion operations? Let us know! */ +#endif + static_assert ((sizeof (hb_glyph_info_t) == 20), ""); static_assert ((sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)), ""); @@ -84,6 +94,7 @@ struct hb_buffer_t { hb_codepoint_t replacement; /* U+FFFD or something else. */ hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */ unsigned int max_len; /* Maximum allowed len. */ + int max_ops; /* Maximum allowed operations. */ /* Buffer contents */ hb_buffer_content_type_t content_type; @@ -102,17 +113,6 @@ struct hb_buffer_t { hb_glyph_info_t *out_info; hb_glyph_position_t *pos; - inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; } - inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; } - - inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; } - inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; } - - inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; } - inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; } - - inline bool has_separate_output (void) const { return info != out_info; } - unsigned int serial; /* Text before / after the main buffer contents. @@ -132,6 +132,10 @@ struct hb_buffer_t { #ifndef HB_NDEBUG uint8_t allocated_var_bits; #endif + + + /* Methods */ + inline void allocate_var (unsigned int start, unsigned int count) { #ifndef HB_NDEBUG @@ -168,8 +172,17 @@ struct hb_buffer_t { #endif } + inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; } + inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; } + + inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; } + inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; } + + inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; } + inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; } + + inline bool has_separate_output (void) const { return info != out_info; } - /* Methods */ HB_INTERNAL void reset (void); HB_INTERNAL void clear (void); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc index f0791780b35..7ead43b0184 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc @@ -722,6 +722,7 @@ hb_buffer_create (void) return hb_buffer_get_empty (); buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT; + buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT; buffer->reset (); @@ -749,6 +750,7 @@ hb_buffer_get_empty (void) HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT, HB_BUFFER_SCRATCH_FLAG_DEFAULT, HB_BUFFER_MAX_LEN_DEFAULT, + HB_BUFFER_MAX_OPS_DEFAULT, HB_BUFFER_CONTENT_TYPE_INVALID, HB_SEGMENT_PROPERTIES_DEFAULT, 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 86ca17fb2dd..2dd10d2da5a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -81,21 +81,12 @@ _hb_cg_font_release (void *data) CGFontRelease ((CGFontRef) data); } -hb_face_t * -hb_coretext_face_create (CGFontRef cg_font) -{ - return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release); -} HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face) HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font, fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size (font->ptem)) <= .5 ) -/* - * shaper face data - */ - static CTFontDescriptorRef get_last_resort_font_desc (void) { @@ -267,6 +258,12 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data) CFRelease ((CGFontRef) data); } +hb_face_t * +hb_coretext_face_create (CGFontRef cg_font) +{ + return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release); +} + /* * Since: 0.9.10 */ @@ -278,10 +275,6 @@ hb_coretext_face_get_cg_font (hb_face_t *face) } -/* - * shaper font data - */ - hb_coretext_shaper_font_data_t * _hb_coretext_shaper_font_data_create (hb_font_t *font) { @@ -306,6 +299,35 @@ _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data) CFRelease ((CTFontRef) data); } +/* + * Since: 1.7.2 + */ +hb_font_t * +hb_coretext_font_create (CTFontRef ct_font) +{ + CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, 0); + hb_face_t *face = hb_coretext_face_create (cg_font); + CFRelease (cg_font); + hb_font_t *font = hb_font_create (face); + hb_face_destroy (face); + + if (unlikely (hb_object_is_inert (font))) + return font; + + /* Let there be dragons here... */ + HB_SHAPER_DATA_GET (font) = (hb_coretext_shaper_font_data_t *) CFRetain (ct_font); + + return font; +} + +CTFontRef +hb_coretext_font_get_ct_font (hb_font_t *font) +{ + if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr; + return (CTFontRef) HB_SHAPER_DATA_GET (font); +} + + /* * shaper shape_plan data @@ -328,13 +350,6 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_ { } -CTFontRef -hb_coretext_font_get_ct_font (hb_font_t *font) -{ - if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr; - return (CTFontRef)HB_SHAPER_DATA_GET (font); -} - /* * shaper @@ -1000,7 +1015,7 @@ resize_and_retry: * However, even that wouldn't work if we were passed in the CGFont to * construct a hb_face to begin with. * - * See: http://github.com/behdad/harfbuzz/pull/36 + * See: http://github.com/harfbuzz/harfbuzz/pull/36 * * Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098 */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.h index c9136ff4c30..4b0a6f01b6f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.h @@ -48,6 +48,9 @@ HB_BEGIN_DECLS HB_EXTERN hb_face_t * hb_coretext_face_create (CGFontRef cg_font); +HB_EXTERN hb_font_t * +hb_coretext_font_create (CTFontRef ct_font); + HB_EXTERN CGFontRef hb_coretext_face_get_cg_font (hb_face_t *face); 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 ca8c638a79d..20dead65b65 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh @@ -221,12 +221,14 @@ template <> template <int max_level, typename ret_t> struct hb_auto_trace_t { + explicit inline hb_auto_trace_t (unsigned int *plevel_, const char *what_, const void *obj_, const char *func, const char *message, - ...) : plevel (plevel_), what (what_), obj (obj_), returned (false) + ...) HB_PRINTF_FUNC(6, 7) + : plevel (plevel_), what (what_), obj (obj_), returned (false) { if (plevel) ++*plevel; @@ -270,7 +272,7 @@ template <typename ret_t> /* Make sure we don't use hb_auto_trace_t when not tra struct hb_auto_trace_t<0, ret_t>; /* For disabled tracing; optimize out everything. - * https://github.com/behdad/harfbuzz/pull/605 */ + * https://github.com/harfbuzz/harfbuzz/pull/605 */ template <typename ret_t> struct hb_no_trace_t { inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; } @@ -343,7 +345,7 @@ struct hb_no_trace_t { #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 @@ -355,7 +357,7 @@ struct hb_no_trace_t { #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 @@ -367,7 +369,7 @@ struct hb_no_trace_t { #define TRACE_SANITIZE(this) \ hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \ (&c->debug_depth, c->get_name (), this, HB_FUNC, \ - ""); + " "); #else #define TRACE_SANITIZE(this) hb_no_trace_t<bool> trace #endif @@ -379,7 +381,7 @@ struct hb_no_trace_t { #define TRACE_SERIALIZE(this) \ hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \ (&c->debug_depth, "SERIALIZE", c, HB_FUNC, \ - ""); + " "); #else #define TRACE_SERIALIZE(this) hb_no_trace_t<bool> trace #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh index 741e74ccc20..644e0b40f6f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh @@ -64,9 +64,9 @@ typedef struct TableRecord Tag tag; /* 4-byte identifier. */ CheckSum checkSum; /* CheckSum for this table. */ - ULONG offset; /* Offset from beginning of TrueType font + UINT32 offset; /* Offset from beginning of TrueType font * file. */ - ULONG length; /* Length of this table. */ + UINT32 length; /* Length of this table. */ public: DEFINE_SIZE_STATIC (16); } OpenTypeTable; @@ -154,7 +154,7 @@ struct TTCHeaderVersion1 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ FixedVersion<>version; /* Version of the TTC Header (1.0), * 0x00010000u */ - ArrayOf<LOffsetTo<OffsetTable>, ULONG> + ArrayOf<LOffsetTo<OffsetTable>, UINT32> table; /* Array of offsets to the OffsetTable for each font * from the beginning of the file */ public: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh index a12c4d2369c..2f4e1b9e9e9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh @@ -635,23 +635,22 @@ struct IntType DEFINE_SIZE_STATIC (Size); }; -typedef IntType<int8_t, 1> CHAR; /* 8-bit signed integer. */ -typedef IntType<uint8_t, 1> BYTE; /* 8-bit unsigned integer. */ +typedef IntType<uint8_t, 1> UINT8; /* 8-bit unsigned integer. */ typedef IntType<int8_t, 1> INT8; /* 8-bit signed integer. */ -typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */ -typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */ -typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */ -typedef IntType<int32_t, 4> LONG; /* 32-bit signed integer. */ +typedef IntType<uint16_t, 2> UINT16; /* 16-bit unsigned integer. */ +typedef IntType<int16_t, 2> INT16; /* 16-bit signed integer. */ +typedef IntType<uint32_t, 4> UINT32; /* 32-bit unsigned integer. */ +typedef IntType<int32_t, 4> INT32; /* 32-bit signed integer. */ typedef IntType<uint32_t, 3> UINT24; /* 24-bit unsigned integer. */ -/* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */ -typedef SHORT FWORD; +/* 16-bit signed integer (INT16) that describes a quantity in FUnits. */ +typedef INT16 FWORD; -/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */ -typedef USHORT UFWORD; +/* 16-bit unsigned integer (UINT16) that describes a quantity in FUnits. */ +typedef UINT16 UFWORD; /* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */ -struct F2DOT14 : SHORT +struct F2DOT14 : INT16 { //inline float to_float (void) const { return ???; } //inline void set_float (float f) { v.set (f * ???); } @@ -660,7 +659,7 @@ struct F2DOT14 : SHORT }; /* 32-bit signed fixed-point number (16.16). */ -struct Fixed: LONG +struct Fixed: INT32 { //inline float to_float (void) const { return ???; } //inline void set_float (float f) { v.set (f * ???); } @@ -678,15 +677,15 @@ struct LONGDATETIME return_trace (likely (c->check_struct (this))); } protected: - LONG major; - ULONG minor; + INT32 major; + UINT32 minor; public: DEFINE_SIZE_STATIC (8); }; /* Array of four uint8s (length = 32 bits) used to identify a script, language * system, feature, or baseline */ -struct Tag : ULONG +struct Tag : UINT32 { /* What the char* converters return is NOT nul-terminated. Print using "%.4s" */ inline operator const char* (void) const { return reinterpret_cast<const char *> (&this->v); } @@ -697,16 +696,16 @@ struct Tag : ULONG DEFINE_NULL_DATA (Tag, " "); /* Glyph index number, same as uint16 (length = 16 bits) */ -typedef USHORT GlyphID; +typedef UINT16 GlyphID; /* Script/language-system/feature index */ -struct Index : USHORT { +struct Index : UINT16 { static const unsigned int NOT_FOUND_INDEX = 0xFFFFu; }; DEFINE_NULL_DATA (Index, "\xff\xff"); /* Offset, Null offset = 0 */ -template <typename Type=USHORT> +template <typename Type> struct Offset : Type { inline bool is_null (void) const { return 0 == *this; } @@ -714,15 +713,18 @@ struct Offset : Type DEFINE_SIZE_STATIC (sizeof(Type)); }; +typedef Offset<UINT16> Offset16; +typedef Offset<UINT32> Offset32; + /* CheckSum */ -struct CheckSum : ULONG +struct CheckSum : UINT32 { /* This is reference implementation from the spec. */ - static inline uint32_t CalcTableChecksum (const ULONG *Table, uint32_t Length) + static inline uint32_t CalcTableChecksum (const UINT32 *Table, uint32_t Length) { uint32_t Sum = 0L; - const ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size; + const UINT32 *EndPtr = Table+((Length+3) & ~3) / UINT32::static_size; while (Table < EndPtr) Sum += *Table++; @@ -731,7 +733,7 @@ struct CheckSum : ULONG /* Note: data should be 4byte aligned and have 4byte padding at the end. */ inline void set_for_data (const void *data, unsigned int length) - { set (CalcTableChecksum ((const ULONG *) data, length)); } + { set (CalcTableChecksum ((const UINT32 *) data, length)); } public: DEFINE_SIZE_STATIC (4); @@ -742,7 +744,7 @@ struct CheckSum : ULONG * Version Numbers */ -template <typename FixedType=USHORT> +template <typename FixedType=UINT16> struct FixedVersion { inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; } @@ -766,7 +768,7 @@ struct FixedVersion * Use: (base+offset) */ -template <typename Type, typename OffsetType=USHORT> +template <typename Type, typename OffsetType=UINT16> struct OffsetTo : Offset<OffsetType> { inline const Type& operator () (const void *base) const @@ -811,7 +813,7 @@ struct OffsetTo : Offset<OffsetType> } DEFINE_SIZE_STATIC (sizeof(OffsetType)); }; -template <typename Type> struct LOffsetTo : OffsetTo<Type, ULONG> {}; +template <typename Type> struct LOffsetTo : OffsetTo<Type, UINT32> {}; template <typename Base, typename OffsetType, typename Type> static inline const Type& operator + (const Base &base, const OffsetTo<Type, OffsetType> &offset) { return offset (base); } template <typename Base, typename OffsetType, typename Type> @@ -823,7 +825,7 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset) */ /* An array with a number of elements. */ -template <typename Type, typename LenType=USHORT> +template <typename Type, typename LenType=UINT16> struct ArrayOf { const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const @@ -933,10 +935,10 @@ struct ArrayOf public: DEFINE_SIZE_ARRAY (sizeof (LenType), array); }; -template <typename Type> struct LArrayOf : ArrayOf<Type, ULONG> {}; +template <typename Type> struct LArrayOf : ArrayOf<Type, UINT32> {}; /* Array of Offset's */ -template <typename Type, typename OffsetType=USHORT> +template <typename Type, typename OffsetType=UINT16> struct OffsetArrayOf : ArrayOf<OffsetTo<Type, OffsetType> > {}; /* Array of offsets relative to the beginning of the array itself. */ @@ -964,7 +966,7 @@ struct OffsetListOf : OffsetArrayOf<Type> /* An array starting at second element. */ -template <typename Type, typename LenType=USHORT> +template <typename Type, typename LenType=UINT16> struct HeadlessArrayOf { inline const Type& operator [] (unsigned int i) const @@ -1026,7 +1028,7 @@ struct HeadlessArrayOf /* * An array with sorted elements. Supports binary searching. */ -template <typename Type, typename LenType=USHORT> +template <typename Type, typename LenType=UINT16> struct SortedArrayOf : ArrayOf<Type, LenType> { template <typename SearchType> @@ -1065,10 +1067,10 @@ struct BinSearchHeader } protected: - USHORT len; - USHORT searchRangeZ; - USHORT entrySelectorZ; - USHORT rangeShiftZ; + UINT16 len; + UINT16 searchRangeZ; + UINT16 entrySelectorZ; + UINT16 rangeShiftZ; public: DEFINE_SIZE_STATIC (8); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cbdt-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cbdt-table.hh index 3c6855b0549..415625e5f80 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cbdt-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cbdt-table.hh @@ -47,20 +47,20 @@ struct SmallGlyphMetrics extents->height = -height; } - BYTE height; - BYTE width; - CHAR bearingX; - CHAR bearingY; - BYTE advance; + UINT8 height; + UINT8 width; + INT8 bearingX; + INT8 bearingY; + UINT8 advance; DEFINE_SIZE_STATIC(5); }; struct BigGlyphMetrics : SmallGlyphMetrics { - CHAR vertBearingX; - CHAR vertBearingY; - BYTE vertAdvance; + INT8 vertBearingX; + INT8 vertBearingY; + UINT8 vertAdvance; DEFINE_SIZE_STATIC(8); }; @@ -73,18 +73,18 @@ struct SBitLineMetrics return_trace (c->check_struct (this)); } - CHAR ascender; - CHAR decender; - BYTE widthMax; - CHAR caretSlopeNumerator; - CHAR caretSlopeDenominator; - CHAR caretOffset; - CHAR minOriginSB; - CHAR minAdvanceSB; - CHAR maxBeforeBL; - CHAR minAfterBL; - CHAR padding1; - CHAR padding2; + INT8 ascender; + INT8 decender; + UINT8 widthMax; + INT8 caretSlopeNumerator; + INT8 caretSlopeDenominator; + INT8 caretOffset; + INT8 minOriginSB; + INT8 minAdvanceSB; + INT8 maxBeforeBL; + INT8 minAfterBL; + INT8 padding1; + INT8 padding2; DEFINE_SIZE_STATIC(12); }; @@ -102,9 +102,9 @@ struct IndexSubtableHeader return_trace (c->check_struct (this)); } - USHORT indexFormat; - USHORT imageFormat; - ULONG imageDataOffset; + UINT16 indexFormat; + UINT16 imageFormat; + UINT32 imageDataOffset; DEFINE_SIZE_STATIC(8); }; @@ -137,8 +137,8 @@ struct IndexSubtableFormat1Or3 DEFINE_SIZE_ARRAY(8, offsetArrayZ); }; -struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<ULONG> {}; -struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<USHORT> {}; +struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<UINT32> {}; +struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<UINT16> {}; struct IndexSubtable { @@ -214,8 +214,8 @@ struct IndexSubtableRecord offset, length, format); } - USHORT firstGlyphIndex; - USHORT lastGlyphIndex; + UINT16 firstGlyphIndex; + UINT16 lastGlyphIndex; LOffsetTo<IndexSubtable> offsetToSubtable; DEFINE_SIZE_STATIC(8); @@ -276,19 +276,19 @@ struct BitmapSizeTable protected: LOffsetTo<IndexSubtableArray> indexSubtableArrayOffset; - ULONG indexTablesSize; - ULONG numberOfIndexSubtables; - ULONG colorRef; + UINT32 indexTablesSize; + UINT32 numberOfIndexSubtables; + UINT32 colorRef; SBitLineMetrics horizontal; SBitLineMetrics vertical; - USHORT startGlyphIndex; - USHORT endGlyphIndex; - BYTE ppemX; - BYTE ppemY; - BYTE bitDepth; - CHAR flags; - -public: + UINT16 startGlyphIndex; + UINT16 endGlyphIndex; + UINT8 ppemX; + UINT8 ppemY; + UINT8 bitDepth; + INT8 flags; + + public: DEFINE_SIZE_STATIC(48); }; @@ -300,8 +300,8 @@ public: struct GlyphBitmapDataFormat17 { SmallGlyphMetrics glyphMetrics; - ULONG dataLen; - BYTE dataZ[VAR]; + UINT32 dataLen; + UINT8 dataZ[VAR]; DEFINE_SIZE_ARRAY(9, dataZ); }; @@ -315,6 +315,8 @@ struct GlyphBitmapDataFormat17 struct CBLC { + friend struct CBDT; + static const hb_tag_t tableTag = HB_OT_TAG_CBLC; inline bool sanitize (hb_sanitize_context_t *c) const @@ -325,7 +327,7 @@ struct CBLC sizeTables.sanitize (c, this)); } - public: + protected: const IndexSubtableRecord *find_table (hb_codepoint_t glyph, unsigned int *x_ppem, unsigned int *y_ppem) const { @@ -371,9 +373,94 @@ struct CBDT likely (version.major == 2 || version.major == 3)); } + struct accelerator_t + { + inline void init (hb_face_t *face) + { + upem = face->get_upem(); + + cblc_blob = Sanitizer<CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC)); + cbdt_blob = Sanitizer<CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT)); + cbdt_len = hb_blob_get_length (cbdt_blob); + + if (hb_blob_get_length (cblc_blob) == 0) { + cblc = nullptr; + cbdt = nullptr; + return; /* Not a bitmap font. */ + } + cblc = Sanitizer<CBLC>::lock_instance (cblc_blob); + cbdt = Sanitizer<CBDT>::lock_instance (cbdt_blob); + + } + + inline void fini (void) + { + hb_blob_destroy (this->cblc_blob); + hb_blob_destroy (this->cbdt_blob); + } + + inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const + { + unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */ + + if (!cblc) + return false; // Not a color bitmap font. + + const IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem); + if (!subtable_record || !x_ppem || !y_ppem) + return false; + + if (subtable_record->get_extents (extents)) + return true; + + unsigned int image_offset = 0, image_length = 0, image_format = 0; + if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format)) + return false; + + { + if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length)) + return false; + + switch (image_format) + { + case 17: { + if (unlikely (image_length < GlyphBitmapDataFormat17::min_size)) + return false; + + const GlyphBitmapDataFormat17& glyphFormat17 = + StructAtOffset<GlyphBitmapDataFormat17> (this->cbdt, image_offset); + glyphFormat17.glyphMetrics.get_extents (extents); + } + break; + default: + // TODO: Support other image formats. + return false; + } + } + + /* Convert to the font units. */ + extents->x_bearing *= upem / (float) x_ppem; + extents->y_bearing *= upem / (float) y_ppem; + extents->width *= upem / (float) x_ppem; + extents->height *= upem / (float) y_ppem; + + return true; + } + + private: + hb_blob_t *cblc_blob; + hb_blob_t *cbdt_blob; + const CBLC *cblc; + const CBDT *cbdt; + + unsigned int cbdt_len; + unsigned int upem; + }; + + protected: FixedVersion<>version; - BYTE dataZ[VAR]; + UINT8 dataZ[VAR]; public: DEFINE_SIZE_ARRAY(4, dataZ); 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 93f38c56ab7..883d7b3f0b2 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 @@ -58,10 +58,10 @@ struct CmapSubtableFormat0 } protected: - USHORT format; /* Format number is set to 0. */ - USHORT lengthZ; /* Byte length of this subtable. */ - USHORT languageZ; /* Ignore. */ - BYTE glyphIdArray[256];/* An array that maps character + UINT16 format; /* Format number is set to 0. */ + UINT16 lengthZ; /* Byte length of this subtable. */ + UINT16 languageZ; /* Ignore. */ + UINT8 glyphIdArray[256];/* An array that maps character * code to glyph index values. */ public: DEFINE_SIZE_STATIC (6 + 256); @@ -88,8 +88,8 @@ struct CmapSubtableFormat4 /* Custom two-array bsearch. */ int min = 0, max = (int) thiz->segCount - 1; - const USHORT *startCount = thiz->startCount; - const USHORT *endCount = thiz->endCount; + const UINT16 *startCount = thiz->startCount; + const UINT16 *endCount = thiz->endCount; unsigned int i; while (min <= max) { @@ -127,11 +127,11 @@ struct CmapSubtableFormat4 return true; } - const USHORT *endCount; - const USHORT *startCount; - const USHORT *idDelta; - const USHORT *idRangeOffset; - const USHORT *glyphIdArray; + const UINT16 *endCount; + const UINT16 *startCount; + const UINT16 *idDelta; + const UINT16 *idRangeOffset; + const UINT16 *glyphIdArray; unsigned int segCount; unsigned int glyphIdArrayLength; }; @@ -165,24 +165,24 @@ struct CmapSubtableFormat4 } protected: - USHORT format; /* Format number is set to 4. */ - USHORT length; /* This is the length in bytes of the + UINT16 format; /* Format number is set to 4. */ + UINT16 length; /* This is the length in bytes of the * subtable. */ - USHORT languageZ; /* Ignore. */ - USHORT segCountX2; /* 2 x segCount. */ - USHORT searchRangeZ; /* 2 * (2**floor(log2(segCount))) */ - USHORT entrySelectorZ; /* log2(searchRange/2) */ - USHORT rangeShiftZ; /* 2 x segCount - searchRange */ + UINT16 languageZ; /* Ignore. */ + UINT16 segCountX2; /* 2 x segCount. */ + UINT16 searchRangeZ; /* 2 * (2**floor(log2(segCount))) */ + UINT16 entrySelectorZ; /* log2(searchRange/2) */ + UINT16 rangeShiftZ; /* 2 x segCount - searchRange */ - USHORT values[VAR]; + UINT16 values[VAR]; #if 0 - USHORT endCount[segCount]; /* End characterCode for each segment, + UINT16 endCount[segCount]; /* End characterCode for each segment, * last=0xFFFFu. */ - USHORT reservedPad; /* Set to 0. */ - USHORT startCount[segCount]; /* Start character code for each segment. */ - SHORT idDelta[segCount]; /* Delta for all character codes in segment. */ - USHORT idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */ - USHORT glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */ + UINT16 reservedPad; /* Set to 0. */ + UINT16 startCount[segCount]; /* Start character code for each segment. */ + INT16 idDelta[segCount]; /* Delta for all character codes in segment. */ + UINT16 idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */ + UINT16 glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */ #endif public: @@ -208,9 +208,9 @@ struct CmapSubtableLongGroup } private: - ULONG startCharCode; /* First character code in this group. */ - ULONG endCharCode; /* Last character code in this group. */ - ULONG glyphID; /* Glyph index; interpretation depends on + UINT32 startCharCode; /* First character code in this group. */ + UINT32 endCharCode; /* Last character code in this group. */ + UINT32 glyphID; /* Glyph index; interpretation depends on * subtable format. */ public: DEFINE_SIZE_STATIC (12); @@ -247,8 +247,8 @@ struct CmapSubtableTrimmed DEFINE_SIZE_ARRAY (5 * sizeof (UINT), glyphIdArray); }; -struct CmapSubtableFormat6 : CmapSubtableTrimmed<USHORT> {}; -struct CmapSubtableFormat10 : CmapSubtableTrimmed<ULONG > {}; +struct CmapSubtableFormat6 : CmapSubtableTrimmed<UINT16> {}; +struct CmapSubtableFormat10 : CmapSubtableTrimmed<UINT32 > {}; template <typename T> struct CmapSubtableLongSegmented @@ -269,11 +269,11 @@ struct CmapSubtableLongSegmented } protected: - USHORT format; /* Subtable format; set to 12. */ - USHORT reservedZ; /* Reserved; set to 0. */ - ULONG lengthZ; /* Byte length of this subtable. */ - ULONG languageZ; /* Ignore. */ - SortedArrayOf<CmapSubtableLongGroup, ULONG> + UINT16 format; /* Subtable format; set to 12. */ + UINT16 reservedZ; /* Reserved; set to 0. */ + UINT32 lengthZ; /* Byte length of this subtable. */ + UINT32 languageZ; /* Ignore. */ + SortedArrayOf<CmapSubtableLongGroup, UINT32> groups; /* Groupings. */ public: DEFINE_SIZE_ARRAY (16, groups); @@ -316,13 +316,13 @@ struct UnicodeValueRange } UINT24 startUnicodeValue; /* First value in this range. */ - BYTE additionalCount; /* Number of additional values in this + UINT8 additionalCount; /* Number of additional values in this * range. */ public: DEFINE_SIZE_STATIC (4); }; -typedef SortedArrayOf<UnicodeValueRange, ULONG> DefaultUVS; +typedef SortedArrayOf<UnicodeValueRange, UINT32> DefaultUVS; struct UVSMapping { @@ -343,7 +343,7 @@ struct UVSMapping DEFINE_SIZE_STATIC (5); }; -typedef SortedArrayOf<UVSMapping, ULONG> NonDefaultUVS; +typedef SortedArrayOf<UVSMapping, UINT32> NonDefaultUVS; struct VariationSelectorRecord { @@ -405,9 +405,9 @@ struct CmapSubtableFormat14 } protected: - USHORT format; /* Format number is set to 14. */ - ULONG lengthZ; /* Byte length of this subtable. */ - SortedArrayOf<VariationSelectorRecord, ULONG> + UINT16 format; /* Format number is set to 14. */ + UINT32 lengthZ; /* Byte length of this subtable. */ + SortedArrayOf<VariationSelectorRecord, UINT32> record; /* Variation selector records; sorted * in increasing order of `varSelector'. */ public: @@ -451,7 +451,7 @@ struct CmapSubtable public: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ CmapSubtableFormat0 format0; CmapSubtableFormat4 format4; CmapSubtableFormat6 format6; @@ -484,8 +484,8 @@ struct EncodingRecord subtable.sanitize (c, base)); } - USHORT platformID; /* Platform ID. */ - USHORT encodingID; /* Platform-specific encoding ID. */ + UINT16 platformID; /* Platform ID. */ + UINT16 encodingID; /* Platform-specific encoding ID. */ LOffsetTo<CmapSubtable> subtable; /* Byte offset from beginning of table to the subtable for this encoding. */ public: @@ -496,6 +496,146 @@ struct cmap { static const hb_tag_t tableTag = HB_OT_TAG_cmap; + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + likely (version == 0) && + encodingRecord.sanitize (c, this)); + } + + struct accelerator_t + { + inline void init (hb_face_t *face) + { + this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap)); + const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob); + const OT::CmapSubtable *subtable = nullptr; + const OT::CmapSubtableFormat14 *subtable_uvs = nullptr; + + bool symbol = false; + /* 32-bit subtables. */ + if (!subtable) subtable = cmap->find_subtable (3, 10); + if (!subtable) subtable = cmap->find_subtable (0, 6); + if (!subtable) subtable = cmap->find_subtable (0, 4); + /* 16-bit subtables. */ + if (!subtable) subtable = cmap->find_subtable (3, 1); + if (!subtable) subtable = cmap->find_subtable (0, 3); + if (!subtable) subtable = cmap->find_subtable (0, 2); + if (!subtable) subtable = cmap->find_subtable (0, 1); + if (!subtable) subtable = cmap->find_subtable (0, 0); + if (!subtable) + { + subtable = cmap->find_subtable (3, 0); + if (subtable) symbol = true; + } + /* Meh. */ + if (!subtable) subtable = &OT::Null(OT::CmapSubtable); + + /* UVS subtable. */ + if (!subtable_uvs) + { + const OT::CmapSubtable *st = cmap->find_subtable (0, 5); + if (st && st->u.format == 14) + subtable_uvs = &st->u.format14; + } + /* Meh. */ + if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14); + + this->uvs_table = subtable_uvs; + + this->get_glyph_data = subtable; + if (unlikely (symbol)) + this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>; + else + switch (subtable->u.format) { + /* Accelerate format 4 and format 12. */ + default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break; + case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break; + case 4: + { + this->format4_accel.init (&subtable->u.format4); + this->get_glyph_data = &this->format4_accel; + this->get_glyph_func = this->format4_accel.get_glyph_func; + } + break; + } + } + + inline void fini (void) + { + hb_blob_destroy (this->blob); + } + + inline bool get_nominal_glyph (hb_codepoint_t unicode, + hb_codepoint_t *glyph) const + { + return this->get_glyph_func (this->get_glyph_data, unicode, glyph); + } + + inline bool get_variation_glyph (hb_codepoint_t unicode, + hb_codepoint_t variation_selector, + hb_codepoint_t *glyph) const + { + switch (this->uvs_table->get_glyph_variant (unicode, + variation_selector, + glyph)) + { + case OT::GLYPH_VARIANT_NOT_FOUND: return false; + case OT::GLYPH_VARIANT_FOUND: return true; + case OT::GLYPH_VARIANT_USE_DEFAULT: break; + } + + return get_nominal_glyph (unicode, glyph); + } + + protected: + typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph); + + template <typename Type> + static inline bool get_glyph_from (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph) + { + const Type *typed_obj = (const Type *) obj; + return typed_obj->get_glyph (codepoint, glyph); + } + + template <typename Type> + static inline bool get_glyph_from_symbol (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph) + { + const Type *typed_obj = (const Type *) obj; + if (likely (typed_obj->get_glyph (codepoint, glyph))) + return true; + + if (codepoint <= 0x00FFu) + { + /* For symbol-encoded OpenType fonts, we duplicate the + * U+F000..F0FF range at U+0000..U+00FF. That's what + * Windows seems to do, and that's hinted about at: + * http://www.microsoft.com/typography/otspec/recom.htm + * under "Non-Standard (Symbol) Fonts". */ + return typed_obj->get_glyph (0xF000u + codepoint, glyph); + } + + return false; + } + + private: + hb_cmap_get_glyph_func_t get_glyph_func; + const void *get_glyph_data; + OT::CmapSubtableFormat4::accelerator_t format4_accel; + + const OT::CmapSubtableFormat14 *uvs_table; + hb_blob_t *blob; + }; + + protected: + inline const CmapSubtable *find_subtable (unsigned int platform_id, unsigned int encoding_id) const { @@ -513,15 +653,8 @@ struct cmap return &(this+encodingRecord[result].subtable); } - inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && - likely (version == 0) && - encodingRecord.sanitize (c, this)); - } - - USHORT version; /* Table version number (0). */ + protected: + UINT16 version; /* Table version number (0). */ SortedArrayOf<EncodingRecord> encodingRecord; /* Encoding tables. */ public: 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 47416012c9d..9864064b112 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 @@ -33,466 +33,20 @@ #include "hb-ot-cmap-table.hh" #include "hb-ot-cbdt-table.hh" #include "hb-ot-glyf-table.hh" -#include "hb-ot-head-table.hh" -#include "hb-ot-hhea-table.hh" #include "hb-ot-hmtx-table.hh" #include "hb-ot-kern-table.hh" -#include "hb-ot-os2-table.hh" #include "hb-ot-post-table.hh" -#include "hb-ot-var-hvar-table.hh" -struct hb_ot_face_metrics_accelerator_t -{ - unsigned int num_metrics; - unsigned int num_advances; - unsigned int default_advance; - unsigned short ascender; - unsigned short descender; - unsigned short line_gap; - bool has_font_extents; - - const OT::hmtxvmtx *table; - hb_blob_t *blob; - - const OT::HVARVVAR *var; - hb_blob_t *var_blob; - - inline void init (hb_face_t *face, - hb_tag_t _hea_tag, - hb_tag_t _mtx_tag, - hb_tag_t _var_tag, - hb_tag_t os2_tag, - unsigned int default_advance = 0) - { - this->default_advance = default_advance ? default_advance : face->get_upem (); - - bool got_font_extents = false; - if (os2_tag) - { - hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>::sanitize (face->reference_table (os2_tag)); - const OT::os2 *os2 = OT::Sanitizer<OT::os2>::lock_instance (os2_blob); -#define USE_TYPO_METRICS (1u<<7) - if (0 != (os2->fsSelection & USE_TYPO_METRICS)) - { - this->ascender = os2->sTypoAscender; - this->descender = os2->sTypoDescender; - this->line_gap = os2->sTypoLineGap; - got_font_extents = (this->ascender | this->descender) != 0; - } - hb_blob_destroy (os2_blob); - } - - hb_blob_t *_hea_blob = OT::Sanitizer<OT::_hea>::sanitize (face->reference_table (_hea_tag)); - const OT::_hea *_hea = OT::Sanitizer<OT::_hea>::lock_instance (_hea_blob); - this->num_advances = _hea->numberOfLongMetrics; - if (!got_font_extents) - { - this->ascender = _hea->ascender; - this->descender = _hea->descender; - this->line_gap = _hea->lineGap; - got_font_extents = (this->ascender | this->descender) != 0; - } - hb_blob_destroy (_hea_blob); - - this->has_font_extents = got_font_extents; - - this->blob = OT::Sanitizer<OT::hmtxvmtx>::sanitize (face->reference_table (_mtx_tag)); - - /* Cap num_metrics() and num_advances() based on table length. */ - unsigned int len = hb_blob_get_length (this->blob); - if (unlikely (this->num_advances * 4 > len)) - this->num_advances = len / 4; - this->num_metrics = this->num_advances + (len - 4 * this->num_advances) / 2; - - /* We MUST set num_metrics to zero if num_advances is zero. - * Our get_advance() depends on that. */ - if (unlikely (!this->num_advances)) - { - this->num_metrics = this->num_advances = 0; - hb_blob_destroy (this->blob); - this->blob = hb_blob_get_empty (); - } - this->table = OT::Sanitizer<OT::hmtxvmtx>::lock_instance (this->blob); - - this->var_blob = OT::Sanitizer<OT::HVARVVAR>::sanitize (face->reference_table (_var_tag)); - this->var = OT::Sanitizer<OT::HVARVVAR>::lock_instance (this->var_blob); - } - - inline void fini (void) - { - hb_blob_destroy (this->blob); - hb_blob_destroy (this->var_blob); - } - - inline unsigned int get_advance (hb_codepoint_t glyph, - hb_font_t *font) const - { - if (unlikely (glyph >= this->num_metrics)) - { - /* If this->num_metrics is zero, it means we don't have the metrics table - * for this direction: return default advance. Otherwise, it means that the - * glyph index is out of bound: return zero. */ - if (this->num_metrics) - return 0; - else - return this->default_advance; - } - - return this->table->longMetric[MIN (glyph, (uint32_t) this->num_advances - 1)].advance - + this->var->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?! - } -}; - -struct hb_ot_face_glyf_accelerator_t -{ - bool short_offset; - unsigned int num_glyphs; - const OT::loca *loca; - const OT::glyf *glyf; - hb_blob_t *loca_blob; - hb_blob_t *glyf_blob; - unsigned int glyf_len; - - inline void init (hb_face_t *face) - { - hb_blob_t *head_blob = OT::Sanitizer<OT::head>::sanitize (face->reference_table (HB_OT_TAG_head)); - const OT::head *head = OT::Sanitizer<OT::head>::lock_instance (head_blob); - if ((unsigned int) head->indexToLocFormat > 1 || head->glyphDataFormat != 0) - { - /* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */ - hb_blob_destroy (head_blob); - return; - } - this->short_offset = 0 == head->indexToLocFormat; - hb_blob_destroy (head_blob); - - this->loca_blob = OT::Sanitizer<OT::loca>::sanitize (face->reference_table (HB_OT_TAG_loca)); - this->loca = OT::Sanitizer<OT::loca>::lock_instance (this->loca_blob); - this->glyf_blob = OT::Sanitizer<OT::glyf>::sanitize (face->reference_table (HB_OT_TAG_glyf)); - this->glyf = OT::Sanitizer<OT::glyf>::lock_instance (this->glyf_blob); - - this->num_glyphs = MAX (1u, hb_blob_get_length (this->loca_blob) / (this->short_offset ? 2 : 4)) - 1; - this->glyf_len = hb_blob_get_length (this->glyf_blob); - } - - inline void fini (void) - { - hb_blob_destroy (this->loca_blob); - hb_blob_destroy (this->glyf_blob); - } - - inline bool get_extents (hb_codepoint_t glyph, - hb_glyph_extents_t *extents) const - { - if (unlikely (glyph >= this->num_glyphs)) - return false; - - unsigned int start_offset, end_offset; - if (this->short_offset) - { - start_offset = 2 * this->loca->u.shortsZ[glyph]; - end_offset = 2 * this->loca->u.shortsZ[glyph + 1]; - } - else - { - start_offset = this->loca->u.longsZ[glyph]; - end_offset = this->loca->u.longsZ[glyph + 1]; - } - - if (start_offset > end_offset || end_offset > this->glyf_len) - return false; - - if (end_offset - start_offset < OT::glyfGlyphHeader::static_size) - return true; /* Empty glyph; zero extents. */ - - const OT::glyfGlyphHeader &glyph_header = OT::StructAtOffset<OT::glyfGlyphHeader> (this->glyf, start_offset); - - extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax); - extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax); - extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing; - extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing; - - return true; - } -}; - -struct hb_ot_face_cbdt_accelerator_t -{ - hb_blob_t *cblc_blob; - hb_blob_t *cbdt_blob; - const OT::CBLC *cblc; - const OT::CBDT *cbdt; - - unsigned int cbdt_len; - unsigned int upem; - - inline void init (hb_face_t *face) - { - upem = face->get_upem(); - - cblc_blob = OT::Sanitizer<OT::CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC)); - cbdt_blob = OT::Sanitizer<OT::CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT)); - cbdt_len = hb_blob_get_length (cbdt_blob); - - if (hb_blob_get_length (cblc_blob) == 0) { - cblc = nullptr; - cbdt = nullptr; - return; /* Not a bitmap font. */ - } - cblc = OT::Sanitizer<OT::CBLC>::lock_instance (cblc_blob); - cbdt = OT::Sanitizer<OT::CBDT>::lock_instance (cbdt_blob); - - } - - inline void fini (void) - { - hb_blob_destroy (this->cblc_blob); - hb_blob_destroy (this->cbdt_blob); - } - - inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const - { - unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */ - - if (!cblc) - return false; // Not a color bitmap font. - - const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem); - if (!subtable_record || !x_ppem || !y_ppem) - return false; - - if (subtable_record->get_extents (extents)) - return true; - - unsigned int image_offset = 0, image_length = 0, image_format = 0; - if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format)) - return false; - - { - /* TODO Move the following into CBDT struct when adding more formats. */ - - if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length)) - return false; - - switch (image_format) - { - case 17: { - if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size)) - return false; - - const OT::GlyphBitmapDataFormat17& glyphFormat17 = - OT::StructAtOffset<OT::GlyphBitmapDataFormat17> (this->cbdt, image_offset); - glyphFormat17.glyphMetrics.get_extents (extents); - } - break; - default: - // TODO: Support other image formats. - return false; - } - } - - /* Convert to the font units. */ - extents->x_bearing *= upem / (float) x_ppem; - extents->y_bearing *= upem / (float) y_ppem; - extents->width *= upem / (float) x_ppem; - extents->height *= upem / (float) y_ppem; - - return true; - } -}; - -struct hb_ot_face_post_accelerator_t -{ - hb_blob_t *post_blob; - OT::post::accelerator_t accel; - - inline void init (hb_face_t *face) - { - hb_blob_t *blob = this->post_blob = OT::Sanitizer<OT::post>::sanitize (face->reference_table (HB_OT_TAG_post)); - accel.init (OT::Sanitizer<OT::post>::lock_instance (blob), hb_blob_get_length (blob)); - } - - inline void fini (void) - { - accel.fini (); - hb_blob_destroy (this->post_blob); - } - - inline bool get_glyph_name (hb_codepoint_t glyph, - char *name, unsigned int size) const - { - return this->accel.get_glyph_name (glyph, name, size); - } - - inline bool get_glyph_from_name (const char *name, int len, - hb_codepoint_t *glyph) const - { - if (unlikely (!len)) - return false; - - return this->accel.get_glyph_from_name (name, len, glyph); - } -}; - -struct hb_ot_face_kern_accelerator_t -{ - hb_blob_t *kern_blob; - OT::kern::accelerator_t accel; - - inline void init (hb_face_t *face) - { - hb_blob_t *blob = this->kern_blob = OT::Sanitizer<OT::kern>::sanitize (face->reference_table (HB_OT_TAG_kern)); - accel.init (OT::Sanitizer<OT::kern>::lock_instance (blob), hb_blob_get_length (blob)); - } - - inline void fini (void) - { - accel.fini (); - hb_blob_destroy (this->kern_blob); - } - - inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const - { return accel.get_h_kerning (left, right); } -}; - -typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph); - -template <typename Type> -static inline bool get_glyph_from (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph) -{ - const Type *typed_obj = (const Type *) obj; - return typed_obj->get_glyph (codepoint, glyph); -} - -template <typename Type> -static inline bool get_glyph_from_symbol (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph) -{ - const Type *typed_obj = (const Type *) obj; - if (likely (typed_obj->get_glyph (codepoint, glyph))) - return true; - - if (codepoint <= 0x00FFu) - { - /* For symbol-encoded OpenType fonts, we duplicate the - * U+F000..F0FF range at U+0000..U+00FF. That's what - * Windows seems to do, and that's hinted about at: - * http://www.microsoft.com/typography/otspec/recom.htm - * under "Non-Standard (Symbol) Fonts". */ - return typed_obj->get_glyph (0xF000u + codepoint, glyph); - } - - return false; -} - -struct hb_ot_face_cmap_accelerator_t -{ - hb_cmap_get_glyph_func_t get_glyph_func; - const void *get_glyph_data; - OT::CmapSubtableFormat4::accelerator_t format4_accel; - - const OT::CmapSubtableFormat14 *uvs_table; - hb_blob_t *blob; - - inline void init (hb_face_t *face) - { - this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap)); - const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob); - const OT::CmapSubtable *subtable = nullptr; - const OT::CmapSubtableFormat14 *subtable_uvs = nullptr; - - bool symbol = false; - /* 32-bit subtables. */ - if (!subtable) subtable = cmap->find_subtable (3, 10); - if (!subtable) subtable = cmap->find_subtable (0, 6); - if (!subtable) subtable = cmap->find_subtable (0, 4); - /* 16-bit subtables. */ - if (!subtable) subtable = cmap->find_subtable (3, 1); - if (!subtable) subtable = cmap->find_subtable (0, 3); - if (!subtable) subtable = cmap->find_subtable (0, 2); - if (!subtable) subtable = cmap->find_subtable (0, 1); - if (!subtable) subtable = cmap->find_subtable (0, 0); - if (!subtable) - { - subtable = cmap->find_subtable (3, 0); - if (subtable) symbol = true; - } - /* Meh. */ - if (!subtable) subtable = &OT::Null(OT::CmapSubtable); - - /* UVS subtable. */ - if (!subtable_uvs) - { - const OT::CmapSubtable *st = cmap->find_subtable (0, 5); - if (st && st->u.format == 14) - subtable_uvs = &st->u.format14; - } - /* Meh. */ - if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14); - - this->uvs_table = subtable_uvs; - - this->get_glyph_data = subtable; - if (unlikely (symbol)) - this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>; - else - switch (subtable->u.format) { - /* Accelerate format 4 and format 12. */ - default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break; - case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break; - case 4: - { - this->format4_accel.init (&subtable->u.format4); - this->get_glyph_data = &this->format4_accel; - this->get_glyph_func = this->format4_accel.get_glyph_func; - } - break; - } - } - - inline void fini (void) - { - hb_blob_destroy (this->blob); - } - - inline bool get_nominal_glyph (hb_codepoint_t unicode, - hb_codepoint_t *glyph) const - { - return this->get_glyph_func (this->get_glyph_data, unicode, glyph); - } - - inline bool get_variation_glyph (hb_codepoint_t unicode, - hb_codepoint_t variation_selector, - hb_codepoint_t *glyph) const - { - switch (this->uvs_table->get_glyph_variant (unicode, - variation_selector, - glyph)) - { - case OT::GLYPH_VARIANT_NOT_FOUND: return false; - case OT::GLYPH_VARIANT_FOUND: return true; - case OT::GLYPH_VARIANT_USE_DEFAULT: break; - } - - return get_nominal_glyph (unicode, glyph); - } -}; - struct hb_ot_font_t { - hb_ot_face_cmap_accelerator_t cmap; - hb_ot_face_metrics_accelerator_t h_metrics; - hb_ot_face_metrics_accelerator_t v_metrics; - OT::hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf; - OT::hb_lazy_loader_t<hb_ot_face_cbdt_accelerator_t> cbdt; - OT::hb_lazy_loader_t<hb_ot_face_post_accelerator_t> post; - OT::hb_lazy_loader_t<hb_ot_face_kern_accelerator_t> kern; + OT::cmap::accelerator_t cmap; + OT::hmtx::accelerator_t h_metrics; + OT::vmtx::accelerator_t v_metrics; + OT::hb_lazy_loader_t<OT::glyf::accelerator_t> glyf; + OT::hb_lazy_loader_t<OT::CBDT::accelerator_t> cbdt; + OT::hb_lazy_loader_t<OT::post::accelerator_t> post; + OT::hb_lazy_loader_t<OT::kern::accelerator_t> kern; }; @@ -505,9 +59,8 @@ _hb_ot_font_create (hb_face_t *face) return nullptr; ot_font->cmap.init (face); - ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_HVAR, HB_OT_TAG_os2); - ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_OT_TAG_VVAR, HB_TAG_NONE, - ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */ + ot_font->h_metrics.init (face); + ot_font->v_metrics.init (face, ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */ ot_font->glyf.init (face); ot_font->cbdt.init (face); ot_font->post.init (face); @@ -688,7 +241,7 @@ retry: hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, nullptr, nullptr); //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, nullptr, nullptr); hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr); - //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr); TODO + //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr); hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, nullptr, nullptr); hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, nullptr, nullptr); 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 dc7aa8469a0..88d3850b6ef 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 @@ -28,6 +28,7 @@ #define HB_OT_GLYF_TABLE_HH #include "hb-open-type-private.hh" +#include "hb-ot-head-table.hh" namespace OT { @@ -42,6 +43,8 @@ namespace OT { struct loca { + friend struct glyf; + static const hb_tag_t tableTag = HB_OT_TAG_loca; inline bool sanitize (hb_sanitize_context_t *c) const @@ -50,12 +53,9 @@ struct loca return_trace (true); } - public: - union { - USHORT shortsZ[VAR]; /* Location offset divided by 2. */ - ULONG longsZ[VAR]; /* Location offset. */ - } u; - DEFINE_SIZE_ARRAY (0, u.longsZ); + protected: + UINT8 dataX[VAR]; /* Location data. */ + DEFINE_SIZE_ARRAY (0, dataX); }; @@ -78,26 +78,102 @@ struct glyf return_trace (true); } - public: - BYTE dataX[VAR]; /* Glyphs data. */ + struct GlyphHeader + { + INT16 numberOfContours; /* If the number of contours is + * greater than or equal to zero, + * this is a simple glyph; if negative, + * this is a composite glyph. */ + FWORD xMin; /* Minimum x for coordinate data. */ + FWORD yMin; /* Minimum y for coordinate data. */ + FWORD xMax; /* Maximum x for coordinate data. */ + FWORD yMax; /* Maximum y for coordinate data. */ + + DEFINE_SIZE_STATIC (10); + }; + + struct accelerator_t + { + inline void init (hb_face_t *face) + { + hb_blob_t *head_blob = Sanitizer<head>::sanitize (face->reference_table (HB_OT_TAG_head)); + const head *head_table = Sanitizer<head>::lock_instance (head_blob); + if ((unsigned int) head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0) + { + /* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */ + hb_blob_destroy (head_blob); + return; + } + short_offset = 0 == head_table->indexToLocFormat; + hb_blob_destroy (head_blob); + + loca_blob = Sanitizer<loca>::sanitize (face->reference_table (HB_OT_TAG_loca)); + loca_table = Sanitizer<loca>::lock_instance (loca_blob); + glyf_blob = Sanitizer<glyf>::sanitize (face->reference_table (HB_OT_TAG_glyf)); + glyf_table = Sanitizer<glyf>::lock_instance (glyf_blob); + + num_glyphs = MAX (1u, hb_blob_get_length (loca_blob) / (short_offset ? 2 : 4)) - 1; + glyf_len = hb_blob_get_length (glyf_blob); + } + + inline void fini (void) + { + hb_blob_destroy (loca_blob); + hb_blob_destroy (glyf_blob); + } + + inline bool get_extents (hb_codepoint_t glyph, + hb_glyph_extents_t *extents) const + { + if (unlikely (glyph >= num_glyphs)) + return false; + + unsigned int start_offset, end_offset; + if (short_offset) + { + const UINT16 *offsets = (const UINT16 *) loca_table->dataX; + start_offset = 2 * offsets[glyph]; + end_offset = 2 * offsets[glyph + 1]; + } + else + { + const UINT32 *offsets = (const UINT32 *) loca_table->dataX; + start_offset = offsets[glyph]; + end_offset = offsets[glyph + 1]; + } + + if (start_offset > end_offset || end_offset > glyf_len) + return false; + + if (end_offset - start_offset < GlyphHeader::static_size) + return true; /* Empty glyph; zero extents. */ + + const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyf_table, start_offset); + + extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax); + extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax); + extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing; + extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing; + + return true; + } + + private: + bool short_offset; + unsigned int num_glyphs; + const loca *loca_table; + const glyf *glyf_table; + hb_blob_t *loca_blob; + hb_blob_t *glyf_blob; + unsigned int glyf_len; + }; + + protected: + UINT8 dataX[VAR]; /* Glyphs data. */ DEFINE_SIZE_ARRAY (0, dataX); }; -struct glyfGlyphHeader -{ - SHORT numberOfContours; /* If the number of contours is - * greater than or equal to zero, - * this is a simple glyph; if negative, - * this is a composite glyph. */ - FWORD xMin; /* Minimum x for coordinate data. */ - FWORD yMin; /* Minimum y for coordinate data. */ - FWORD xMax; /* Maximum x for coordinate data. */ - FWORD yMax; /* Maximum y for coordinate data. */ - - DEFINE_SIZE_STATIC (10); -}; - } /* namespace OT */ 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 9c3e51eb08f..dd4349ef85a 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 @@ -64,11 +64,11 @@ struct head FixedVersion<>version; /* Version of the head table--currently * 0x00010000u for version 1.0. */ FixedVersion<>fontRevision; /* Set by font manufacturer. */ - ULONG checkSumAdjustment; /* To compute: set it to 0, sum the - * entire font as ULONG, then store + UINT32 checkSumAdjustment; /* To compute: set it to 0, sum the + * entire font as UINT32, then store * 0xB1B0AFBAu - sum. */ - ULONG magicNumber; /* Set to 0x5F0F3CF5u. */ - USHORT flags; /* Bit 0: Baseline for font at y=0; + UINT32 magicNumber; /* Set to 0x5F0F3CF5u. */ + UINT16 flags; /* Bit 0: Baseline for font at y=0; * Bit 1: Left sidebearing point at x=0; * Bit 2: Instructions may depend on point size; * Bit 3: Force ppem to integer values for all @@ -114,18 +114,18 @@ struct head * encoded in the cmap subtables represent proper * support for those code points. * Bit 15: Reserved, set to 0. */ - USHORT unitsPerEm; /* Valid range is from 16 to 16384. This value + UINT16 unitsPerEm; /* Valid range is from 16 to 16384. This value * should be a power of 2 for fonts that have * TrueType outlines. */ LONGDATETIME created; /* Number of seconds since 12:00 midnight, January 1, 1904. 64-bit integer */ LONGDATETIME modified; /* Number of seconds since 12:00 midnight, January 1, 1904. 64-bit integer */ - SHORT xMin; /* For all glyph bounding boxes. */ - SHORT yMin; /* For all glyph bounding boxes. */ - SHORT xMax; /* For all glyph bounding boxes. */ - SHORT yMax; /* For all glyph bounding boxes. */ - USHORT macStyle; /* Bit 0: Bold (if set to 1); + INT16 xMin; /* For all glyph bounding boxes. */ + INT16 yMin; /* For all glyph bounding boxes. */ + INT16 xMax; /* For all glyph bounding boxes. */ + INT16 yMax; /* For all glyph bounding boxes. */ + UINT16 macStyle; /* Bit 0: Bold (if set to 1); * Bit 1: Italic (if set to 1) * Bit 2: Underline (if set to 1) * Bit 3: Outline (if set to 1) @@ -133,16 +133,16 @@ struct head * Bit 5: Condensed (if set to 1) * Bit 6: Extended (if set to 1) * Bits 7-15: Reserved (set to 0). */ - USHORT lowestRecPPEM; /* Smallest readable size in pixels. */ - SHORT fontDirectionHint; /* Deprecated (Set to 2). + UINT16 lowestRecPPEM; /* Smallest readable size in pixels. */ + INT16 fontDirectionHint; /* Deprecated (Set to 2). * 0: Fully mixed directional glyphs; * 1: Only strongly left to right; * 2: Like 1 but also contains neutrals; * -1: Only strongly right to left; * -2: Like -1 but also contains neutrals. */ public: - SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ - SHORT glyphDataFormat; /* 0 for current format. */ + INT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */ + INT16 glyphDataFormat; /* 0 for current format. */ DEFINE_SIZE_STATIC (54); }; 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 c8e9536cf1e..dca014148ea 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 @@ -44,11 +44,6 @@ namespace OT { struct _hea { - static const hb_tag_t tableTag = HB_TAG('_','h','e','a'); - - static const hb_tag_t hheaTag = HB_OT_TAG_hhea; - static const hb_tag_t vheaTag = HB_OT_TAG_vhea; - inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -69,21 +64,21 @@ struct _hea * (xMax - xMin)) for horizontal. */ FWORD maxExtent; /* horizontal: Max(lsb + (xMax - xMin)), * vertical: minLeadingBearing+(yMax-yMin). */ - SHORT caretSlopeRise; /* Used to calculate the slope of the + INT16 caretSlopeRise; /* Used to calculate the slope of the * cursor (rise/run); 1 for vertical caret, * 0 for horizontal.*/ - SHORT caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */ - SHORT caretOffset; /* The amount by which a slanted + INT16 caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */ + INT16 caretOffset; /* The amount by which a slanted * highlight on a glyph needs * to be shifted to produce the * best appearance. Set to 0 for * non-slanted fonts. */ - SHORT reserved1; /* Set to 0. */ - SHORT reserved2; /* Set to 0. */ - SHORT reserved3; /* Set to 0. */ - SHORT reserved4; /* Set to 0. */ - SHORT metricDataFormat; /* 0 for current format. */ - USHORT numberOfLongMetrics; /* Number of LongMetric entries in metric + INT16 reserved1; /* Set to 0. */ + INT16 reserved2; /* Set to 0. */ + INT16 reserved3; /* Set to 0. */ + INT16 reserved4; /* Set to 0. */ + INT16 metricDataFormat; /* 0 for current format. */ + UINT16 numberOfLongMetrics; /* Number of LongMetric entries in metric * table. */ public: DEFINE_SIZE_STATIC (36); 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 30aa625347f..e710aee42ec 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 @@ -28,6 +28,9 @@ #define HB_OT_HMTX_TABLE_HH #include "hb-open-type-private.hh" +#include "hb-ot-hhea-table.hh" +#include "hb-ot-os2-table.hh" +#include "hb-ot-var-hvar-table.hh" namespace OT { @@ -50,11 +53,9 @@ struct LongMetric DEFINE_SIZE_STATIC (4); }; +template <typename T> struct hmtxvmtx { - static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx; - static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx; - inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -63,7 +64,107 @@ struct hmtxvmtx return_trace (true); } - public: + struct accelerator_t + { + inline void init (hb_face_t *face, + unsigned int default_advance_ = 0) + { + default_advance = default_advance_ ? default_advance_ : face->get_upem (); + + bool got_font_extents = false; + if (T::os2Tag) + { + hb_blob_t *os2_blob = Sanitizer<os2>::sanitize (face->reference_table (T::os2Tag)); + const os2 *os2_table = Sanitizer<os2>::lock_instance (os2_blob); +#define USE_TYPO_METRICS (1u<<7) + if (0 != (os2_table->fsSelection & USE_TYPO_METRICS)) + { + ascender = os2_table->sTypoAscender; + descender = os2_table->sTypoDescender; + line_gap = os2_table->sTypoLineGap; + got_font_extents = (ascender | descender) != 0; + } + hb_blob_destroy (os2_blob); + } + + hb_blob_t *_hea_blob = Sanitizer<_hea>::sanitize (face->reference_table (T::headerTag)); + const _hea *_hea_table = Sanitizer<_hea>::lock_instance (_hea_blob); + num_advances = _hea_table->numberOfLongMetrics; + if (!got_font_extents) + { + ascender = _hea_table->ascender; + descender = _hea_table->descender; + line_gap = _hea_table->lineGap; + got_font_extents = (ascender | descender) != 0; + } + hb_blob_destroy (_hea_blob); + + has_font_extents = got_font_extents; + + blob = Sanitizer<hmtxvmtx>::sanitize (face->reference_table (T::tableTag)); + + /* Cap num_metrics() and num_advances() based on table length. */ + unsigned int len = hb_blob_get_length (blob); + if (unlikely (num_advances * 4 > len)) + num_advances = len / 4; + num_metrics = num_advances + (len - 4 * num_advances) / 2; + + /* We MUST set num_metrics to zero if num_advances is zero. + * Our get_advance() depends on that. */ + if (unlikely (!num_advances)) + { + num_metrics = num_advances = 0; + hb_blob_destroy (blob); + blob = hb_blob_get_empty (); + } + table = Sanitizer<hmtxvmtx>::lock_instance (blob); + + var_blob = Sanitizer<HVARVVAR>::sanitize (face->reference_table (T::variationsTag)); + var_table = Sanitizer<HVARVVAR>::lock_instance (var_blob); + } + + inline void fini (void) + { + hb_blob_destroy (blob); + hb_blob_destroy (var_blob); + } + + inline unsigned int get_advance (hb_codepoint_t glyph, + hb_font_t *font) const + { + if (unlikely (glyph >= num_metrics)) + { + /* If num_metrics is zero, it means we don't have the metrics table + * for this direction: return default advance. Otherwise, it means that the + * glyph index is out of bound: return zero. */ + if (num_metrics) + return 0; + else + return default_advance; + } + + return table->longMetric[MIN (glyph, (uint32_t) num_advances - 1)].advance + + var_table->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?! + } + + public: + bool has_font_extents; + unsigned short ascender; + unsigned short descender; + unsigned short line_gap; + + private: + unsigned int num_metrics; + unsigned int num_advances; + unsigned int default_advance; + + const hmtxvmtx *table; + hb_blob_t *blob; + const HVARVVAR *var_table; + hb_blob_t *var_blob; + }; + + protected: LongMetric longMetric[VAR]; /* Paired advance width and leading * bearing values for each glyph. The * value numOfHMetrics comes from @@ -89,11 +190,17 @@ struct hmtxvmtx DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX); }; -struct hmtx : hmtxvmtx { +struct hmtx : hmtxvmtx<hmtx> { static const hb_tag_t tableTag = HB_OT_TAG_hmtx; + static const hb_tag_t headerTag = HB_OT_TAG_hhea; + static const hb_tag_t variationsTag = HB_OT_TAG_HVAR; + static const hb_tag_t os2Tag = HB_OT_TAG_os2; }; -struct vmtx : hmtxvmtx { +struct vmtx : hmtxvmtx<vmtx> { static const hb_tag_t tableTag = HB_OT_TAG_vmtx; + static const hb_tag_t headerTag = HB_OT_TAG_vhea; + static const hb_tag_t variationsTag = HB_OT_TAG_VVAR; + static const hb_tag_t os2Tag = HB_TAG_NONE; }; } /* namespace OT */ 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 5fd2e20e67d..e07faca63f3 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 @@ -104,8 +104,8 @@ struct KernClassTable } protected: - USHORT firstGlyph; /* First glyph in class range. */ - ArrayOf<USHORT> classes; /* Glyph classes. */ + UINT16 firstGlyph; /* First glyph in class range. */ + ArrayOf<UINT16> classes; /* Glyph classes. */ public: DEFINE_SIZE_ARRAY (4, classes); }; @@ -136,7 +136,7 @@ struct KernSubTableFormat2 } protected: - USHORT rowWidth; /* The width, in bytes, of a row in the table. */ + UINT16 rowWidth; /* The width, in bytes, of a row in the table. */ OffsetTo<KernClassTable> leftClassTable; /* Offset from beginning of this subtable to * left-hand class table. */ @@ -275,19 +275,19 @@ struct KernOT : KernTable<KernOT> }; protected: - USHORT versionZ; /* Unused. */ - USHORT length; /* Length of the subtable (including this header). */ - BYTE format; /* Subtable format. */ - BYTE coverage; /* Coverage bits. */ + UINT16 versionZ; /* Unused. */ + UINT16 length; /* Length of the subtable (including this header). */ + UINT8 format; /* Subtable format. */ + UINT8 coverage; /* Coverage bits. */ KernSubTable subtable; /* Subtable data. */ public: DEFINE_SIZE_MIN (6); }; protected: - USHORT version; /* Version--0x0000u */ - USHORT nTables; /* Number of subtables in the kerning table. */ - BYTE data[VAR]; + UINT16 version; /* Version--0x0000u */ + UINT16 nTables; /* Number of subtables in the kerning table. */ + UINT8 data[VAR]; public: DEFINE_SIZE_ARRAY (4, data); }; @@ -314,10 +314,10 @@ struct KernAAT : KernTable<KernAAT> }; protected: - ULONG length; /* Length of the subtable (including this header). */ - BYTE coverage; /* Coverage bits. */ - BYTE format; /* Subtable format. */ - USHORT tupleIndex; /* The tuple index (used for variations fonts). + UINT32 length; /* Length of the subtable (including this header). */ + UINT8 coverage; /* Coverage bits. */ + UINT8 format; /* Subtable format. */ + UINT16 tupleIndex; /* The tuple index (used for variations fonts). * This value specifies which tuple this subtable covers. */ KernSubTable subtable; /* Subtable data. */ public: @@ -325,9 +325,9 @@ struct KernAAT : KernTable<KernAAT> }; protected: - ULONG version; /* Version--0x00010000u */ - ULONG nTables; /* Number of subtables in the kerning table. */ - BYTE data[VAR]; + UINT32 version; /* Version--0x00010000u */ + UINT32 nTables; /* Number of subtables in the kerning table. */ + UINT8 data[VAR]; public: DEFINE_SIZE_ARRAY (8, data); }; @@ -358,24 +358,29 @@ struct kern struct accelerator_t { - inline void init (const kern *table_, unsigned int table_length_) + inline void init (hb_face_t *face) { - table = table_; - table_length = table_length_; + blob = Sanitizer<kern>::sanitize (face->reference_table (HB_OT_TAG_kern)); + table = Sanitizer<kern>::lock_instance (blob); + table_length = hb_blob_get_length (blob); + } + inline void fini (void) + { + hb_blob_destroy (blob); } - inline void fini (void) {} inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const { return table->get_h_kerning (left, right, table_length); } private: + hb_blob_t *blob; const kern *table; unsigned int table_length; }; protected: union { - USHORT major; + UINT16 major; KernOT ot; KernAAT aat; } u; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh index 8d881add50d..86a74ccb604 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh @@ -161,7 +161,7 @@ struct RangeRecord GlyphID start; /* First GlyphID in the range */ GlyphID end; /* Last GlyphID in the range */ - USHORT value; /* Value */ + UINT16 value; /* Value */ public: DEFINE_SIZE_STATIC (6); }; @@ -175,7 +175,7 @@ struct IndexArray : ArrayOf<Index> unsigned int *_indexes /* OUT */) const { if (_count) { - const USHORT *arr = this->sub_array (start_offset, _count); + const UINT16 *arr = this->sub_array (start_offset, _count); unsigned int count = *_count; for (unsigned int i = 0; i < count; i++) _indexes[i] = arr[i]; @@ -216,9 +216,9 @@ struct LangSys return_trace (c->check_struct (this) && featureIndex.sanitize (c)); } - Offset<> lookupOrderZ; /* = Null (reserved for an offset to a + Offset16 lookupOrderZ; /* = Null (reserved for an offset to a * reordering table) */ - USHORT reqFeatureIndex;/* Index of a feature required for this + UINT16 reqFeatureIndex;/* Index of a feature required for this * language system--if no required features * = 0xFFFFu */ IndexArray featureIndex; /* Array of indices into the FeatureList */ @@ -343,12 +343,12 @@ struct FeatureParamsSize return_trace (true); } - USHORT designSize; /* Represents the design size in 720/inch + UINT16 designSize; /* Represents the design size in 720/inch * units (decipoints). The design size entry * must be non-zero. When there is a design * size but no recommended size range, the * rest of the array will consist of zeros. */ - USHORT subfamilyID; /* Has no independent meaning, but serves + UINT16 subfamilyID; /* Has no independent meaning, but serves * as an identifier that associates fonts * in a subfamily. All fonts which share a * Preferred or Font Family name and which @@ -358,7 +358,7 @@ struct FeatureParamsSize * same subfamily value. If this value is * zero, the remaining fields in the array * will be ignored. */ - USHORT subfamilyNameID;/* If the preceding value is non-zero, this + UINT16 subfamilyNameID;/* If the preceding value is non-zero, this * value must be set in the range 256 - 32767 * (inclusive). It records the value of a * field in the name table, which must @@ -372,10 +372,10 @@ struct FeatureParamsSize * subfamily in a menu. Applications will * choose the appropriate version based on * their selection criteria. */ - USHORT rangeStart; /* Large end of the recommended usage range + UINT16 rangeStart; /* Large end of the recommended usage range * (inclusive), stored in 720/inch units * (decipoints). */ - USHORT rangeEnd; /* Small end of the recommended usage range + UINT16 rangeEnd; /* Small end of the recommended usage range (exclusive), stored in 720/inch units * (decipoints). */ public: @@ -393,12 +393,12 @@ struct FeatureParamsStylisticSet return_trace (c->check_struct (this)); } - USHORT version; /* (set to 0): This corresponds to a “minor” + UINT16 version; /* (set to 0): This corresponds to a “minor” * version number. Additional data may be * added to the end of this Feature Parameters * table in the future. */ - USHORT uiNameID; /* The 'name' table name ID that specifies a + UINT16 uiNameID; /* The 'name' table name ID that specifies a * string (or strings, for multiple languages) * for a user-interface label for this * feature. The values of uiLabelNameId and @@ -426,25 +426,25 @@ struct FeatureParamsCharacterVariants characters.sanitize (c)); } - USHORT format; /* Format number is set to 0. */ - USHORT featUILableNameID; /* The ‘name’ table name ID that + UINT16 format; /* Format number is set to 0. */ + UINT16 featUILableNameID; /* The ‘name’ table name ID that * specifies a string (or strings, * for multiple languages) for a * user-interface label for this * feature. (May be nullptr.) */ - USHORT featUITooltipTextNameID;/* The ‘name’ table name ID that + UINT16 featUITooltipTextNameID;/* The ‘name’ table name ID that * specifies a string (or strings, * for multiple languages) that an * application can use for tooltip * text for this feature. (May be * nullptr.) */ - USHORT sampleTextNameID; /* The ‘name’ table name ID that + UINT16 sampleTextNameID; /* The ‘name’ table name ID that * specifies sample text that * illustrates the effect of this * feature. (May be nullptr.) */ - USHORT numNamedParameters; /* Number of named parameters. (May + UINT16 numNamedParameters; /* Number of named parameters. (May * be zero.) */ - USHORT firstParamUILabelNameID;/* The first ‘name’ table name ID + UINT16 firstParamUILabelNameID;/* The first ‘name’ table name ID * used to specify strings for * user-interface labels for the * feature parameters. (Must be zero @@ -562,7 +562,7 @@ struct Feature typedef RecordListOf<Feature> FeatureList; -struct LookupFlag : USHORT +struct LookupFlag : UINT16 { enum Flags { RightToLeft = 0x0001u, @@ -608,7 +608,7 @@ struct Lookup unsigned int flag = lookupFlag; if (unlikely (flag & LookupFlag::UseMarkFilteringSet)) { - const USHORT &markFilteringSet = StructAfter<USHORT> (subTable); + const UINT16 &markFilteringSet = StructAfter<UINT16> (subTable); flag += (markFilteringSet << 16); } return flag; @@ -640,7 +640,7 @@ struct Lookup if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false); if (lookupFlag & LookupFlag::UseMarkFilteringSet) { - USHORT &markFilteringSet = StructAfter<USHORT> (subTable); + UINT16 &markFilteringSet = StructAfter<UINT16> (subTable); markFilteringSet.set (lookup_props >> 16); } return_trace (true); @@ -653,18 +653,18 @@ struct Lookup if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false); if (lookupFlag & LookupFlag::UseMarkFilteringSet) { - const USHORT &markFilteringSet = StructAfter<USHORT> (subTable); + const UINT16 &markFilteringSet = StructAfter<UINT16> (subTable); if (!markFilteringSet.sanitize (c)) return_trace (false); } return_trace (true); } private: - USHORT lookupType; /* Different enumerations for GSUB and GPOS */ - USHORT lookupFlag; /* Lookup qualifiers */ - ArrayOf<Offset<> > + UINT16 lookupType; /* Different enumerations for GSUB and GPOS */ + UINT16 lookupFlag; /* Lookup qualifiers */ + ArrayOf<Offset16> subTable; /* Array of SubTables */ - USHORT markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets + UINT16 markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets * structure. This field is only present if bit * UseMarkFilteringSet of lookup flags is set. */ public: @@ -737,7 +737,7 @@ struct CoverageFormat1 private: protected: - USHORT coverageFormat; /* Format identifier--format = 1 */ + UINT16 coverageFormat; /* Format identifier--format = 1 */ SortedArrayOf<GlyphID> glyphArray; /* Array of GlyphIDs--in numerical order */ public: @@ -860,7 +860,7 @@ struct CoverageFormat2 private: protected: - USHORT coverageFormat; /* Format identifier--format = 2 */ + UINT16 coverageFormat; /* Format identifier--format = 2 */ SortedArrayOf<RangeRecord> rangeRecord; /* Array of glyph ranges--ordered by * Start GlyphID. rangeCount entries @@ -985,7 +985,7 @@ struct Coverage protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ CoverageFormat1 format1; CoverageFormat2 format2; } u; @@ -1047,9 +1047,9 @@ struct ClassDefFormat1 } protected: - USHORT classFormat; /* Format identifier--format = 1 */ + UINT16 classFormat; /* Format identifier--format = 1 */ GlyphID startGlyph; /* First GlyphID of the classValueArray */ - ArrayOf<USHORT> + ArrayOf<UINT16> classValue; /* Array of Class Values--one per GlyphID */ public: DEFINE_SIZE_ARRAY (6, classValue); @@ -1107,7 +1107,7 @@ struct ClassDefFormat2 } protected: - USHORT classFormat; /* Format identifier--format = 2 */ + UINT16 classFormat; /* Format identifier--format = 2 */ SortedArrayOf<RangeRecord> rangeRecord; /* Array of glyph ranges--ordered by * Start GlyphID */ @@ -1155,7 +1155,7 @@ struct ClassDef protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ ClassDefFormat1 format1; ClassDefFormat2 format2; } u; @@ -1240,8 +1240,8 @@ struct VarRegionList } protected: - USHORT axisCount; - USHORT regionCount; + UINT16 axisCount; + UINT16 regionCount; VarRegionAxis axesZ[VAR]; public: DEFINE_SIZE_ARRAY (4, axesZ); @@ -1265,13 +1265,13 @@ struct VarData unsigned int count = regionIndices.len; unsigned int scount = shortCount; - const BYTE *bytes = &StructAfter<BYTE> (regionIndices); - const BYTE *row = bytes + inner * (scount + count); + const UINT8 *bytes = &StructAfter<UINT8> (regionIndices); + const UINT8 *row = bytes + inner * (scount + count); float delta = 0.; unsigned int i = 0; - const SHORT *scursor = reinterpret_cast<const SHORT *> (row); + const INT16 *scursor = reinterpret_cast<const INT16 *> (row); for (; i < scount; i++) { float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); @@ -1293,15 +1293,15 @@ struct VarData return_trace (c->check_struct (this) && regionIndices.sanitize(c) && shortCount <= regionIndices.len && - c->check_array (&StructAfter<BYTE> (regionIndices), + c->check_array (&StructAfter<UINT8> (regionIndices), get_row_size (), itemCount)); } protected: - USHORT itemCount; - USHORT shortCount; - ArrayOf<USHORT> regionIndices; - BYTE bytesX[VAR]; + UINT16 itemCount; + UINT16 shortCount; + ArrayOf<UINT16> regionIndices; + UINT8 bytesX[VAR]; public: DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX); }; @@ -1337,9 +1337,9 @@ struct VariationStore } protected: - USHORT format; + UINT16 format; LOffsetTo<VarRegionList> regions; - OffsetArrayOf<VarData, ULONG> dataSets; + OffsetArrayOf<VarData, UINT32> dataSets; public: DEFINE_SIZE_ARRAY (8, dataSets); }; @@ -1366,8 +1366,8 @@ struct ConditionFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ - USHORT axisIndex; + UINT16 format; /* Format identifier--format = 1 */ + UINT16 axisIndex; F2DOT14 filterRangeMinValue; F2DOT14 filterRangeMaxValue; public: @@ -1396,7 +1396,7 @@ struct Condition protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ ConditionFormat1 format1; } u; public: @@ -1421,7 +1421,7 @@ struct ConditionSet } protected: - OffsetArrayOf<Condition, ULONG> conditions; + OffsetArrayOf<Condition, UINT32> conditions; public: DEFINE_SIZE_ARRAY (2, conditions); }; @@ -1437,7 +1437,7 @@ struct FeatureTableSubstitutionRecord } protected: - USHORT featureIndex; + UINT16 featureIndex; LOffsetTo<Feature> feature; public: DEFINE_SIZE_STATIC (6); @@ -1557,8 +1557,8 @@ struct HintingDevice inline unsigned int get_size (void) const { unsigned int f = deltaFormat; - if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size; - return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f))); + if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * UINT16::static_size; + return UINT16::static_size * (4 + ((endSize - startSize) >> (4 - f))); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -1603,14 +1603,14 @@ struct HintingDevice } protected: - USHORT startSize; /* Smallest size to correct--in ppem */ - USHORT endSize; /* Largest size to correct--in ppem */ - USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 + UINT16 startSize; /* Smallest size to correct--in ppem */ + UINT16 endSize; /* Largest size to correct--in ppem */ + UINT16 deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 * 1 Signed 2-bit value, 8 values per uint16 * 2 Signed 4-bit value, 4 values per uint16 * 3 Signed 8-bit value, 2 values per uint16 */ - USHORT deltaValue[VAR]; /* Array of compressed data */ + UINT16 deltaValue[VAR]; /* Array of compressed data */ public: DEFINE_SIZE_ARRAY (6, deltaValue); }; @@ -1641,9 +1641,9 @@ struct VariationDevice } protected: - USHORT outerIndex; - USHORT innerIndex; - USHORT deltaFormat; /* Format identifier for this table: 0x0x8000 */ + UINT16 outerIndex; + UINT16 innerIndex; + UINT16 deltaFormat; /* Format identifier for this table: 0x0x8000 */ public: DEFINE_SIZE_STATIC (6); }; @@ -1651,10 +1651,10 @@ struct VariationDevice struct DeviceHeader { protected: - USHORT reserved1; - USHORT reserved2; + UINT16 reserved1; + UINT16 reserved2; public: - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ public: DEFINE_SIZE_STATIC (6); }; 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 99dda3a74bb..eed46dd6728 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 @@ -41,7 +41,7 @@ namespace OT { * Attachment List Table */ -typedef ArrayOf<USHORT> AttachPoint; /* Array of contour point indices--in +typedef ArrayOf<UINT16> AttachPoint; /* Array of contour point indices--in * increasing numerical order */ struct AttachList @@ -62,7 +62,7 @@ struct AttachList const AttachPoint &points = this+attachPoint[index]; if (point_count) { - const USHORT *array = points.sub_array (start_offset, point_count); + const UINT16 *array = points.sub_array (start_offset, point_count); unsigned int count = *point_count; for (unsigned int i = 0; i < count; i++) point_array[i] = array[i]; @@ -109,8 +109,8 @@ struct CaretValueFormat1 } protected: - USHORT caretValueFormat; /* Format identifier--format = 1 */ - SHORT coordinate; /* X or Y value, in design units */ + UINT16 caretValueFormat; /* Format identifier--format = 1 */ + INT16 coordinate; /* X or Y value, in design units */ public: DEFINE_SIZE_STATIC (4); }; @@ -136,8 +136,8 @@ struct CaretValueFormat2 } protected: - USHORT caretValueFormat; /* Format identifier--format = 2 */ - USHORT caretValuePoint; /* Contour point index on glyph */ + UINT16 caretValueFormat; /* Format identifier--format = 2 */ + UINT16 caretValuePoint; /* Contour point index on glyph */ public: DEFINE_SIZE_STATIC (4); }; @@ -160,8 +160,8 @@ struct CaretValueFormat3 } protected: - USHORT caretValueFormat; /* Format identifier--format = 3 */ - SHORT coordinate; /* X or Y value, in design units */ + UINT16 caretValueFormat; /* Format identifier--format = 3 */ + INT16 coordinate; /* X or Y value, in design units */ OffsetTo<Device> deviceTable; /* Offset to Device table for X or Y * value--from beginning of CaretValue @@ -199,7 +199,7 @@ struct CaretValue protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ CaretValueFormat1 format1; CaretValueFormat2 format2; CaretValueFormat3 format3; @@ -294,7 +294,7 @@ struct MarkGlyphSetsFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ ArrayOf<LOffsetTo<Coverage> > coverage; /* Array of long offsets to mark set * coverage tables */ @@ -324,7 +324,7 @@ struct MarkGlyphSets protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ MarkGlyphSetsFormat1 format1; } u; public: 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 e45ce2721c8..3dcf2ec911a 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 @@ -51,11 +51,11 @@ enum attach_type_t { /* Shared Tables: ValueRecord, Anchor Table, and MarkArray */ -typedef USHORT Value; +typedef UINT16 Value; typedef Value ValueRecord[VAR]; -struct ValueFormat : USHORT +struct ValueFormat : UINT16 { enum Flags { xPlacement = 0x0001u, /* Includes horizontal adjustment for placement */ @@ -74,14 +74,14 @@ struct ValueFormat : USHORT /* All fields are options. Only those available advance the value pointer. */ #if 0 - SHORT xPlacement; /* Horizontal adjustment for + INT16 xPlacement; /* Horizontal adjustment for * placement--in design units */ - SHORT yPlacement; /* Vertical adjustment for + INT16 yPlacement; /* Vertical adjustment for * placement--in design units */ - SHORT xAdvance; /* Horizontal adjustment for + INT16 xAdvance; /* Horizontal adjustment for * advance--in design units (only used * for horizontal writing) */ - SHORT yAdvance; /* Vertical adjustment for advance--in + INT16 yAdvance; /* Vertical adjustment for advance--in * design units (only used for vertical * writing) */ Offset xPlaDevice; /* Offset to Device table for @@ -178,8 +178,8 @@ struct ValueFormat : USHORT static inline const OffsetTo<Device>& get_device (const Value* value) { return *CastP<OffsetTo<Device> > (value); } - static inline const SHORT& get_short (const Value* value) - { return *CastP<SHORT> (value); } + static inline const INT16& get_short (const Value* value) + { return *CastP<INT16> (value); } public: @@ -247,9 +247,9 @@ struct AnchorFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ - SHORT xCoordinate; /* Horizontal value--in design units */ - SHORT yCoordinate; /* Vertical value--in design units */ + UINT16 format; /* Format identifier--format = 1 */ + INT16 xCoordinate; /* Horizontal value--in design units */ + INT16 yCoordinate; /* Vertical value--in design units */ public: DEFINE_SIZE_STATIC (6); }; @@ -278,10 +278,10 @@ struct AnchorFormat2 } protected: - USHORT format; /* Format identifier--format = 2 */ - SHORT xCoordinate; /* Horizontal value--in design units */ - SHORT yCoordinate; /* Vertical value--in design units */ - USHORT anchorPoint; /* Index to glyph contour point */ + UINT16 format; /* Format identifier--format = 2 */ + INT16 xCoordinate; /* Horizontal value--in design units */ + INT16 yCoordinate; /* Vertical value--in design units */ + UINT16 anchorPoint; /* Index to glyph contour point */ public: DEFINE_SIZE_STATIC (8); }; @@ -308,9 +308,9 @@ struct AnchorFormat3 } protected: - USHORT format; /* Format identifier--format = 3 */ - SHORT xCoordinate; /* Horizontal value--in design units */ - SHORT yCoordinate; /* Vertical value--in design units */ + UINT16 format; /* Format identifier--format = 3 */ + INT16 xCoordinate; /* Horizontal value--in design units */ + INT16 yCoordinate; /* Vertical value--in design units */ OffsetTo<Device> xDeviceTable; /* Offset to Device table for X * coordinate-- from beginning of @@ -351,7 +351,7 @@ struct Anchor protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ AnchorFormat1 format1; AnchorFormat2 format2; AnchorFormat3 format3; @@ -382,7 +382,7 @@ struct AnchorMatrix return_trace (true); } - USHORT rows; /* Number of rows */ + UINT16 rows; /* Number of rows */ protected: OffsetTo<Anchor> matrixZ[VAR]; /* Matrix of offsets to Anchor tables-- @@ -403,7 +403,7 @@ struct MarkRecord } protected: - USHORT klass; /* Class defined for this mark */ + UINT16 klass; /* Class defined for this mark */ OffsetTo<Anchor> markAnchor; /* Offset to Anchor table--from * beginning of MarkArray table */ @@ -492,7 +492,7 @@ struct SinglePosFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -544,13 +544,13 @@ struct SinglePosFormat2 } protected: - USHORT format; /* Format identifier--format = 2 */ + UINT16 format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of subtable */ ValueFormat valueFormat; /* Defines the types of data in the * ValueRecord */ - USHORT valueCount; /* Number of ValueRecords */ + UINT16 valueCount; /* Number of ValueRecords */ ValueRecord values; /* Array of ValueRecords--positioning * values applied to glyphs */ public: @@ -573,7 +573,7 @@ struct SinglePos protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ SinglePosFormat1 format1; SinglePosFormat2 format2; } u; @@ -604,7 +604,7 @@ struct PairSet TRACE_COLLECT_GLYPHS (this); unsigned int len1 = valueFormats[0].get_len (); unsigned int len2 = valueFormats[1].get_len (); - unsigned int record_size = USHORT::static_size * (1 + len1 + len2); + unsigned int record_size = UINT16::static_size * (1 + len1 + len2); const PairValueRecord *record = CastP<PairValueRecord> (arrayZ); unsigned int count = len; @@ -623,7 +623,7 @@ struct PairSet hb_buffer_t *buffer = c->buffer; unsigned int len1 = valueFormats[0].get_len (); unsigned int len2 = valueFormats[1].get_len (); - unsigned int record_size = USHORT::static_size * (1 + len1 + len2); + unsigned int record_size = UINT16::static_size * (1 + len1 + len2); const PairValueRecord *record_array = CastP<PairValueRecord> (arrayZ); unsigned int count = len; @@ -668,7 +668,7 @@ struct PairSet { TRACE_SANITIZE (this); if (!(c->check_struct (this) - && c->check_array (arrayZ, USHORT::static_size * closure->stride, len))) return_trace (false); + && c->check_array (arrayZ, UINT16::static_size * closure->stride, len))) return_trace (false); unsigned int count = len; const PairValueRecord *record = CastP<PairValueRecord> (arrayZ); @@ -677,8 +677,8 @@ struct PairSet } protected: - USHORT len; /* Number of PairValueRecords */ - USHORT arrayZ[VAR]; /* Array of PairValueRecords--ordered + UINT16 len; /* Number of PairValueRecords */ + UINT16 arrayZ[VAR]; /* Array of PairValueRecords--ordered * by GlyphID of the second glyph */ public: DEFINE_SIZE_ARRAY (2, arrayZ); @@ -733,7 +733,7 @@ struct PairPosFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -823,7 +823,7 @@ struct PairPosFormat2 } protected: - USHORT format; /* Format identifier--format = 2 */ + UINT16 format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -841,9 +841,9 @@ struct PairPosFormat2 classDef2; /* Offset to ClassDef table--from * beginning of PairPos subtable--for * the second glyph of the pair */ - USHORT class1Count; /* Number of classes in ClassDef1 + UINT16 class1Count; /* Number of classes in ClassDef1 * table--includes Class0 */ - USHORT class2Count; /* Number of classes in ClassDef2 + UINT16 class2Count; /* Number of classes in ClassDef2 * table--includes Class0 */ ValueRecord values; /* Matrix of value pairs: * class1-major, class2-minor, @@ -868,7 +868,7 @@ struct PairPos protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ PairPosFormat1 format1; PairPosFormat2 format2; } u; @@ -1022,7 +1022,7 @@ struct CursivePosFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -1048,7 +1048,7 @@ struct CursivePos protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ CursivePosFormat1 format1; } u; }; @@ -1113,14 +1113,14 @@ struct MarkBasePosFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> markCoverage; /* Offset to MarkCoverage table--from * beginning of MarkBasePos subtable */ OffsetTo<Coverage> baseCoverage; /* Offset to BaseCoverage table--from * beginning of MarkBasePos subtable */ - USHORT classCount; /* Number of classes defined for marks */ + UINT16 classCount; /* Number of classes defined for marks */ OffsetTo<MarkArray> markArray; /* Offset to MarkArray table--from * beginning of MarkBasePos subtable */ @@ -1146,7 +1146,7 @@ struct MarkBasePos protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ MarkBasePosFormat1 format1; } u; }; @@ -1230,7 +1230,7 @@ struct MarkLigPosFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> markCoverage; /* Offset to Mark Coverage table--from * beginning of MarkLigPos subtable */ @@ -1238,7 +1238,7 @@ struct MarkLigPosFormat1 ligatureCoverage; /* Offset to Ligature Coverage * table--from beginning of MarkLigPos * subtable */ - USHORT classCount; /* Number of defined mark classes */ + UINT16 classCount; /* Number of defined mark classes */ OffsetTo<MarkArray> markArray; /* Offset to MarkArray table--from * beginning of MarkLigPos subtable */ @@ -1264,7 +1264,7 @@ struct MarkLigPos protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ MarkLigPosFormat1 format1; } u; }; @@ -1344,7 +1344,7 @@ struct MarkMarkPosFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> mark1Coverage; /* Offset to Combining Mark1 Coverage * table--from beginning of MarkMarkPos @@ -1353,7 +1353,7 @@ struct MarkMarkPosFormat1 mark2Coverage; /* Offset to Combining Mark2 Coverage * table--from beginning of MarkMarkPos * subtable */ - USHORT classCount; /* Number of defined mark classes */ + UINT16 classCount; /* Number of defined mark classes */ OffsetTo<MarkArray> mark1Array; /* Offset to Mark1Array table--from * beginning of MarkMarkPos subtable */ @@ -1379,7 +1379,7 @@ struct MarkMarkPos protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ MarkMarkPosFormat1 format1; } u; }; @@ -1438,7 +1438,7 @@ struct PosLookupSubTable protected: union { - USHORT sub_format; + UINT16 sub_format; SinglePos single; PairPos pair; CursivePos cursive; 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 4ae45b9eff0..28e0790e6ca 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 @@ -44,7 +44,7 @@ struct SingleSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. - * https://github.com/behdad/harfbuzz/issues/363 */ + * https://github.com/harfbuzz/harfbuzz/issues/363 */ hb_codepoint_t glyph_id = iter.get_glyph (); if (c->glyphs->has (glyph_id)) c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFFu); @@ -58,7 +58,7 @@ struct SingleSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. - * https://github.com/behdad/harfbuzz/issues/363 */ + * https://github.com/harfbuzz/harfbuzz/issues/363 */ hb_codepoint_t glyph_id = iter.get_glyph (); c->input->add (glyph_id); c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu); @@ -110,11 +110,11 @@ struct SingleSubstFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - SHORT deltaGlyphID; /* Add to original GlyphID to get + INT16 deltaGlyphID; /* Add to original GlyphID to get * substitute GlyphID */ public: DEFINE_SIZE_STATIC (6); @@ -130,7 +130,7 @@ struct SingleSubstFormat2 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) c->glyphs->add (substitute[iter.get_coverage ()]); } @@ -144,7 +144,7 @@ struct SingleSubstFormat2 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ c->input->add (iter.get_glyph ()); c->output->add (substitute[iter.get_coverage ()]); } @@ -195,7 +195,7 @@ struct SingleSubstFormat2 } protected: - USHORT format; /* Format identifier--format = 2 */ + UINT16 format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -249,7 +249,7 @@ struct SingleSubst protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ SingleSubstFormat1 format1; SingleSubstFormat2 format2; } u; @@ -287,7 +287,7 @@ struct Sequence return_trace (true); } /* Spec disallows this, but Uniscribe allows it. - * https://github.com/behdad/harfbuzz/issues/253 */ + * https://github.com/harfbuzz/harfbuzz/issues/253 */ else if (unlikely (count == 0)) { c->buffer->delete_glyph (); @@ -339,7 +339,7 @@ struct MultipleSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) (this+sequence[iter.get_coverage ()]).closure (c); } @@ -400,7 +400,7 @@ struct MultipleSubstFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -442,7 +442,7 @@ struct MultipleSubst protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ MultipleSubstFormat1 format1; } u; }; @@ -461,7 +461,7 @@ struct AlternateSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) { const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; unsigned int count = alt_set.len; @@ -479,7 +479,7 @@ struct AlternateSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ c->input->add (iter.get_glyph ()); const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; unsigned int count = alt_set.len; @@ -552,7 +552,7 @@ struct AlternateSubstFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -594,7 +594,7 @@ struct AlternateSubst protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ AlternateSubstFormat1 format1; } u; }; @@ -792,7 +792,7 @@ struct LigatureSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) (this+ligatureSet[iter.get_coverage ()]).closure (c); } @@ -806,7 +806,7 @@ struct LigatureSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ c->input->add (iter.get_glyph ()); (this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c); } @@ -868,7 +868,7 @@ struct LigatureSubstFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -918,7 +918,7 @@ struct LigatureSubst protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ LigatureSubstFormat1 format1; } u; }; @@ -961,7 +961,7 @@ struct ReverseChainSingleSubstFormat1 for (iter.init (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) c->glyphs->add (substitute[iter.get_coverage ()]); } @@ -1016,11 +1016,11 @@ struct ReverseChainSingleSubstFormat1 unsigned int start_index = 0, end_index = 0; if (match_backtrack (c, - backtrack.len, (USHORT *) backtrack.array, + backtrack.len, (UINT16 *) backtrack.array, match_coverage, this, &start_index) && match_lookahead (c, - lookahead.len, (USHORT *) lookahead.array, + lookahead.len, (UINT16 *) lookahead.array, match_coverage, this, 1, &end_index)) { @@ -1048,7 +1048,7 @@ struct ReverseChainSingleSubstFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of table */ @@ -1082,7 +1082,7 @@ struct ReverseChainSingleSubst protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ ReverseChainSingleSubstFormat1 format1; } u; }; @@ -1128,7 +1128,7 @@ struct SubstLookupSubTable protected: union { - USHORT sub_format; + UINT16 sub_format; SingleSubst single; MultipleSubst multiple; AlternateSubst alternate; @@ -1280,9 +1280,11 @@ struct SubstLookup : Lookup if (unlikely (get_type () == SubstLookupSubTable::Extension)) { /* The spec says all subtables of an Extension lookup should - * have the same type. This is specially important if one has - * a reverse type! */ + * have the same type, which shall not be the Extension type + * itself. This is specially important if one has a reverse type! */ unsigned int type = get_subtable (0).u.extension.get_type (); + if (unlikely (type == SubstLookupSubTable::Extension)) + return_trace (false); unsigned int count = get_subtable_count (); for (unsigned int i = 1; i < count; i++) if (get_subtable (i).u.extension.get_type () != type) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh index b0cffa3a85f..b08a59138e3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh @@ -234,7 +234,7 @@ struct hb_apply_context_t : match_func (nullptr), match_data (nullptr) {}; - typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data); + typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data); inline void set_ignore_zwnj (bool ignore_zwnj_) { ignore_zwnj = ignore_zwnj_; } inline void set_ignore_zwj (bool ignore_zwj_) { ignore_zwj = ignore_zwj_; } @@ -252,7 +252,7 @@ struct hb_apply_context_t : }; inline may_match_t may_match (const hb_glyph_info_t &info, - const USHORT *glyph_data) const + const UINT16 *glyph_data) const { if (!(info.mask & mask) || (syllable && syllable != info.syllable ())) @@ -315,7 +315,7 @@ struct hb_apply_context_t : } inline void set_match_func (matcher_t::match_func_t match_func_, const void *match_data_, - const USHORT glyph_data[]) + const UINT16 glyph_data[]) { matcher.set_match_func (match_func_, match_data_); match_glyph_data = glyph_data; @@ -398,7 +398,7 @@ struct hb_apply_context_t : protected: hb_apply_context_t *c; matcher_t matcher; - const USHORT *match_glyph_data; + const UINT16 *match_glyph_data; unsigned int num_items; unsigned int end; @@ -413,7 +413,7 @@ struct hb_apply_context_t : bool stop_sublookup_iteration (return_t r) const { return r; } return_t recurse (unsigned int lookup_index) { - if (unlikely (nesting_level_left == 0 || !recurse_func)) + if (unlikely (nesting_level_left == 0 || !recurse_func || buffer->max_ops-- <= 0)) return default_return_value (); nesting_level_left--; @@ -568,9 +568,9 @@ struct hb_apply_context_t : -typedef bool (*intersects_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data); -typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data); -typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data); +typedef bool (*intersects_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data); +typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data); +typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data); struct ContextClosureFuncs { @@ -586,16 +586,16 @@ struct ContextApplyFuncs }; -static inline bool intersects_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED) +static inline bool intersects_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED) { return glyphs->has (value); } -static inline bool intersects_class (hb_set_t *glyphs, const USHORT &value, const void *data) +static inline bool intersects_class (hb_set_t *glyphs, const UINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data); return class_def.intersects_class (glyphs, value); } -static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, const void *data) +static inline bool intersects_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data) { const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value; return (data+coverage).intersects (glyphs); @@ -603,7 +603,7 @@ static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, c static inline bool intersects_array (hb_closure_context_t *c, unsigned int count, - const USHORT values[], + const UINT16 values[], intersects_func_t intersects_func, const void *intersects_data) { @@ -614,16 +614,16 @@ static inline bool intersects_array (hb_closure_context_t *c, } -static inline void collect_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED) +static inline void collect_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED) { glyphs->add (value); } -static inline void collect_class (hb_set_t *glyphs, const USHORT &value, const void *data) +static inline void collect_class (hb_set_t *glyphs, const UINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data); class_def.add_class (glyphs, value); } -static inline void collect_coverage (hb_set_t *glyphs, const USHORT &value, const void *data) +static inline void collect_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data) { const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value; (data+coverage).add_coverage (glyphs); @@ -631,7 +631,7 @@ static inline void collect_coverage (hb_set_t *glyphs, const USHORT &value, cons static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED, hb_set_t *glyphs, unsigned int count, - const USHORT values[], + const UINT16 values[], collect_glyphs_func_t collect_func, const void *collect_data) { @@ -640,16 +640,16 @@ static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED, } -static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const void *data HB_UNUSED) +static inline bool match_glyph (hb_codepoint_t glyph_id, const UINT16 &value, const void *data HB_UNUSED) { return glyph_id == value; } -static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, const void *data) +static inline bool match_class (hb_codepoint_t glyph_id, const UINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data); return class_def.get_class (glyph_id) == value; } -static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, const void *data) +static inline bool match_coverage (hb_codepoint_t glyph_id, const UINT16 &value, const void *data) { const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value; return (data+coverage).get_coverage (glyph_id) != NOT_COVERED; @@ -657,7 +657,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, static inline bool would_match_input (hb_would_apply_context_t *c, unsigned int count, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ match_func_t match_func, const void *match_data) { @@ -672,7 +672,7 @@ static inline bool would_match_input (hb_would_apply_context_t *c, } static inline bool match_input (hb_apply_context_t *c, unsigned int count, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ match_func_t match_func, const void *match_data, unsigned int *end_offset, @@ -711,7 +711,7 @@ static inline bool match_input (hb_apply_context_t *c, * o If two marks want to ligate and they belong to different components of the * same ligature glyph, and said ligature glyph is to be ignored according to * mark-filtering rules, then allow. - * https://github.com/behdad/harfbuzz/issues/545 + * https://github.com/harfbuzz/harfbuzz/issues/545 */ bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->cur()); @@ -896,7 +896,7 @@ static inline bool ligate_input (hb_apply_context_t *c, static inline bool match_backtrack (hb_apply_context_t *c, unsigned int count, - const USHORT backtrack[], + const UINT16 backtrack[], match_func_t match_func, const void *match_data, unsigned int *match_start) @@ -918,7 +918,7 @@ static inline bool match_backtrack (hb_apply_context_t *c, static inline bool match_lookahead (hb_apply_context_t *c, unsigned int count, - const USHORT lookahead[], + const UINT16 lookahead[], match_func_t match_func, const void *match_data, unsigned int offset, @@ -949,9 +949,9 @@ struct LookupRecord return_trace (c->check_struct (this)); } - USHORT sequenceIndex; /* Index into current glyph + UINT16 sequenceIndex; /* Index into current glyph * sequence--first glyph = 0 */ - USHORT lookupListIndex; /* Lookup to apply to that + UINT16 lookupListIndex; /* Lookup to apply to that * position--zero--based */ public: DEFINE_SIZE_STATIC (4); @@ -1002,7 +1002,11 @@ static inline bool apply_lookup (hb_apply_context_t *c, if (idx == 0 && lookupRecord[i].lookupListIndex == c->lookup_index) continue; - buffer->move_to (match_positions[idx]); + if (unlikely (!buffer->move_to (match_positions[idx]))) + break; + + if (unlikely (buffer->max_ops <= 0)) + break; unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len (); if (!c->recurse (lookupRecord[i].lookupListIndex)) @@ -1108,7 +1112,7 @@ struct ContextApplyLookupContext static inline void context_closure_lookup (hb_closure_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], ContextClosureLookupContext &lookup_context) @@ -1122,7 +1126,7 @@ static inline void context_closure_lookup (hb_closure_context_t *c, static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], ContextCollectGlyphsLookupContext &lookup_context) @@ -1136,7 +1140,7 @@ static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c static inline bool context_would_apply_lookup (hb_would_apply_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount HB_UNUSED, const LookupRecord lookupRecord[] HB_UNUSED, ContextApplyLookupContext &lookup_context) @@ -1147,7 +1151,7 @@ static inline bool context_would_apply_lookup (hb_would_apply_context_t *c, } static inline bool context_apply_lookup (hb_apply_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], ContextApplyLookupContext &lookup_context) @@ -1213,11 +1217,11 @@ struct Rule } protected: - USHORT inputCount; /* Total number of glyphs in input + UINT16 inputCount; /* Total number of glyphs in input * glyph sequence--includes the first * glyph */ - USHORT lookupCount; /* Number of LookupRecords */ - USHORT inputZ[VAR]; /* Array of match inputs--start with + UINT16 lookupCount; /* Number of LookupRecords */ + UINT16 inputZ[VAR]; /* Array of match inputs--start with * second glyph */ LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in * design order */ @@ -1357,7 +1361,7 @@ struct ContextFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of table */ @@ -1450,7 +1454,7 @@ struct ContextFormat2 } protected: - USHORT format; /* Format identifier--format = 2 */ + UINT16 format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of table */ @@ -1479,7 +1483,7 @@ struct ContextFormat3 this }; context_closure_lookup (c, - glyphCount, (const USHORT *) (coverageZ + 1), + glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context); } @@ -1496,7 +1500,7 @@ struct ContextFormat3 }; context_collect_glyphs_lookup (c, - glyphCount, (const USHORT *) (coverageZ + 1), + glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context); } @@ -1510,7 +1514,7 @@ struct ContextFormat3 {match_coverage}, this }; - return_trace (context_would_apply_lookup (c, glyphCount, (const USHORT *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); + return_trace (context_would_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); } inline const Coverage &get_coverage (void) const @@ -1529,7 +1533,7 @@ struct ContextFormat3 {match_coverage}, this }; - return_trace (context_apply_lookup (c, glyphCount, (const USHORT *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); + return_trace (context_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -1546,10 +1550,10 @@ struct ContextFormat3 } protected: - USHORT format; /* Format identifier--format = 3 */ - USHORT glyphCount; /* Number of glyphs in the input glyph + UINT16 format; /* Format identifier--format = 3 */ + UINT16 glyphCount; /* Number of glyphs in the input glyph * sequence */ - USHORT lookupCount; /* Number of LookupRecords */ + UINT16 lookupCount; /* Number of LookupRecords */ OffsetTo<Coverage> coverageZ[VAR]; /* Array of offsets to Coverage * table in glyph sequence order */ @@ -1576,7 +1580,7 @@ struct Context protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ ContextFormat1 format1; ContextFormat2 format2; ContextFormat3 format3; @@ -1606,11 +1610,11 @@ struct ChainContextApplyLookupContext static inline void chain_context_closure_lookup (hb_closure_context_t *c, unsigned int backtrackCount, - const USHORT backtrack[], + const UINT16 backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const USHORT lookahead[], + const UINT16 lookahead[], unsigned int lookupCount, const LookupRecord lookupRecord[], ChainContextClosureLookupContext &lookup_context) @@ -1630,11 +1634,11 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c, static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int backtrackCount, - const USHORT backtrack[], + const UINT16 backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const USHORT lookahead[], + const UINT16 lookahead[], unsigned int lookupCount, const LookupRecord lookupRecord[], ChainContextCollectGlyphsLookupContext &lookup_context) @@ -1654,11 +1658,11 @@ static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_contex static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c, unsigned int backtrackCount, - const USHORT backtrack[] HB_UNUSED, + const UINT16 backtrack[] HB_UNUSED, unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const USHORT lookahead[] HB_UNUSED, + const UINT16 lookahead[] HB_UNUSED, unsigned int lookupCount HB_UNUSED, const LookupRecord lookupRecord[] HB_UNUSED, ChainContextApplyLookupContext &lookup_context) @@ -1671,11 +1675,11 @@ static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c static inline bool chain_context_apply_lookup (hb_apply_context_t *c, unsigned int backtrackCount, - const USHORT backtrack[], + const UINT16 backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ - const USHORT input[], /* Array of input values--start with second glyph */ + const UINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const USHORT lookahead[], + const UINT16 lookahead[], unsigned int lookupCount, const LookupRecord lookupRecord[], ChainContextApplyLookupContext &lookup_context) @@ -1706,8 +1710,8 @@ struct ChainRule inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { TRACE_CLOSURE (this); - const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack); - const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input); + const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack); + const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); chain_context_closure_lookup (c, backtrack.len, backtrack.array, @@ -1720,8 +1724,8 @@ struct ChainRule inline void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const { TRACE_COLLECT_GLYPHS (this); - const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack); - const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input); + const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack); + const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); chain_context_collect_glyphs_lookup (c, backtrack.len, backtrack.array, @@ -1734,8 +1738,8 @@ struct ChainRule inline bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { TRACE_WOULD_APPLY (this); - const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack); - const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input); + const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack); + const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); return_trace (chain_context_would_apply_lookup (c, backtrack.len, backtrack.array, @@ -1747,8 +1751,8 @@ struct ChainRule inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); - const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack); - const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input); + const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack); + const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); return_trace (chain_context_apply_lookup (c, backtrack.len, backtrack.array, @@ -1761,23 +1765,23 @@ struct ChainRule { TRACE_SANITIZE (this); if (!backtrack.sanitize (c)) return_trace (false); - const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack); + const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack); if (!input.sanitize (c)) return_trace (false); - const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input); + const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input); if (!lookahead.sanitize (c)) return_trace (false); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); return_trace (lookup.sanitize (c)); } protected: - ArrayOf<USHORT> + ArrayOf<UINT16> backtrack; /* Array of backtracking values * (to be matched before the input * sequence) */ - HeadlessArrayOf<USHORT> + HeadlessArrayOf<UINT16> inputX; /* Array of input values (start with * second glyph) */ - ArrayOf<USHORT> + ArrayOf<UINT16> lookaheadX; /* Array of lookahead values's (to be * matched after the input sequence) */ ArrayOf<LookupRecord> @@ -1914,7 +1918,7 @@ struct ChainContextFormat1 } protected: - USHORT format; /* Format identifier--format = 1 */ + UINT16 format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of table */ @@ -2029,7 +2033,7 @@ struct ChainContextFormat2 } protected: - USHORT format; /* Format identifier--format = 2 */ + UINT16 format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of table */ @@ -2069,9 +2073,9 @@ struct ChainContextFormat3 {this, this, this} }; chain_context_closure_lookup (c, - backtrack.len, (const USHORT *) backtrack.array, - input.len, (const USHORT *) input.array + 1, - lookahead.len, (const USHORT *) lookahead.array, + backtrack.len, (const UINT16 *) backtrack.array, + input.len, (const UINT16 *) input.array + 1, + lookahead.len, (const UINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context); } @@ -2090,9 +2094,9 @@ struct ChainContextFormat3 {this, this, this} }; chain_context_collect_glyphs_lookup (c, - backtrack.len, (const USHORT *) backtrack.array, - input.len, (const USHORT *) input.array + 1, - lookahead.len, (const USHORT *) lookahead.array, + backtrack.len, (const UINT16 *) backtrack.array, + input.len, (const UINT16 *) input.array + 1, + lookahead.len, (const UINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context); } @@ -2109,9 +2113,9 @@ struct ChainContextFormat3 {this, this, this} }; return_trace (chain_context_would_apply_lookup (c, - backtrack.len, (const USHORT *) backtrack.array, - input.len, (const USHORT *) input.array + 1, - lookahead.len, (const USHORT *) lookahead.array, + backtrack.len, (const UINT16 *) backtrack.array, + input.len, (const UINT16 *) input.array + 1, + lookahead.len, (const UINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context)); } @@ -2136,9 +2140,9 @@ struct ChainContextFormat3 {this, this, this} }; return_trace (chain_context_apply_lookup (c, - backtrack.len, (const USHORT *) backtrack.array, - input.len, (const USHORT *) input.array + 1, - lookahead.len, (const USHORT *) lookahead.array, + backtrack.len, (const UINT16 *) backtrack.array, + input.len, (const UINT16 *) input.array + 1, + lookahead.len, (const UINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context)); } @@ -2156,7 +2160,7 @@ struct ChainContextFormat3 } protected: - USHORT format; /* Format identifier--format = 3 */ + UINT16 format; /* Format identifier--format = 3 */ OffsetArrayOf<Coverage> backtrack; /* Array of coverage tables * in backtracking sequence, in glyph @@ -2193,7 +2197,7 @@ struct ChainContext protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ ChainContextFormat1 format1; ChainContextFormat2 format2; ChainContextFormat3 format3; @@ -2230,11 +2234,11 @@ struct ExtensionFormat1 } protected: - USHORT format; /* Format identifier. Set to 1. */ - USHORT extensionLookupType; /* Lookup type of subtable referenced + UINT16 format; /* Format identifier. Set to 1. */ + UINT16 extensionLookupType; /* Lookup type of subtable referenced * by ExtensionOffset (i.e. the * extension subtable). */ - ULONG extensionOffset; /* Offset to the extension subtable, + UINT32 extensionOffset; /* Offset to the extension subtable, * of lookup type subtable. */ public: DEFINE_SIZE_STATIC (8); @@ -2272,7 +2276,7 @@ struct Extension protected: union { - USHORT format; /* Format identifier */ + UINT16 format; /* Format identifier */ ExtensionFormat1<T> format1; } u; }; @@ -2284,9 +2288,6 @@ struct Extension struct GSUBGPOS { - static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB; - static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS; - inline unsigned int get_script_count (void) const { return (this+scriptList).len; } inline const Tag& get_script_tag (unsigned int i) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh index 460028a61b0..0f0926f8906 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh @@ -273,13 +273,13 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) * what we do for joiners in Indic-like shapers, but since the * FVSes are GC=Mn, we have use a separate bit to remember them. * Fixes: - * https://github.com/behdad/harfbuzz/issues/234 */ + * https://github.com/harfbuzz/harfbuzz/issues/234 */ else if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN; /* TAG characters need similar treatment. Fixes: - * https://github.com/behdad/harfbuzz/issues/463 */ + * https://github.com/harfbuzz/harfbuzz/issues/463 */ else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN; /* COMBINING GRAPHEME JOINER should not be skipped; at least some times. - * https://github.com/behdad/harfbuzz/issues/554 */ + * https://github.com/harfbuzz/harfbuzz/issues/554 */ else if (unlikely (u == 0x034Fu)) props |= UPROPS_MASK_HIDDEN; } else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat))) @@ -305,7 +305,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) /* Recategorize emoji skin-tone modifiers as Unicode mark, so they * behave correctly in non-native directionality. They originally * are MODIFIER_SYMBOL. Fixes: - * https://github.com/behdad/harfbuzz/issues/169 + * https://github.com/harfbuzz/harfbuzz/issues/169 */ if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu))) { 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 8fe15313417..88458898272 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 @@ -601,6 +601,7 @@ unsigned int hb_ot_layout_table_get_lookup_count (hb_face_t *face, hb_tag_t table_tag) { + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return 0; switch (table_tag) { case HB_OT_TAG_GSUB: 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 b3c8571bcbe..7dc3283a289 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 @@ -48,7 +48,7 @@ struct MathValueRecord } protected: - SHORT value; /* The X or Y value in design units */ + INT16 value; /* The X or Y value in design units */ OffsetTo<Device> deviceTable; /* Offset to the device table - from the * beginning of parent table. May be nullptr. * Suggested format for device table is 1. */ @@ -154,10 +154,10 @@ struct MathConstants } protected: - SHORT percentScaleDown[2]; - USHORT minHeight[2]; + INT16 percentScaleDown[2]; + UINT16 minHeight[2]; MathValueRecord mathValueRecords[51]; - SHORT radicalDegreeBottomRaisePercent; + INT16 radicalDegreeBottomRaisePercent; public: DEFINE_SIZE_STATIC (214); @@ -279,7 +279,7 @@ struct MathKern } protected: - USHORT heightCount; + UINT16 heightCount; MathValueRecord mathValueRecords[VAR]; /* Array of correction heights at * which the kern value changes. * Sorted by the height value in @@ -425,7 +425,7 @@ struct MathGlyphVariantRecord protected: GlyphID variantGlyph; /* Glyph ID for the variant. */ - USHORT advanceMeasurement; /* Advance width/height, in design units, of the + UINT16 advanceMeasurement; /* Advance width/height, in design units, of the * variant, in the direction of requested * glyph extension. */ @@ -433,7 +433,7 @@ struct MathGlyphVariantRecord DEFINE_SIZE_STATIC (4); }; -struct PartFlags : USHORT +struct PartFlags : UINT16 { enum Flags { Extender = 0x0001u, /* If set, the part can be skipped or repeated. */ @@ -473,15 +473,15 @@ struct MathGlyphPartRecord protected: GlyphID glyph; /* Glyph ID for the part. */ - USHORT startConnectorLength; /* Advance width/ height of the straight bar + UINT16 startConnectorLength; /* Advance width/ height of the straight bar * connector material, in design units, is at * the beginning of the glyph, in the * direction of the extension. */ - USHORT endConnectorLength; /* Advance width/ height of the straight bar + UINT16 endConnectorLength; /* Advance width/ height of the straight bar * connector material, in design units, is at * the end of the glyph, in the direction of * the extension. */ - USHORT fullAdvance; /* Full advance width/height for this part, + UINT16 fullAdvance; /* Full advance width/height for this part, * in the direction of the extension. * In design units. */ PartFlags partFlags; /* Part qualifiers. */ @@ -651,7 +651,7 @@ struct MathVariants } protected: - USHORT minConnectorOverlap; /* Minimum overlap of connecting + UINT16 minConnectorOverlap; /* Minimum overlap of connecting * glyphs during glyph construction, * in design units. */ OffsetTo<Coverage> vertGlyphCoverage; /* Offset to Coverage table - @@ -660,10 +660,10 @@ struct MathVariants OffsetTo<Coverage> horizGlyphCoverage; /* Offset to Coverage table - * from the beginning of MathVariants * table. */ - USHORT vertGlyphCount; /* Number of glyphs for which + UINT16 vertGlyphCount; /* Number of glyphs for which * information is provided for * vertically growing variants. */ - USHORT horizGlyphCount; /* Number of glyphs for which + UINT16 horizGlyphCount; /* Number of glyphs for which * information is provided for * horizontally growing variants. */ 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 943e3908c71..f6d283eb14a 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 @@ -60,7 +60,7 @@ struct maxp protected: FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0), * 0x00005000u or 0x00010000u. */ - USHORT numGlyphs; /* The number of glyphs in the font. */ + UINT16 numGlyphs; /* The number of glyphs in the font. */ public: DEFINE_SIZE_STATIC (6); }; 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 8e688a6bfa2..4c5b3c0f986 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 @@ -65,12 +65,12 @@ struct NameRecord return_trace (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset)); } - USHORT platformID; /* Platform ID. */ - USHORT encodingID; /* Platform-specific encoding ID. */ - USHORT languageID; /* Language ID. */ - USHORT nameID; /* Name ID. */ - USHORT length; /* String length (in bytes). */ - USHORT offset; /* String offset from start of storage area (in bytes). */ + UINT16 platformID; /* Platform ID. */ + UINT16 encodingID; /* Platform-specific encoding ID. */ + UINT16 languageID; /* Language ID. */ + UINT16 nameID; /* Name ID. */ + UINT16 length; /* String length (in bytes). */ + UINT16 offset; /* String offset from start of storage area (in bytes). */ public: DEFINE_SIZE_STATIC (12); }; @@ -123,9 +123,9 @@ struct name } /* We only implement format 0 for now. */ - USHORT format; /* Format selector (=0/1). */ - USHORT count; /* Number of name records. */ - Offset<> stringOffset; /* Offset to start of string storage (from start of table). */ + UINT16 format; /* Format selector (=0/1). */ + UINT16 count; /* Number of name records. */ + Offset16 stringOffset; /* Offset to start of string storage (from start of table). */ NameRecord nameRecord[VAR]; /* The name records where count is the number of records. */ public: DEFINE_SIZE_ARRAY (6, nameRecord); 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 4709cd6e877..aa78f1e0a6b 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 @@ -50,50 +50,50 @@ struct os2 } public: - USHORT version; + UINT16 version; /* Version 0 */ - SHORT xAvgCharWidth; - USHORT usWeightClass; - USHORT usWidthClass; - USHORT fsType; - SHORT ySubscriptXSize; - SHORT ySubscriptYSize; - SHORT ySubscriptXOffset; - SHORT ySubscriptYOffset; - SHORT ySuperscriptXSize; - SHORT ySuperscriptYSize; - SHORT ySuperscriptXOffset; - SHORT ySuperscriptYOffset; - SHORT yStrikeoutSize; - SHORT yStrikeoutPosition; - SHORT sFamilyClass; - BYTE panose[10]; - ULONG ulUnicodeRange[4]; + INT16 xAvgCharWidth; + UINT16 usWeightClass; + UINT16 usWidthClass; + UINT16 fsType; + INT16 ySubscriptXSize; + INT16 ySubscriptYSize; + INT16 ySubscriptXOffset; + INT16 ySubscriptYOffset; + INT16 ySuperscriptXSize; + INT16 ySuperscriptYSize; + INT16 ySuperscriptXOffset; + INT16 ySuperscriptYOffset; + INT16 yStrikeoutSize; + INT16 yStrikeoutPosition; + INT16 sFamilyClass; + UINT8 panose[10]; + UINT32 ulUnicodeRange[4]; Tag achVendID; - USHORT fsSelection; - USHORT usFirstCharIndex; - USHORT usLastCharIndex; - SHORT sTypoAscender; - SHORT sTypoDescender; - SHORT sTypoLineGap; - USHORT usWinAscent; - USHORT usWinDescent; + UINT16 fsSelection; + UINT16 usFirstCharIndex; + UINT16 usLastCharIndex; + INT16 sTypoAscender; + INT16 sTypoDescender; + INT16 sTypoLineGap; + UINT16 usWinAscent; + UINT16 usWinDescent; /* Version 1 */ - //ULONG ulCodePageRange1; - //ULONG ulCodePageRange2; + //UINT32 ulCodePageRange1; + //UINT32 ulCodePageRange2; /* Version 2 */ - //SHORT sxHeight; - //SHORT sCapHeight; - //USHORT usDefaultChar; - //USHORT usBreakChar; - //USHORT usMaxContext; + //INT16 sxHeight; + //INT16 sCapHeight; + //UINT16 usDefaultChar; + //UINT16 usBreakChar; + //UINT16 usMaxContext; /* Version 5 */ - //USHORT usLowerOpticalPointSize; - //USHORT usUpperOpticalPointSize; + //UINT16 usLowerOpticalPointSize; + //UINT16 usUpperOpticalPointSize; public: DEFINE_SIZE_STATIC (78); 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 01d626bf1de..7f1c2c420f1 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 @@ -56,10 +56,10 @@ struct postV2Tail return_trace (glyphNameIndex.sanitize (c)); } - ArrayOf<USHORT>glyphNameIndex; /* This is not an offset, but is the + ArrayOf<UINT16>glyphNameIndex; /* This is not an offset, but is the * ordinal number of the glyph in 'post' * string tables. */ - BYTE namesX[VAR]; /* Glyph names with length bytes [variable] + UINT8 namesX[VAR]; /* Glyph names with length bytes [variable] * (a Pascal string). */ DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX); @@ -84,8 +84,12 @@ struct post struct accelerator_t { - inline void init (const post *table, unsigned int post_len) + inline void init (hb_face_t *face) { + blob = Sanitizer<post>::sanitize (face->reference_table (HB_OT_TAG_post)); + const post *table = Sanitizer<post>::lock_instance (blob); + unsigned int table_length = hb_blob_get_length (blob); + version = table->version.to_int (); index_to_offset.init (); if (version != 0x00020000) @@ -96,7 +100,7 @@ struct post glyphNameIndex = &v2.glyphNameIndex; pool = &StructAfter<uint8_t> (v2.glyphNameIndex); - const uint8_t *end = (uint8_t *) table + post_len; + const uint8_t *end = (uint8_t *) table + table_length; for (const uint8_t *data = pool; data < end && data + *data <= end; data += 1 + *data) { uint32_t *offset = index_to_offset.push (); @@ -227,8 +231,10 @@ struct post return hb_string_t ((const char *) data, name_length); } + private: + hb_blob_t *blob; uint32_t version; - const ArrayOf<USHORT> *glyphNameIndex; + const ArrayOf<UINT16> *glyphNameIndex; hb_prealloced_array_t<uint32_t, 1> index_to_offset; const uint8_t *pool; mutable uint16_t *gids_sorted_by_name; @@ -255,16 +261,16 @@ struct post * from the value of this field. */ FWORD underlineThickness; /* Suggested values for the underline thickness. */ - ULONG isFixedPitch; /* Set to 0 if the font is proportionally + UINT32 isFixedPitch; /* Set to 0 if the font is proportionally * spaced, non-zero if the font is not * proportionally spaced (i.e. monospaced). */ - ULONG minMemType42; /* Minimum memory usage when an OpenType font + UINT32 minMemType42; /* Minimum memory usage when an OpenType font * is downloaded. */ - ULONG maxMemType42; /* Maximum memory usage when an OpenType font + UINT32 maxMemType42; /* Maximum memory usage when an OpenType font * is downloaded. */ - ULONG minMemType1; /* Minimum memory usage when an OpenType font + UINT32 minMemType1; /* Minimum memory usage when an OpenType font * is downloaded as a Type 1 font. */ - ULONG maxMemType1; /* Maximum memory usage when an OpenType font + UINT32 maxMemType1; /* Maximum memory usage when an OpenType font * is downloaded as a Type 1 font. */ /*postV2Tail v2[VAR];*/ DEFINE_SIZE_STATIC (32); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh index e70c48f427c..54c6cdc24f1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh @@ -43,16 +43,16 @@ #define OT_TABLE_END } #define OT_LABEL_START(Name) unsigned char Name[ #define OT_LABEL_END ]; -#define OT_BYTE(u8) +1/*byte*/ -#define OT_USHORT(u16) +2/*bytes*/ +#define OT_UINT8(u8) +1/*byte*/ +#define OT_UINT16(u16) +2/*bytes*/ #else #undef OT_MEASURE #define OT_TABLE_START TABLE_NAME = { #define OT_TABLE_END }; #define OT_LABEL_START(Name) { #define OT_LABEL_END }, -#define OT_BYTE(u8) (u8), -#define OT_USHORT(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu), +#define OT_UINT8(u8) (u8), +#define OT_UINT16(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu), #define OT_COUNT(Name, ItemSize) ((unsigned int) sizeof(((struct TABLE_NAME*)0)->Name) \ / (unsigned int)(ItemSize) \ /* OT_ASSERT it's divisible (and positive). */) @@ -80,24 +80,24 @@ */ #define OT_TAG(a,b,c,d) \ - OT_BYTE(a) OT_BYTE(b) OT_BYTE(c) OT_BYTE(d) + OT_UINT8(a) OT_UINT8(b) OT_UINT8(c) OT_UINT8(d) #define OT_OFFSET(From, To) /* Offset from From to To in bytes */ \ - OT_USHORT(OT_DISTANCE(From, To)) + OT_UINT16(OT_DISTANCE(From, To)) #define OT_GLYPHID /* GlyphID */ \ - OT_USHORT + OT_UINT16 #define OT_UARRAY(Name, Items) \ OT_LABEL_START(Name) \ - OT_USHORT(OT_COUNT(Name##Data, 2)) \ + OT_UINT16(OT_COUNT(Name##Data, 2)) \ OT_LABEL(Name##Data) \ Items \ OT_LABEL_END #define OT_UHEADLESSARRAY(Name, Items) \ OT_LABEL_START(Name) \ - OT_USHORT(OT_COUNT(Name##Data, 2) + 1) \ + OT_UINT16(OT_COUNT(Name##Data, 2) + 1) \ OT_LABEL(Name##Data) \ Items \ OT_LABEL_END @@ -111,19 +111,19 @@ #define OT_LOOKUP(Name, LookupType, LookupFlag, SubLookupOffsets) \ OT_LABEL_START(Name) \ - OT_USHORT(LookupType) \ - OT_USHORT(LookupFlag) \ + OT_UINT16(LookupType) \ + OT_UINT16(LookupFlag) \ OT_LABEL_END \ OT_UARRAY(Name##SubLookupOffsetsArray, OT_LIST(SubLookupOffsets)) #define OT_SUBLOOKUP(Name, SubFormat, Items) \ OT_LABEL_START(Name) \ - OT_USHORT(SubFormat) \ + OT_UINT16(SubFormat) \ Items #define OT_COVERAGE1(Name, Items) \ OT_LABEL_START(Name) \ - OT_USHORT(1) \ + OT_UINT16(1) \ OT_LABEL_END \ OT_UARRAY(Name##Glyphs, OT_LIST(Items)) @@ -174,7 +174,7 @@ /* Table manifest. */ #define MANIFEST(Items) \ OT_LABEL_START(manifest) \ - OT_USHORT(OT_COUNT(manifestData, 6)) \ + OT_UINT16(OT_COUNT(manifestData, 6)) \ OT_LABEL(manifestData) \ Items \ OT_LABEL_END @@ -304,8 +304,8 @@ OT_TABLE_END #undef OT_TABLE_END #undef OT_LABEL_START #undef OT_LABEL_END -#undef OT_BYTE -#undef OT_USHORT +#undef OT_UINT8 +#undef OT_UINT16 #undef OT_DISTANCE #undef OT_COUNT diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc index 3ba2d069cb3..eb9d36ff1d5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc @@ -36,7 +36,7 @@ #define HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH HB_BUFFER_SCRATCH_FLAG_COMPLEX0 /* See: - * https://github.com/behdad/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */ + * https://github.com/harfbuzz/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */ #define HB_ARABIC_GENERAL_CATEGORY_IS_WORD(gen_cat) \ (FLAG_UNSAFE (gen_cat) & \ (FLAG (HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) | \ @@ -198,7 +198,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) * pause for Arabic, not other scripts. * * A pause after calt is required to make KFGQPC Uthmanic Script HAFS - * work correctly. See https://github.com/behdad/harfbuzz/issues/505 + * work correctly. See https://github.com/harfbuzz/harfbuzz/issues/505 */ map->add_gsub_pause (nuke_joiners); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc index ba78186a09c..34cf28b8e24 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc @@ -161,7 +161,7 @@ disable_otl_hebrew (const hb_ot_shape_plan_t *plan) * script. This matches Uniscribe better, and makes fonts like * Arial that have GSUB/GPOS/GDEF but no data for Hebrew work. * See: - * https://github.com/behdad/harfbuzz/issues/347#issuecomment-267838368 + * https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368 */ return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r'); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh index 8fe2509ef21..a1e0d5266b4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh @@ -123,7 +123,7 @@ enum indic_syllabic_category_t { INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_CM, INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA = OT_N, INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER = OT_CS, - INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM, /* https://github.com/behdad/harfbuzz/issues/552 */ + INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM, /* https://github.com/harfbuzz/harfbuzz/issues/552 */ INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER = OT_Coeng, INDIC_SYLLABIC_CATEGORY_JOINER = OT_ZWJ, INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc index 8e2cd620ef3..7d0e7c5a4e0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc @@ -210,7 +210,7 @@ set_indic_properties (hb_glyph_info_t &info) } else if (unlikely (u == 0x0A51u)) { - /* https://github.com/behdad/harfbuzz/issues/524 */ + /* https://github.com/harfbuzz/harfbuzz/issues/524 */ cat = OT_M; pos = POS_BELOW_C; } @@ -220,9 +220,10 @@ set_indic_properties (hb_glyph_info_t &info) else if (unlikely (u == 0x11301u || u == 0x11303u)) cat = OT_SM; else if (unlikely (u == 0x1133cu)) cat = OT_N; - else if (unlikely (u == 0x0AFBu)) cat = OT_N; /* https://github.com/behdad/harfbuzz/issues/552 */ + else if (unlikely (u == 0x0AFBu)) cat = OT_N; /* https://github.com/harfbuzz/harfbuzz/issues/552 */ - else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/behdad/harfbuzz/issues/538 */ + else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/issues/538 */ + else if (unlikely (u == 0x0C80u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/pull/623 */ else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */ else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER; @@ -691,7 +692,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data; hb_glyph_info_t *info = buffer->info; - /* https://github.com/behdad/harfbuzz/issues/435#issuecomment-335560167 + /* https://github.com/harfbuzz/harfbuzz/issues/435#issuecomment-335560167 * // For compatibility with legacy usage in Kannada, * // Ra+h+ZWJ must behave like Ra+ZWJ+h... */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl index 7bd8fce15e4..86cd8b25fb6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl @@ -90,7 +90,7 @@ CS = 43; # CONS_WITH_STACKER consonant_modifiers = CMAbv* CMBlw* ((H B | SUB) VS? CMAbv? CMBlw*)*; -# Override: Allow two MBlw. https://github.com/behdad/harfbuzz/issues/376 +# Override: Allow two MBlw. https://github.com/harfbuzz/harfbuzz/issues/376 medial_consonants = MPre? MAbv? MBlw?.MBlw? MPst?; dependent_vowels = VPre* VAbv* VBlw* VPst*; vowel_modifiers = VMPre* VMAbv* VMBlw* VMPst*; 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 1f90fc858b4..fd6978f281e 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 @@ -348,7 +348,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O, /* 2080 */ O, O, FM, FM, FM, O, O, O, -#define use_offset_0xa800u 2616 +#define use_offset_0x20f0u 2616 + + + /* Combining Diacritical Marks for Symbols */ + + /* 20F0 */ VMAbv, O, O, O, O, O, O, O, + +#define use_offset_0xa800u 2624 /* Syloti Nagri */ @@ -370,7 +377,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* A880 */ VMPst, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A890 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A8A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* A8B0 */ B, B, B, B, FPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, + /* A8B0 */ B, B, B, B, MPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, /* A8C0 */ VPst, VPst, VPst, VPst, H, VMAbv, O, O, O, O, O, O, O, O, O, O, /* A8D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, @@ -435,7 +442,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst, /* AAF0 */ O, O, O, O, O, VMPst, H, O, -#define use_offset_0xabc0u 3376 +#define use_offset_0xabc0u 3384 /* Meetei Mayek */ @@ -445,14 +452,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O, /* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0xfe00u 3440 +#define use_offset_0xfe00u 3448 /* Variation Selectors */ /* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, -#define use_offset_0x10a00u 3456 +#define use_offset_0x10a00u 3464 /* Kharoshthi */ @@ -463,7 +470,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10A30 */ B, B, B, B, O, O, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H, /* 10A40 */ B, B, B, B, B, B, B, B, -#define use_offset_0x11000u 3528 +#define use_offset_0x11000u 3536 /* Brahmi */ @@ -484,7 +491,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11100u 3720 +#define use_offset_0x11100u 3728 /* Chakma */ @@ -522,7 +529,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw, /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O, -#define use_offset_0x11280u 4040 +#define use_offset_0x11280u 4048 /* Multani */ @@ -550,7 +557,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, -#define use_offset_0x11400u 4288 +#define use_offset_0x11400u 4296 /* Newa */ @@ -573,7 +580,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11580u 4512 +#define use_offset_0x11580u 4520 /* Siddham */ @@ -616,7 +623,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O, /* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, -#define use_offset_0x11a00u 4960 +#define use_offset_0x11a00u 4968 /* Zanabazar Square */ @@ -635,7 +642,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11A80 */ B, B, B, B, O, O, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, O, O, O, -#define use_offset_0x11c00u 5120 +#define use_offset_0x11c00u 5128 /* Bhaiksuki */ @@ -656,7 +663,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O, -#define use_offset_0x11d00u 5304 +#define use_offset_0x11d00u 5312 /* Masaram Gondi */ @@ -668,7 +675,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, O, O, O, O, O, O, O, O, /* 11D50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -}; /* Table items: 5400; occupancy: 73% */ +}; /* Table items: 5408; occupancy: 73% */ USE_TABLE_ELEMENT_TYPE hb_use_get_categories (hb_codepoint_t u) @@ -694,6 +701,7 @@ hb_use_get_categories (hb_codepoint_t u) case 0x2u: if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u]; if (hb_in_range<hb_codepoint_t> (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u]; + if (hb_in_range<hb_codepoint_t> (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u]; if (unlikely (u == 0x25CCu)) return GB; break; 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 f3308847e19..458c8eaa048 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 @@ -218,10 +218,10 @@ position_mark (const hb_ot_shape_plan_t *plan, case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW: case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE: if (buffer->props.direction == HB_DIRECTION_LTR) { - pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing; + pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing; break; } else if (buffer->props.direction == HB_DIRECTION_RTL) { - pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing; + pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing; break; } HB_FALLTHROUGH; 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 624132d8961..2f28b5620da 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 @@ -108,7 +108,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, /* We really want to find a 'vert' feature if there's any in the font, no * matter which script/langsys it is listed (or not) under. * See various bugs referenced from: - * https://github.com/behdad/harfbuzz/issues/63 */ + * https://github.com/harfbuzz/harfbuzz/issues/63 */ map->add_feature (HB_TAG ('v','e','r','t'), 1, F_GLOBAL | F_GLOBAL_SEARCH); } @@ -817,11 +817,16 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) { c->buffer->deallocate_var_all (); c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT; - if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_EXPANSION_FACTOR))) + if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR))) { - c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_EXPANSION_FACTOR, + c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR, (unsigned) HB_BUFFER_MAX_LEN_MIN); } + if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR))) + { + c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR, + (unsigned) HB_BUFFER_MAX_OPS_MIN); + } bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan); //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face); @@ -861,6 +866,7 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) c->buffer->props.direction = c->target_direction; c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT; + c->buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT; c->buffer->deallocate_var_all (); } 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 464cf35bbd4..4b88a403041 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 @@ -133,8 +133,8 @@ struct avar protected: FixedVersion<>version; /* Version of the avar table * initially set to 0x00010000u */ - USHORT reserved; /* This field is permanently reserved. Set to 0. */ - USHORT axisCount; /* The number of variation axes in the font. This + UINT16 reserved; /* This field is permanently reserved. Set to 0. */ + UINT16 axisCount; /* The number of variation axes in the font. This * must be the same number as axisCount in the * 'fvar' table. */ SegmentMaps axisSegmentMapsZ; 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 9f6fb3250a4..2a9357a5e2d 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 @@ -42,11 +42,11 @@ struct InstanceRecord } protected: - USHORT subfamilyNameID;/* The name ID for entries in the 'name' table + UINT16 subfamilyNameID;/* The name ID for entries in the 'name' table * that provide subfamily names for this instance. */ - USHORT reserved; /* Reserved for future use — set to 0. */ + UINT16 reserved; /* Reserved for future use — set to 0. */ Fixed coordinates[VAR];/* The coordinates array for this instance. */ - //USHORT postScriptNameIDX;/*Optional. The name ID for entries in the 'name' + //UINT16 postScriptNameIDX;/*Optional. The name ID for entries in the 'name' // * table that provide PostScript names for this // * instance. */ @@ -67,8 +67,8 @@ struct AxisRecord Fixed minValue; /* The minimum coordinate value for the axis. */ Fixed defaultValue; /* The default coordinate value for the axis. */ Fixed maxValue; /* The maximum coordinate value for the axis. */ - USHORT reserved; /* Reserved for future use — set to 0. */ - USHORT axisNameID; /* The name ID for entries in the 'name' table that + UINT16 reserved; /* Reserved for future use — set to 0. */ + UINT16 axisNameID; /* The name ID for entries in the 'name' table that * provide a display name for this axis. */ public: @@ -186,16 +186,16 @@ struct fvar protected: FixedVersion<>version; /* Version of the fvar table * initially set to 0x00010000u */ - Offset<> things; /* Offset in bytes from the beginning of the table + Offset16 things; /* Offset in bytes from the beginning of the table * to the start of the AxisRecord array. */ - USHORT reserved; /* This field is permanently reserved. Set to 2. */ - USHORT axisCount; /* The number of variation axes in the font (the + UINT16 reserved; /* This field is permanently reserved. Set to 2. */ + UINT16 axisCount; /* The number of variation axes in the font (the * number of records in the axes array). */ - USHORT axisSize; /* The size in bytes of each VariationAxisRecord — + UINT16 axisSize; /* The size in bytes of each VariationAxisRecord — * set to 20 (0x0014) for this version. */ - USHORT instanceCount; /* The number of named instances defined in the font + UINT16 instanceCount; /* The number of named instances defined in the font * (the number of records in the instances array). */ - USHORT instanceSize; /* The size in bytes of each InstanceRecord — set + UINT16 instanceSize; /* The size in bytes of each InstanceRecord — set * to either axisCount * sizeof(Fixed) + 4, or to * axisCount * sizeof(Fixed) + 6. */ 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 f9d801e3b8f..fac843a7199 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 @@ -55,7 +55,7 @@ struct DeltaSetIndexMap unsigned int u = 0; { /* Fetch it. */ unsigned int w = get_width (); - const BYTE *p = mapData + w * v; + const UINT8 *p = mapData + w * v; for (; w; w--) u = (u << 8) + *p++; } @@ -78,10 +78,10 @@ struct DeltaSetIndexMap { return (format & 0xF) + 1; } protected: - USHORT format; /* A packed field that describes the compressed + UINT16 format; /* A packed field that describes the compressed * representation of delta-set indices. */ - USHORT mapCount; /* The number of mapping entries. */ - BYTE mapData[VAR]; /* The delta-set index mapping data. */ + UINT16 mapCount; /* The number of mapping entries. */ + UINT8 mapData[VAR]; /* The delta-set index mapping data. */ public: DEFINE_SIZE_ARRAY (4, mapData); 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 96bc77f3a6e..e17ff5160a6 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 @@ -43,7 +43,7 @@ struct VariationValueRecord public: Tag valueTag; /* Four-byte tag identifying a font-wide measure. */ - ULONG varIdx; /* Outer/inner index into VariationStore item. */ + UINT32 varIdx; /* Outer/inner index into VariationStore item. */ public: DEFINE_SIZE_STATIC (8); @@ -95,13 +95,13 @@ protected: protected: FixedVersion<>version; /* Version of the metrics variation table * initially set to 0x00010000u */ - USHORT reserved; /* Not used; set to 0. */ - USHORT valueRecordSize;/* The size in bytes of each value record — + UINT16 reserved; /* Not used; set to 0. */ + UINT16 valueRecordSize;/* The size in bytes of each value record — * must be greater than zero. */ - USHORT valueRecordCount;/* The number of value records — may be zero. */ + UINT16 valueRecordCount;/* The number of value records — may be zero. */ OffsetTo<VariationStore> varStore; /* Offset to item variation store table. */ - BYTE values[VAR]; /* Array of value records. The records must be + UINT8 values[VAR]; /* Array of value records. The records must be * in binary order of their valueTag field. */ public: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh index b6d13bd3084..9c55b4bc4b4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh @@ -692,7 +692,7 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3) * one enum to another... So this doesn't provide the type-checking that I * originally had in mind... :(. * - * For MSVC warnings, see: https://github.com/behdad/harfbuzz/pull/163 + * For MSVC warnings, see: https://github.com/harfbuzz/harfbuzz/pull/163 */ #ifdef _MSC_VER # pragma warning(disable:4200) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh index c970b89dda7..5971e9b7a3d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh @@ -35,6 +35,9 @@ * hb_set_t */ +/* TODO Keep a free-list so we can free pages that are completely zeroed. At that + * point maybe also use a sentinel value for "all-1" pages? */ + struct hb_set_t { struct page_map_t @@ -47,9 +50,8 @@ struct hb_set_t struct page_t { - inline void init (void) { - memset (&v, 0, sizeof (v)); - } + inline void init0 (void) { memset (&v, 0, sizeof (v)); } + inline void init1 (void) { memset (&v, 0xff, sizeof (v)); } inline unsigned int len (void) const { return ARRAY_LENGTH_CONST (v); } @@ -66,6 +68,24 @@ struct hb_set_t inline void del (hb_codepoint_t g) { elt (g) &= ~mask (g); } inline bool has (hb_codepoint_t g) const { return !!(elt (g) & mask (g)); } + inline void add_range (hb_codepoint_t a, hb_codepoint_t b) + { + elt_t *la = &elt (a); + elt_t *lb = &elt (b); + if (la == lb) + *la |= (mask (b) << 1) - mask(a); + else + { + *la |= ~(mask (a) - 1); + la++; + + memset (la, 0xff, (char *) lb - (char *) la); + + *lb |= ((mask (b) << 1) - 1); + + } + } + inline bool is_equal (const page_t *other) const { return 0 == memcmp (&v, &other->v, sizeof (v)); @@ -196,16 +216,37 @@ struct hb_set_t if (unlikely (in_error)) return; if (unlikely (g == INVALID)) return; page_t *page = page_for_insert (g); - if (!page) - return; + if (unlikely (!page)) return; page->add (g); } inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { - if (unlikely (in_error)) return; - /* TODO Speedup */ - for (unsigned int i = a; i < b + 1; i++) - add (i); + if (unlikely (in_error || a > b || a == INVALID || b == INVALID)) return; + unsigned int ma = get_major (a); + unsigned int mb = get_major (b); + if (ma == mb) + { + page_t *page = page_for_insert (a); + if (unlikely (!page)) return; + page->add_range (a, b); + } + else + { + page_t *page = page_for_insert (a); + if (unlikely (!page)) return; + page->add_range (a, major_start (ma + 1) - 1); + + for (unsigned int m = ma + 1; m < mb; m++) + { + page = page_for_insert (major_start (m)); + if (unlikely (!page)) return; + page->init1 (); + } + + page = page_for_insert (b); + if (unlikely (!page)) return; + page->add_range (major_start (mb), b); + } } inline void del (hb_codepoint_t g) { @@ -217,6 +258,7 @@ struct hb_set_t } inline void del_range (hb_codepoint_t a, hb_codepoint_t b) { + /* TODO Optimize, like add_range(). */ if (unlikely (in_error)) return; for (unsigned int i = a; i < b + 1; i++) del (i); @@ -433,7 +475,7 @@ struct hb_set_t static const hb_codepoint_t INVALID = HB_SET_VALUE_INVALID; - page_t *page_for_insert (hb_codepoint_t g) + inline page_t *page_for_insert (hb_codepoint_t g) { page_map_t map = {get_major (g), pages.len}; unsigned int i; @@ -442,13 +484,13 @@ struct hb_set_t if (!resize (pages.len + 1)) return nullptr; - pages[map.index].init (); + pages[map.index].init0 (); memmove (&page_map[i + 1], &page_map[i], (page_map.len - 1 - i) * sizeof (page_map[0])); page_map[i] = map; } return &pages[page_map[i].index]; } - page_t *page_for (hb_codepoint_t g) + inline page_t *page_for (hb_codepoint_t g) { page_map_t key = {get_major (g)}; const page_map_t *found = page_map.bsearch (&key); @@ -456,7 +498,7 @@ struct hb_set_t return &pages[found->index]; return nullptr; } - const page_t *page_for (hb_codepoint_t g) const + inline const page_t *page_for (hb_codepoint_t g) const { page_map_t key = {get_major (g)}; const page_map_t *found = page_map.bsearch (&key); @@ -464,9 +506,10 @@ struct hb_set_t return &pages[found->index]; return nullptr; } - page_t &page_at (unsigned int i) { return pages[page_map[i].index]; } - const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; } - unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; } + inline page_t &page_at (unsigned int i) { return pages[page_map[i].index]; } + inline const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; } + inline unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; } + inline hb_codepoint_t major_start (unsigned int major) const { return major * page_t::PAGE_BITS; } }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh index 285b4b53574..ba829b0cf04 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh @@ -48,7 +48,7 @@ static const union HB_STRING_ARRAY_TYPE_NAME { #include HB_STRING_ARRAY_LIST #undef _S } st; - char str[0]; + char str[VAR]; } HB_STRING_ARRAY_POOL_NAME = { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh index ac17f283f85..82bb9a4ddc7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh @@ -137,7 +137,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE * we do NOT want to hide them, as the way Uniscribe has implemented them * is with regular spacing glyphs, and that's the way fonts are made to work. * As such, we make exceptions for those four. - * Also ignoring U+1BCA0..1BCA3. https://github.com/behdad/harfbuzz/issues/503 + * Also ignoring U+1BCA0..1BCA3. https://github.com/harfbuzz/harfbuzz/issues/503 * * Unicode 7.0: * $ grep '; Default_Ignorable_Code_Point ' DerivedCoreProperties.txt | sed 's/;.*#/#/' diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc index 377d1396ab8..819100e47e5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc @@ -106,8 +106,8 @@ main (int argc, char **argv) switch (table.tag) { - case GSUBGPOS::GSUBTag: - case GSUBGPOS::GPOSTag: + case HB_OT_TAG_GSUB: + case HB_OT_TAG_GPOS: { const GSUBGPOS &g = *CastP<GSUBGPOS> (font_data + table.offset); |