summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-03-07 22:32:14 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-03-07 22:32:14 +0000
commitef9282421b00185a4962b7d22b96e979687258e2 (patch)
treeb6d0d8c700086d3141e228187693a26b102c971f /Build/source/libs/harfbuzz/harfbuzz-src/src
parent55fbdeae2498166ec7c7301fd48d990fc9010058 (diff)
harfbuzz-1.7.6
git-svn-id: svn://tug.org/texlive/trunk@46877 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am146
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources40
-rwxr-xr-xBuild/source/libs/harfbuzz/harfbuzz-src/src/check-defs.sh54
-rwxr-xr-xBuild/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.sh22
-rwxr-xr-xBuild/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.sh58
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc43
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc43
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc43
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc38
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py9
-rwxr-xr-xBuild/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-config.cmake.in82
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-subset.pc.in12
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh80
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh48
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh339
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh90
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh201
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc85
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc27
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.h3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh744
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh490
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh5
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.h18
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc19
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh13
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.h.tmpl3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.h47
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh100
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh78
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh137
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh (renamed from Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cbdt-table.hh)8
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh142
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh208
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc183
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh317
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh198
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh6
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh171
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh655
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh12
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh26
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh12
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh10
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh34
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc61
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h17
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh10
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh88
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh130
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh247
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh244
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc214
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-private.hh124
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc118
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh251
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-private.hh171
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc158
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh516
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc13
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc6
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh314
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh164
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc63
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h19
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc307
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh40
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc119
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc227
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh85
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh62
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc339
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h83
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc67
96 files changed, 7405 insertions, 2007 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
index 833d1f9567d..afa104b83e4 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
@@ -9,12 +9,14 @@ CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
+TESTS =
+check_PROGRAMS =
# The following warning options are useful for debugging: -Wpadded
#AM_CXXFLAGS =
# Convenience targets:
-lib: $(BUILT_SOURCES) libharfbuzz.la
+lib: $(BUILT_SOURCES) libharfbuzz.la libharfbuzz-subset.la
fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la
lib_LTLIBRARIES = libharfbuzz.la
@@ -28,7 +30,15 @@ HBDEPS =
HBSOURCES = $(HB_BASE_sources)
HBSOURCES += $(HB_BASE_RAGEL_GENERATED_sources)
HBHEADERS = $(HB_BASE_headers)
-HBNODISTHEADERS = $(HB_NODIST_headers)
+
+if WITH_LIBSTDCXX
+HBNOLIBCXXCFLAGS =
+else
+# Make sure we don't link to libstdc++
+# No threadsafe statics in C++ as we do it ourselves
+HBCFLAGS += -fno-exceptions
+HBNOLIBCXXFLAGS = -fno-threadsafe-statics -fno-rtti
+endif
if HAVE_OT
HBSOURCES += $(HB_OT_sources)
@@ -114,31 +124,59 @@ HBLIBS += $(HBNONPCLIBS)
if OS_WIN32
export_symbols = -export-symbols harfbuzz.def
harfbuzz_def_dependency = harfbuzz.def
-libharfbuzz_la_LINK = $(CXXLINK) $(libharfbuzz_la_LDFLAGS)
+export_symbols_subset = -export-symbols harfbuzz-subset.def
+harfbuzz_subset_def_dependency = harfbuzz-subset.def
+export_symbols_icu = -export-symbols harfbuzz-icu.def
+harfbuzz_icu_def_dependency = harfbuzz-icu.def
+export_symbols_gobject = -export-symbols harfbuzz-gobject.def
+harfbuzz_gobject_def_dependency = harfbuzz-gobject.def
+chosen_linker = $(CXXLINK)
+else
+if WITH_LIBSTDCXX
+chosen_linker = $(CXXLINK)
else
-# Use a C linker for GCC, not C++; Don't link to libstdc++
if HAVE_GCC
-libharfbuzz_la_LINK = $(LINK) $(libharfbuzz_la_LDFLAGS)
+# Use a C linker for GCC, not C++; Don't link to libstdc++
+chosen_linker = $(LINK)
else
-libharfbuzz_la_LINK = $(CXXLINK) $(libharfbuzz_la_LDFLAGS)
+chosen_linker = $(CXXLINK)
endif
endif
+endif
+
+@CODE_COVERAGE_RULES@
-libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS) $(HBNODISTHEADERS)
-libharfbuzz_la_CPPFLAGS = $(HBCFLAGS)
-libharfbuzz_la_LDFLAGS = $(AM_LDFLAGS) -lm -version-info $(HB_LIBTOOL_VERSION_INFO) $(export_symbols) -no-undefined
+base_link_flags = $(AM_LDFLAGS) -lm -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined
+libharfbuzz_la_LINK = $(chosen_linker) $(libharfbuzz_la_LDFLAGS) $(CODE_COVERAGE_LDFLAGS)
+libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
+libharfbuzz_la_CPPFLAGS = $(HBCFLAGS) $(HBNOLIBCXXFLAGS) $(CODE_COVERAGE_CFLAGS)
+libharfbuzz_la_LDFLAGS = $(base_link_flags) $(export_symbols)
libharfbuzz_la_LIBADD = $(HBLIBS)
EXTRA_libharfbuzz_la_DEPENDENCIES = $(harfbuzz_def_dependency)
pkginclude_HEADERS = $(HBHEADERS)
-nodist_pkginclude_HEADERS = $(HBNODISTHEADERS)
+nodist_pkginclude_HEADERS =
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = harfbuzz.pc
-EXTRA_DIST += harfbuzz.pc.in
+cmakedir = $(libdir)/cmake/harfbuzz
+cmake_DATA = harfbuzz-config.cmake
+EXTRA_DIST += harfbuzz.pc.in harfbuzz-config.cmake.in
+
+lib_LTLIBRARIES += libharfbuzz-subset.la
+libharfbuzz_subset_la_SOURCES = $(HB_SUBSET_sources)
+libharfbuzz_subset_la_CPPFLAGS = $(HBCFLAGS)
+libharfbuzz_subset_la_LDFLAGS = $(base_link_flags) $(export_symbols_subset)
+libharfbuzz_subset_la_LIBADD = libharfbuzz.la
+EXTRA_libharfbuzz_subset_la_DEPENDENCIES = $(harfbuzz_subset_def_dependency)
+pkginclude_HEADERS += $(HB_SUBSET_headers)
+pkgconfig_DATA += harfbuzz-subset.pc
+EXTRA_DIST += harfbuzz-subset.pc.in
FUZZING_CPPFLAGS = \
-DHB_NDEBUG \
-DHB_MAX_NESTING_LEVEL=3 \
-DHB_SANITIZE_MAX_EDITS=3 \
+ -DHB_SANITIZE_MAX_OPS_FACTOR=3 \
+ -DHB_SANITIZE_MAX_OPS_MIN=128 \
-DHB_BUFFER_MAX_LEN_FACTOR=3 \
-DHB_BUFFER_MAX_LEN_MIN=8 \
-DHB_BUFFER_MAX_LEN_DEFAULT=128 \
@@ -147,10 +185,10 @@ FUZZING_CPPFLAGS = \
-DHB_BUFFER_MAX_OPS_DEFAULT=1024 \
$(NULL)
EXTRA_LTLIBRARIES = libharfbuzz-fuzzing.la
-libharfbuzz_fuzzing_la_LINK = $(libharfbuzz_la_LINK)
+libharfbuzz_fuzzing_la_LINK = $(chosen_linker) $(libharfbuzz_fuzzing_la_LDFLAGS)
libharfbuzz_fuzzing_la_SOURCES = $(libharfbuzz_la_SOURCES)
-libharfbuzz_fuzzing_la_CPPFLAGS = $(libharfbuzz_la_CPPFLAGS) $(FUZZING_CPPFLAGS)
-libharfbuzz_fuzzing_la_LDFLAGS = $(libharfbuzz_la_LDFLAGS)
+libharfbuzz_fuzzing_la_CPPFLAGS = $(HBCFLAGS) $(FUZZING_CPPFLAGS)
+libharfbuzz_fuzzing_la_LDFLAGS = $(AM_LDFLAGS)
libharfbuzz_fuzzing_la_LIBADD = $(libharfbuzz_la_LIBADD)
EXTRA_libharfbuzz_fuzzing_la_DEPENDENCIES = $(EXTRA_libharfbuzz_la_DEPENDENCIES)
CLEANFILES += libharfbuzz-fuzzing.la
@@ -164,9 +202,10 @@ HBHEADERS += $(HB_ICU_headers)
else
lib_LTLIBRARIES += libharfbuzz-icu.la
libharfbuzz_icu_la_SOURCES = $(HB_ICU_sources)
-libharfbuzz_icu_la_CPPFLAGS = $(ICU_CFLAGS)
-libharfbuzz_icu_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined
+libharfbuzz_icu_la_CPPFLAGS = $(HBCFLAGS) $(ICU_CFLAGS)
+libharfbuzz_icu_la_LDFLAGS = $(base_link_flags) $(export_symbols_icu)
libharfbuzz_icu_la_LIBADD = $(ICU_LIBS) libharfbuzz.la
+EXTRA_libharfbuzz_icu_la_DEPENDENCIES = $(harfbuzz_icu_def_dependency)
pkginclude_HEADERS += $(HB_ICU_headers)
pkgconfig_DATA += harfbuzz-icu.pc
endif
@@ -175,13 +214,15 @@ EXTRA_DIST += harfbuzz-icu.pc.in
if HAVE_GOBJECT
lib_LTLIBRARIES += libharfbuzz-gobject.la
-libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_sources)
-nodist_libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_ENUM_sources)
-libharfbuzz_gobject_la_CPPFLAGS = $(GOBJECT_CFLAGS)
-libharfbuzz_gobject_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined
+libharfbuzz_gobject_la_LINK = $(chosen_linker) $(libharfbuzz_gobject_la_LDFLAGS)
+libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_DIST_sources)
+nodist_libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_NODIST_sources)
+libharfbuzz_gobject_la_CPPFLAGS = $(HBCFLAGS) $(HBNOLIBCXXFLAGS) $(GOBJECT_CFLAGS)
+libharfbuzz_gobject_la_LDFLAGS = $(base_link_flags)
libharfbuzz_gobject_la_LIBADD = $(GOBJECT_LIBS) libharfbuzz.la
-pkginclude_HEADERS += $(HB_GOBJECT_headers)
-nodist_pkginclude_HEADERS += $(HB_GOBJECT_ENUM_headers)
+EXTRA_libharfbuzz_gobject_la_DEPENDENCIES = $(harfbuzz_gobject_def_dependency)
+pkginclude_HEADERS += $(HB_GOBJECT_DIST_headers)
+nodist_pkginclude_HEADERS += $(HB_GOBJECT_NODIST_headers)
pkgconfig_DATA += harfbuzz-gobject.pc
BUILT_SOURCES += \
@@ -221,9 +262,20 @@ EXTRA_DIST += \
CLEANFILES += $(pkgconfig_DATA)
-CLEANFILES += harfbuzz.def
+DEF_FILES = harfbuzz.def harfbuzz-subset.def harfbuzz-icu.def
+if HAVE_GOBJECT
+DEF_FILES += harfbuzz-gobject.def
+endif
+check: $(DEF_FILES) # For check-symbols.sh
+CLEANFILES += $(DEF_FILES)
harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+harfbuzz-subset.def: $(HB_SUBSET_headers)
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+harfbuzz-icu.def: $(HB_ICU_headers)
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+harfbuzz-gobject.def: $(HB_GOBJECT_headers)
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
GENERATORS = \
@@ -261,7 +313,8 @@ EXTRA_DIST += \
$(HB_BASE_RAGEL_sources) \
$(HB_OT_RAGEL_sources) \
$(NULL)
-MAINTAINERCLEANFILES += $(RAGEL_GENERATED)
+# We decided to add ragel-generated files to git...
+#MAINTAINERCLEANFILES += $(RAGEL_GENERATED)
$(srcdir)/%.hh: $(srcdir)/%.rl
$(AM_V_GEN)(cd $(srcdir) && $(RAGEL) -e -F1 -o "$*.hh" "$*.rl") \
|| ($(RM) "$@"; false)
@@ -295,32 +348,56 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
test_buffer_serialize_CPPFLAGS = $(HBCFLAGS)
test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS)
-check: harfbuzz.def # For check-defs.sh
-
dist_check_SCRIPTS = \
check-c-linkage-decls.sh \
- check-defs.sh \
check-externs.sh \
check-header-guards.sh \
check-includes.sh \
- check-libstdc++.sh \
check-static-inits.sh \
check-symbols.sh \
$(NULL)
+TESTS += $(dist_check_SCRIPTS)
-check_PROGRAMS = \
- test-ot-tag \
+if !WITH_LIBSTDCXX
+dist_check_SCRIPTS += \
+ check-libstdc++.sh \
$(NULL)
+endif
+
+check_PROGRAMS += \
+ dump-indic-data \
+ dump-khmer-data \
+ dump-myanmar-data \
+ dump-use-data \
+ $(NULL)
+dump_indic_data_SOURCES = dump-indic-data.cc hb-ot-shape-complex-indic-table.cc
+dump_indic_data_CPPFLAGS = $(HBCFLAGS)
+dump_indic_data_LDADD = libharfbuzz.la $(HBLIBS)
+dump_khmer_data_SOURCES = dump-khmer-data.cc hb-ot-shape-complex-indic-table.cc
+dump_khmer_data_CPPFLAGS = $(HBCFLAGS)
+dump_khmer_data_LDADD = libharfbuzz.la $(HBLIBS)
+dump_myanmar_data_SOURCES = dump-myanmar-data.cc hb-ot-shape-complex-indic-table.cc
+dump_myanmar_data_CPPFLAGS = $(HBCFLAGS)
+dump_myanmar_data_LDADD = libharfbuzz.la $(HBLIBS)
+dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc
+dump_use_data_CPPFLAGS = $(HBCFLAGS)
+dump_use_data_LDADD = libharfbuzz.la $(HBLIBS)
+
+check_PROGRAMS += test-ot-tag test-unicode-ranges
+TESTS += test-ot-tag test-unicode-ranges
+
test_ot_tag_SOURCES = hb-ot-tag.cc
test_ot_tag_CPPFLAGS = $(HBCFLAGS) -DMAIN
test_ot_tag_LDADD = libharfbuzz.la $(HBLIBS)
-TESTS = $(dist_check_SCRIPTS) $(check_PROGRAMS)
+test_unicode_ranges_SOURCES = test-unicode-ranges.cc
+test_unicode_ranges_LDADD = libharfbuzz.la $(HBLIBS)
+
TESTS_ENVIRONMENT = \
srcdir="$(srcdir)" \
MAKE="$(MAKE) $(AM_MAKEFLAGS)" \
HBSOURCES="$(HBSOURCES)" \
- HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \
+ HBHEADERS="$(HBHEADERS)" \
$(NULL)
if HAVE_INTROSPECTION
@@ -350,12 +427,9 @@ HarfBuzz_0_0_gir_LIBS = \
$(NULL)
HarfBuzz_0_0_gir_FILES = \
$(HBHEADERS) \
- $(HBNODISTHEADERS) \
$(HBSOURCES) \
- $(HB_GOBJECT_ENUM_sources) \
- $(HB_GOBJECT_ENUM_headers) \
$(HB_GOBJECT_sources) \
- $(HB_GOBJECT_STRUCTS_headers) \
+ $(HB_GOBJECT_headers) \
$(NULL)
girdir = $(datadir)/gir-1.0
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
index 213aa22f684..787c3c4bb52 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
@@ -17,9 +17,10 @@ HB_BASE_sources = \
hb-object-private.hh \
hb-open-file-private.hh \
hb-open-type-private.hh \
- hb-ot-cbdt-table.hh \
+ hb-ot-color-cbdt-table.hh \
hb-ot-cmap-table.hh \
hb-ot-glyf-table.hh \
+ hb-ot-hdmx-table.hh \
hb-ot-head-table.hh \
hb-ot-hhea-table.hh \
hb-ot-hmtx-table.hh \
@@ -27,6 +28,7 @@ HB_BASE_sources = \
hb-ot-maxp-table.hh \
hb-ot-name-table.hh \
hb-ot-os2-table.hh \
+ hb-ot-os2-unicode-ranges.hh \
hb-ot-post-macroman.hh \
hb-ot-post-table.hh \
hb-ot-tag.cc \
@@ -69,9 +71,6 @@ HB_BASE_headers = \
hb-shape.h \
hb-shape-plan.h \
hb-unicode.h \
- $(NULL)
-
-HB_NODIST_headers = \
hb-version.h \
$(NULL)
@@ -82,10 +81,14 @@ HB_FALLBACK_sources = \
HB_OT_sources = \
hb-aat-layout.cc \
hb-aat-layout-common-private.hh \
+ hb-aat-layout-ankr-table.hh \
+ hb-aat-layout-kerx-table.hh \
hb-aat-layout-morx-table.hh \
+ hb-aat-layout-trak-table.hh \
hb-aat-layout-private.hh \
hb-ot-font.cc \
hb-ot-layout.cc \
+ hb-ot-layout-base-table.hh \
hb-ot-layout-common-private.hh \
hb-ot-layout-gdef-table.hh \
hb-ot-layout-gpos-table.hh \
@@ -93,6 +96,9 @@ HB_OT_sources = \
hb-ot-layout-gsub-table.hh \
hb-ot-layout-jstf-table.hh \
hb-ot-layout-private.hh \
+ hb-ot-color.cc \
+ hb-ot-color-colr-table.hh \
+ hb-ot-color-cpal-table.hh \
hb-ot-map.cc \
hb-ot-map-private.hh \
hb-ot-math.cc \
@@ -109,7 +115,9 @@ HB_OT_sources = \
hb-ot-shape-complex-indic.cc \
hb-ot-shape-complex-indic-private.hh \
hb-ot-shape-complex-indic-table.cc \
+ hb-ot-shape-complex-khmer-private.hh \
hb-ot-shape-complex-khmer.cc \
+ hb-ot-shape-complex-myanmar-private.hh \
hb-ot-shape-complex-myanmar.cc \
hb-ot-shape-complex-thai.cc \
hb-ot-shape-complex-tibetan.cc \
@@ -181,8 +189,26 @@ HB_UCDN_sources = hb-ucdn.cc
HB_ICU_sources = hb-icu.cc
HB_ICU_headers = hb-icu.h
-HB_GOBJECT_sources = hb-gobject-structs.cc
-HB_GOBJECT_STRUCTS_headers = hb-gobject-structs.h
-HB_GOBJECT_headers = hb-gobject.h $(HB_GOBJECT_STRUCTS_headers)
+# Sources for libharfbuzz-subset
+HB_SUBSET_sources = \
+ hb-subset.cc \
+ hb-subset-glyf.cc \
+ hb-subset-input.cc \
+ hb-subset-plan.cc \
+ $(NULL)
+
+HB_SUBSET_headers = \
+ hb-subset.h \
+ hb-subset-glyf.hh \
+ hb-subset-plan.hh \
+ hb-subset-private.hh \
+ $(NULL)
+
+HB_GOBJECT_DIST_sources = hb-gobject-structs.cc
+HB_GOBJECT_DIST_headers = hb-gobject.h hb-gobject-structs.h
HB_GOBJECT_ENUM_sources = hb-gobject-enums.cc
HB_GOBJECT_ENUM_headers = hb-gobject-enums.h
+HB_GOBJECT_NODIST_sources = $(HB_GOBJECT_ENUM_sources)
+HB_GOBJECT_NODIST_headers = $(HB_GOBJECT_ENUM_headers)
+HB_GOBJECT_sources = $(HB_GOBJECT_DIST_sources) $(HB_GOBJECT_NODIST_sources)
+HB_GOBJECT_headers = $(HB_GOBJECT_DIST_headers) $(HB_GOBJECT_NODIST_headers)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-defs.sh b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-defs.sh
deleted file mode 100755
index c6697831fe1..00000000000
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-defs.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-
-LC_ALL=C
-export LC_ALL
-
-test -z "$srcdir" && srcdir=.
-test -z "$libs" && libs=.libs
-stat=0
-
-if which nm 2>/dev/null >/dev/null; then
- :
-else
- echo "check-defs.sh: 'nm' not found; skipping test"
- exit 77
-fi
-
-defs="harfbuzz.def"
-if ! test -f "$defs"; then
- echo "check-defs.sh: '$defs' not found; skipping test"
- exit 77
-fi
-
-tested=false
-for def in $defs; do
- lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'`
- for suffix in so dylib; do
- so=$libs/lib${lib}.$suffix
- if ! test -f "$so"; then continue; fi
-
- # On mac, C symbols are prefixed with _
- if test $suffix = dylib; then prefix="_"; fi
-
- EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v " $prefix"'\(_fini\>\|_init\>\|_fdata\>\|_ftext\>\|_fbss\>\|__bss_start\>\|__bss_start__\>\|__bss_end__\>\|_edata\>\|_end\>\|_bss_end__\>\|__end__\>\|__gcov_flush\>\|llvm_\)' | cut -d' ' -f3`"
-
- if test -f "$so"; then
-
- echo "Checking that $so has the same symbol list as $def"
- {
- echo EXPORTS
- echo "$EXPORTED_SYMBOLS" | sed -e "s/^${prefix}hb/hb/g"
- # cheat: copy the last line from the def file!
- tail -n1 "$def"
- } | diff "$def" - >&2 || stat=1
-
- tested=true
- fi
- done
-done
-if ! $tested; then
- echo "check-defs.sh: libharfbuzz shared library not found; skipping test"
- exit 77
-fi
-
-exit $stat
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.sh b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.sh
index e4aaeb2b4a1..ce0bdab755f 100755
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.sh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.sh
@@ -21,16 +21,20 @@ else
fi
tested=false
-for suffix in so dylib; do
- so=$libs/libharfbuzz.$suffix
- if ! test -f "$so"; then continue; fi
+# harfbuzz-icu links to libstdc++ because icu does.
+# harfbuzz-subset uses libstdc++.
+for soname in harfbuzz harfbuzz-gobject; do
+ for suffix in so dylib; do
+ so=$libs/lib$soname.$suffix
+ if ! test -f "$so"; then continue; fi
- echo "Checking that we are not linking to libstdc++ or libc++"
- if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then
- echo "Ouch, linked to libstdc++ or libc++"
- stat=1
- fi
- tested=true
+ echo "Checking that we are not linking to libstdc++ or libc++ in $so"
+ if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then
+ echo "Ouch, linked to libstdc++ or libc++"
+ stat=1
+ fi
+ tested=true
+ done
done
if ! $tested; then
echo "check-libstdc++.sh: libharfbuzz shared library not found; skipping test"
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.sh b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.sh
index 3adf65f8744..bfc93b349ae 100755
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.sh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.sh
@@ -7,6 +7,7 @@ test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.libs
stat=0
+IGNORED_SYMBOLS='_fini\|_init\|_fdata\|_ftext\|_fbss\|__bss_start\|__bss_start__\|__bss_end__\|_edata\|_end\|_bss_end__\|__end__\|__gcov_flush\|llvm_.*'
if which nm 2>/dev/null >/dev/null; then
:
@@ -15,29 +16,46 @@ else
exit 77
fi
-echo "Checking that we are not exposing internal symbols"
tested=false
-for suffix in so dylib; do
- so=$libs/libharfbuzz.$suffix
- if ! test -f "$so"; then continue; fi
-
- EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| ___gcov_flush\>\| llvm_\| _llvm_' | cut -d' ' -f3`"
-
- prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
-
- # On mac, C symbols are prefixed with _
- if test $suffix = dylib; then prefix="_$prefix"; fi
-
- echo "Processing $so"
- if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}_"; then
- echo "Ouch, internal symbols exposed"
- stat=1
- fi
-
- tested=true
+for soname in harfbuzz harfbuzz-subset harfbuzz-icu harfbuzz-gobject; do
+ for suffix in so dylib; do
+ so=$libs/lib$soname.$suffix
+ if ! test -f "$so"; then continue; fi
+
+ # On macOS, C symbols are prefixed with _
+ symprefix=
+ if test $suffix = dylib; then symprefix=_; fi
+
+ EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v " $symprefix\\($IGNORED_SYMBOLS\\>\\)" | cut -d' ' -f3 | c++filt`"
+
+ prefix=$symprefix`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
+
+ echo
+ echo "Checking that $so does not expose internal symbols"
+ if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}\(_\|$\)"; then
+ echo "Ouch, internal symbols exposed"
+ stat=1
+ fi
+
+ def=$soname.def
+ if ! test -f "$def"; then
+ echo "'$def' not found; skipping"
+ else
+ echo
+ echo "Checking that $so has the same symbol list as $def"
+ {
+ echo EXPORTS
+ echo "$EXPORTED_SYMBOLS" | sed -e "s/^${symprefix}hb/hb/g"
+ # cheat: copy the last line from the def file!
+ tail -n1 "$def"
+ } | c++filt | diff "$def" - >&2 || stat=1
+ fi
+
+ tested=true
+ done
done
if ! $tested; then
- echo "check-symbols.sh: no shared library found; skipping test"
+ echo "check-symbols.sh: no shared libraries found; skipping test"
exit 77
fi
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc
new file mode 100644
index 00000000000..d57413884be
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-ot-shape-complex-indic-private.hh"
+
+int
+main (void)
+{
+ for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
+ {
+ hb_glyph_info_t info;
+ info.codepoint = u;
+ set_indic_properties (info);
+ if (info.indic_category() != INDIC_SYLLABIC_CATEGORY_OTHER ||
+ info.indic_position() != INDIC_MATRA_CATEGORY_NOT_APPLICABLE)
+ printf("U+%04X %u %u\n", u,
+ info.indic_category(),
+ info.indic_position());
+ }
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc
new file mode 100644
index 00000000000..7dd09b2b5ca
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-ot-shape-complex-khmer-private.hh"
+
+int
+main (void)
+{
+ for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
+ {
+ hb_glyph_info_t info;
+ info.codepoint = u;
+ set_khmer_properties (info);
+ if (info.khmer_category() != INDIC_SYLLABIC_CATEGORY_OTHER ||
+ info.khmer_position() != INDIC_MATRA_CATEGORY_NOT_APPLICABLE)
+ printf("U+%04X %u %u\n", u,
+ info.khmer_category(),
+ info.khmer_position());
+ }
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc
new file mode 100644
index 00000000000..2df9cd987f3
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-ot-shape-complex-myanmar-private.hh"
+
+int
+main (void)
+{
+ for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
+ {
+ hb_glyph_info_t info;
+ info.codepoint = u;
+ set_myanmar_properties (info);
+ if (info.myanmar_category() != INDIC_SYLLABIC_CATEGORY_OTHER ||
+ info.myanmar_position() != INDIC_MATRA_CATEGORY_NOT_APPLICABLE)
+ printf("U+%04X %u %u\n", u,
+ info.myanmar_category(),
+ info.myanmar_position());
+ }
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc
new file mode 100644
index 00000000000..0e64688f1e0
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-ot-shape-complex-use-private.hh"
+
+int
+main (void)
+{
+ for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
+ {
+ unsigned int category = hb_use_get_category (u);
+ if (category != USE_O)
+ printf("U+%04X %u\n", u, category);
+ }
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py
index ad1606ec3ff..1673537c963 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py
@@ -9,8 +9,11 @@ for h in os.environ["headers"].split (' '):
if h.endswith (".h"):
with io.open(h, encoding='utf8') as f: headers_content.append (f.read ())
-result = ("EXPORTS\n" +
- "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))) +
- "\nLIBRARY libharfbuzz-0.dll")
+result = """EXPORTS
+%s
+LIBRARY lib%s-0.dll""" % (
+ "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))),
+ sys.argv[1].replace ('.def', '')
+)
with open (sys.argv[1], "w") as f: f.write (result)
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 5391f27eb3e..06817255c92 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
@@ -449,7 +449,7 @@ page_bits = 12
print "}; /* Table items: %d; occupancy: %d%% */" % (offset, occupancy)
print
print "USE_TABLE_ELEMENT_TYPE"
-print "hb_use_get_categories (hb_codepoint_t u)"
+print "hb_use_get_category (hb_codepoint_t u)"
print "{"
print " switch (u >> %d)" % page_bits
print " {"
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-config.cmake.in b/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-config.cmake.in
new file mode 100644
index 00000000000..87b15721a3a
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-config.cmake.in
@@ -0,0 +1,82 @@
+# Set these variables so that the `${prefix}/lib` expands to something we can
+# remove.
+set(_harfbuzz_remove_string "REMOVE_ME")
+set(exec_prefix "${_harfbuzz_remove_string}")
+set(prefix "${_harfbuzz_remove_string}")
+
+# Compute the installation prefix by stripping components from our current
+# location.
+get_filename_component(_harfbuzz_prefix "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
+get_filename_component(_harfbuzz_prefix "${_harfbuzz_prefix}" DIRECTORY)
+set(_harfbuzz_libdir "@libdir@")
+string(REPLACE "${_harfbuzz_remove_string}/" "" _harfbuzz_libdir "${_harfbuzz_libdir}")
+set(_harfbuzz_libdir_iter "${_harfbuzz_libdir}")
+while (_harfbuzz_libdir_iter)
+ get_filename_component(_harfbuzz_libdir_iter "${_harfbuzz_libdir_iter}" DIRECTORY)
+ get_filename_component(_harfbuzz_prefix "${_harfbuzz_prefix}" DIRECTORY)
+endwhile ()
+unset(_harfbuzz_libdir_iter)
+
+# Get the include subdir.
+set(_harfbuzz_includedir "@includedir@")
+string(REPLACE "${_harfbuzz_remove_string}/" "" _harfbuzz_includedir "${_harfbuzz_includedir}")
+
+# Extract version information from libtool.
+set(_harfbuzz_version_info "@HB_LIBTOOL_VERSION_INFO@")
+string(REPLACE ":" ";" _harfbuzz_version_info "${_harfbuzz_version_info}")
+list(GET _harfbuzz_version_info 0
+ _harfbuzz_current)
+list(GET _harfbuzz_version_info 1
+ _harfbuzz_revision)
+list(GET _harfbuzz_version_info 2
+ _harfbuzz_age)
+unset(_harfbuzz_version_info)
+
+if (APPLE)
+ set(_harfbuzz_lib_suffix ".0${CMAKE_SHARED_LIBRARY_SUFFIX}")
+elseif (UNIX)
+ set(_harfbuzz_lib_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}.0.${_harfbuzz_current}.${_harfbuzz_revision}")
+else ()
+ # Unsupported.
+ set(harfbuzz_FOUND 0)
+endif ()
+
+# Add the libraries.
+add_library(harfbuzz::harfbuzz SHARED IMPORTED)
+set_target_properties(harfbuzz::harfbuzz PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz"
+ IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz${_harfbuzz_lib_suffix}")
+
+add_library(harfbuzz::icu SHARED IMPORTED)
+set_target_properties(harfbuzz::icu PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz"
+ INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz"
+ IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz-icu${_harfbuzz_lib_suffix}")
+
+add_library(harfbuzz::subset SHARED IMPORTED)
+set_target_properties(harfbuzz::subset PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz"
+ INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz"
+ IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz-subset${_harfbuzz_lib_suffix}")
+
+# Only add the gobject library if it was built.
+set(_harfbuzz_have_gobject "@have_gobject@")
+if (_harfbuzz_have_gobject)
+ add_library(harfbuzz::gobject SHARED IMPORTED)
+ set_target_properties(harfbuzz::gobject PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz"
+ INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz"
+ IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz-gobject${_harfbuzz_lib_suffix}")
+endif ()
+
+# Clean out variables we used in our scope.
+unset(_harfbuzz_lib_suffix)
+unset(_harfbuzz_current)
+unset(_harfbuzz_revision)
+unset(_harfbuzz_age)
+unset(_harfbuzz_includedir)
+unset(_harfbuzz_libdir)
+unset(_harfbuzz_prefix)
+unset(exec_prefix)
+unset(prefix)
+unset(_harfbuzz_remove_string)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-subset.pc.in b/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-subset.pc.in
new file mode 100644
index 00000000000..5da64b3f126
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz-subset.pc.in
@@ -0,0 +1,12 @@
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%
+
+Name: harfbuzz
+Description: HarfBuzz font subsetter
+Version: %VERSION%
+
+Requires: harfbuzz
+Libs: -L${libdir} -lharfbuzz-subset
+Cflags: -I${includedir}/harfbuzz
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh
new file mode 100644
index 00000000000..d0453bd8807
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh
@@ -0,0 +1,80 @@
+/*
+ * Copyright © 2018 Ebrahim Byagowi
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#ifndef HB_AAT_LAYOUT_ANKR_TABLE_HH
+#define HB_AAT_LAYOUT_ANKR_TABLE_HH
+
+#include "hb-aat-layout-common-private.hh"
+
+#define HB_AAT_TAG_ankr HB_TAG('a','n','k','r')
+
+
+namespace AAT {
+
+
+/*
+ * ankr -- Anchor point
+ */
+
+struct Anchor
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ FWORD xCoordinate;
+ FWORD yCoordinate;
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct ankr
+{
+ static const hb_tag_t tableTag = HB_AAT_TAG_ankr;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && version == 0 &&
+ lookupTable.sanitize (c, this) &&
+ anchors.sanitize (c, this));
+ }
+
+ protected:
+ HBUINT16 version; /* Version number (set to zero) */
+ HBUINT16 flags; /* Flags (currently unused; set to zero) */
+ LOffsetTo<Lookup<HBUINT16> > lookupTable; /* Offset to the table's lookup table */
+ LOffsetTo<ArrayOf<Anchor, HBUINT32> >
+ anchors; /* Offset to the glyph data table */
+
+ public:
+ DEFINE_SIZE_STATIC (12);
+};
+
+} /* namespace AAT */
+
+
+#endif /* HB_AAT_LAYOUT_ANKR_TABLE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh
index b5395bba5bb..7c0dfa8b0cf 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh
@@ -120,7 +120,7 @@ struct BinSearchArrayOf
else
return p;
}
- return NULL;
+ return nullptr;
}
private:
@@ -563,9 +563,9 @@ struct StateTable
unsigned int entry = 0;
while (state < num_states)
{
- if (unlikely (!c->check_array (states + state * nClasses,
- states[0].static_size,
- nClasses * (num_states - state))))
+ if (unlikely (!c->check_array (states,
+ states[0].static_size * nClasses,
+ num_states)))
return_trace (false);
{ /* Sweep new states. */
const HBUINT16 *stop = &states[num_states * nClasses];
@@ -574,9 +574,9 @@ struct StateTable
state = num_states;
}
- if (unlikely (!c->check_array (entries + entry,
+ if (unlikely (!c->check_array (entries,
entries[0].static_size,
- num_entries - entry)))
+ num_entries)))
return_trace (false);
{ /* Sweep new entries. */
const Entry<Extra> *stop = &entries[num_entries];
@@ -614,8 +614,7 @@ struct StateTableDriver
hb_face_t *face_) :
machine (machine_),
buffer (buffer_),
- num_glyphs (face_->get_num_glyphs ()),
- last_zero (0) {}
+ num_glyphs (face_->get_num_glyphs ()) {}
template <typename context_t>
inline void drive (context_t *c)
@@ -629,9 +628,6 @@ struct StateTableDriver
bool last_was_dont_advance = false;
for (buffer->idx = 0;;)
{
- if (!state)
- last_zero = buffer->idx;
-
unsigned int klass = buffer->idx < buffer->len ?
machine.get_class (info[buffer->idx].codepoint, num_glyphs) :
0 /* End of text */;
@@ -639,10 +635,29 @@ struct StateTableDriver
if (unlikely (!entry))
break;
+ /* Unsafe-to-break before this if not in state 0, as things might
+ * go differently if we start from state 0 here. */
+ if (state && buffer->idx)
+ {
+ /* If there's no action and we're just epsilon-transitioning to state 0,
+ * safe to break. */
+ if (c->is_actionable (this, entry) ||
+ !(entry->newState == 0 && entry->flags == context_t::DontAdvance))
+ buffer->unsafe_to_break (buffer->idx - 1, buffer->idx + 1);
+ }
+
+ /* Unsafe-to-break if end-of-text would kick in here. */
+ if (buffer->idx + 2 <= buffer->len)
+ {
+ const Entry<EntryData> *end_entry = machine.get_entryZ (state, 0);
+ if (c->is_actionable (this, end_entry))
+ buffer->unsafe_to_break (buffer->idx, buffer->idx + 2);
+ }
+
if (unlikely (!c->transition (this, entry)))
break;
- last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops--;
+ last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0;
state = entry->newState;
@@ -665,7 +680,6 @@ struct StateTableDriver
const StateTable<EntryData> &machine;
hb_buffer_t *buffer;
unsigned int num_glyphs;
- unsigned int last_zero;
};
@@ -684,17 +698,23 @@ struct hb_aat_apply_context_t :
hb_buffer_t *buffer;
hb_sanitize_context_t sanitizer;
+ /* Unused. For debug tracing only. */
+ unsigned int lookup_index;
+ unsigned int debug_depth;
+
inline hb_aat_apply_context_t (hb_font_t *font_,
hb_buffer_t *buffer_,
hb_blob_t *table) :
font (font_), face (font->face), buffer (buffer_),
- sanitizer ()
+ sanitizer (), lookup_index (0), debug_depth (0)
{
sanitizer.init (table);
sanitizer.num_glyphs = face->get_num_glyphs ();
sanitizer.start_processing ();
}
+ inline void set_lookup_index (unsigned int i) { lookup_index = i; }
+
inline ~hb_aat_apply_context_t (void)
{
sanitizer.end_processing ();
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh
new file mode 100644
index 00000000000..ce7ca105faa
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh
@@ -0,0 +1,339 @@
+/*
+ * Copyright © 2018 Ebrahim Byagowi
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_AAT_LAYOUT_KERX_TABLE_HH
+#define HB_AAT_LAYOUT_KERX_TABLE_HH
+
+#include "hb-open-type-private.hh"
+#include "hb-aat-layout-common-private.hh"
+
+#define HB_AAT_TAG_KERX HB_TAG('k','e','r','x')
+
+
+namespace AAT {
+
+using namespace OT;
+
+
+struct KerxFormat0Records
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ GlyphID left;
+ GlyphID right;
+ FWORD value;
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct KerxSubTableFormat0
+{
+ // TODO(ebraminio) Enable when we got suitable BinSearchArrayOf
+ // inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
+ // {
+ // hb_glyph_pair_t pair = {left, right};
+ // int i = pairs.bsearch (pair);
+ // if (i == -1)
+ // return 0;
+ // return pairs[i].get_kerning ();
+ // }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (records, records[0].static_size, nPairs));
+ }
+
+ protected:
+ // TODO(ebraminio): A custom version of "BinSearchArrayOf<KerxPair> pairs;" is
+ // needed here to use HBUINT32 instead
+ HBUINT32 nPairs; /* The number of kerning pairs in this subtable */
+ HBUINT32 searchRange; /* The largest power of two less than or equal to the value of nPairs,
+ * multiplied by the size in bytes of an entry in the subtable. */
+ HBUINT32 entrySelector; /* This is calculated as log2 of the largest power of two less
+ * than or equal to the value of nPairs. */
+ HBUINT32 rangeShift; /* The value of nPairs minus the largest power of two less than or equal to nPairs. */
+ KerxFormat0Records records[VAR]; /* VAR=nPairs */
+ public:
+ DEFINE_SIZE_ARRAY (16, records);
+};
+
+struct KerxSubTableFormat1
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ stateHeader.sanitize (c));
+ }
+
+ protected:
+ StateTable<HBUINT16> stateHeader;
+ LOffsetTo<ArrayOf<HBUINT16> > valueTable;
+ public:
+ DEFINE_SIZE_STATIC (20);
+};
+
+// TODO(ebraminio): Maybe this can be replaced with Lookup<HBUINT16>?
+struct KerxClassTable
+{
+ inline unsigned int get_class (hb_codepoint_t g) const { return classes[g - firstGlyph]; }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (firstGlyph.sanitize (c) && classes.sanitize (c));
+ }
+
+ protected:
+ HBUINT16 firstGlyph; /* First glyph in class range. */
+ ArrayOf<HBUINT16> classes; /* Glyph classes. */
+ public:
+ DEFINE_SIZE_ARRAY (4, classes);
+};
+
+struct KerxSubTableFormat2
+{
+ inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end) const
+ {
+ unsigned int l = (this+leftClassTable).get_class (left);
+ unsigned int r = (this+leftClassTable).get_class (left);
+ unsigned int offset = l * rowWidth + r * sizeof (FWORD);
+ const FWORD *arr = &(this+array);
+ if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
+ return 0;
+ const FWORD *v = &StructAtOffset<FWORD> (arr, offset);
+ if (unlikely ((const void *) v < (const void *) arr || (const void *) (v + 1) > (const void *) end))
+ return 0;
+ return *v;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ rowWidth.sanitize (c) &&
+ leftClassTable.sanitize (c, this) &&
+ rightClassTable.sanitize (c, this) &&
+ array.sanitize (c, this));
+ }
+
+ protected:
+ HBUINT32 rowWidth; /* The width, in bytes, of a row in the table. */
+ LOffsetTo<KerxClassTable>
+ leftClassTable; /* Offset from beginning of this subtable to
+ * left-hand class table. */
+ LOffsetTo<KerxClassTable>
+ rightClassTable;/* Offset from beginning of this subtable to
+ * right-hand class table. */
+ LOffsetTo<FWORD>
+ array; /* Offset from beginning of this subtable to
+ * the start of the kerning array. */
+ public:
+ DEFINE_SIZE_STATIC (16);
+};
+
+struct KerxSubTableFormat4
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ rowWidth.sanitize (c) &&
+ leftClassTable.sanitize (c, this) &&
+ rightClassTable.sanitize (c, this) &&
+ array.sanitize (c, this));
+ }
+
+ protected:
+ HBUINT32 rowWidth; /* The width, in bytes, of a row in the table. */
+ LOffsetTo<KerxClassTable>
+ leftClassTable; /* Offset from beginning of this subtable to
+ * left-hand class table. */
+ LOffsetTo<KerxClassTable>
+ rightClassTable;/* Offset from beginning of this subtable to
+ * right-hand class table. */
+ LOffsetTo<FWORD>
+ array; /* Offset from beginning of this subtable to
+ * the start of the kerning array. */
+ public:
+ DEFINE_SIZE_STATIC (16);
+};
+
+struct KerxSubTableFormat6
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ rowIndexTable.sanitize (c, this) &&
+ columnIndexTable.sanitize (c, this) &&
+ kerningArray.sanitize (c, this) &&
+ kerningVector.sanitize (c, this));
+ }
+
+ protected:
+ HBUINT32 flags;
+ HBUINT16 rowCount;
+ HBUINT16 columnCount;
+ LOffsetTo<Lookup<HBUINT16> > rowIndexTable;
+ LOffsetTo<Lookup<HBUINT16> > columnIndexTable;
+ LOffsetTo<Lookup<HBUINT16> > kerningArray;
+ LOffsetTo<Lookup<HBUINT16> > kerningVector;
+ public:
+ DEFINE_SIZE_STATIC (24);
+};
+
+enum coverage_flags_t
+{
+ COVERAGE_VERTICAL_FLAG = 0x80u,
+ COVERAGE_CROSSSTREAM_FLAG = 0x40u,
+ COVERAGE_VARIATION_FLAG = 0x20u,
+ COVERAGE_PROCESS_DIRECTION = 0x10u,
+};
+
+struct KerxTable
+{
+ inline bool apply (hb_aat_apply_context_t *c, const AAT::ankr *ankr) const
+ {
+ TRACE_APPLY (this);
+ /* TODO */
+ return_trace (false);
+ }
+
+ inline unsigned int get_size (void) const { return length; }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!c->check_struct (this))
+ return_trace (false);
+
+ switch (format) {
+ case 0: return u.format0.sanitize (c);
+ case 1: return u.format1.sanitize (c);
+ case 2: return u.format2.sanitize (c);
+ case 4: return u.format4.sanitize (c);
+ case 6: return u.format6.sanitize (c);
+ default:return_trace (false);
+ }
+ }
+
+protected:
+ HBUINT32 length;
+ HBUINT8 coverage;
+ HBUINT16 unused;
+ HBUINT8 format;
+ HBUINT32 tupleIndex;
+ union {
+ KerxSubTableFormat0 format0;
+ KerxSubTableFormat1 format1;
+ KerxSubTableFormat2 format2;
+ KerxSubTableFormat4 format4;
+ KerxSubTableFormat6 format6;
+ } u;
+public:
+ DEFINE_SIZE_MIN (12);
+};
+
+struct SubtableGlyphCoverageArray
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ HBUINT32 length;
+ HBUINT32 coverage;
+ HBUINT32 tupleCount;
+ public:
+ DEFINE_SIZE_STATIC (12);
+};
+
+struct kerx
+{
+ static const hb_tag_t tableTag = HB_AAT_TAG_KERX;
+
+ inline bool apply (hb_aat_apply_context_t *c, const AAT::ankr *ankr) const
+ {
+ TRACE_APPLY (this);
+ const KerxTable &table = StructAfter<KerxTable> (*this);
+ return_trace (table.apply (c, ankr));
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!(c->check_struct (this)))
+ return_trace (false);
+
+ /* TODO: Something like `morx`s ChainSubtable should be done here instead */
+ const KerxTable *table = &StructAfter<KerxTable> (*this);
+ if (!(table->sanitize (c)))
+ return_trace (false);
+
+ for (unsigned int i = 0; i < nTables - 1; ++i)
+ {
+ table = &StructAfter<KerxTable> (*table);
+ if (!(table->sanitize (c)))
+ return_trace (false);
+ }
+
+ // If version is less than 3, we are done here; otherwise better to check footer also
+ if (version < 3)
+ return_trace (true);
+
+ // TODO: Investigate why this just work on some fonts no matter of version
+ // const SubtableGlyphCoverageArray &footer =
+ // StructAfter<SubtableGlyphCoverageArray> (*table);
+ // return_trace (footer.sanitize (c));
+
+ return_trace (true);
+ }
+
+ protected:
+ HBUINT16 version;
+ HBUINT16 padding;
+ HBUINT32 nTables;
+/*KerxTable tables[VAR];*/
+/*SubtableGlyphCoverageArray coverage_array;*/
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+} /* namespace AAT */
+
+
+#endif /* HB_AAT_LAYOUT_KERX_TABLE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh
index c64dca06670..4cc2824214e 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh
@@ -40,6 +40,8 @@ using namespace OT;
struct RearrangementSubtable
{
+ typedef void EntryData;
+
struct driver_context_t
{
static const bool in_place = true;
@@ -58,20 +60,21 @@ struct RearrangementSubtable
inline driver_context_t (const RearrangementSubtable *table) :
ret (false),
- start (0), end (0),
- last_zero_before_start (0) {}
+ start (0), end (0) {}
- inline bool transition (StateTableDriver<void> *driver,
- const Entry<void> *entry)
+ inline bool is_actionable (StateTableDriver<EntryData> *driver,
+ const Entry<EntryData> *entry)
+ {
+ return (entry->flags & Verb) && start < end;
+ }
+ inline bool transition (StateTableDriver<EntryData> *driver,
+ const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry->flags;
if (flags & MarkFirst)
- {
start = buffer->idx;
- last_zero_before_start = driver->last_zero;
- }
if (flags & MarkLast)
end = MIN (buffer->idx + 1, buffer->len);
@@ -110,7 +113,7 @@ struct RearrangementSubtable
if (end - start >= l + r)
{
- buffer->unsafe_to_break (last_zero_before_start, MIN (buffer->idx + 1, buffer->len));
+ buffer->merge_clusters (start, MIN (buffer->idx + 1, buffer->len));
buffer->merge_clusters (start, end);
hb_glyph_info_t *info = buffer->info;
@@ -147,7 +150,6 @@ struct RearrangementSubtable
private:
unsigned int start;
unsigned int end;
- unsigned int last_zero_before_start;
};
inline bool apply (hb_aat_apply_context_t *c) const
@@ -169,7 +171,7 @@ struct RearrangementSubtable
}
protected:
- StateTable<void> machine;
+ StateTable<EntryData> machine;
public:
DEFINE_SIZE_STATIC (16);
};
@@ -198,20 +200,29 @@ struct ContextualSubtable
inline driver_context_t (const ContextualSubtable *table) :
ret (false),
+ mark_set (false),
mark (0),
- last_zero_before_mark (0),
subs (table+table->substitutionTables) {}
+ inline bool is_actionable (StateTableDriver<EntryData> *driver,
+ const Entry<EntryData> *entry)
+ {
+ hb_buffer_t *buffer = driver->buffer;
+
+ if (buffer->idx == buffer->len && !mark_set)
+ return false;
+
+ return entry->data.markIndex != 0xFFFF || entry->data.currentIndex != 0xFFFF;
+ }
inline bool transition (StateTableDriver<EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
- if (entry->flags & SetMark)
- {
- mark = buffer->idx;
- last_zero_before_mark = driver->last_zero;
- }
+ /* Looks like CoreText applies neither mark nor current substitution for
+ * end-of-text if mark was not explicitly set. */
+ if (buffer->idx == buffer->len && !mark_set)
+ return true;
if (entry->data.markIndex != 0xFFFF)
{
@@ -220,32 +231,38 @@ struct ContextualSubtable
const GlyphID *replacement = lookup.get_value (info[mark].codepoint, driver->num_glyphs);
if (replacement)
{
- buffer->unsafe_to_break (last_zero_before_mark, MIN (buffer->idx + 1, buffer->len));
+ buffer->unsafe_to_break (mark, MIN (buffer->idx + 1, buffer->len));
info[mark].codepoint = *replacement;
ret = true;
}
}
if (entry->data.currentIndex != 0xFFFF)
{
+ unsigned int idx = MIN (buffer->idx, buffer->len - 1);
const Lookup<GlyphID> &lookup = subs[entry->data.currentIndex];
hb_glyph_info_t *info = buffer->info;
- const GlyphID *replacement = lookup.get_value (info[buffer->idx].codepoint, driver->num_glyphs);
+ const GlyphID *replacement = lookup.get_value (info[idx].codepoint, driver->num_glyphs);
if (replacement)
{
- buffer->unsafe_to_break (driver->last_zero, MIN (buffer->idx + 1, buffer->len));
- info[buffer->idx].codepoint = *replacement;
+ info[idx].codepoint = *replacement;
ret = true;
}
}
+ if (entry->flags & SetMark)
+ {
+ mark_set = true;
+ mark = buffer->idx;
+ }
+
return true;
}
public:
bool ret;
private:
+ bool mark_set;
unsigned int mark;
- unsigned int last_zero_before_mark;
const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32> &subs;
};
@@ -265,8 +282,8 @@ struct ContextualSubtable
{
TRACE_SANITIZE (this);
- unsigned int num_entries;
- if (unlikely (!machine.sanitize (c, &num_entries))) return false;
+ unsigned int num_entries = 0;
+ if (unlikely (!machine.sanitize (c, &num_entries))) return_trace (false);
unsigned int num_lookups = 0;
@@ -275,8 +292,10 @@ struct ContextualSubtable
{
const EntryData &data = entries[i].data;
- num_lookups = MAX<unsigned int> (num_lookups, 1 + data.markIndex);
- num_lookups = MAX<unsigned int> (num_lookups, 1 + data.currentIndex);
+ if (data.markIndex != 0xFFFF)
+ num_lookups = MAX<unsigned int> (num_lookups, 1 + data.markIndex);
+ if (data.currentIndex != 0xFFFF)
+ num_lookups = MAX<unsigned int> (num_lookups, 1 + data.currentIndex);
}
return_trace (substitutionTables.sanitize (c, this, num_lookups));
@@ -333,6 +352,11 @@ struct LigatureSubtable
ligature (table+table->ligature),
match_length (0) {}
+ inline bool is_actionable (StateTableDriver<EntryData> *driver,
+ const Entry<EntryData> *entry)
+ {
+ return !!(entry->flags & PerformAction);
+ }
inline bool transition (StateTableDriver<EntryData> *driver,
const Entry<EntryData> *entry)
{
@@ -432,9 +456,8 @@ struct LigatureSubtable
{
TRACE_SANITIZE (this);
/* The rest of array sanitizations are done at run-time. */
- return c->check_struct (this) && machine.sanitize (c) &&
- ligAction && component && ligature;
- return_trace (true);
+ return_trace (c->check_struct (this) && machine.sanitize (c) &&
+ ligAction && component && ligature);
}
protected:
@@ -593,8 +616,18 @@ struct Chain
unsigned int count = subtableCount;
for (unsigned int i = 0; i < count; i++)
{
+ if (!c->buffer->message (c->font, "start chain subtable %d", c->lookup_index))
+ {
+ c->set_lookup_index (c->lookup_index + 1);
+ continue;
+ }
+
subtable->apply (c);
subtable = &StructAfter<ChainSubtable> (*subtable);
+
+ (void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index);
+
+ c->set_lookup_index (c->lookup_index + 1);
}
}
@@ -648,6 +681,7 @@ struct morx
inline void apply (hb_aat_apply_context_t *c) const
{
+ c->set_lookup_index (0);
const Chain *chain = chains;
unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh
index c1c607a2f7a..ce75c8e7192 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh
@@ -37,4 +37,7 @@
HB_INTERNAL void
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer);
+HB_INTERNAL void
+hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer);
+
#endif /* HB_AAT_LAYOUT_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh
new file mode 100644
index 00000000000..5767b116cbf
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh
@@ -0,0 +1,201 @@
+/*
+ * Copyright © 2018 Ebrahim Byagowi
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_AAT_LAYOUT_TRAK_TABLE_HH
+#define HB_AAT_LAYOUT_TRAK_TABLE_HH
+
+#include "hb-aat-layout-common-private.hh"
+#include "hb-open-type-private.hh"
+
+#define HB_AAT_TAG_trak HB_TAG('t','r','a','k')
+
+
+namespace AAT {
+
+
+struct TrackTableEntry
+{
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base, unsigned int size) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && (values.sanitize (c, base, size)));
+ }
+
+ inline float get_track_value () const
+ {
+ return track.to_float ();
+ }
+
+ inline int get_value (const void *base, unsigned int index) const
+ {
+ return (base+values)[index];
+ }
+
+ protected:
+ Fixed track; /* Track value for this record. */
+ HBUINT16 trackNameID; /* The 'name' table index for this track */
+ OffsetTo<UnsizedArrayOf<FWORD> >
+ values; /* Offset from start of tracking table to
+ * per-size tracking values for this track. */
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct TrackData
+{
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ sizeTable.sanitize (c, base, nSizes) &&
+ trackTable.sanitize (c, nTracks, base, nSizes));
+ }
+
+ inline float get_tracking (const void *base, float ptem) const
+ {
+ /* CoreText points are CSS pixels (96 per inch),
+ * NOT typographic points (72 per inch).
+ *
+ * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
+ */
+ float csspx = ptem * 96.f / 72.f;
+ Fixed fixed_size;
+ fixed_size.set_float (csspx);
+
+ /* XXX Clean this up. Make it work with nSizes==1 and 0. */
+
+ unsigned int sizes = nSizes;
+
+ const TrackTableEntry *trackTableEntry = nullptr;
+ for (unsigned int i = 0; i < sizes; ++i)
+ // For now we only seek for track entries with zero tracking value
+ if (trackTable[i].get_track_value () == 0.)
+ trackTableEntry = &trackTable[0];
+
+ // We couldn't match any, exit
+ if (!trackTableEntry) return 0.;
+
+ /* TODO bfind() */
+ unsigned int size_index;
+ UnsizedArrayOf<Fixed> size_table = base+sizeTable;
+ for (size_index = 0; size_index < sizes; ++size_index)
+ if (size_table[size_index] >= fixed_size)
+ break;
+
+ // TODO(ebraminio): We don't attempt to extrapolate to larger or
+ // smaller values for now but we should do, per spec
+ if (size_index == sizes)
+ return trackTableEntry->get_value (base, sizes - 1);
+ if (size_index == 0 || size_table[size_index] == fixed_size)
+ return trackTableEntry->get_value (base, size_index);
+
+ float s0 = size_table[size_index - 1].to_float ();
+ float s1 = size_table[size_index].to_float ();
+ float t = (csspx - s0) / (s1 - s0);
+ return t * trackTableEntry->get_value (base, size_index) +
+ (1.0 - t) * trackTableEntry->get_value (base, size_index - 1);
+ }
+
+ protected:
+ HBUINT16 nTracks; /* Number of separate tracks included in this table. */
+ HBUINT16 nSizes; /* Number of point sizes included in this table. */
+ LOffsetTo<UnsizedArrayOf<Fixed> > /* Offset to array[nSizes] of size values. */
+ sizeTable;
+ UnsizedArrayOf<TrackTableEntry>
+ trackTable; /* Array[nTracks] of TrackTableEntry records. */
+
+ public:
+ DEFINE_SIZE_ARRAY (8, trackTable);
+};
+
+struct trak
+{
+ static const hb_tag_t tableTag = HB_AAT_TAG_trak;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+
+ return_trace (c->check_struct (this) &&
+ horizData.sanitize (c, this, this) &&
+ vertData.sanitize (c, this, this));
+ }
+
+ inline bool apply (hb_aat_apply_context_t *c) const
+ {
+ TRACE_APPLY (this);
+
+ const float ptem = c->font->ptem;
+ if (ptem <= 0.f)
+ return_trace (false);
+
+ hb_buffer_t *buffer = c->buffer;
+ if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
+ {
+ const TrackData &trackData = this+horizData;
+ float tracking = trackData.get_tracking (this, ptem);
+ hb_position_t advance_to_add = c->font->em_scalef_x (tracking / 2);
+ foreach_grapheme (buffer, start, end)
+ {
+ /* TODO This is wrong. */
+ buffer->pos[start].x_advance += advance_to_add;
+ buffer->pos[end].x_advance += advance_to_add;
+ }
+ }
+ else
+ {
+ const TrackData &trackData = this+vertData;
+ float tracking = trackData.get_tracking (this, ptem);
+ hb_position_t advance_to_add = c->font->em_scalef_y (tracking / 2);
+ foreach_grapheme (buffer, start, end)
+ {
+ /* TODO This is wrong. */
+ buffer->pos[start].y_advance += advance_to_add;
+ buffer->pos[end].y_advance += advance_to_add;
+ }
+ }
+
+ return_trace (true);
+ }
+
+ protected:
+ FixedVersion<> version; /* Version of the tracking table--currently
+ * 0x00010000u for version 1.0. */
+ HBUINT16 format; /* Format of the tracking table */
+ OffsetTo<TrackData> horizData; /* TrackData for horizontal text */
+ OffsetTo<TrackData> vertData; /* TrackData for vertical text */
+ HBUINT16 reserved; /* Reserved. Set to 0. */
+
+ public:
+ DEFINE_SIZE_MIN (12);
+};
+
+} /* namespace AAT */
+
+
+#endif /* HB_AAT_LAYOUT_TRAK_TABLE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc
index d882fa16681..45268e3e7ab 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc
@@ -30,12 +30,48 @@
#include "hb-ot-layout-gsubgpos-private.hh"
#include "hb-aat-layout-private.hh"
+#include "hb-aat-layout-ankr-table.hh"
+#include "hb-aat-layout-kerx-table.hh"
#include "hb-aat-layout-morx-table.hh"
+#include "hb-aat-layout-trak-table.hh"
/*
- * mort/morx
+ * morx/kerx/trak
*/
+static inline const AAT::ankr&
+_get_ankr (hb_face_t *face, hb_blob_t **blob = nullptr)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
+ {
+ if (blob)
+ *blob = hb_blob_get_empty ();
+ return OT::Null(AAT::ankr);
+ }
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ const AAT::ankr& ankr = *(layout->ankr.get ());
+ if (blob)
+ *blob = layout->ankr.blob;
+ return ankr;
+}
+
+static inline const AAT::kerx&
+_get_kerx (hb_face_t *face, hb_blob_t **blob = nullptr)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
+ {
+ if (blob)
+ *blob = hb_blob_get_empty ();
+ return OT::Null(AAT::kerx);
+ }
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ /* XXX this doesn't call set_num_glyphs on sanitizer. */
+ const AAT::kerx& kerx = *(layout->kerx.get ());
+ if (blob)
+ *blob = layout->kerx.blob;
+ return kerx;
+}
+
static inline const AAT::morx&
_get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
{
@@ -53,20 +89,36 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
return morx;
}
-static inline void
-_hb_aat_layout_create (hb_face_t *face)
+static inline const AAT::trak&
+_get_trak (hb_face_t *face, hb_blob_t **blob = nullptr)
{
- OT::Sanitizer<AAT::morx> sanitizer;
- sanitizer.set_num_glyphs (face->get_num_glyphs ());
- hb_blob_t *morx_blob = sanitizer.sanitize (face->reference_table (HB_AAT_TAG_MORX));
- OT::Sanitizer<AAT::morx>::lock_instance (morx_blob);
-
- if (0)
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
{
- OT::Sanitizer<AAT::Lookup<OT::GlyphID> >::lock_instance (morx_blob)->get_value (1, face->get_num_glyphs ());
+ if (blob)
+ *blob = hb_blob_get_empty ();
+ return OT::Null(AAT::trak);
}
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ const AAT::trak& trak = *(layout->trak.get ());
+ if (blob)
+ *blob = layout->trak.blob;
+ return trak;
}
+// static inline void
+// _hb_aat_layout_create (hb_face_t *face)
+// {
+// OT::Sanitizer<AAT::morx> sanitizer;
+// sanitizer.set_num_glyphs (face->get_num_glyphs ());
+// hb_blob_t *morx_blob = sanitizer.sanitize (face->reference_table (HB_AAT_TAG_MORX));
+// OT::Sanitizer<AAT::morx>::lock_instance (morx_blob);
+
+// if (0)
+// {
+// OT::Sanitizer<AAT::Lookup<OT::GlyphID> >::lock_instance (morx_blob)->get_value (1, face->get_num_glyphs ());
+// }
+// }
+
void
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
{
@@ -76,3 +128,16 @@ hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
AAT::hb_aat_apply_context_t c (font, buffer, blob);
morx.apply (&c);
}
+
+void
+hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer)
+{
+ hb_blob_t *blob;
+ const AAT::ankr& ankr = _get_ankr (font->face, &blob);
+ const AAT::kerx& kerx = _get_kerx (font->face, &blob);
+ const AAT::trak& trak = _get_trak (font->face, &blob);
+
+ AAT::hb_aat_apply_context_t c (font, buffer, blob);
+ kerx.apply (&c, &ankr);
+ trak.apply (&c);
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc
index 4cf6d1e5451..b5291f650cc 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc
@@ -171,6 +171,31 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
}
/**
+ * hb_blob_copy_writable_or_fail:
+ * @blob: A blob.
+ *
+ * Makes a writable copy of @blob.
+ *
+ * Return value: New blob, or nullptr if allocation failed.
+ *
+ * Since: 1.8.0
+ **/
+hb_blob_t *
+hb_blob_copy_writable_or_fail (hb_blob_t *blob)
+{
+ blob = hb_blob_create (blob->data,
+ blob->length,
+ HB_MEMORY_MODE_DUPLICATE,
+ nullptr,
+ nullptr);
+
+ if (unlikely (blob == hb_blob_get_empty ()))
+ blob = nullptr;
+
+ return blob;
+}
+
+/**
* hb_blob_get_empty:
*
* Returns the singleton empty blob.
@@ -222,7 +247,7 @@ hb_blob_reference (hb_blob_t *blob)
* hb_blob_destroy: (skip)
* @blob: a blob.
*
- * Descreases the reference count on @blob, and if it reaches zero, destroys
+ * Decreases the reference count on @blob, and if it reaches zero, destroys
* @blob, freeing all memory, possibly calling the destroy-callback the blob
* was created for if it has not been called already.
*
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.h
index 53682d3eb1c..fd561f73869 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.h
@@ -83,6 +83,9 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
unsigned int length);
HB_EXTERN hb_blob_t *
+hb_blob_copy_writable_or_fail (hb_blob_t *blob);
+
+HB_EXTERN hb_blob_t *
hb_blob_get_empty (void);
HB_EXTERN hb_blob_t *
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh
index 125a4192911..be374c77a5b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh
@@ -34,397 +34,397 @@
#line 36 "hb-buffer-deserialize-json.hh"
static const unsigned char _deserialize_json_trans_keys[] = {
- 0u, 0u, 9u, 123u, 9u, 34u, 97u, 103u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u,
- 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u,
- 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u, 9u, 125u,
- 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u,
- 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u,
+ 0u, 0u, 9u, 123u, 9u, 34u, 97u, 103u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u,
+ 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u,
+ 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u, 9u, 125u,
+ 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u,
+ 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u,
65u, 122u, 34u, 122u, 9u, 125u, 9u, 125u, 9u, 93u, 9u, 123u, 0u, 0u, 0
};
static const char _deserialize_json_key_spans[] = {
- 0, 115, 26, 7, 2, 1, 50, 49,
- 10, 117, 117, 117, 1, 50, 49, 10,
- 117, 117, 1, 1, 50, 49, 117, 117,
- 2, 1, 50, 49, 10, 117, 117, 1,
- 50, 49, 10, 117, 117, 1, 50, 49,
+ 0, 115, 26, 7, 2, 1, 50, 49,
+ 10, 117, 117, 117, 1, 50, 49, 10,
+ 117, 117, 1, 1, 50, 49, 117, 117,
+ 2, 1, 50, 49, 10, 117, 117, 1,
+ 50, 49, 10, 117, 117, 1, 50, 49,
58, 89, 117, 117, 85, 115, 0
};
static const short _deserialize_json_index_offsets[] = {
- 0, 0, 116, 143, 151, 154, 156, 207,
- 257, 268, 386, 504, 622, 624, 675, 725,
- 736, 854, 972, 974, 976, 1027, 1077, 1195,
- 1313, 1316, 1318, 1369, 1419, 1430, 1548, 1666,
- 1668, 1719, 1769, 1780, 1898, 2016, 2018, 2069,
+ 0, 0, 116, 143, 151, 154, 156, 207,
+ 257, 268, 386, 504, 622, 624, 675, 725,
+ 736, 854, 972, 974, 976, 1027, 1077, 1195,
+ 1313, 1316, 1318, 1369, 1419, 1430, 1548, 1666,
+ 1668, 1719, 1769, 1780, 1898, 2016, 2018, 2069,
2119, 2178, 2268, 2386, 2504, 2590, 2706
};
static const char _deserialize_json_indicies[] = {
- 0, 0, 0, 0, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 1, 3, 3, 3,
- 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 1, 1, 1, 1, 63,
- 1, 64, 1, 64, 64, 64, 64, 64,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 64, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 65, 1, 65, 65,
- 65, 65, 65, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 65, 1, 66,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 67, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 1,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 1, 1, 1, 1, 1, 1,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 1, 70, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 71, 71,
- 1, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 1, 1, 1, 1, 1,
- 1, 1, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 1, 1, 1, 1,
- 71, 1, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 1, 72, 72, 72,
- 72, 72, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 72, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 73, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 65, 1, 65, 65,
+ 65, 65, 65, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 65, 1, 66,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 67, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 1,
+ 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 1, 1, 1, 1, 1, 1,
+ 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 1, 70, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 71, 71,
+ 1, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 1, 1, 1, 1, 1,
+ 1, 1, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 1, 1, 1, 1,
+ 71, 1, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 1, 72, 72, 72,
+ 72, 72, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 72, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 73, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,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1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 1, 0
};
static const char _deserialize_json_trans_targs[] = {
- 1, 0, 2, 2, 3, 4, 18, 24,
- 37, 5, 12, 6, 7, 8, 9, 11,
- 9, 11, 10, 2, 44, 10, 44, 13,
- 14, 15, 16, 17, 16, 17, 10, 2,
- 44, 19, 20, 21, 22, 23, 10, 2,
- 44, 23, 25, 31, 26, 27, 28, 29,
- 30, 29, 30, 10, 2, 44, 32, 33,
- 34, 35, 36, 35, 36, 10, 2, 44,
- 38, 39, 40, 42, 43, 41, 10, 41,
+ 1, 0, 2, 2, 3, 4, 18, 24,
+ 37, 5, 12, 6, 7, 8, 9, 11,
+ 9, 11, 10, 2, 44, 10, 44, 13,
+ 14, 15, 16, 17, 16, 17, 10, 2,
+ 44, 19, 20, 21, 22, 23, 10, 2,
+ 44, 23, 25, 31, 26, 27, 28, 29,
+ 30, 29, 30, 10, 2, 44, 32, 33,
+ 34, 35, 36, 35, 36, 10, 2, 44,
+ 38, 39, 40, 42, 43, 41, 10, 41,
10, 2, 44, 43, 44, 45, 46
};
static const char _deserialize_json_trans_actions[] = {
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 2, 2,
- 0, 0, 3, 3, 4, 0, 5, 0,
- 0, 2, 2, 2, 0, 0, 6, 6,
- 7, 0, 0, 0, 2, 2, 8, 8,
- 9, 0, 0, 0, 0, 0, 2, 2,
- 2, 0, 0, 10, 10, 11, 0, 0,
- 2, 2, 2, 0, 0, 12, 12, 13,
- 0, 0, 0, 2, 2, 2, 14, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 2, 2,
+ 0, 0, 3, 3, 4, 0, 5, 0,
+ 0, 2, 2, 2, 0, 0, 6, 6,
+ 7, 0, 0, 0, 2, 2, 8, 8,
+ 9, 0, 0, 0, 0, 0, 2, 2,
+ 2, 0, 0, 10, 10, 11, 0, 0,
+ 2, 2, 2, 0, 0, 12, 12, 13,
+ 0, 0, 0, 2, 2, 2, 14, 0,
15, 15, 16, 0, 0, 0, 0
};
@@ -461,7 +461,7 @@ _hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer,
int cs;
hb_glyph_info_t info = {0};
hb_glyph_position_t pos = {0};
-
+
#line 466 "hb-buffer-deserialize-json.hh"
{
cs = deserialize_json_start;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl
index 91b350f5ac0..0f7d48ee298 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl
@@ -106,7 +106,7 @@ _hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer,
const char *p = buf, *pe = buf + buf_len;
/* Ensure we have positions. */
- (void) hb_buffer_get_glyph_positions (buffer, NULL);
+ (void) hb_buffer_get_glyph_positions (buffer, nullptr);
while (p < pe && ISSPACE (*p))
p++;
@@ -115,7 +115,7 @@ _hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer,
*end_ptr = ++p;
}
- const char *tok = NULL;
+ const char *tok = nullptr;
int cs;
hb_glyph_info_t info = {0};
hb_glyph_position_t pos = {0};
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh
index 426b1375876..a6ab0bbde67 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh
@@ -34,274 +34,274 @@
#line 36 "hb-buffer-deserialize-text.hh"
static const unsigned char _deserialize_text_trans_keys[] = {
- 0u, 0u, 9u, 122u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u,
- 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 9u, 124u, 9u, 124u, 0u, 0u,
- 9u, 122u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u,
+ 0u, 0u, 9u, 122u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u,
+ 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 9u, 124u, 9u, 124u, 0u, 0u,
+ 9u, 122u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u,
9u, 124u, 9u, 124u, 9u, 124u, 0
};
static const char _deserialize_text_key_spans[] = {
- 0, 114, 13, 10, 13, 10, 10, 13,
- 10, 1, 13, 10, 14, 116, 116, 0,
- 114, 116, 116, 116, 116, 116, 116, 116,
+ 0, 114, 13, 10, 13, 10, 10, 13,
+ 10, 1, 13, 10, 14, 116, 116, 0,
+ 114, 116, 116, 116, 116, 116, 116, 116,
116, 116, 116
};
static const short _deserialize_text_index_offsets[] = {
- 0, 0, 115, 129, 140, 154, 165, 176,
- 190, 201, 203, 217, 228, 243, 360, 477,
- 478, 593, 710, 827, 944, 1061, 1178, 1295,
+ 0, 0, 115, 129, 140, 154, 165, 176,
+ 190, 201, 203, 217, 228, 243, 360, 477,
+ 478, 593, 710, 827, 944, 1061, 1178, 1295,
1412, 1529, 1646
};
static const char _deserialize_text_indicies[] = {
- 0, 0, 0, 0, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 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 55, 55, 55, 55,
+ 1, 1, 1, 30, 1, 1, 31, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 1, 1, 32, 1, 55, 1, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
55, 1, 33, 1, 0
};
static const char _deserialize_text_trans_targs[] = {
- 1, 0, 13, 17, 26, 3, 18, 21,
- 18, 21, 5, 19, 20, 19, 20, 22,
- 25, 8, 9, 12, 9, 12, 10, 11,
- 23, 24, 23, 24, 14, 2, 6, 7,
- 15, 16, 14, 15, 16, 17, 14, 4,
- 15, 16, 14, 15, 16, 14, 2, 7,
+ 1, 0, 13, 17, 26, 3, 18, 21,
+ 18, 21, 5, 19, 20, 19, 20, 22,
+ 25, 8, 9, 12, 9, 12, 10, 11,
+ 23, 24, 23, 24, 14, 2, 6, 7,
+ 15, 16, 14, 15, 16, 17, 14, 4,
+ 15, 16, 14, 15, 16, 14, 2, 7,
15, 16, 14, 2, 15, 16, 25, 26
};
static const char _deserialize_text_trans_actions[] = {
- 0, 0, 1, 1, 1, 2, 2, 2,
- 0, 0, 2, 2, 2, 0, 0, 2,
- 2, 2, 2, 2, 0, 0, 3, 2,
- 2, 2, 0, 0, 4, 5, 5, 5,
- 4, 4, 0, 0, 0, 0, 6, 7,
- 6, 6, 8, 8, 8, 9, 10, 10,
+ 0, 0, 1, 1, 1, 2, 2, 2,
+ 0, 0, 2, 2, 2, 0, 0, 2,
+ 2, 2, 2, 2, 0, 0, 3, 2,
+ 2, 2, 0, 0, 4, 5, 5, 5,
+ 4, 4, 0, 0, 0, 0, 6, 7,
+ 6, 6, 8, 8, 8, 9, 10, 10,
9, 9, 11, 12, 11, 11, 0, 0
};
static const char _deserialize_text_eof_actions[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 4, 0, 0,
- 0, 4, 6, 8, 8, 6, 9, 11,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 4, 0, 0,
+ 0, 4, 6, 8, 8, 6, 9, 11,
11, 9, 4
};
@@ -338,7 +338,7 @@ _hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer,
int cs;
hb_glyph_info_t info = {0};
hb_glyph_position_t pos = {0};
-
+
#line 343 "hb-buffer-deserialize-text.hh"
{
cs = deserialize_text_start;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl
index 8a682f7378a..fd9be42df14 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl
@@ -100,7 +100,7 @@ _hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer,
const char *p = buf, *pe = buf + buf_len;
/* Ensure we have positions. */
- (void) hb_buffer_get_glyph_positions (buffer, NULL);
+ (void) hb_buffer_get_glyph_positions (buffer, nullptr);
while (p < pe && ISSPACE (*p))
p++;
@@ -109,7 +109,7 @@ _hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer,
*end_ptr = ++p;
}
- const char *eof = pe, *tok = NULL;
+ const char *eof = pe, *tok = nullptr;
int cs;
hb_glyph_info_t info = {0};
hb_glyph_position_t pos = {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 9148ef31b65..af4767f5114 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
@@ -93,7 +93,7 @@ struct hb_buffer_t {
hb_buffer_flags_t flags; /* BOT / EOT / etc. */
hb_buffer_cluster_level_t cluster_level;
hb_codepoint_t replacement; /* U+FFFD or something else. */
- hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
+ hb_buffer_scratch_flags_t scratch_flags; /* Have space-fallback, etc. */
unsigned int max_len; /* Maximum allowed len. */
int max_ops; /* Maximum allowed operations. */
@@ -344,8 +344,7 @@ struct hb_buffer_t {
inline void
unsafe_to_break_all (void)
{
- for (unsigned int i = 0; i < len; i++)
- info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ unsafe_to_break_impl (0, len);
}
inline void
safe_to_break_all (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 7ead43b0184..dc0639f4f29 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
@@ -1933,7 +1933,7 @@ hb_buffer_diff (hb_buffer_t *buffer,
result |= HB_BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH;
if (buf_info->cluster != ref_info->cluster)
result |= HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH;
- if ((buf_info->mask & HB_GLYPH_FLAG_DEFINED) != (ref_info->mask & HB_GLYPH_FLAG_DEFINED))
+ if ((buf_info->mask & ~ref_info->mask & HB_GLYPH_FLAG_DEFINED))
result |= HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH;
if (contains && ref_info->codepoint == dottedcircle_glyph)
result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.h
index b2801ddf546..8a2d3e8690f 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.h
@@ -71,6 +71,24 @@ typedef struct hb_glyph_info_t {
hb_var_int_t var2;
} hb_glyph_info_t;
+/**
+ * hb_glyph_flags_t:
+ * @HB_GLYPH_FLAG_UNSAFE_TO_BREAK: Indicates that if input text is broken at the
+ * beginning of the cluster this glyph is part of,
+ * then both sides need to be re-shaped, as the
+ * result might be different. On the flip side,
+ * it means that when this flag is not present,
+ * then it's safe to break the glyph-run at the
+ * beginning of this cluster, and the two sides
+ * represent the exact same result one would get
+ * if breaking input text at the beginning of
+ * this cluster and shaping the two sides
+ * separately. This can be used to optimize
+ * paragraph layout, by avoiding re-shaping
+ * of each line after line-breaking, or limiting
+ * the reshaping to a small piece around the
+ * breaking point only.
+ */
typedef enum { /*< flags >*/
HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc
index 1d0e7264234..d1fcf799aac 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc
@@ -879,7 +879,7 @@ parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *fea
parse_bool (pp, end, &feature->value);
/* CSS doesn't use equal-sign between tag and value.
* If there was an equal-sign, then there *must* be a value.
- * A value without an eqaul-sign is ok, but not required. */
+ * A value without an equal-sign is ok, but not required. */
return !had_equal || had_value;
}
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 44020176939..aba7cf44d3f 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
@@ -74,7 +74,10 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
const char *data = reinterpret_cast<const char*> (CFDataGetBytePtr (cf_data));
const size_t length = CFDataGetLength (cf_data);
if (!data || !length)
+ {
+ CFRelease (cf_data);
return nullptr;
+ }
return hb_blob_create (data, length, HB_MEMORY_MODE_READONLY,
reinterpret_cast<void *> (const_cast<__CFData *> (cf_data)),
@@ -311,7 +314,7 @@ _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
hb_font_t *
hb_coretext_font_create (CTFontRef ct_font)
{
- CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, 0);
+ CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, nullptr);
hb_face_t *face = hb_coretext_face_create (cg_font);
CFRelease (cg_font);
hb_font_t *font = hb_font_create (face);
@@ -877,7 +880,10 @@ resize_and_retry:
kCFStringEncodingUTF8,
kCFAllocatorNull);
if (unlikely (!lang))
+ {
+ CFRelease (attr_string);
FAIL ("CFStringCreateWithCStringNoCopy failed");
+ }
CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
kCTLanguageAttributeName, lang);
CFRelease (lang);
@@ -946,7 +952,10 @@ resize_and_retry:
&kCFTypeDictionaryValueCallBacks);
CFRelease (level_number);
if (unlikely (!options))
+ {
+ CFRelease (attr_string);
FAIL ("CFDictionaryCreate failed");
+ }
CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options);
CFRelease (options);
@@ -1036,7 +1045,7 @@ resize_and_retry:
}
if (!matched)
{
- CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
+ CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, nullptr);
if (run_cg_font)
{
matched = CFEqual (run_cg_font, cg_font);
@@ -1209,7 +1218,7 @@ resize_and_retry:
}
/* Mac OS 10.6 doesn't have kCTTypesetterOptionForcedEmbeddingLevel,
- * or if it does, it doesn't resepct it. So we get runs with wrong
+ * or if it does, it doesn't respect it. So we get runs with wrong
* directions. As such, disable the assert... It wouldn't crash, but
* cursoring will be off...
*
@@ -1235,8 +1244,6 @@ resize_and_retry:
pos->x_offset = info->var1.i32;
pos->y_offset = info->var2.i32;
- info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
-
info++, pos++;
}
else
@@ -1246,8 +1253,6 @@ resize_and_retry:
pos->x_offset = info->var1.i32;
pos->y_offset = info->var2.i32;
- info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
-
info++, pos++;
}
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 6c425f7b9dd..c244347b348 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh
@@ -396,6 +396,18 @@ struct hb_no_trace_t {
#define TRACE_SERIALIZE(this) hb_no_trace_t<bool> trace
#endif
+#ifndef HB_DEBUG_SUBSET
+#define HB_DEBUG_SUBSET (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_SUBSET
+#define TRACE_SUBSET(this) \
+ hb_auto_trace_t<HB_DEBUG_SUBSET, bool> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ " ");
+#else
+#define TRACE_SUBSET(this) hb_no_trace_t<bool> trace
+#endif
+
#ifndef HB_DEBUG_WOULD_APPLY
#define HB_DEBUG_WOULD_APPLY (HB_DEBUG+0)
#endif
@@ -415,6 +427,7 @@ struct hb_no_trace_t {
HB_DEBUG_COLLECT_GLYPHS + \
HB_DEBUG_SANITIZE + \
HB_DEBUG_SERIALIZE + \
+ HB_DEBUG_SUBSET + \
HB_DEBUG_WOULD_APPLY + \
0)
#endif
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc
index 0674ef9bcfc..69a8aa2081b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc
@@ -370,7 +370,7 @@ public:
{
if (textPosition == 0 || textPosition > mTextLength) {
// Either there is no text before here (== 0), or this
- // is an invalid position. The query is considered valid thouh.
+ // is an invalid position. The query is considered valid though.
*textString = nullptr;
*textLength = 0;
}
@@ -878,8 +878,6 @@ retry_getglyphs:
pos->x_offset =
x_mult * (isRightToLeft ? -info->var1.i32 : info->var1.i32);
pos->y_offset = y_mult * info->var2.i32;
-
- info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
}
if (isRightToLeft)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h
index 9842d52b650..0ce8d0462d5 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h
@@ -71,7 +71,6 @@ hb_face_set_user_data (hb_face_t *face,
hb_destroy_func_t destroy,
hb_bool_t replace);
-
HB_EXTERN void *
hb_face_get_user_data (hb_face_t *face,
hb_user_data_key_t *key);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
index 1c526cf37dc..fc4b11220a9 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
@@ -58,7 +58,7 @@
*
* - In the future, we should add constructors to create fonts in font space?
*
- * - FT_Load_Glyph() is exteremely costly. Do something about it?
+ * - FT_Load_Glyph() is extremely costly. Do something about it?
*/
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.h.tmpl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.h.tmpl
index e28510c2284..606727cd32d 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.h.tmpl
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.h.tmpl
@@ -42,7 +42,8 @@ HB_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN value-header ***/
-HB_EXTERN GType @enum_name@_get_type (void) G_GNUC_CONST;
+HB_EXTERN GType
+@enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.h
index 1c303219b7c..302dc9584e9 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.h
@@ -45,7 +45,8 @@ HB_BEGIN_DECLS
*
* Since: 0.9.2
**/
-HB_EXTERN GType hb_gobject_blob_get_type (void);
+HB_EXTERN GType
+hb_gobject_blob_get_type (void);
#define HB_GOBJECT_TYPE_BLOB (hb_gobject_blob_get_type ())
/**
@@ -53,7 +54,8 @@ HB_EXTERN GType hb_gobject_blob_get_type (void);
*
* Since: 0.9.2
**/
-HB_EXTERN GType hb_gobject_buffer_get_type (void);
+HB_EXTERN GType
+hb_gobject_buffer_get_type (void);
#define HB_GOBJECT_TYPE_BUFFER (hb_gobject_buffer_get_type ())
/**
@@ -61,7 +63,8 @@ HB_EXTERN GType hb_gobject_buffer_get_type (void);
*
* Since: 0.9.2
**/
-HB_EXTERN GType hb_gobject_face_get_type (void);
+HB_EXTERN GType
+hb_gobject_face_get_type (void);
#define HB_GOBJECT_TYPE_FACE (hb_gobject_face_get_type ())
/**
@@ -69,7 +72,8 @@ HB_EXTERN GType hb_gobject_face_get_type (void);
*
* Since: 0.9.2
**/
-HB_EXTERN GType hb_gobject_font_get_type (void);
+HB_EXTERN GType
+hb_gobject_font_get_type (void);
#define HB_GOBJECT_TYPE_FONT (hb_gobject_font_get_type ())
/**
@@ -77,13 +81,16 @@ HB_EXTERN GType hb_gobject_font_get_type (void);
*
* Since: 0.9.2
**/
-HB_EXTERN GType hb_gobject_font_funcs_get_type (void);
+HB_EXTERN GType
+hb_gobject_font_funcs_get_type (void);
#define HB_GOBJECT_TYPE_FONT_FUNCS (hb_gobject_font_funcs_get_type ())
-HB_EXTERN GType hb_gobject_set_get_type (void);
+HB_EXTERN GType
+hb_gobject_set_get_type (void);
#define HB_GOBJECT_TYPE_SET (hb_gobject_set_get_type ())
-HB_EXTERN GType hb_gobject_shape_plan_get_type (void);
+HB_EXTERN GType
+hb_gobject_shape_plan_get_type (void);
#define HB_GOBJECT_TYPE_SHAPE_PLAN (hb_gobject_shape_plan_get_type ())
/**
@@ -91,26 +98,40 @@ HB_EXTERN GType hb_gobject_shape_plan_get_type (void);
*
* Since: 0.9.2
**/
-HB_EXTERN GType hb_gobject_unicode_funcs_get_type (void);
+HB_EXTERN GType
+hb_gobject_unicode_funcs_get_type (void);
#define HB_GOBJECT_TYPE_UNICODE_FUNCS (hb_gobject_unicode_funcs_get_type ())
/* Value types */
-HB_EXTERN GType hb_gobject_feature_get_type (void);
+HB_EXTERN GType
+hb_gobject_feature_get_type (void);
#define HB_GOBJECT_TYPE_FEATURE (hb_gobject_feature_get_type ())
-HB_EXTERN GType hb_gobject_glyph_info_get_type (void);
+HB_EXTERN GType
+hb_gobject_glyph_info_get_type (void);
#define HB_GOBJECT_TYPE_GLYPH_INFO (hb_gobject_glyph_info_get_type ())
-HB_EXTERN GType hb_gobject_glyph_position_get_type (void);
+HB_EXTERN GType
+hb_gobject_glyph_position_get_type (void);
#define HB_GOBJECT_TYPE_GLYPH_POSITION (hb_gobject_glyph_position_get_type ())
-HB_EXTERN GType hb_gobject_segment_properties_get_type (void);
+HB_EXTERN GType
+hb_gobject_segment_properties_get_type (void);
#define HB_GOBJECT_TYPE_SEGMENT_PROPERTIES (hb_gobject_segment_properties_get_type ())
-HB_EXTERN GType hb_gobject_user_data_key_get_type (void);
+HB_EXTERN GType
+hb_gobject_user_data_key_get_type (void);
#define HB_GOBJECT_TYPE_USER_DATA_KEY (hb_gobject_user_data_key_get_type ())
+HB_EXTERN GType
+hb_gobject_ot_math_glyph_variant_get_type (void);
+#define HB_GOBJECT_TYPE_OT_MATH_GLYPH_VARIANT (hb_gobject_ot_math_glyph_variant_get_type ())
+
+HB_EXTERN GType
+hb_gobject_ot_math_glyph_part_get_type (void);
+#define HB_GOBJECT_TYPE_OT_MATH_GLYPH_PART (hb_gobject_ot_math_glyph_part_get_type ())
+
HB_END_DECLS
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc
index 62aaae9e87c..46fe1399913 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc
@@ -80,7 +80,7 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
p->tag = tag;
/* TODO Not thread-safe, but fairly harmless.
- * We can do the double-chcked pointer cmpexch thing here. */
+ * We can do the double-checked pointer cmpexch thing here. */
p->next = face_data->tlist;
face_data->tlist = p;
}
@@ -360,7 +360,6 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
hb_glyph_info_t *info = &buffer->info[clusters[i].base_glyph + j];
info->codepoint = gids[clusters[i].base_glyph + j];
info->cluster = clusters[i].cluster;
- info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
info->var1.i32 = clusters[i].advance; // all glyphs in the cluster get the same advance
}
}
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 1e5676e8262..e2644eaf91e 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
@@ -30,6 +30,7 @@
#define HB_OPEN_FILE_PRIVATE_HH
#include "hb-open-type-private.hh"
+#include "hb-ot-head-table.hh"
namespace OT {
@@ -54,7 +55,14 @@ struct TTCHeader;
typedef struct TableRecord
{
int cmp (Tag t) const
- { return t.cmp (tag); }
+ { return -t.cmp (tag); }
+
+ static int cmp (const void *pa, const void *pb)
+ {
+ const TableRecord *a = (const TableRecord *) pa;
+ const TableRecord *b = (const TableRecord *) pb;
+ return b->cmp (a->tag);
+ }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -64,9 +72,9 @@ typedef struct TableRecord
Tag tag; /* 4-byte identifier. */
CheckSum checkSum; /* CheckSum for this table. */
- HBUINT32 offset; /* Offset from beginning of TrueType font
+ Offset32 offset; /* Offset from beginning of TrueType font
* file. */
- HBUINT32 length; /* Length of this table. */
+ HBUINT32 length; /* Length of this table. */
public:
DEFINE_SIZE_STATIC (16);
} OpenTypeTable;
@@ -81,7 +89,7 @@ typedef struct OffsetTable
{
return tables[i];
}
- inline unsigned int get_table_tags (unsigned int start_offset,
+ inline unsigned int get_table_tags (unsigned int start_offset,
unsigned int *table_count, /* IN/OUT */
hb_tag_t *table_tags /* OUT */) const
{
@@ -118,6 +126,78 @@ typedef struct OffsetTable
}
public:
+
+ inline bool serialize (hb_serialize_context_t *c,
+ hb_tag_t sfnt_tag,
+ Supplier<hb_tag_t> &tags,
+ Supplier<hb_blob_t *> &blobs,
+ unsigned int table_count)
+ {
+ TRACE_SERIALIZE (this);
+ /* Alloc 12 for the OTHeader. */
+ if (unlikely (!c->extend_min (*this))) return_trace (false);
+ /* Write sfntVersion (bytes 0..3). */
+ sfnt_version.set (sfnt_tag);
+ /* Take space for numTables, searchRange, entrySelector, RangeShift
+ * and the TableRecords themselves. */
+ if (unlikely (!tables.serialize (c, table_count))) return_trace (false);
+
+ const char *dir_end = (const char *) c->head;
+ HBUINT32 *checksum_adjustment = nullptr;
+
+ /* Write OffsetTables, alloc for and write actual table blobs. */
+ for (unsigned int i = 0; i < table_count; i++)
+ {
+ TableRecord &rec = tables.array[i];
+ hb_blob_t *blob = blobs[i];
+ rec.tag.set (tags[i]);
+ rec.length.set (hb_blob_get_length (blob));
+ rec.offset.serialize (c, this);
+
+ /* Allocate room for the table and copy it. */
+ char *start = (char *) c->allocate_size<void> (rec.length);
+ if (unlikely (!start)) {return false;}
+
+ memcpy (start, hb_blob_get_data (blob, nullptr), rec.length);
+
+ /* 4-byte allignment. */
+ if (rec.length % 4)
+ c->allocate_size<void> (4 - rec.length % 4);
+ const char *end = (const char *) c->head;
+
+ if (tags[i] == HB_OT_TAG_head && end - start >= head::static_size)
+ {
+ head *h = (head *) start;
+ checksum_adjustment = &h->checkSumAdjustment;
+ checksum_adjustment->set (0);
+ }
+
+ rec.checkSum.set_for_data (start, end - start);
+ }
+ tags += table_count;
+ blobs += table_count;
+
+ tables.qsort ();
+
+ if (checksum_adjustment)
+ {
+ CheckSum checksum;
+
+ /* The following line is a slower version of the following block. */
+ //checksum.set_for_data (this, (const char *) c->head - (const char *) this);
+ checksum.set_for_data (this, dir_end - (const char *) this);
+ for (unsigned int i = 0; i < table_count; i++)
+ {
+ TableRecord &rec = tables.array[i];
+ checksum.set (checksum + rec.checkSum);
+ }
+
+ checksum_adjustment->set (0xB1B0AFBAu - checksum);
+ }
+
+ return_trace (true);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -249,6 +329,18 @@ struct OpenTypeFontFile
}
}
+ inline bool serialize_single (hb_serialize_context_t *c,
+ hb_tag_t sfnt_tag,
+ Supplier<hb_tag_t> &tags,
+ Supplier<hb_blob_t *> &blobs,
+ unsigned int table_count)
+ {
+ TRACE_SERIALIZE (this);
+ assert (sfnt_tag != TTCTag);
+ if (unlikely (!c->extend_min (*this))) return_trace (false);
+ return_trace (u.fontFace.serialize (c, sfnt_tag, tags, blobs, table_count));
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
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 04e4a4e1ba9..5d33199e128 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
@@ -134,7 +134,17 @@ static inline Type& StructAfter(TObject &X)
#define HB_NULL_POOL_SIZE 264
static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
-extern HB_INTERNAL const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)];
+
+#ifdef HB_NO_VISIBILITY
+static
+#else
+extern HB_INTERNAL
+#endif
+const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)]
+#ifdef HB_NO_VISIBILITY
+= {}
+#endif
+;
/* Generic nul-content Null objects. */
template <typename Type>
@@ -179,6 +189,12 @@ struct hb_dispatch_context_t
#ifndef HB_SANITIZE_MAX_EDITS
#define HB_SANITIZE_MAX_EDITS 32
#endif
+#ifndef HB_SANITIZE_MAX_OPS_FACTOR
+#define HB_SANITIZE_MAX_OPS_FACTOR 8
+#endif
+#ifndef HB_SANITIZE_MAX_OPS_MIN
+#define HB_SANITIZE_MAX_OPS_MIN 16384
+#endif
struct hb_sanitize_context_t :
hb_dispatch_context_t<hb_sanitize_context_t, bool, HB_DEBUG_SANITIZE>
@@ -186,7 +202,7 @@ struct hb_sanitize_context_t :
inline hb_sanitize_context_t (void) :
debug_depth (0),
start (nullptr), end (nullptr),
- writable (false), edit_count (0),
+ writable (false), edit_count (0), max_ops (0),
blob (nullptr),
num_glyphs (0) {}
@@ -211,6 +227,8 @@ struct hb_sanitize_context_t :
this->start = hb_blob_get_data (this->blob, nullptr);
this->end = this->start + hb_blob_get_length (this->blob);
assert (this->start <= this->end); /* Must not overflow. */
+ this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
+ (unsigned) HB_SANITIZE_MAX_OPS_MIN);
this->edit_count = 0;
this->debug_depth = 0;
@@ -234,7 +252,10 @@ struct hb_sanitize_context_t :
inline bool check_range (const void *base, unsigned int len) const
{
const char *p = (const char *) base;
- bool ok = this->start <= p && p <= this->end && (unsigned int) (this->end - p) >= len;
+ bool ok = this->max_ops-- > 0 &&
+ this->start <= p &&
+ p <= this->end &&
+ (unsigned int) (this->end - p) >= len;
DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,
"check_range [%p..%p] (%d bytes) in [%p..%p] -> %s",
@@ -298,6 +319,7 @@ struct hb_sanitize_context_t :
const char *start, *end;
bool writable;
unsigned int edit_count;
+ mutable int max_ops;
hb_blob_t *blob;
unsigned int num_glyphs;
};
@@ -499,23 +521,25 @@ struct hb_serialize_context_t
template <typename Type>
struct Supplier
{
- inline Supplier (const Type *array, unsigned int len_)
+ inline Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof(Type))
{
head = array;
len = len_;
+ stride = stride_;
}
inline const Type operator [] (unsigned int i) const
{
if (unlikely (i >= len)) return Type ();
- return head[i];
+ return * (const Type *) (const void *) ((const char *) head + stride * i);
}
- inline void advance (unsigned int count)
+ inline Supplier<Type> & operator += (unsigned int count)
{
if (unlikely (count > len))
count = len;
len -= count;
- head += count;
+ head = (const Type *) (const void *) ((const char *) head + stride * count);
+ return *this;
}
private:
@@ -523,6 +547,7 @@ struct Supplier
inline Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */
unsigned int len;
+ unsigned int stride;
const Type *head;
};
@@ -667,8 +692,8 @@ struct F2DOT14 : HBINT16
/* 32-bit signed fixed-point number (16.16). */
struct Fixed: HBINT32
{
- //inline float to_float (void) const { return ???; }
- //inline void set_float (float f) { v.set (f * ???); }
+ inline float to_float (void) const { return ((int32_t) v) / 65536.0; }
+ inline void set_float (float f) { v.set (round (f * 65536.0)); }
public:
DEFINE_SIZE_STATIC (4);
};
@@ -715,6 +740,14 @@ template <typename Type>
struct Offset : Type
{
inline bool is_null (void) const { return 0 == *this; }
+
+ inline void *serialize (hb_serialize_context_t *c, const void *base)
+ {
+ void *t = c->start_embed<void> ();
+ this->set ((char *) t - (char *) base); /* TODO(serialize) Overflow? */
+ return t;
+ }
+
public:
DEFINE_SIZE_STATIC (sizeof(Type));
};
@@ -730,7 +763,8 @@ struct CheckSum : HBUINT32
static inline uint32_t CalcTableChecksum (const HBUINT32 *Table, uint32_t Length)
{
uint32_t Sum = 0L;
- const HBUINT32 *EndPtr = Table+((Length+3) & ~3) / HBUINT32::static_size;
+ assert (0 == (Length & 3));
+ const HBUINT32 *EndPtr = Table + Length / HBUINT32::static_size;
while (Table < EndPtr)
Sum += *Table++;
@@ -786,9 +820,7 @@ struct OffsetTo : Offset<OffsetType>
inline Type& serialize (hb_serialize_context_t *c, const void *base)
{
- Type *t = c->start_embed<Type> ();
- this->set ((char *) t - (char *) base); /* TODO(serialize) Overflow? */
- return *t;
+ return * (Type *) Offset<OffsetType>::serialize (c, base);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
@@ -876,7 +908,7 @@ struct ArrayOf
if (unlikely (!serialize (c, items_len))) return_trace (false);
for (unsigned int i = 0; i < items_len; i++)
array[i] = items[i];
- items.advance (items_len);
+ items += items_len;
return_trace (true);
}
@@ -928,6 +960,11 @@ struct ArrayOf
return -1;
}
+ inline void qsort (void)
+ {
+ ::qsort (array, len, sizeof (Type), Type::cmp);
+ }
+
private:
inline bool sanitize_shallow (hb_sanitize_context_t *c) const
{
@@ -994,7 +1031,7 @@ struct HeadlessArrayOf
if (unlikely (!c->extend (*this))) return_trace (false);
for (unsigned int i = 0; i < items_len - 1; i++)
array[i] = items[i];
- items.advance (items_len - 1);
+ items += items_len - 1;
return_trace (true);
}
@@ -1072,6 +1109,17 @@ struct BinSearchHeader
return_trace (c->check_struct (this));
}
+ inline void set (unsigned int v)
+ {
+ len.set (v);
+ assert (len == v);
+ entrySelectorZ.set (MAX (1u, _hb_bit_storage (v)) - 1);
+ searchRangeZ.set (16 * (1u << entrySelectorZ));
+ rangeShiftZ.set (v * 16 > searchRangeZ
+ ? 16 * v - searchRangeZ
+ : 0);
+ }
+
protected:
HBUINT16 len;
HBUINT16 searchRangeZ;
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 b9d6e248ae9..02079898683 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
@@ -28,7 +28,7 @@
#define HB_OT_CMAP_TABLE_HH
#include "hb-open-type-private.hh"
-
+#include "hb-subset-plan.hh"
namespace OT {
@@ -61,7 +61,7 @@ struct CmapSubtableFormat0
HBUINT16 format; /* Format number is set to 0. */
HBUINT16 lengthZ; /* Byte length of this subtable. */
HBUINT16 languageZ; /* Ignore. */
- HBUINT8 glyphIdArray[256];/* An array that maps character
+ HBUINT8 glyphIdArray[256];/* An array that maps character
* code to glyph index values. */
public:
DEFINE_SIZE_STATIC (6 + 256);
@@ -193,6 +193,7 @@ struct CmapSubtableLongGroup
{
friend struct CmapSubtableFormat12;
friend struct CmapSubtableFormat13;
+ friend struct cmap;
int cmp (hb_codepoint_t codepoint) const
{
@@ -253,6 +254,8 @@ struct CmapSubtableFormat10 : CmapSubtableTrimmed<HBUINT32 > {};
template <typename T>
struct CmapSubtableLongSegmented
{
+ friend struct cmap;
+
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
int i = groups.bsearch (codepoint);
@@ -268,6 +271,16 @@ struct CmapSubtableLongSegmented
return_trace (c->check_struct (this) && groups.sanitize (c));
}
+ inline bool serialize (hb_serialize_context_t *c,
+ hb_prealloced_array_t<CmapSubtableLongGroup> &group_data)
+ {
+ TRACE_SERIALIZE (this);
+ if (unlikely (!c->extend_min (*this))) return_trace (false);
+ Supplier<CmapSubtableLongGroup> supplier (group_data.array, group_data.len);
+ if (unlikely (!groups.serialize (c, supplier, group_data.len))) return_trace (false);
+ return true;
+ }
+
protected:
HBUINT16 format; /* Subtable format; set to 12. */
HBUINT16 reservedZ; /* Reserved; set to 0. */
@@ -422,12 +435,12 @@ struct CmapSubtable
hb_codepoint_t *glyph) const
{
switch (u.format) {
- case 0: return u.format0 .get_glyph(codepoint, glyph);
- case 4: return u.format4 .get_glyph(codepoint, glyph);
- case 6: return u.format6 .get_glyph(codepoint, glyph);
- case 10: return u.format10.get_glyph(codepoint, glyph);
- case 12: return u.format12.get_glyph(codepoint, glyph);
- case 13: return u.format13.get_glyph(codepoint, glyph);
+ case 0: return u.format0 .get_glyph (codepoint, glyph);
+ case 4: return u.format4 .get_glyph (codepoint, glyph);
+ case 6: return u.format6 .get_glyph (codepoint, glyph);
+ case 10: return u.format10.get_glyph (codepoint, glyph);
+ case 12: return u.format12.get_glyph (codepoint, glyph);
+ case 13: return u.format13.get_glyph (codepoint, glyph);
case 14:
default: return false;
}
@@ -504,6 +517,114 @@ struct cmap
encodingRecord.sanitize (c, this));
}
+ inline bool populate_groups (hb_subset_plan_t *plan,
+ hb_prealloced_array_t<CmapSubtableLongGroup> *groups) const
+ {
+ CmapSubtableLongGroup *group = nullptr;
+ for (unsigned int i = 0; i < plan->codepoints.len; i++) {
+
+ hb_codepoint_t cp = plan->codepoints[i];
+ if (!group || cp - 1 != group->endCharCode)
+ {
+ group = groups->push ();
+ group->startCharCode.set (cp);
+ group->endCharCode.set (cp);
+ hb_codepoint_t new_gid;
+ if (unlikely (!hb_subset_plan_new_gid_for_codepoint (plan, cp, &new_gid)))
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Unable to find new gid for %04x", cp);
+ return false;
+ }
+ group->glyphID.set (new_gid);
+ } else
+ {
+ group->endCharCode.set (cp);
+ }
+ }
+
+ DEBUG_MSG(SUBSET, nullptr, "cmap");
+ for (unsigned int i = 0; i < groups->len; i++) {
+ CmapSubtableLongGroup& group = (*groups)[i];
+ DEBUG_MSG(SUBSET, nullptr, " %d: U+%04X-U+%04X, gid %d-%d", i, (uint32_t) group.startCharCode, (uint32_t) group.endCharCode, (uint32_t) group.glyphID, (uint32_t) group.glyphID + ((uint32_t) group.endCharCode - (uint32_t) group.startCharCode));
+ }
+
+ return true;
+ }
+
+ inline bool _subset (hb_prealloced_array_t<CmapSubtableLongGroup> &groups,
+ size_t dest_sz,
+ void *dest) const
+ {
+ hb_serialize_context_t c (dest, dest_sz);
+
+ OT::cmap *cmap = c.start_serialize<OT::cmap> ();
+ if (unlikely (!c.extend_min (*cmap)))
+ {
+ return false;
+ }
+
+ cmap->version.set (0);
+
+ if (unlikely (!cmap->encodingRecord.serialize (&c, /* numTables */ 1))) return false;
+
+ EncodingRecord &rec = cmap->encodingRecord[0];
+ rec.platformID.set (3); // Windows
+ rec.encodingID.set (10); // Unicode UCS-4
+
+ /* capture offset to subtable */
+ CmapSubtable &subtable = rec.subtable.serialize (&c, cmap);
+
+ subtable.u.format.set (12);
+
+ CmapSubtableFormat12 &format12 = subtable.u.format12;
+ if (unlikely (!c.extend_min (format12))) return false;
+
+ format12.format.set (12);
+ format12.reservedZ.set (0);
+ format12.lengthZ.set (16 + 12 * groups.len);
+
+ if (unlikely (!format12.serialize (&c, groups))) return false;
+
+ c.end_serialize ();
+
+ return true;
+ }
+
+ inline bool subset (hb_subset_plan_t *plan) const
+ {
+ hb_auto_array_t<CmapSubtableLongGroup> groups;
+
+ if (unlikely (!populate_groups (plan, &groups))) return false;
+
+ // We now know how big our blob needs to be
+ // TODO use APIs from the structs to get size?
+ size_t dest_sz = 4 // header
+ + 8 // 1 EncodingRecord
+ + 16 // Format 12 header
+ + 12 * groups.len; // SequentialMapGroup records
+ void *dest = malloc (dest_sz);
+ if (unlikely (!dest)) {
+ DEBUG_MSG(SUBSET, nullptr, "Unable to alloc %lu for cmap subset output", (unsigned long) dest_sz);
+ return false;
+ }
+
+ if (unlikely (!_subset (groups, dest_sz, dest)))
+ {
+ free (dest);
+ return false;
+ }
+
+ // all done, write the blob into dest
+ hb_blob_t *cmap_prime = hb_blob_create ((const char *)dest,
+ dest_sz,
+ HB_MEMORY_MODE_READONLY,
+ dest,
+ free);
+ bool result = hb_subset_plan_add_table (plan, HB_OT_TAG_cmap, cmap_prime);
+ hb_blob_destroy (cmap_prime);
+ return result;
+ }
+
struct accelerator_t
{
inline void init (hb_face_t *face)
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-color-cbdt-table.hh
index 6c2b9a88ee1..e7ab917e06e 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cbdt-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh
@@ -24,8 +24,8 @@
* Google Author(s): Seigo Nonaka
*/
-#ifndef HB_OT_CBDT_TABLE_HH
-#define HB_OT_CBDT_TABLE_HH
+#ifndef HB_OT_COLOR_CBDT_TABLE_HH
+#define HB_OT_COLOR_CBDT_TABLE_HH
#include "hb-open-type-private.hh"
@@ -377,7 +377,7 @@ struct CBDT
{
inline void init (hb_face_t *face)
{
- upem = face->get_upem();
+ upem = hb_face_get_upem (face);
cblc_blob = Sanitizer<CBLC>().sanitize (face->reference_table (HB_OT_TAG_CBLC));
cbdt_blob = Sanitizer<CBDT>().sanitize (face->reference_table (HB_OT_TAG_CBDT));
@@ -468,4 +468,4 @@ struct CBDT
} /* namespace OT */
-#endif /* HB_OT_CBDT_TABLE_HH */
+#endif /* HB_OT_COLOR_CBDT_TABLE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh
new file mode 100644
index 00000000000..2c3b1cccae9
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh
@@ -0,0 +1,142 @@
+/*
+ * Copyright © 2018 Ebrahim Byagowi
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#ifndef HB_OT_COLOR_COLR_TABLE_HH
+#define HB_OT_COLOR_COLR_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+/*
+ * Color Palette
+ * http://www.microsoft.com/typography/otspec/colr.htm
+ */
+
+#define HB_OT_TAG_COLR HB_TAG('C','O','L','R')
+
+namespace OT {
+
+
+struct LayerRecord
+{
+ friend struct COLR;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ GlyphID gID; /* Glyph ID of layer glyph */
+ HBUINT16 paletteIndex; /* Index value to use with a selected color palette */
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct BaseGlyphRecord
+{
+ friend struct COLR;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ GlyphID gID; /* Glyph ID of reference glyph */
+ HBUINT16 firstLayerIndex; /* Index to the layer record */
+ HBUINT16 numLayers; /* Number of color layers associated with this glyph */
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct COLR
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_COLR;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!(c->check_struct (this) &&
+ c->check_array ((const void*) &layerRecordsOffsetZ, sizeof (LayerRecord), numLayerRecords) &&
+ c->check_array ((const void*) &baseGlyphRecordsZ, sizeof (BaseGlyphRecord), numBaseGlyphRecords)))
+ return_trace (false);
+
+ const BaseGlyphRecord* base_glyph_records = &baseGlyphRecordsZ (this);
+ for (unsigned int i = 0; i < numBaseGlyphRecords; ++i)
+ if (base_glyph_records[i].firstLayerIndex +
+ base_glyph_records[i].numLayers > numLayerRecords)
+ return_trace (false);
+
+ return_trace (true);
+ }
+
+ inline bool get_base_glyph_record (
+ hb_codepoint_t glyph_id, unsigned int &first_layer, unsigned int &num_layers) const
+ {
+ const BaseGlyphRecord* base_glyph_records = &baseGlyphRecordsZ (this);
+ unsigned int min = 0, max = numBaseGlyphRecords - 1;
+ while (min <= max)
+ {
+ unsigned int mid = (min + max) / 2;
+ hb_codepoint_t gID = base_glyph_records[mid].gID;
+ if (gID > glyph_id)
+ max = mid - 1;
+ else if (gID < glyph_id)
+ min = mid + 1;
+ else
+ {
+ first_layer = base_glyph_records[mid].firstLayerIndex;
+ num_layers = base_glyph_records[mid].numLayers;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ inline void get_layer_record (int layer,
+ hb_codepoint_t &glyph_id, unsigned int &palette_index) const
+ {
+ const LayerRecord* records = &layerRecordsOffsetZ (this);
+ glyph_id = records[layer].gID;
+ palette_index = records[layer].paletteIndex;
+ }
+
+ protected:
+ HBUINT16 version; /* Table version number */
+ HBUINT16 numBaseGlyphRecords; /* Number of Base Glyph Records */
+ LOffsetTo<BaseGlyphRecord>
+ baseGlyphRecordsZ; /* Offset to Base Glyph records. */
+ LOffsetTo<LayerRecord>
+ layerRecordsOffsetZ; /* Offset to Layer Records */
+ HBUINT16 numLayerRecords; /* Number of Layer Records */
+ public:
+ DEFINE_SIZE_STATIC (14);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_COLOR_COLR_TABLE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh
new file mode 100644
index 00000000000..e364c8a44d3
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2016 Google, Inc.
+ * Copyright © 2018 Ebrahim Byagowi
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Sascha Brawer
+ */
+
+#ifndef HB_OT_COLOR_CPAL_TABLE_HH
+#define HB_OT_COLOR_CPAL_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+
+/*
+ * Following parts to be moved to a public header.
+ */
+
+/**
+ * hb_ot_color_t:
+ * ARGB data type for holding color values.
+ *
+ * Since: REPLACEME
+ */
+typedef uint32_t hb_ot_color_t;
+
+
+/**
+ * hb_ot_color_palette_flags_t:
+ * @HB_OT_COLOR_PALETTE_FLAG_DEFAULT: default indicating that there is nothing special to note about a color palette.
+ * @HB_OT_COLOR_PALETTE_FLAG_FOR_LIGHT_BACKGROUND: flag indicating that the color palette is suitable for rendering text on light background.
+ * @HB_OT_COLOR_PALETTE_FLAG_FOR_DARK_BACKGROUND: flag indicating that the color palette is suitable for rendering text on dark background.
+ *
+ * Since: REPLACEME
+ */
+typedef enum { /*< flags >*/
+ HB_OT_COLOR_PALETTE_FLAG_DEFAULT = 0x00000000u,
+ HB_OT_COLOR_PALETTE_FLAG_FOR_LIGHT_BACKGROUND = 0x00000001u,
+ HB_OT_COLOR_PALETTE_FLAG_FOR_DARK_BACKGROUND = 0x00000002u,
+} hb_ot_color_palette_flags_t;
+
+// HB_EXTERN unsigned int
+// hb_ot_color_get_palette_count (hb_face_t *face);
+
+// HB_EXTERN unsigned int
+// hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette);
+
+// HB_EXTERN hb_ot_color_palette_flags_t
+// hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette);
+
+// HB_EXTERN unsigned int
+// hb_ot_color_get_palette_colors (hb_face_t *face,
+// unsigned int palette, /* default=0 */
+// unsigned int start_offset,
+// unsigned int *color_count /* IN/OUT */,
+// hb_ot_color_t *colors /* OUT */);
+
+
+
+
+
+/*
+ * Color Palette
+ * http://www.microsoft.com/typography/otspec/cpal.htm
+ */
+
+#define HB_OT_TAG_CPAL HB_TAG('C','P','A','L')
+
+namespace OT {
+
+
+struct CPALV1Tail
+{
+ friend struct CPAL;
+
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int palettes) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (
+ c->check_struct (this) &&
+ c->check_array ((const void*) &paletteFlags, sizeof (HBUINT32), palettes) &&
+ c->check_array ((const void*) &paletteLabel, sizeof (HBUINT16), palettes) &&
+ c->check_array ((const void*) &paletteEntryLabel, sizeof (HBUINT16), palettes));
+ }
+
+ private:
+ inline hb_ot_color_palette_flags_t
+ get_palette_flags (const void *base, unsigned int palette) const
+ {
+ const HBUINT32* flags = &paletteFlags (base);
+ return (hb_ot_color_palette_flags_t) (uint32_t) flags[palette];
+ }
+
+ inline unsigned int
+ get_palette_name_id (const void *base, unsigned int palette) const
+ {
+ const HBUINT16* name_ids = &paletteLabel (base);
+ return name_ids[palette];
+ }
+
+ protected:
+ LOffsetTo<HBUINT32> paletteFlags;
+ LOffsetTo<HBUINT16> paletteLabel;
+ LOffsetTo<HBUINT16> paletteEntryLabel;
+ public:
+ DEFINE_SIZE_STATIC (12);
+};
+
+typedef HBUINT32 BGRAColor;
+
+struct CPAL
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_CPAL;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!(c->check_struct (this) && // This checks colorRecordIndicesX sanity also, see #get_size
+ c->check_array ((const void*) &colorRecordsZ, sizeof (BGRAColor), numColorRecords)))
+ return_trace (false);
+
+ // Check for indices sanity so no need for doing it runtime
+ for (unsigned int i = 0; i < numPalettes; ++i)
+ if (colorRecordIndicesX[i] + numPaletteEntries > numColorRecords)
+ return_trace (false);
+
+ // If version is zero, we are done here; otherwise we need to check tail also
+ if (version == 0)
+ return_trace (true);
+
+ const CPALV1Tail &v1 = StructAfter<CPALV1Tail> (*this);
+ return_trace (v1.sanitize (c, numPalettes));
+ }
+
+ inline unsigned int get_size (void) const
+ {
+ return min_size + numPalettes * sizeof (HBUINT16);
+ }
+
+ inline hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette) const
+ {
+ if (version == 0 || palette >= numPalettes)
+ return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
+
+ const CPALV1Tail& cpal1 = StructAfter<CPALV1Tail> (*this);
+ return cpal1.get_palette_flags (this, palette);
+ }
+
+ inline unsigned int get_palette_name_id (unsigned int palette) const
+ {
+ if (version == 0 || palette >= numPalettes)
+ return 0xFFFF;
+
+ const CPALV1Tail& cpal1 = StructAfter<CPALV1Tail> (*this);
+ return cpal1.get_palette_name_id (this, palette);
+ }
+
+ inline unsigned int get_palette_count () const
+ {
+ return numPalettes;
+ }
+
+ inline hb_ot_color_t get_color_record_argb (unsigned int color_index, unsigned int palette) const
+ {
+ if (color_index >= numPaletteEntries || palette >= numPalettes)
+ return 0;
+
+ const BGRAColor* records = &colorRecordsZ(this);
+ // No need for more range check as it is already done on #sanitize
+ return records[colorRecordIndicesX[palette] + color_index];
+ }
+
+ protected:
+ HBUINT16 version;
+ /* Version 0 */
+ HBUINT16 numPaletteEntries;
+ HBUINT16 numPalettes;
+ HBUINT16 numColorRecords;
+ LOffsetTo<HBUINT32> colorRecordsZ;
+ HBUINT16 colorRecordIndicesX[VAR]; // VAR=numPalettes
+/*CPALV1Tail v1[VAR];*/
+ public:
+ DEFINE_SIZE_ARRAY (12, colorRecordIndicesX);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_COLOR_CPAL_TABLE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc
new file mode 100644
index 00000000000..ceebe0b7a02
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc
@@ -0,0 +1,183 @@
+/*
+ * Copyright © 2016 Google, Inc.
+ * Copyright © 2018 Ebrahim Byagowi
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Sascha Brawer
+ */
+
+#include "hb-open-type-private.hh"
+#include "hb-ot-color-colr-table.hh"
+#include "hb-ot-color-cpal-table.hh"
+#include "hb-ot.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "hb-ot-layout-private.hh"
+#include "hb-shaper-private.hh"
+
+#if 0
+HB_MARK_AS_FLAG_T (hb_ot_color_palette_flags_t)
+//HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) Hmm?
+
+
+static inline const OT::COLR&
+_get_colr (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::COLR);
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ return *(layout->colr.get ());
+}
+
+static inline const OT::CPAL&
+_get_cpal (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::CPAL);
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ return *(layout->cpal.get ());
+}
+
+
+/**
+ * hb_ot_color_get_palette_count:
+ * @face: a font face.
+ *
+ * Returns: the number of color palettes in @face, or zero if @face has
+ * no colors.
+ *
+ * Since: REPLACEME
+ */
+unsigned int
+hb_ot_color_get_palette_count (hb_face_t *face)
+{
+ const OT::CPAL& cpal = _get_cpal (face);
+ return cpal.get_palette_count ();
+}
+
+
+/**
+ * hb_ot_color_get_palette_name_id:
+ * @face: a font face.
+ * @palette: the index of the color palette whose name is being requested.
+ *
+ * Retrieves the name id of a color palette. For example, a color font can
+ * have themed palettes like "Spring", "Summer", "Fall", and "Winter".
+ *
+ * Returns: an identifier within @face's `name` table.
+ * If the requested palette has no name, or if @face has no colors,
+ * or if @palette is not between 0 and hb_ot_color_get_palette_count(),
+ * the result is 0xFFFF. The implementation does not check whether
+ * the returned palette name id is actually in @face's `name` table.
+ *
+ * Since: REPLACEME
+ */
+unsigned int
+hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette)
+{
+ const OT::CPAL& cpal = _get_cpal (face);
+ return cpal.get_palette_name_id (palette);
+}
+
+
+/**
+ * hb_ot_color_get_palette_flags:
+ * @face: a font face
+ * @palette: the index of the color palette whose flags are being requested
+ *
+ * Returns: the flags for the requested color palette. If @face has no colors,
+ * or if @palette is not between 0 and hb_ot_color_get_palette_count(),
+ * the result is #HB_OT_COLOR_PALETTE_FLAG_DEFAULT.
+ *
+ * Since: REPLACEME
+ */
+hb_ot_color_palette_flags_t
+hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette)
+{
+ const OT::CPAL& cpal = _get_cpal(face);
+ return cpal.get_palette_flags (palette);
+}
+
+
+/**
+ * hb_ot_color_get_palette_colors:
+ * @face: a font face.
+ * @palette: the index of the color palette whose colors
+ * are being requested.
+ * @start_offset: the index of the first color being requested.
+ * @color_count: (inout) (optional): on input, how many colors
+ * can be maximally stored into the @colors array;
+ * on output, how many colors were actually stored.
+ * @colors: (array length=color_count) (optional):
+ * an array of #hb_ot_color_t records. After calling
+ * this function, @colors will be filled with
+ * the palette colors. If @colors is NULL, the function
+ * will just return the number of total colors
+ * without storing any actual colors; this can be used
+ * for allocating a buffer of suitable size before calling
+ * hb_ot_color_get_palette_colors() a second time.
+ *
+ * Retrieves the colors in a color palette.
+ *
+ * Returns: the total number of colors in the palette. All palettes in
+ * a font have the same number of colors. If @face has no colors, or if
+ * @palette is not between 0 and hb_ot_color_get_palette_count(),
+ * the result is zero.
+ *
+ * Since: REPLACEME
+ */
+unsigned int
+hb_ot_color_get_palette_colors (hb_face_t *face,
+ unsigned int palette, /* default=0 */
+ unsigned int start_offset,
+ unsigned int *color_count /* IN/OUT */,
+ hb_ot_color_t *colors /* OUT */)
+{
+ const OT::CPAL& cpal = _get_cpal(face);
+ if (unlikely (palette >= cpal.numPalettes))
+ {
+ if (color_count) *color_count = 0;
+ return 0;
+ }
+
+ const OT::ColorRecord* crec = &cpal.offsetFirstColorRecord (&cpal);
+ crec += cpal.colorRecordIndices[palette];
+
+ unsigned int num_results = 0;
+ if (likely (color_count && colors))
+ {
+ for (unsigned int i = start_offset;
+ i < cpal.numPaletteEntries && num_results < *color_count; ++i)
+ {
+ hb_ot_color_t* result = &colors[num_results];
+ result->red = crec[i].red;
+ result->green = crec[i].green;
+ result->blue = crec[i].blue;
+ result->alpha = crec[i].alpha;
+ ++num_results;
+ }
+ }
+
+ if (likely (color_count)) *color_count = num_results;
+ return cpal.numPaletteEntries;
+}
+#endif
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 9864064b112..0e373d30f92 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
@@ -31,12 +31,13 @@
#include "hb-font-private.hh"
#include "hb-ot-cmap-table.hh"
-#include "hb-ot-cbdt-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-kern-table.hh"
#include "hb-ot-post-table.hh"
+#include "hb-ot-color-cbdt-table.hh"
+
struct hb_ot_font_t
{
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 67143c6393a..d62f24bd916 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
@@ -29,7 +29,9 @@
#include "hb-open-type-private.hh"
#include "hb-ot-head-table.hh"
-
+#include "hb-subset-glyf.hh"
+#include "hb-subset-plan.hh"
+#include "hb-subset-private.hh"
namespace OT {
@@ -78,12 +80,50 @@ struct glyf
return_trace (true);
}
+ inline bool subset (hb_subset_plan_t *plan) const
+ {
+ hb_blob_t *glyf_prime = nullptr;
+ hb_blob_t *loca_prime = nullptr;
+
+ bool success = true;
+ bool use_short_loca = false;
+ if (hb_subset_glyf_and_loca (plan, &use_short_loca, &glyf_prime, &loca_prime)) {
+ success = success && hb_subset_plan_add_table (plan, HB_OT_TAG_glyf, glyf_prime);
+ success = success && hb_subset_plan_add_table (plan, HB_OT_TAG_loca, loca_prime);
+ success = success && _add_head_and_set_loca_version (plan->source, use_short_loca, plan->dest);
+ } else {
+ success = false;
+ }
+ hb_blob_destroy (loca_prime);
+ hb_blob_destroy (glyf_prime);
+
+ return success;
+ }
+
+ static bool
+ _add_head_and_set_loca_version (hb_face_t *source, bool use_short_loca, hb_face_t *dest)
+ {
+ hb_blob_t *head_blob = OT::Sanitizer<OT::head>().sanitize (hb_face_reference_table (source, HB_OT_TAG_head));
+ hb_blob_t *head_prime_blob = hb_blob_copy_writable_or_fail (head_blob);
+ hb_blob_destroy (head_blob);
+
+ if (unlikely (!head_prime_blob))
+ return false;
+
+ OT::head *head_prime = (OT::head *) hb_blob_get_data_writable (head_prime_blob, nullptr);
+ head_prime->indexToLocFormat.set (use_short_loca ? 0 : 1);
+ bool success = hb_subset_face_add_table (dest, HB_OT_TAG_head, head_prime_blob);
+
+ hb_blob_destroy (head_prime_blob);
+ return success;
+ }
+
struct GlyphHeader
{
HBINT16 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. */
+ * 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. */
@@ -92,6 +132,102 @@ struct glyf
DEFINE_SIZE_STATIC (10);
};
+ struct CompositeGlyphHeader
+ {
+ static const uint16_t ARG_1_AND_2_ARE_WORDS = 0x0001;
+ static const uint16_t ARGS_ARE_XY_VALUES = 0x0002;
+ static const uint16_t ROUND_XY_TO_GRID = 0x0004;
+ static const uint16_t WE_HAVE_A_SCALE = 0x0008;
+ static const uint16_t MORE_COMPONENTS = 0x0020;
+ static const uint16_t WE_HAVE_AN_X_AND_Y_SCALE = 0x0040;
+ static const uint16_t WE_HAVE_A_TWO_BY_TWO = 0x0080;
+ static const uint16_t WE_HAVE_INSTRUCTIONS = 0x0100;
+ static const uint16_t USE_MY_METRICS = 0x0200;
+ static const uint16_t OVERLAP_COMPOUND = 0x0400;
+ static const uint16_t SCALED_COMPONENT_OFFSET = 0x0800;
+ static const uint16_t UNSCALED_COMPONENT_OFFSET = 0x1000;
+
+ HBUINT16 flags;
+ HBUINT16 glyphIndex;
+
+ inline unsigned int get_size (void) const
+ {
+ unsigned int size = min_size;
+ if (flags & ARG_1_AND_2_ARE_WORDS) {
+ // arg1 and 2 are int16
+ size += 4;
+ } else {
+ // arg1 and 2 are int8
+ size += 2;
+ }
+ if (flags & WE_HAVE_A_SCALE) {
+ // One x 16 bit (scale)
+ size += 2;
+ } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
+ // Two x 16 bit (xscale, yscale)
+ size += 4;
+ } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
+ // Four x 16 bit (xscale, scale01, scale10, yscale)
+ size += 8;
+ }
+ return size;
+ }
+
+ struct Iterator
+ {
+ const char *glyph_start;
+ const char *glyph_end;
+ const CompositeGlyphHeader *current;
+
+ inline bool move_to_next ()
+ {
+ if (current->flags & CompositeGlyphHeader::MORE_COMPONENTS)
+ {
+ const CompositeGlyphHeader *possible =
+ &StructAfter<CompositeGlyphHeader, CompositeGlyphHeader> (*current);
+ if (!in_range (possible))
+ return false;
+ current = possible;
+ return true;
+ }
+ return false;
+ }
+
+ inline bool in_range (const CompositeGlyphHeader *composite) const
+ {
+ return (const char *) composite >= glyph_start
+ && ((const char *) composite + CompositeGlyphHeader::min_size) <= glyph_end
+ && ((const char *) composite + composite->get_size()) <= glyph_end;
+ }
+ };
+
+ static inline bool get_iterator (const char * glyph_data,
+ unsigned int length,
+ CompositeGlyphHeader::Iterator *iterator /* OUT */)
+ {
+ if (length < GlyphHeader::static_size)
+ return false; /* Empty glyph; zero extents. */
+
+ const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyph_data, 0);
+ if (glyph_header.numberOfContours < 0)
+ {
+ const CompositeGlyphHeader *possible =
+ &StructAfter<CompositeGlyphHeader, GlyphHeader> (glyph_header);
+
+ iterator->glyph_start = glyph_data;
+ iterator->glyph_end = (const char *) glyph_data + length;
+ if (!iterator->in_range (possible))
+ return false;
+ iterator->current = possible;
+ return true;
+ }
+
+ return false;
+ }
+
+ DEFINE_SIZE_MIN (4);
+ };
+
struct accelerator_t
{
inline void init (hb_face_t *face)
@@ -122,29 +258,186 @@ struct glyf
hb_blob_destroy (glyf_blob);
}
- inline bool get_extents (hb_codepoint_t glyph,
- hb_glyph_extents_t *extents) const
+ /*
+ * Returns true if the referenced glyph is a valid glyph and a composite glyph.
+ * If true is returned a pointer to the composite glyph will be written into
+ * composite.
+ */
+ inline bool get_composite (hb_codepoint_t glyph,
+ CompositeGlyphHeader::Iterator *composite /* OUT */) const
+ {
+ unsigned int start_offset, end_offset;
+ if (!get_offsets (glyph, &start_offset, &end_offset))
+ return false; /* glyph not found */
+
+ return CompositeGlyphHeader::get_iterator ((const char*) this->glyf_table + start_offset,
+ end_offset - start_offset,
+ composite);
+ }
+
+ /* based on FontTools _g_l_y_f.py::trim */
+ inline bool remove_padding(unsigned int start_offset,
+ unsigned int *end_offset) const
+ {
+ static const int FLAG_X_SHORT = 0x02;
+ static const int FLAG_Y_SHORT = 0x04;
+ static const int FLAG_REPEAT = 0x08;
+ static const int FLAG_X_SAME = 0x10;
+ static const int FLAG_Y_SAME = 0x20;
+
+ if (*end_offset - start_offset < GlyphHeader::static_size)
+ return true;
+
+ const char *glyph = ((const char *) glyf_table) + start_offset;
+ const char * const glyph_end = glyph + (*end_offset - start_offset);
+ const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyph, 0);
+ int16_t num_contours = (int16_t) glyph_header.numberOfContours;
+
+ if (num_contours < 0)
+ /* Trimming for composites not implemented.
+ * If removing hints it falls out of that. */
+ return true;
+ else if (num_contours > 0)
+ {
+ /* simple glyph w/contours, possibly trimmable */
+ glyph += GlyphHeader::static_size + 2 * num_contours;
+
+ if (unlikely (glyph + 2 >= glyph_end)) return false;
+ uint16_t nCoordinates = (uint16_t) StructAtOffset<HBUINT16>(glyph - 2, 0) + 1;
+ uint16_t nInstructions = (uint16_t) StructAtOffset<HBUINT16>(glyph, 0);
+
+ glyph += 2 + nInstructions;
+ if (unlikely (glyph + 2 >= glyph_end)) return false;
+
+ unsigned int coordBytes = 0;
+ unsigned int coordsWithFlags = 0;
+ while (glyph < glyph_end)
+ {
+ uint8_t flag = (uint8_t) *glyph;
+ glyph++;
+
+ unsigned int repeat = 1;
+ if (flag & FLAG_REPEAT)
+ {
+ if (glyph >= glyph_end)
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Bad flag");
+ return false;
+ }
+ repeat = ((uint8_t) *glyph) + 1;
+ glyph++;
+ }
+
+ unsigned int xBytes, yBytes;
+ xBytes = yBytes = 0;
+ if (flag & FLAG_X_SHORT)
+ xBytes = 1;
+ else if ((flag & FLAG_X_SAME) == 0)
+ xBytes = 2;
+
+ if (flag & FLAG_Y_SHORT)
+ yBytes = 1;
+ else if ((flag & FLAG_Y_SAME) == 0)
+ yBytes = 2;
+
+ coordBytes += (xBytes + yBytes) * repeat;
+ coordsWithFlags += repeat;
+ if (coordsWithFlags >= nCoordinates)
+ break;
+ }
+
+ if (coordsWithFlags != nCoordinates)
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Expect %d coords to have flags, got flags for %d", nCoordinates, coordsWithFlags);
+ return false;
+ }
+ glyph += coordBytes;
+
+ if (glyph < glyph_end)
+ *end_offset -= glyph_end - glyph;
+ }
+ return true;
+ }
+
+ inline bool get_offsets (hb_codepoint_t glyph,
+ unsigned int *start_offset /* OUT */,
+ unsigned int *end_offset /* OUT */) const
{
if (unlikely (glyph >= num_glyphs))
return false;
- unsigned int start_offset, end_offset;
if (short_offset)
{
const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataX;
- start_offset = 2 * offsets[glyph];
- end_offset = 2 * offsets[glyph + 1];
+ *start_offset = 2 * offsets[glyph];
+ *end_offset = 2 * offsets[glyph + 1];
}
else
{
const HBUINT32 *offsets = (const HBUINT32 *) loca_table->dataX;
- start_offset = offsets[glyph];
- end_offset = offsets[glyph + 1];
+
+ *start_offset = offsets[glyph];
+ *end_offset = offsets[glyph + 1];
}
- if (start_offset > end_offset || end_offset > glyf_len)
+ if (*start_offset > *end_offset || *end_offset > glyf_len)
return false;
+ return true;
+ }
+
+ inline bool get_instruction_offsets(unsigned int start_offset,
+ unsigned int end_offset,
+ unsigned int *instruction_start /* OUT */,
+ unsigned int *instruction_end /* OUT */) const
+ {
+ if (end_offset - start_offset < GlyphHeader::static_size)
+ {
+ *instruction_start = 0;
+ *instruction_end = 0;
+ return true; /* Empty glyph; no instructions. */
+ }
+ const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyf_table, start_offset);
+ int16_t num_contours = (int16_t) glyph_header.numberOfContours;
+ if (num_contours < 0)
+ {
+ CompositeGlyphHeader::Iterator composite_it;
+ if (unlikely (!CompositeGlyphHeader::get_iterator (
+ (const char*) this->glyf_table + start_offset,
+ end_offset - start_offset, &composite_it))) return false;
+ const CompositeGlyphHeader *last;
+ do {
+ last = composite_it.current;
+ } while (composite_it.move_to_next());
+
+ if ( (uint16_t) last->flags & CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS)
+ *instruction_start = ((char *) last - (char *) glyf_table->dataX) + last->get_size();
+ else
+ *instruction_start = end_offset;
+ *instruction_end = end_offset;
+ if (unlikely (*instruction_start > *instruction_end))
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Invalid instruction offset, %d is outside [%d, %d]", *instruction_start, start_offset, end_offset);
+ return false;
+ }
+ }
+ else
+ {
+ unsigned int instruction_length_offset = start_offset + GlyphHeader::static_size + 2 * num_contours;
+ const HBUINT16 &instruction_length = StructAtOffset<HBUINT16> (glyf_table, instruction_length_offset);
+ *instruction_start = instruction_length_offset + 2;
+ *instruction_end = *instruction_start + (uint16_t) instruction_length;
+ }
+ return true;
+ }
+
+ inline bool get_extents (hb_codepoint_t glyph,
+ hb_glyph_extents_t *extents) const
+ {
+ unsigned int start_offset, end_offset;
+ if (!get_offsets (glyph, &start_offset, &end_offset))
+ return false;
+
if (end_offset - start_offset < GlyphHeader::static_size)
return true; /* Empty glyph; zero extents. */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh
new file mode 100644
index 00000000000..f08fe39d8be
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh
@@ -0,0 +1,198 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger
+ */
+
+#ifndef HB_OT_HDMX_TABLE_HH
+#define HB_OT_HDMX_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+namespace OT {
+
+
+/*
+ * hdmx - Horizontal Device Metric
+ */
+
+#define HB_OT_TAG_hdmx HB_TAG('h','d','m','x')
+
+struct DeviceRecord
+{
+ struct SubsetView
+ {
+ const DeviceRecord *source_device_record;
+ hb_subset_plan_t *subset_plan;
+
+ inline void init(const DeviceRecord *source_device_record,
+ hb_subset_plan_t *subset_plan)
+ {
+ this->source_device_record = source_device_record;
+ this->subset_plan = subset_plan;
+ }
+
+ inline unsigned int len () const
+ {
+ return this->subset_plan->gids_to_retain_sorted.len;
+ }
+
+ inline const HBUINT8& operator [] (unsigned int i) const
+ {
+ if (unlikely (i >= len())) return Null(HBUINT8);
+ hb_codepoint_t gid = this->subset_plan->gids_to_retain_sorted [i];
+ return this->source_device_record->widths[gid];
+ }
+ };
+
+ static inline unsigned int get_size (unsigned int count)
+ {
+ unsigned int raw_size = min_size + count * HBUINT8::static_size;
+ if (raw_size % 4)
+ /* Align to 32 bits */
+ return raw_size + (4 - (raw_size % 4));
+ return raw_size;
+ }
+
+ inline bool serialize (hb_serialize_context_t *c, const SubsetView &subset_view)
+ {
+ TRACE_SERIALIZE (this);
+
+ if (unlikely (!c->allocate_size<DeviceRecord> (get_size (subset_view.len()))))
+ return_trace (false);
+
+ this->pixel_size.set (subset_view.source_device_record->pixel_size);
+ this->max_width.set (subset_view.source_device_record->max_width);
+
+ for (unsigned int i = 0; i < subset_view.len(); i++)
+ widths[i].set (subset_view[i]);
+
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int size_device_record) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this) &&
+ c->check_range (this, size_device_record)));
+ }
+
+ HBUINT8 pixel_size; /* Pixel size for following widths (as ppem). */
+ HBUINT8 max_width; /* Maximum width. */
+ HBUINT8 widths[VAR]; /* Array of widths (numGlyphs is from the 'maxp' table). */
+ public:
+ DEFINE_SIZE_ARRAY (2, widths);
+};
+
+
+struct hdmx
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_hdmx;
+
+ inline unsigned int get_size (void) const
+ {
+ return min_size + num_records * size_device_record;
+ }
+
+ inline const DeviceRecord& operator [] (unsigned int i) const
+ {
+ if (unlikely (i >= num_records)) return Null(DeviceRecord);
+ return StructAtOffset<DeviceRecord> (this, min_size + i * size_device_record);
+ }
+
+ inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan)
+ {
+ TRACE_SERIALIZE (this);
+
+ if (unlikely (!c->extend_min ((*this)))) return_trace (false);
+
+ this->version.set (source_hdmx->version);
+ this->num_records.set (source_hdmx->num_records);
+ this->size_device_record.set (DeviceRecord::get_size (plan->gids_to_retain_sorted.len));
+
+ for (unsigned int i = 0; i < source_hdmx->num_records; i++)
+ {
+ DeviceRecord::SubsetView subset_view;
+ subset_view.init (&(*source_hdmx)[i], plan);
+
+ c->start_embed<DeviceRecord> ()->serialize (c, subset_view);
+ }
+
+ return_trace (true);
+ }
+
+ static inline size_t get_subsetted_size (hb_subset_plan_t *plan)
+ {
+ return min_size + DeviceRecord::get_size (plan->gids_to_retain_sorted.len);
+ }
+
+ inline bool subset (hb_subset_plan_t *plan) const
+ {
+ size_t dest_size = get_subsetted_size (plan);
+ hdmx *dest = (hdmx *) malloc (dest_size);
+ if (unlikely (!dest))
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Unable to alloc %lu for hdmx subset output.", (unsigned long) dest_size);
+ return false;
+ }
+
+ hb_serialize_context_t c (dest, dest_size);
+ hdmx *hdmx_prime = c.start_serialize<hdmx> ();
+ if (!hdmx_prime || !hdmx_prime->serialize (&c, this, plan)) {
+ free (dest);
+ return false;
+ }
+ c.end_serialize ();
+
+ hb_blob_t *hdmx_prime_blob = hb_blob_create ((const char *) dest,
+ dest_size,
+ HB_MEMORY_MODE_READONLY,
+ dest,
+ free);
+ bool result = hb_subset_plan_add_table (plan, HB_OT_TAG_hdmx, hdmx_prime_blob);
+ hb_blob_destroy (hdmx_prime_blob);
+
+ return result;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && version == 0 &&
+ !_hb_unsigned_int_mul_overflows (num_records, size_device_record) &&
+ c->check_range (this, get_size()));
+ }
+
+ protected:
+ HBUINT16 version; /* Table version number (0) */
+ HBUINT16 num_records; /* Number of device records. */
+ HBUINT32 size_device_record; /* Size of a device record, 32-bit aligned. */
+ HBUINT8 data[VAR]; /* Array of device records. */
+ public:
+ DEFINE_SIZE_ARRAY (8, data);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_HDMX_TABLE_HH */
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 2024cea7e78..1d458404517 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
@@ -43,6 +43,8 @@ namespace OT {
struct head
{
+ friend struct OffsetTable;
+
static const hb_tag_t tableTag = HB_OT_TAG_head;
inline unsigned int get_upem (void) const
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh
index 54eb5eb7732..97952b4ebbb 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
@@ -41,7 +41,7 @@ namespace OT {
#define HB_OT_TAG_hhea HB_TAG('h','h','e','a')
#define HB_OT_TAG_vhea HB_TAG('v','h','e','a')
-
+template <typename T>
struct _hea
{
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -84,10 +84,10 @@ struct _hea
DEFINE_SIZE_STATIC (36);
};
-struct hhea : _hea {
+struct hhea : _hea<hhea> {
static const hb_tag_t tableTag = HB_OT_TAG_hhea;
};
-struct vhea : _hea {
+struct vhea : _hea<vhea> {
static const hb_tag_t tableTag = HB_OT_TAG_vhea;
};
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
index 934acde7792..3cd48a62e93 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
@@ -21,7 +21,7 @@
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
- * Google Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod, Roderick Sheeter
*/
#ifndef HB_OT_HMTX_TABLE_HH
@@ -53,7 +53,7 @@ struct LongMetric
DEFINE_SIZE_STATIC (4);
};
-template <typename T>
+template <typename T, typename H>
struct hmtxvmtx
{
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -64,17 +64,128 @@ struct hmtxvmtx
return_trace (true);
}
+
+ inline bool subset_update_header (hb_subset_plan_t *plan,
+ unsigned int num_hmetrics) const
+ {
+ hb_blob_t *src_blob = OT::Sanitizer<H> ().sanitize (plan->source->reference_table (H::tableTag));
+ hb_blob_t *dest_blob = hb_blob_copy_writable_or_fail(src_blob);
+ hb_blob_destroy (src_blob);
+
+ if (unlikely (!dest_blob)) {
+ return false;
+ }
+
+ unsigned int length;
+ H *table = (H *) hb_blob_get_data (dest_blob, &length);
+ table->numberOfLongMetrics.set (num_hmetrics);
+
+ bool result = hb_subset_plan_add_table (plan, H::tableTag, dest_blob);
+ hb_blob_destroy (dest_blob);
+
+ return result;
+ }
+
+ inline bool subset (hb_subset_plan_t *plan) const
+ {
+ typename T::accelerator_t _mtx;
+ _mtx.init (plan->source);
+
+ /* All the trailing glyphs with the same advance can use one LongMetric
+ * and just keep LSB */
+ hb_prealloced_array_t<hb_codepoint_t> &gids = plan->gids_to_retain_sorted;
+ unsigned int num_advances = gids.len;
+ unsigned int last_advance = _mtx.get_advance (gids[num_advances - 1]);
+ while (num_advances > 1
+ && last_advance == _mtx.get_advance (gids[num_advances - 2]))
+ {
+ num_advances--;
+ }
+
+ /* alloc the new table */
+ size_t dest_sz = num_advances * 4
+ + (gids.len - num_advances) * 2;
+ void *dest = (void *) malloc (dest_sz);
+ if (unlikely (!dest))
+ {
+ return false;
+ }
+ DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in src has %d advances, %d lsbs", HB_UNTAG(T::tableTag), _mtx.num_advances, _mtx.num_metrics - _mtx.num_advances);
+ DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in dest has %d advances, %d lsbs, %u bytes", HB_UNTAG(T::tableTag), num_advances, gids.len - num_advances, (unsigned int) dest_sz);
+
+ const char *source_table = hb_blob_get_data (_mtx.blob, nullptr);
+ // Copy everything over
+ LongMetric * old_metrics = (LongMetric *) source_table;
+ FWORD *lsbs = (FWORD *) (old_metrics + _mtx.num_advances);
+ char * dest_pos = (char *) dest;
+ for (unsigned int i = 0; i < gids.len; i++)
+ {
+ /* the last metric or the one for gids[i] */
+ LongMetric *src_metric = old_metrics + MIN ((hb_codepoint_t) _mtx.num_advances - 1, gids[i]);
+ if (gids[i] < _mtx.num_advances)
+ {
+ /* src is a LongMetric */
+ if (i < num_advances)
+ {
+ /* dest is a LongMetric, copy it */
+ *((LongMetric *) dest_pos) = *src_metric;
+ }
+ else
+ {
+ /* dest just lsb */
+ *((FWORD *) dest_pos) = src_metric->lsb;
+ }
+ }
+ else
+ {
+ FWORD src_lsb = *(lsbs + gids[i] - _mtx.num_advances);
+ if (i < num_advances)
+ {
+ /* dest needs a full LongMetric */
+ LongMetric *metric = (LongMetric *)dest_pos;
+ metric->advance = src_metric->advance;
+ metric->lsb = src_lsb;
+ }
+ else
+ {
+ /* dest just needs an lsb */
+ *((FWORD *) dest_pos) = src_lsb;
+ }
+ }
+ dest_pos += (i < num_advances ? 4 : 2);
+ }
+ _mtx.fini ();
+
+ // Amend header num hmetrics
+ if (unlikely (!subset_update_header (plan, num_advances)))
+ {
+ free (dest);
+ return false;
+ }
+
+ hb_blob_t *result = hb_blob_create ((const char *)dest,
+ dest_sz,
+ HB_MEMORY_MODE_READONLY,
+ dest,
+ free);
+ bool success = hb_subset_plan_add_table (plan, T::tableTag, result);
+ hb_blob_destroy (result);
+ return success;
+ }
+
struct accelerator_t
{
+ friend struct hmtxvmtx;
+
inline void init (hb_face_t *face,
unsigned int default_advance_ = 0)
{
- default_advance = default_advance_ ? default_advance_ : face->get_upem ();
+ default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face);
bool got_font_extents = false;
if (T::os2Tag)
{
- hb_blob_t *os2_blob = Sanitizer<os2>().sanitize (face->reference_table (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))
@@ -87,8 +198,8 @@ struct hmtxvmtx
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);
+ hb_blob_t *_hea_blob = Sanitizer<H> ().sanitize (face->reference_table (H::tableTag));
+ const H *_hea_table = Sanitizer<H>::lock_instance (_hea_blob);
num_advances = _hea_table->numberOfLongMetrics;
if (!got_font_extents)
{
@@ -101,7 +212,7 @@ struct hmtxvmtx
has_font_extents = got_font_extents;
- blob = Sanitizer<hmtxvmtx>().sanitize (face->reference_table (T::tableTag));
+ 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);
@@ -119,7 +230,7 @@ struct hmtxvmtx
}
table = Sanitizer<hmtxvmtx>::lock_instance (blob);
- var_blob = Sanitizer<HVARVVAR>().sanitize (face->reference_table (T::variationsTag));
+ var_blob = Sanitizer<HVARVVAR> ().sanitize (face->reference_table (T::variationsTag));
var_table = Sanitizer<HVARVVAR>::lock_instance (var_blob);
}
@@ -129,22 +240,31 @@ struct hmtxvmtx
hb_blob_destroy (var_blob);
}
- inline unsigned int get_advance (hb_codepoint_t glyph,
- hb_font_t *font) const
+ inline unsigned int get_advance (hb_codepoint_t glyph) 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;
+ /* 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
- + (font->num_coords ? var_table->get_advance_var (glyph, font->coords, font->num_coords) : 0); // TODO Optimize?!
+ return table->longMetric[MIN (glyph, (uint32_t) num_advances - 1)].advance;
+ }
+
+ inline unsigned int get_advance (hb_codepoint_t glyph,
+ hb_font_t *font) const
+ {
+ unsigned int advance = get_advance (glyph);
+ if (likely(glyph < num_metrics))
+ {
+ advance += (font->num_coords ? var_table->get_advance_var (glyph, font->coords, font->num_coords) : 0); // TODO Optimize?!
+ }
+ return advance;
}
public:
@@ -153,11 +273,12 @@ struct hmtxvmtx
unsigned short descender;
unsigned short line_gap;
- private:
+ protected:
unsigned int num_metrics;
unsigned int num_advances;
unsigned int default_advance;
+ private:
const hmtxvmtx *table;
hb_blob_t *blob;
const HVARVVAR *var_table;
@@ -173,7 +294,7 @@ struct hmtxvmtx
* be in the array, but that entry is
* required. The last entry applies to
* all subsequent glyphs. */
- FWORD leadingBearingX[VAR]; /* Here the advance is assumed
+/*FWORD leadingBearingX[VAR];*/ /* Here the advance is assumed
* to be the same as the advance
* for the last entry above. The
* number of entries in this array is
@@ -187,18 +308,16 @@ struct hmtxvmtx
* font to vary the side bearing
* values for each glyph. */
public:
- DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX);
+ DEFINE_SIZE_ARRAY (0, longMetric);
};
-struct hmtx : hmtxvmtx<hmtx> {
+struct hmtx : hmtxvmtx<hmtx, hhea> {
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<vmtx> {
+struct vmtx : hmtxvmtx<vmtx, vhea> {
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;
};
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh
new file mode 100644
index 00000000000..20b8bd76223
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh
@@ -0,0 +1,655 @@
+/*
+ * Copyright © 2016 Elie Roux <elie.roux@telecom-bretagne.eu>
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_LAYOUT_BASE_TABLE_HH
+#define HB_OT_LAYOUT_BASE_TABLE_HH
+
+#include "hb-open-type-private.hh"
+#include "hb-ot-layout-common-private.hh"
+
+namespace OT {
+
+#define NOT_INDEXED ((unsigned int) -1)
+
+/*
+ * BASE -- The BASE Table
+ */
+
+struct BaseCoordFormat1
+{
+ inline int get_coord (void) const { return coordinate; }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier--format = 1 */
+ HBINT16 coordinate; /* X or Y value, in design units */
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct BaseCoordFormat2
+{
+ inline int get_coord (void) const
+ {
+ /* TODO */
+ return coordinate;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier--format = 2 */
+ HBINT16 coordinate; /* X or Y value, in design units */
+ GlyphID referenceGlyph; /* Glyph ID of control glyph */
+ HBUINT16 coordPoint; /* Index of contour point on the
+ * reference glyph */
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct BaseCoordFormat3
+{
+ inline int get_coord (void) const
+ {
+ /* TODO */
+ return coordinate;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && deviceTable.sanitize (c, this));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier--format = 3 */
+ HBINT16 coordinate; /* X or Y value, in design units */
+ OffsetTo<Device> deviceTable; /* Offset to Device table for X or
+ * Y value, from beginning of
+ * BaseCoord table (may be NULL). */
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct BaseCoord
+{
+ inline int get_coord (void) const
+ {
+ switch (u.format) {
+ case 1: return u.format1.get_coord ();
+ case 2: return u.format2.get_coord ();
+ case 3: return u.format3.get_coord ();
+ default:return 0;
+ }
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!u.format.sanitize (c)) return_trace (false);
+ switch (u.format) {
+ case 1: return_trace (u.format1.sanitize (c));
+ case 2: return_trace (u.format2.sanitize (c));
+ case 3: return_trace (u.format3.sanitize (c));
+ default:return_trace (false);
+ }
+ }
+
+ protected:
+ union {
+ HBUINT16 format;
+ BaseCoordFormat1 format1;
+ BaseCoordFormat2 format2;
+ BaseCoordFormat3 format3;
+ } u;
+ public:
+ DEFINE_SIZE_UNION (2, format);
+};
+
+struct FeatMinMaxRecord
+{
+ inline int get_min_value (void) const
+ { return (this+minCoord).get_coord(); }
+
+ inline int get_max_value (void) const
+ { return (this+maxCoord).get_coord(); }
+
+ inline const Tag &get_tag () const
+ { return tag; }
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ minCoord.sanitize (c, base) &&
+ maxCoord.sanitize (c, base));
+ }
+
+ protected:
+ Tag tag; /* 4-byte feature identification tag--must
+ * match feature tag in FeatureList */
+ OffsetTo<BaseCoord> minCoord; /* Offset to BaseCoord table that defines
+ * the minimum extent value, from beginning
+ * of MinMax table (may be NULL) */
+ OffsetTo<BaseCoord> maxCoord; /* Offset to BaseCoord table that defines
+ * the maximum extent value, from beginning
+ * of MinMax table (may be NULL) */
+ public:
+ DEFINE_SIZE_STATIC (8);
+
+};
+
+struct MinMax
+{
+ inline unsigned int get_feature_tag_index (Tag featureTableTag) const
+ {
+ /* TODO bsearch */
+ unsigned int count = featMinMaxRecords.len;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ Tag tag = featMinMaxRecords[i].get_tag();
+ int cmp = tag.cmp(featureTableTag);
+ if (cmp == 0) return i;
+ if (cmp > 0) return NOT_INDEXED;
+ }
+ return NOT_INDEXED;
+ }
+
+ inline int get_min_value (unsigned int featureTableTagIndex) const
+ {
+ if (featureTableTagIndex == NOT_INDEXED)
+ return (this+minCoord).get_coord();
+ return featMinMaxRecords[featureTableTagIndex].get_min_value();
+ }
+
+ inline int get_max_value (unsigned int featureTableTagIndex) const
+ {
+ if (featureTableTagIndex == NOT_INDEXED)
+ return (this+maxCoord).get_coord();
+ return featMinMaxRecords[featureTableTagIndex].get_max_value();
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ minCoord.sanitize (c, this) &&
+ maxCoord.sanitize (c, this) &&
+ featMinMaxRecords.sanitize (c, this));
+ }
+
+ protected:
+ OffsetTo<BaseCoord> minCoord; /* Offset to BaseCoord table that defines
+ * minimum extent value, from the beginning
+ * of MinMax table (may be NULL) */
+ OffsetTo<BaseCoord> maxCoord; /* Offset to BaseCoord table that defines
+ * maximum extent value, from the beginning
+ * of MinMax table (may be NULL) */
+ ArrayOf<FeatMinMaxRecord>
+ featMinMaxRecords; /* Array of FeatMinMaxRecords, in alphabetical
+ * order by featureTableTag */
+ public:
+ DEFINE_SIZE_ARRAY (6, featMinMaxRecords);
+};
+
+/* TODO... */
+struct BaseLangSysRecord
+{
+ inline const Tag& get_tag(void) const
+ { return baseLangSysTag; }
+
+ inline unsigned int get_feature_tag_index (Tag featureTableTag) const
+ { return (this+minMax).get_feature_tag_index(featureTableTag); }
+
+ inline int get_min_value (unsigned int featureTableTagIndex) const
+ { return (this+minMax).get_min_value(featureTableTagIndex); }
+
+ inline int get_max_value (unsigned int featureTableTagIndex) const
+ { return (this+minMax).get_max_value(featureTableTagIndex); }
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ minMax.sanitize (c, base));
+ }
+
+ protected:
+ Tag baseLangSysTag;
+ OffsetTo<MinMax> minMax;
+ public:
+ DEFINE_SIZE_STATIC (6);
+
+};
+
+struct BaseValues
+{
+ inline unsigned int get_default_base_tag_index (void) const
+ { return defaultIndex; }
+
+ inline int get_base_coord (unsigned int baselineTagIndex) const
+ {
+ return (this+baseCoords[baselineTagIndex]).get_coord();
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ defaultIndex <= baseCoordCount &&
+ baseCoords.sanitize (c, this));
+ }
+
+ protected:
+ Index defaultIndex;
+ HBUINT16 baseCoordCount;
+ OffsetArrayOf<BaseCoord> baseCoords;
+ public:
+ DEFINE_SIZE_ARRAY (6, baseCoords);
+
+};
+
+struct BaseScript {
+
+ inline unsigned int get_lang_tag_index (Tag baseLangSysTag) const
+ {
+ Tag tag;
+ int cmp;
+ for (unsigned int i = 0; i < baseLangSysCount; i++) {
+ tag = baseLangSysRecords[i].get_tag();
+ // taking advantage of alphabetical order
+ cmp = tag.cmp(baseLangSysTag);
+ if (cmp == 0) return i;
+ if (cmp > 0) return NOT_INDEXED;
+ }
+ return NOT_INDEXED;
+ }
+
+ inline unsigned int get_feature_tag_index (unsigned int baseLangSysIndex, Tag featureTableTag) const
+ {
+ if (baseLangSysIndex == NOT_INDEXED) {
+ if (unlikely(defaultMinMax)) return NOT_INDEXED;
+ return (this+defaultMinMax).get_feature_tag_index(featureTableTag);
+ }
+ if (unlikely(baseLangSysIndex >= baseLangSysCount)) return NOT_INDEXED;
+ return baseLangSysRecords[baseLangSysIndex].get_feature_tag_index(featureTableTag);
+ }
+
+ inline int get_min_value (unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ if (baseLangSysIndex == NOT_INDEXED)
+ return (this+defaultMinMax).get_min_value(featureTableTagIndex);
+ return baseLangSysRecords[baseLangSysIndex].get_max_value(featureTableTagIndex);
+ }
+
+ inline int get_max_value (unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ if (baseLangSysIndex == NOT_INDEXED)
+ return (this+defaultMinMax).get_min_value(featureTableTagIndex);
+ return baseLangSysRecords[baseLangSysIndex].get_max_value(featureTableTagIndex);
+ }
+
+ inline unsigned int get_default_base_tag_index (void) const
+ { return (this+baseValues).get_default_base_tag_index(); }
+
+ inline int get_base_coord (unsigned int baselineTagIndex) const
+ { return (this+baseValues).get_base_coord(baselineTagIndex); }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ baseValues.sanitize (c, this) &&
+ defaultMinMax.sanitize (c, this) &&
+ baseLangSysRecords.sanitize (c, this));
+ }
+
+ protected:
+ OffsetTo<BaseValues> baseValues;
+ OffsetTo<MinMax> defaultMinMax;
+ HBUINT16 baseLangSysCount;
+ ArrayOf<BaseLangSysRecord> baseLangSysRecords;
+
+ public:
+ DEFINE_SIZE_ARRAY (8, baseLangSysRecords);
+};
+
+
+struct BaseScriptRecord {
+
+ inline const Tag& get_tag (void) const
+ { return baseScriptTag; }
+
+ inline unsigned int get_default_base_tag_index(void) const
+ { return (this+baseScript).get_default_base_tag_index(); }
+
+ inline int get_base_coord(unsigned int baselineTagIndex) const
+ { return (this+baseScript).get_base_coord(baselineTagIndex); }
+
+ inline unsigned int get_lang_tag_index (Tag baseLangSysTag) const
+ { return (this+baseScript).get_lang_tag_index(baseLangSysTag); }
+
+ inline unsigned int get_feature_tag_index (unsigned int baseLangSysIndex, Tag featureTableTag) const
+ { return (this+baseScript).get_feature_tag_index(baseLangSysIndex, featureTableTag); }
+
+ inline int get_max_value (unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ { return (this+baseScript).get_max_value(baseLangSysIndex, featureTableTagIndex); }
+
+ inline int get_min_value (unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ { return (this+baseScript).get_min_value(baseLangSysIndex, featureTableTagIndex); }
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ baseScript != Null(OffsetTo<BaseScript>) &&
+ baseScript.sanitize (c, base));
+ }
+
+ protected:
+ Tag baseScriptTag;
+ OffsetTo<BaseScript> baseScript;
+
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct BaseScriptList {
+
+ inline unsigned int get_base_script_index (Tag baseScriptTag) const
+ {
+ for (unsigned int i = 0; i < baseScriptCount; i++)
+ if (baseScriptRecords[i].get_tag() == baseScriptTag)
+ return i;
+ return NOT_INDEXED;
+ }
+
+ inline unsigned int get_default_base_tag_index (unsigned int baseScriptIndex) const
+ {
+ if (unlikely(baseScriptIndex >= baseScriptCount)) return NOT_INDEXED;
+ return baseScriptRecords[baseScriptIndex].get_default_base_tag_index();
+ }
+
+ inline int get_base_coord(unsigned int baseScriptIndex, unsigned int baselineTagIndex) const
+ {
+ return baseScriptRecords[baseScriptIndex].get_base_coord(baselineTagIndex);
+ }
+
+ inline unsigned int get_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
+ {
+ if (unlikely(baseScriptIndex >= baseScriptCount)) return NOT_INDEXED;
+ return baseScriptRecords[baseScriptIndex].get_lang_tag_index(baseLangSysTag);
+ }
+
+ inline unsigned int get_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const
+ {
+ if (unlikely(baseScriptIndex >= baseScriptCount)) return NOT_INDEXED;
+ return baseScriptRecords[baseScriptIndex].get_feature_tag_index(baseLangSysIndex, featureTableTag);
+ }
+
+ inline int get_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return baseScriptRecords[baseScriptIndex].get_max_value(baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline int get_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return baseScriptRecords[baseScriptIndex].get_min_value(baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ baseScriptRecords.sanitize (c, this));
+ }
+
+ protected:
+ HBUINT16 baseScriptCount;
+ ArrayOf<BaseScriptRecord> baseScriptRecords;
+
+ public:
+ DEFINE_SIZE_ARRAY (4, baseScriptRecords);
+
+};
+
+struct BaseTagList
+{
+
+ inline unsigned int get_tag_index(Tag baselineTag) const
+ {
+ for (unsigned int i = 0; i < baseTagCount; i++)
+ if (baselineTags[i] == baselineTag)
+ return i;
+ return NOT_INDEXED;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ HBUINT16 baseTagCount;
+ SortedArrayOf<Tag> baselineTags;
+
+ public:
+ DEFINE_SIZE_ARRAY (4, baselineTags);
+};
+
+struct Axis
+{
+
+ inline unsigned int get_base_tag_index(Tag baselineTag) const
+ {
+ if (unlikely(baseTagList == Null(OffsetTo<BaseTagList>))) return NOT_INDEXED;
+ return (this+baseTagList).get_tag_index(baselineTag);
+ }
+
+ inline unsigned int get_default_base_tag_index_for_script_index (unsigned int baseScriptIndex) const
+ {
+ if (unlikely(baseScriptList == Null(OffsetTo<BaseScriptList>))) return NOT_INDEXED;
+ return (this+baseScriptList).get_default_base_tag_index(baseScriptIndex);
+ }
+
+ inline int get_base_coord(unsigned int baseScriptIndex, unsigned int baselineTagIndex) const
+ {
+ return (this+baseScriptList).get_base_coord(baseScriptIndex, baselineTagIndex);
+ }
+
+ inline unsigned int get_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
+ {
+ if (unlikely(baseScriptList == Null(OffsetTo<BaseScriptList>))) return NOT_INDEXED;
+ return (this+baseScriptList).get_lang_tag_index(baseScriptIndex, baseLangSysTag);
+ }
+
+ inline unsigned int get_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const
+ {
+ if (unlikely(baseScriptList == Null(OffsetTo<BaseScriptList>))) return NOT_INDEXED;
+ return (this+baseScriptList).get_feature_tag_index(baseScriptIndex, baseLangSysIndex, featureTableTag);
+ }
+
+ inline int get_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return (this+baseScriptList).get_max_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline int get_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return (this+baseScriptList).get_min_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ baseTagList.sanitize (c, this) &&
+ baseScriptList.sanitize (c, this));
+ }
+
+ protected:
+ OffsetTo<BaseTagList> baseTagList;
+ OffsetTo<BaseScriptList> baseScriptList;
+
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct BASE
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_BASE;
+
+ inline bool has_vert_axis(void)
+ { return vertAxis != Null(OffsetTo<Axis>); }
+
+ inline bool has_horiz_axis(void)
+ { return horizAxis != Null(OffsetTo<Axis>); }
+
+ // horizontal axis base coords:
+
+ inline unsigned int get_horiz_base_tag_index(Tag baselineTag) const
+ {
+ if (unlikely(horizAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+horizAxis).get_base_tag_index(baselineTag);
+ }
+
+ inline unsigned int get_horiz_default_base_tag_index_for_script_index (unsigned int baseScriptIndex) const
+ {
+ if (unlikely(horizAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+horizAxis).get_default_base_tag_index_for_script_index(baseScriptIndex);
+ }
+
+ inline int get_horiz_base_coord(unsigned int baseScriptIndex, unsigned int baselineTagIndex) const
+ {
+ return (this+horizAxis).get_base_coord(baseScriptIndex, baselineTagIndex);
+ }
+
+ // vertical axis base coords:
+
+ inline unsigned int get_vert_base_tag_index(Tag baselineTag) const
+ {
+ if (unlikely(vertAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+vertAxis).get_base_tag_index(baselineTag);
+ }
+
+ inline unsigned int get_vert_default_base_tag_index_for_script_index (unsigned int baseScriptIndex) const
+ {
+ if (unlikely(vertAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+vertAxis).get_default_base_tag_index_for_script_index(baseScriptIndex);
+ }
+
+ inline int get_vert_base_coord(unsigned int baseScriptIndex, unsigned int baselineTagIndex) const
+ {
+ return (this+vertAxis).get_base_coord(baseScriptIndex, baselineTagIndex);
+ }
+
+ // horizontal axis min/max coords:
+
+ inline unsigned int get_horiz_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
+ {
+ if (unlikely(horizAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+horizAxis).get_lang_tag_index (baseScriptIndex, baseLangSysTag);
+ }
+
+ inline unsigned int get_horiz_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const
+ {
+ if (unlikely(horizAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+horizAxis).get_feature_tag_index (baseScriptIndex, baseLangSysIndex, featureTableTag);
+ }
+
+ inline int get_horiz_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return (this+horizAxis).get_max_value (baseScriptIndex, baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline int get_horiz_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return (this+horizAxis).get_min_value (baseScriptIndex, baseLangSysIndex, featureTableTagIndex);
+ }
+
+ // vertical axis min/max coords:
+
+ inline unsigned int get_vert_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
+ {
+ if (unlikely(vertAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+vertAxis).get_lang_tag_index (baseScriptIndex, baseLangSysTag);
+ }
+
+ inline unsigned int get_vert_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const
+ {
+ if (unlikely(vertAxis == Null(OffsetTo<Axis>))) return NOT_INDEXED;
+ return (this+vertAxis).get_feature_tag_index (baseScriptIndex, baseLangSysIndex, featureTableTag);
+ }
+
+ inline int get_vert_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return (this+vertAxis).get_max_value (baseScriptIndex, baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline int get_vert_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
+ {
+ return (this+vertAxis).get_min_value (baseScriptIndex, baseLangSysIndex, featureTableTagIndex);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ likely (version.major == 1) &&
+ horizAxis.sanitize (c, this) &&
+ vertAxis.sanitize (c, this) &&
+ (version.to_int () < 0x00010001u || varStore.sanitize (c, this)));
+ }
+
+ protected:
+ FixedVersion<> version;
+ OffsetTo<Axis> horizAxis;
+ OffsetTo<Axis> vertAxis;
+ LOffsetTo<VariationStore>
+ varStore; /* Offset to the table of Item Variation
+ * Store--from beginning of BASE
+ * header (may be NULL). Introduced
+ * in version 0x00010001. */
+ public:
+ DEFINE_SIZE_MIN (8);
+};
+
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_LAYOUT_BASE_TABLE_HH */
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 31c436a09dd..c5e7f5217c9 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
@@ -299,7 +299,7 @@ struct FeatureParamsSize
* better.
*
* Assume that the offset to the size feature is according to specification,
- * and make the following value checks. If it fails, assume the the size
+ * and make the following value checks. If it fails, assume the size
* feature is calculated as versions of MakeOTF before the AFDKO 2.0 built it.
* If this fails, reject the 'size' feature. The older makeOTF's calculated the
* offset from the beginning of the FeatureList table, rather than from the
@@ -700,7 +700,7 @@ struct CoverageFormat1
if (unlikely (!c->extend (glyphArray))) return_trace (false);
for (unsigned int i = 0; i < num_glyphs; i++)
glyphArray[i] = glyphs[i];
- glyphs.advance (num_glyphs);
+ glyphs += num_glyphs;
return_trace (true);
}
@@ -789,7 +789,7 @@ struct CoverageFormat2
} else {
rangeRecord[range].end = glyphs[i];
}
- glyphs.advance (num_glyphs);
+ glyphs += num_glyphs;
return_trace (true);
}
@@ -1057,7 +1057,7 @@ struct ClassDefFormat1
if (klass == 0)
{
/* Match if there's any glyph that is not listed! */
- hb_codepoint_t g = -1;
+ hb_codepoint_t g = HB_SET_VALUE_INVALID;
if (!hb_set_next (glyphs, &g))
return false;
if (g < startGlyph)
@@ -1128,7 +1128,7 @@ struct ClassDefFormat2
if (klass == 0)
{
/* Match if there's any glyph that is not listed! */
- hb_codepoint_t g = (hb_codepoint_t) -1;
+ hb_codepoint_t g = HB_SET_VALUE_INVALID;
for (unsigned int i = 0; i < count; i++)
{
if (!hb_set_next (glyphs, &g))
@@ -1137,7 +1137,7 @@ struct ClassDefFormat2
return true;
g = rangeRecord[i].end;
}
- if (g != (hb_codepoint_t) -1 && hb_set_next (glyphs, &g))
+ if (g != HB_SET_VALUE_INVALID && hb_set_next (glyphs, &g))
return true;
/* Fall through. */
}
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 aad7d60290d..2d6c66e6c99 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
@@ -110,7 +110,7 @@ struct CaretValueFormat1
protected:
HBUINT16 caretValueFormat; /* Format identifier--format = 1 */
- HBINT16 coordinate; /* X or Y value, in design units */
+ FWORD coordinate; /* X or Y value, in design units */
public:
DEFINE_SIZE_STATIC (4);
};
@@ -161,7 +161,7 @@ struct CaretValueFormat3
protected:
HBUINT16 caretValueFormat; /* Format identifier--format = 3 */
- HBINT16 coordinate; /* X or Y value, in design units */
+ FWORD coordinate; /* X or Y value, in design units */
OffsetTo<Device>
deviceTable; /* Offset to Device table for X or Y
* value--from beginning of CaretValue
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 3ef3d30b084..46ffcc66883 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh
@@ -99,7 +99,7 @@ struct ValueFormat : HBUINT16
#endif
inline unsigned int get_len (void) const
- { return _hb_popcount32 ((unsigned int) *this); }
+ { return _hb_popcount ((unsigned int) *this); }
inline unsigned int get_size (void) const
{ return get_len () * Value::static_size; }
@@ -248,8 +248,8 @@ struct AnchorFormat1
protected:
HBUINT16 format; /* Format identifier--format = 1 */
- HBINT16 xCoordinate; /* Horizontal value--in design units */
- HBINT16 yCoordinate; /* Vertical value--in design units */
+ FWORD xCoordinate; /* Horizontal value--in design units */
+ FWORD yCoordinate; /* Vertical value--in design units */
public:
DEFINE_SIZE_STATIC (6);
};
@@ -279,8 +279,8 @@ struct AnchorFormat2
protected:
HBUINT16 format; /* Format identifier--format = 2 */
- HBINT16 xCoordinate; /* Horizontal value--in design units */
- HBINT16 yCoordinate; /* Vertical value--in design units */
+ FWORD xCoordinate; /* Horizontal value--in design units */
+ FWORD yCoordinate; /* Vertical value--in design units */
HBUINT16 anchorPoint; /* Index to glyph contour point */
public:
DEFINE_SIZE_STATIC (8);
@@ -309,8 +309,8 @@ struct AnchorFormat3
protected:
HBUINT16 format; /* Format identifier--format = 3 */
- HBINT16 xCoordinate; /* Horizontal value--in design units */
- HBINT16 yCoordinate; /* Vertical value--in design units */
+ FWORD xCoordinate; /* Horizontal value--in design units */
+ FWORD yCoordinate; /* Vertical value--in design units */
OffsetTo<Device>
xDeviceTable; /* Offset to Device table for X
* coordinate-- from beginning of
@@ -1072,9 +1072,17 @@ struct MarkBasePosFormat1
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
do {
if (!skippy_iter.prev ()) return_trace (false);
- /* We only want to attach to the first of a MultipleSubst sequence. Reject others. */
+ /* We only want to attach to the first of a MultipleSubst sequence.
+ * https://github.com/harfbuzz/harfbuzz/issues/740
+ * Reject others. */
if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
- 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]))
+ 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) ||
+ (skippy_iter.idx == 0 ||
+ _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]) !=
+ _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) ||
+ _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=
+ _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx - 1]) + 1
+ ))
break;
skippy_iter.reject ();
} while (1);
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 263e0a6e102..5f67aed21ed 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
@@ -114,7 +114,7 @@ struct SingleSubstFormat1
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of Substitution table */
- HBINT16 deltaGlyphID; /* Add to original GlyphID to get
+ HBINT16 deltaGlyphID; /* Add to original GlyphID to get
* substitute GlyphID */
public:
DEFINE_SIZE_STATIC (6);
@@ -386,7 +386,7 @@ struct MultipleSubstFormat1
if (unlikely (!sequence[i].serialize (c, this).serialize (c,
substitute_glyphs_list,
substitute_len_list[i]))) return_trace (false);
- substitute_len_list.advance (num_glyphs);
+ substitute_len_list += num_glyphs;
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return_trace (false);
return_trace (true);
}
@@ -536,7 +536,7 @@ struct AlternateSubstFormat1
if (unlikely (!alternateSet[i].serialize (c, this).serialize (c,
alternate_glyphs_list,
alternate_len_list[i]))) return_trace (false);
- alternate_len_list.advance (num_glyphs);
+ alternate_len_list += num_glyphs;
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return_trace (false);
return_trace (true);
}
@@ -757,8 +757,8 @@ struct LigatureSet
ligatures[i],
component_list,
component_count_list[i]))) return_trace (false);
- ligatures.advance (num_ligatures);
- component_count_list.advance (num_ligatures);
+ ligatures += num_ligatures;
+ component_count_list += num_ligatures;
return_trace (true);
}
@@ -850,7 +850,7 @@ struct LigatureSubstFormat1
component_count_list,
ligature_per_first_glyph_count_list[i],
component_list))) return_trace (false);
- ligature_per_first_glyph_count_list.advance (num_first_glyphs);
+ ligature_per_first_glyph_count_list += num_first_glyphs;
if (unlikely (!coverage.serialize (c, this).serialize (c, first_glyphs, num_first_glyphs))) return_trace (false);
return_trace (true);
}
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 8a005f5a27a..90546344d69 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
@@ -1212,7 +1212,7 @@ struct Rule
lookupCount.sanitize (c) &&
c->check_range (inputZ,
inputZ[0].static_size * inputCount +
- lookupRecordX[0].static_size * lookupCount));
+ LookupRecord::static_size * lookupCount));
}
protected:
@@ -1222,10 +1222,10 @@ struct Rule
HBUINT16 lookupCount; /* Number of LookupRecords */
HBUINT16 inputZ[VAR]; /* Array of match inputs--start with
* second glyph */
- LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
+/*LookupRecord lookupRecordX[VAR];*/ /* Array of LookupRecords--in
* design order */
public:
- DEFINE_SIZE_ARRAY2 (4, inputZ, lookupRecordX);
+ DEFINE_SIZE_ARRAY (4, inputZ);
};
struct RuleSet
@@ -1556,10 +1556,10 @@ struct ContextFormat3
OffsetTo<Coverage>
coverageZ[VAR]; /* Array of offsets to Coverage
* table in glyph sequence order */
- LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
+/*LookupRecord lookupRecordX[VAR];*/ /* Array of LookupRecords--in
* design order */
public:
- DEFINE_SIZE_ARRAY2 (6, coverageZ, lookupRecordX);
+ DEFINE_SIZE_ARRAY (6, coverageZ);
};
struct Context
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 60119629cf5..870ba73fa88 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
@@ -122,6 +122,9 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font,
*/
namespace OT {
+ struct BASE;
+ struct COLR;
+ struct CPAL;
struct GDEF;
struct GSUB;
struct GPOS;
@@ -131,7 +134,10 @@ namespace OT {
}
namespace AAT {
+ struct ankr;
+ struct kerx;
struct morx;
+ struct trak;
}
struct hb_ot_layout_lookup_accelerator_t
@@ -166,10 +172,16 @@ struct hb_ot_layout_t
const struct OT::GPOS *gpos;
/* TODO Move the following out of this struct. */
+ OT::hb_lazy_table_loader_t<struct OT::BASE> base;
+ OT::hb_lazy_table_loader_t<struct OT::COLR> colr;
+ OT::hb_lazy_table_loader_t<struct OT::CPAL> cpal;
OT::hb_lazy_table_loader_t<struct OT::MATH> math;
OT::hb_lazy_table_loader_t<struct OT::fvar> fvar;
OT::hb_lazy_table_loader_t<struct OT::avar> avar;
+ OT::hb_lazy_table_loader_t<struct AAT::ankr> ankr;
+ OT::hb_lazy_table_loader_t<struct AAT::kerx> kerx;
OT::hb_lazy_table_loader_t<struct AAT::morx> morx;
+ OT::hb_lazy_table_loader_t<struct AAT::trak> trak;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;
@@ -359,6 +371,28 @@ _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
}
+
+/* Loop over grapheme. Based on foreach_cluster(). */
+#define foreach_grapheme(buffer, start, end) \
+ for (unsigned int \
+ _count = buffer->len, \
+ start = 0, end = _count ? _next_grapheme (buffer, 0) : 0; \
+ start < _count; \
+ start = end, end = _next_grapheme (buffer, start))
+
+static inline unsigned int
+_next_grapheme (hb_buffer_t *buffer, unsigned int start)
+{
+ hb_glyph_info_t *info = buffer->info;
+ unsigned int count = buffer->len;
+
+ while (++start < count && _hb_glyph_info_is_unicode_mark (&info[start]))
+ ;
+
+ return start;
+}
+
+
#define info_cc(info) (_hb_glyph_info_get_modified_combining_class (&(info)))
static inline bool
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 919ecbb4b57..1c9e950b29a 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
@@ -31,16 +31,21 @@
#include "hb-open-type-private.hh"
#include "hb-ot-layout-private.hh"
+#include "hb-ot-layout-base-table.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
#include "hb-ot-layout-jstf-table.hh" // Just so we compile it; unused otherwise.
#include "hb-ot-name-table.hh" // Just so we compile it; unused otherwise.
+#include "hb-ot-color-colr-table.hh"
+#include "hb-ot-color-cpal-table.hh"
#include "hb-ot-map-private.hh"
+#ifndef HB_NO_VISIBILITY
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
+#endif
hb_ot_layout_t *
@@ -59,10 +64,16 @@ _hb_ot_layout_create (hb_face_t *face)
layout->gpos_blob = OT::Sanitizer<OT::GPOS>().sanitize (face->reference_table (HB_OT_TAG_GPOS));
layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
+ layout->base.init (face);
+ layout->colr.init (face);
+ layout->cpal.init (face);
layout->math.init (face);
layout->fvar.init (face);
layout->avar.init (face);
+ layout->ankr.init (face);
+ layout->kerx.init (face);
layout->morx.init (face);
+ layout->trak.init (face);
{
/*
@@ -195,10 +206,12 @@ _hb_ot_layout_create (hb_face_t *face)
void
_hb_ot_layout_destroy (hb_ot_layout_t *layout)
{
- for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
- layout->gsub_accels[i].fini ();
- for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
- layout->gpos_accels[i].fini ();
+ if (layout->gsub_accels)
+ for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
+ layout->gsub_accels[i].fini ();
+ if (layout->gpos_accels)
+ for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
+ layout->gpos_accels[i].fini ();
free (layout->gsub_accels);
free (layout->gpos_accels);
@@ -207,14 +220,28 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
hb_blob_destroy (layout->gsub_blob);
hb_blob_destroy (layout->gpos_blob);
+ layout->base.fini ();
+ layout->colr.fini ();
+ layout->cpal.fini ();
layout->math.fini ();
layout->fvar.fini ();
layout->avar.fini ();
+ layout->ankr.fini ();
+ layout->kerx.fini ();
layout->morx.fini ();
+ layout->trak.fini ();
free (layout);
}
+// static inline const OT::BASE&
+// _get_base (hb_face_t *face)
+// {
+// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::BASE);
+// hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+// return *(layout->base.get ());
+// }
+
static inline const OT::GDEF&
_get_gdef (hb_face_t *face)
{
@@ -1253,10 +1280,34 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
apply (proxy, plan, font, buffer);
}
-HB_INTERNAL void
+void
hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
const OT::SubstLookup &lookup,
const hb_ot_layout_lookup_accelerator_t &accel)
{
apply_string<GSUBProxy> (c, lookup, accel);
}
+
+
+
+
+/*
+ * OT::BASE
+ */
+
+// /**
+// * hb_ot_base_has_data:
+// * @face: #hb_face_t to test
+// *
+// * This function allows to verify the presence of an OpenType BASE table on the
+// * face.
+// *
+// * Return value: true if face has a BASE table, false otherwise
+// *
+// * Since: XXX
+// **/
+// hb_bool_t
+// hb_ot_base_has_data (hb_face_t *face)
+// {
+// return &_get_base (face) != &OT::Null(OT::BASE);
+// }
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h
index 9861f0fc7bb..85938ba123e 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h
@@ -38,6 +38,7 @@
HB_BEGIN_DECLS
+#define HB_OT_TAG_BASE HB_TAG('B','A','S','E')
#define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
#define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
#define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
@@ -316,6 +317,22 @@ hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *range_end /* OUT. May be NULL */);
+/*
+ * BASE
+ */
+#if 0
+
+#define HB_OT_TAG_BASE_HANG HB_TAG('h','a','n','g')
+#define HB_OT_TAG_BASE_ICFB HB_TAG('i','c','f','b')
+#define HB_OT_TAG_BASE_ICFT HB_TAG('i','c','f','t')
+#define HB_OT_TAG_BASE_IDEO HB_TAG('i','d','e','o')
+#define HB_OT_TAG_BASE_IDTB HB_TAG('i','d','t','b')
+#define HB_OT_TAG_BASE_MATH HB_TAG('m','a','t','h')
+#define HB_OT_TAG_BASE_ROMN HB_TAG('r','o','m','n')
+
+#endif
+
+
HB_END_DECLS
#endif /* HB_OT_LAYOUT_H */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh
index a80ac720fe1..e6bd8ea5ef3 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh
@@ -84,28 +84,28 @@ struct hb_ot_map_t
inline hb_mask_t get_global_mask (void) const { return global_mask; }
inline hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const {
- const feature_map_t *map = features.bsearch (&feature_tag);
+ const feature_map_t *map = features.bsearch (feature_tag);
if (shift) *shift = map ? map->shift : 0;
return map ? map->mask : 0;
}
inline bool needs_fallback (hb_tag_t feature_tag) const {
- const feature_map_t *map = features.bsearch (&feature_tag);
+ const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->needs_fallback : false;
}
inline hb_mask_t get_1_mask (hb_tag_t feature_tag) const {
- const feature_map_t *map = features.bsearch (&feature_tag);
+ const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->_1_mask : 0;
}
inline unsigned int get_feature_index (unsigned int table_index, hb_tag_t feature_tag) const {
- const feature_map_t *map = features.bsearch (&feature_tag);
+ const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->index[table_index] : HB_OT_LAYOUT_NO_FEATURE_INDEX;
}
inline unsigned int get_feature_stage (unsigned int table_index, hb_tag_t feature_tag) const {
- const feature_map_t *map = features.bsearch (&feature_tag);
+ const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->stage[table_index] : (unsigned int) -1;
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc
index 6f07a7e2281..54b0ce377d7 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc
@@ -139,7 +139,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
{
static_assert ((!(HB_GLYPH_FLAG_DEFINED & (HB_GLYPH_FLAG_DEFINED + 1))), "");
unsigned int global_bit_mask = HB_GLYPH_FLAG_DEFINED + 1;
- unsigned int global_bit_shift = _hb_popcount32 (HB_GLYPH_FLAG_DEFINED);
+ unsigned int global_bit_shift = _hb_popcount (HB_GLYPH_FLAG_DEFINED);
m.global_mask = global_bit_mask;
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 54b4f11ce65..881dedad54c 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
@@ -28,7 +28,7 @@
#define HB_OT_MAXP_TABLE_HH
#include "hb-open-type-private.hh"
-
+#include "hb-subset-plan.hh"
namespace OT {
@@ -39,28 +39,104 @@ namespace OT {
#define HB_OT_TAG_maxp HB_TAG('m','a','x','p')
+struct maxpV1Tail
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ HBUINT16 maxPoints; /* Maximum points in a non-composite glyph. */
+ HBUINT16 maxContours; /* Maximum contours in a non-composite glyph. */
+ HBUINT16 maxCompositePoints; /* Maximum points in a composite glyph. */
+ HBUINT16 maxCompositeContours; /* Maximum contours in a composite glyph. */
+ HBUINT16 maxZones; /* 1 if instructions do not use the twilight zone (Z0),
+ * or 2 if instructions do use Z0; should be set to 2 in
+ * most cases. */
+ HBUINT16 maxTwilightPoints; /* Maximum points used in Z0. */
+ HBUINT16 maxStorage; /* Number of Storage Area locations. */
+ HBUINT16 maxFunctionDefs; /* Number of FDEFs, equal to the highest function number + 1. */
+ HBUINT16 maxInstructionDefs; /* Number of IDEFs. */
+ HBUINT16 maxStackElements; /* Maximum stack depth. (This includes Font and CVT
+ * Programs, as well as the instructions for each glyph.) */
+ HBUINT16 maxSizeOfInstructions; /* Maximum byte count for glyph instructions. */
+ HBUINT16 maxComponentElements; /* Maximum number of components referenced at
+ * "top level" for any composite glyph. */
+ HBUINT16 maxComponentDepth; /* Maximum levels of recursion; 1 for simple components. */
+ public:
+ DEFINE_SIZE_STATIC (26);
+};
+
+
struct maxp
{
- static const hb_tag_t tableTag = HB_OT_TAG_maxp;
+ static const hb_tag_t tableTag = HB_OT_TAG_maxp;
inline unsigned int get_num_glyphs (void) const
{
return numGlyphs;
}
+ inline void set_num_glyphs (unsigned int count)
+ {
+ numGlyphs.set (count);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return_trace (c->check_struct (this) &&
- likely (version.major == 1 ||
- (version.major == 0 && version.minor == 0x5000u)));
+ if (unlikely (!c->check_struct (this)))
+ return_trace (false);
+
+ if (version.major == 1)
+ {
+ const maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*this);
+ return v1.sanitize (c);
+ }
+ return_trace (likely (version.major == 0 && version.minor == 0x5000u));
+ }
+
+ inline bool subset (hb_subset_plan_t *plan) const
+ {
+ hb_blob_t *maxp_blob = OT::Sanitizer<OT::maxp>().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_maxp));
+ hb_blob_t *maxp_prime_blob = hb_blob_copy_writable_or_fail (maxp_blob);
+ hb_blob_destroy (maxp_blob);
+
+ if (unlikely (!maxp_prime_blob)) {
+ return false;
+ }
+ OT::maxp *maxp_prime = (OT::maxp *) hb_blob_get_data (maxp_prime_blob, nullptr);
+
+ maxp_prime->set_num_glyphs (plan->gids_to_retain_sorted.len);
+ if (plan->drop_hints)
+ drop_hint_fields (plan, maxp_prime);
+
+ bool result = hb_subset_plan_add_table(plan, HB_OT_TAG_maxp, maxp_prime_blob);
+ hb_blob_destroy (maxp_prime_blob);
+ return result;
+ }
+
+ static inline void drop_hint_fields (hb_subset_plan_t *plan, OT::maxp *maxp_prime)
+ {
+ if (maxp_prime->version.major == 1)
+ {
+ maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*maxp_prime);
+ v1.maxZones.set (1);
+ v1.maxTwilightPoints.set (0);
+ v1.maxStorage.set (0);
+ v1.maxFunctionDefs.set (0);
+ v1.maxInstructionDefs.set (0);
+ v1.maxStackElements.set (0);
+ v1.maxSizeOfInstructions.set (0);
+ }
}
- /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
protected:
FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
* 0x00005000u or 0x00010000u. */
HBUINT16 numGlyphs; /* The number of glyphs in the font. */
+/*maxpV1Tail v1Tail[VAR]; */
public:
DEFINE_SIZE_STATIC (6);
};
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 5bed47013ea..6cb8d494958 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
@@ -28,7 +28,7 @@
#define HB_OT_OS2_TABLE_HH
#include "hb-open-type-private.hh"
-
+#include "hb-ot-os2-unicode-ranges.hh"
namespace OT {
@@ -49,51 +49,127 @@ struct os2
return_trace (c->check_struct (this));
}
+ inline bool subset (hb_subset_plan_t *plan) const
+ {
+ hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_os2));
+ hb_blob_t *os2_prime_blob = hb_blob_create_sub_blob (os2_blob, 0, -1);
+ // TODO(grieger): move to hb_blob_copy_writable_or_fail
+ hb_blob_destroy (os2_blob);
+
+ OT::os2 *os2_prime = (OT::os2 *) hb_blob_get_data_writable (os2_prime_blob, nullptr);
+ if (unlikely (!os2_prime)) {
+ hb_blob_destroy (os2_prime_blob);
+ return false;
+ }
+
+ uint16_t min_cp, max_cp;
+ find_min_and_max_codepoint (plan->codepoints, &min_cp, &max_cp);
+ os2_prime->usFirstCharIndex.set (min_cp);
+ os2_prime->usLastCharIndex.set (max_cp);
+
+ _update_unicode_ranges (plan->codepoints, os2_prime->ulUnicodeRange);
+ bool result = hb_subset_plan_add_table(plan, HB_OT_TAG_os2, os2_prime_blob);
+
+ hb_blob_destroy (os2_prime_blob);
+ return result;
+ }
+
+ inline void _update_unicode_ranges (const hb_prealloced_array_t<hb_codepoint_t> &codepoints,
+ HBUINT32 ulUnicodeRange[4]) const
+ {
+ for (unsigned int i = 0; i < 4; i++)
+ ulUnicodeRange[i].set (0);
+
+ for (unsigned int i = 0; i < codepoints.len; i++)
+ {
+ hb_codepoint_t cp = codepoints[i];
+ unsigned int bit = hb_get_unicode_range_bit (cp);
+ if (bit < 128)
+ {
+ unsigned int block = bit / 32;
+ unsigned int bit_in_block = bit % 32;
+ unsigned int mask = 1 << bit_in_block;
+ ulUnicodeRange[block].set (ulUnicodeRange[block] | mask);
+ }
+ if (cp >= 0x10000 && cp <= 0x110000)
+ {
+ /* the spec says that bit 57 ("Non Plane 0") implies that there's
+ at least one codepoint beyond the BMP; so I also include all
+ the non-BMP codepoints here */
+ ulUnicodeRange[1].set (ulUnicodeRange[1] | (1 << 25));
+ }
+ }
+ }
+
+ static inline void find_min_and_max_codepoint (const hb_prealloced_array_t<hb_codepoint_t> &codepoints,
+ uint16_t *min_cp, /* OUT */
+ uint16_t *max_cp /* OUT */)
+ {
+ hb_codepoint_t min = -1, max = 0;
+
+ for (unsigned int i = 0; i < codepoints.len; i++)
+ {
+ hb_codepoint_t cp = codepoints[i];
+ if (cp < min)
+ min = cp;
+ if (cp > max)
+ max = cp;
+ }
+
+ if (min > 0xFFFF)
+ min = 0xFFFF;
+ if (max > 0xFFFF)
+ max = 0xFFFF;
+
+ *min_cp = min;
+ *max_cp = max;
+ }
+
public:
HBUINT16 version;
/* Version 0 */
- HBINT16 xAvgCharWidth;
+ HBINT16 xAvgCharWidth;
HBUINT16 usWeightClass;
HBUINT16 usWidthClass;
HBUINT16 fsType;
- HBINT16 ySubscriptXSize;
- HBINT16 ySubscriptYSize;
- HBINT16 ySubscriptXOffset;
- HBINT16 ySubscriptYOffset;
- HBINT16 ySuperscriptXSize;
- HBINT16 ySuperscriptYSize;
- HBINT16 ySuperscriptXOffset;
- HBINT16 ySuperscriptYOffset;
- HBINT16 yStrikeoutSize;
- HBINT16 yStrikeoutPosition;
- HBINT16 sFamilyClass;
- HBUINT8 panose[10];
- HBUINT32 ulUnicodeRange[4];
+ HBINT16 ySubscriptXSize;
+ HBINT16 ySubscriptYSize;
+ HBINT16 ySubscriptXOffset;
+ HBINT16 ySubscriptYOffset;
+ HBINT16 ySuperscriptXSize;
+ HBINT16 ySuperscriptYSize;
+ HBINT16 ySuperscriptXOffset;
+ HBINT16 ySuperscriptYOffset;
+ HBINT16 yStrikeoutSize;
+ HBINT16 yStrikeoutPosition;
+ HBINT16 sFamilyClass;
+ HBUINT8 panose[10];
+ HBUINT32 ulUnicodeRange[4];
Tag achVendID;
HBUINT16 fsSelection;
HBUINT16 usFirstCharIndex;
HBUINT16 usLastCharIndex;
- HBINT16 sTypoAscender;
- HBINT16 sTypoDescender;
- HBINT16 sTypoLineGap;
+ HBINT16 sTypoAscender;
+ HBINT16 sTypoDescender;
+ HBINT16 sTypoLineGap;
HBUINT16 usWinAscent;
HBUINT16 usWinDescent;
/* Version 1 */
- //HBUINT32 ulCodePageRange1;
- //HBUINT32 ulCodePageRange2;
+ //HBUINT32 ulCodePageRange1;
+ //HBUINT32 ulCodePageRange2;
/* Version 2 */
- //HBINT16 sxHeight;
- //HBINT16 sCapHeight;
- //HBUINT16 usDefaultChar;
- //HBUINT16 usBreakChar;
- //HBUINT16 usMaxContext;
+ //HBINT16 sxHeight;
+ //HBINT16 sCapHeight;
+ //HBUINT16 usDefaultChar;
+ //HBUINT16 usBreakChar;
+ //HBUINT16 usMaxContext;
/* Version 5 */
- //HBUINT16 usLowerOpticalPointSize;
- //HBUINT16 usUpperOpticalPointSize;
+ //HBUINT16 usLowerOpticalPointSize;
+ //HBUINT16 usUpperOpticalPointSize;
public:
DEFINE_SIZE_STATIC (78);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh
new file mode 100644
index 00000000000..2cf168f9c55
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh
@@ -0,0 +1,247 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger
+ */
+
+#ifndef HB_OT_OS2_UNICODE_RANGES_HH
+#define HB_OT_OS2_UNICODE_RANGES_HH
+
+#include "hb-private.hh"
+#include "hb-dsalgs.hh"
+
+namespace OT {
+
+struct Range {
+ hb_codepoint_t start;
+ hb_codepoint_t end;
+ unsigned int bit;
+};
+
+/* Note: The contents of this array was generated using src/gen-unicode-ranges.py. */
+static Range os2UnicodeRangesSorted[] =
+{
+ { 0x0, 0x7F, 0}, // Basic Latin
+ { 0x80, 0xFF, 1}, // Latin-1 Supplement
+ { 0x100, 0x17F, 2}, // Latin Extended-A
+ { 0x180, 0x24F, 3}, // Latin Extended-B
+ { 0x250, 0x2AF, 4}, // IPA Extensions
+ { 0x2B0, 0x2FF, 5}, // Spacing Modifier Letters
+ { 0x300, 0x36F, 6}, // Combining Diacritical Marks
+ { 0x370, 0x3FF, 7}, // Greek and Coptic
+ { 0x400, 0x4FF, 9}, // Cyrillic
+ { 0x500, 0x52F, 9}, // Cyrillic Supplement
+ { 0x530, 0x58F, 10}, // Armenian
+ { 0x590, 0x5FF, 11}, // Hebrew
+ { 0x600, 0x6FF, 13}, // Arabic
+ { 0x700, 0x74F, 71}, // Syriac
+ { 0x750, 0x77F, 13}, // Arabic Supplement
+ { 0x780, 0x7BF, 72}, // Thaana
+ { 0x7C0, 0x7FF, 14}, // NKo
+ { 0x900, 0x97F, 15}, // Devanagari
+ { 0x980, 0x9FF, 16}, // Bengali
+ { 0xA00, 0xA7F, 17}, // Gurmukhi
+ { 0xA80, 0xAFF, 18}, // Gujarati
+ { 0xB00, 0xB7F, 19}, // Oriya
+ { 0xB80, 0xBFF, 20}, // Tamil
+ { 0xC00, 0xC7F, 21}, // Telugu
+ { 0xC80, 0xCFF, 22}, // Kannada
+ { 0xD00, 0xD7F, 23}, // Malayalam
+ { 0xD80, 0xDFF, 73}, // Sinhala
+ { 0xE00, 0xE7F, 24}, // Thai
+ { 0xE80, 0xEFF, 25}, // Lao
+ { 0xF00, 0xFFF, 70}, // Tibetan
+ { 0x1000, 0x109F, 74}, // Myanmar
+ { 0x10A0, 0x10FF, 26}, // Georgian
+ { 0x1100, 0x11FF, 28}, // Hangul Jamo
+ { 0x1200, 0x137F, 75}, // Ethiopic
+ { 0x1380, 0x139F, 75}, // Ethiopic Supplement
+ { 0x13A0, 0x13FF, 76}, // Cherokee
+ { 0x1400, 0x167F, 77}, // Unified Canadian Aboriginal Syllabics
+ { 0x1680, 0x169F, 78}, // Ogham
+ { 0x16A0, 0x16FF, 79}, // Runic
+ { 0x1700, 0x171F, 84}, // Tagalog
+ { 0x1720, 0x173F, 84}, // Hanunoo
+ { 0x1740, 0x175F, 84}, // Buhid
+ { 0x1760, 0x177F, 84}, // Tagbanwa
+ { 0x1780, 0x17FF, 80}, // Khmer
+ { 0x1800, 0x18AF, 81}, // Mongolian
+ { 0x1900, 0x194F, 93}, // Limbu
+ { 0x1950, 0x197F, 94}, // Tai Le
+ { 0x1980, 0x19DF, 95}, // New Tai Lue
+ { 0x19E0, 0x19FF, 80}, // Khmer Symbols
+ { 0x1A00, 0x1A1F, 96}, // Buginese
+ { 0x1B00, 0x1B7F, 27}, // Balinese
+ { 0x1B80, 0x1BBF, 112}, // Sundanese
+ { 0x1C00, 0x1C4F, 113}, // Lepcha
+ { 0x1C50, 0x1C7F, 114}, // Ol Chiki
+ { 0x1D00, 0x1D7F, 4}, // Phonetic Extensions
+ { 0x1D80, 0x1DBF, 4}, // Phonetic Extensions Supplement
+ { 0x1DC0, 0x1DFF, 6}, // Combining Diacritical Marks Supplement
+ { 0x1E00, 0x1EFF, 29}, // Latin Extended Additional
+ { 0x1F00, 0x1FFF, 30}, // Greek Extended
+ { 0x2000, 0x206F, 31}, // General Punctuation
+ { 0x2070, 0x209F, 32}, // Superscripts And Subscripts
+ { 0x20A0, 0x20CF, 33}, // Currency Symbols
+ { 0x20D0, 0x20FF, 34}, // Combining Diacritical Marks For Symbols
+ { 0x2100, 0x214F, 35}, // Letterlike Symbols
+ { 0x2150, 0x218F, 36}, // Number Forms
+ { 0x2190, 0x21FF, 37}, // Arrows
+ { 0x2200, 0x22FF, 38}, // Mathematical Operators
+ { 0x2300, 0x23FF, 39}, // Miscellaneous Technical
+ { 0x2400, 0x243F, 40}, // Control Pictures
+ { 0x2440, 0x245F, 41}, // Optical Character Recognition
+ { 0x2460, 0x24FF, 42}, // Enclosed Alphanumerics
+ { 0x2500, 0x257F, 43}, // Box Drawing
+ { 0x2580, 0x259F, 44}, // Block Elements
+ { 0x25A0, 0x25FF, 45}, // Geometric Shapes
+ { 0x2600, 0x26FF, 46}, // Miscellaneous Symbols
+ { 0x2700, 0x27BF, 47}, // Dingbats
+ { 0x27C0, 0x27EF, 38}, // Miscellaneous Mathematical Symbols-A
+ { 0x27F0, 0x27FF, 37}, // Supplemental Arrows-A
+ { 0x2800, 0x28FF, 82}, // Braille Patterns
+ { 0x2900, 0x297F, 37}, // Supplemental Arrows-B
+ { 0x2980, 0x29FF, 38}, // Miscellaneous Mathematical Symbols-B
+ { 0x2A00, 0x2AFF, 38}, // Supplemental Mathematical Operators
+ { 0x2B00, 0x2BFF, 37}, // Miscellaneous Symbols and Arrows
+ { 0x2C00, 0x2C5F, 97}, // Glagolitic
+ { 0x2C60, 0x2C7F, 29}, // Latin Extended-C
+ { 0x2C80, 0x2CFF, 8}, // Coptic
+ { 0x2D00, 0x2D2F, 26}, // Georgian Supplement
+ { 0x2D30, 0x2D7F, 98}, // Tifinagh
+ { 0x2D80, 0x2DDF, 75}, // Ethiopic Extended
+ { 0x2DE0, 0x2DFF, 9}, // Cyrillic Extended-A
+ { 0x2E00, 0x2E7F, 31}, // Supplemental Punctuation
+ { 0x2E80, 0x2EFF, 59}, // CJK Radicals Supplement
+ { 0x2F00, 0x2FDF, 59}, // Kangxi Radicals
+ { 0x2FF0, 0x2FFF, 59}, // Ideographic Description Characters
+ { 0x3000, 0x303F, 48}, // CJK Symbols And Punctuation
+ { 0x3040, 0x309F, 49}, // Hiragana
+ { 0x30A0, 0x30FF, 50}, // Katakana
+ { 0x3100, 0x312F, 51}, // Bopomofo
+ { 0x3130, 0x318F, 52}, // Hangul Compatibility Jamo
+ { 0x3190, 0x319F, 59}, // Kanbun
+ { 0x31A0, 0x31BF, 51}, // Bopomofo Extended
+ { 0x31C0, 0x31EF, 61}, // CJK Strokes
+ { 0x31F0, 0x31FF, 50}, // Katakana Phonetic Extensions
+ { 0x3200, 0x32FF, 54}, // Enclosed CJK Letters And Months
+ { 0x3300, 0x33FF, 55}, // CJK Compatibility
+ { 0x3400, 0x4DBF, 59}, // CJK Unified Ideographs Extension A
+ { 0x4DC0, 0x4DFF, 99}, // Yijing Hexagram Symbols
+ { 0x4E00, 0x9FFF, 59}, // CJK Unified Ideographs
+ { 0xA000, 0xA48F, 83}, // Yi Syllables
+ { 0xA490, 0xA4CF, 83}, // Yi Radicals
+ { 0xA500, 0xA63F, 12}, // Vai
+ { 0xA640, 0xA69F, 9}, // Cyrillic Extended-B
+ { 0xA700, 0xA71F, 5}, // Modifier Tone Letters
+ { 0xA720, 0xA7FF, 29}, // Latin Extended-D
+ { 0xA800, 0xA82F, 100}, // Syloti Nagri
+ { 0xA840, 0xA87F, 53}, // Phags-pa
+ { 0xA880, 0xA8DF, 115}, // Saurashtra
+ { 0xA900, 0xA92F, 116}, // Kayah Li
+ { 0xA930, 0xA95F, 117}, // Rejang
+ { 0xAA00, 0xAA5F, 118}, // Cham
+ { 0xAC00, 0xD7AF, 56}, // Hangul Syllables
+ { 0xD800, 0xDFFF, 57}, // Non-Plane 0 *
+ { 0xE000, 0xF8FF, 60}, // Private Use Area (plane 0)
+ { 0xF900, 0xFAFF, 61}, // CJK Compatibility Ideographs
+ { 0xFB00, 0xFB4F, 62}, // Alphabetic Presentation Forms
+ { 0xFB50, 0xFDFF, 63}, // Arabic Presentation Forms-A
+ { 0xFE00, 0xFE0F, 91}, // Variation Selectors
+ { 0xFE10, 0xFE1F, 65}, // Vertical Forms
+ { 0xFE20, 0xFE2F, 64}, // Combining Half Marks
+ { 0xFE30, 0xFE4F, 65}, // CJK Compatibility Forms
+ { 0xFE50, 0xFE6F, 66}, // Small Form Variants
+ { 0xFE70, 0xFEFF, 67}, // Arabic Presentation Forms-B
+ { 0xFF00, 0xFFEF, 68}, // Halfwidth And Fullwidth Forms
+ { 0xFFF0, 0xFFFF, 69}, // Specials
+ { 0x10000, 0x1007F, 101}, // Linear B Syllabary
+ { 0x10080, 0x100FF, 101}, // Linear B Ideograms
+ { 0x10100, 0x1013F, 101}, // Aegean Numbers
+ { 0x10140, 0x1018F, 102}, // Ancient Greek Numbers
+ { 0x10190, 0x101CF, 119}, // Ancient Symbols
+ { 0x101D0, 0x101FF, 120}, // Phaistos Disc
+ { 0x10280, 0x1029F, 121}, // Lycian
+ { 0x102A0, 0x102DF, 121}, // Carian
+ { 0x10300, 0x1032F, 85}, // Old Italic
+ { 0x10330, 0x1034F, 86}, // Gothic
+ { 0x10380, 0x1039F, 103}, // Ugaritic
+ { 0x103A0, 0x103DF, 104}, // Old Persian
+ { 0x10400, 0x1044F, 87}, // Deseret
+ { 0x10450, 0x1047F, 105}, // Shavian
+ { 0x10480, 0x104AF, 106}, // Osmanya
+ { 0x10800, 0x1083F, 107}, // Cypriot Syllabary
+ { 0x10900, 0x1091F, 58}, // Phoenician
+ { 0x10920, 0x1093F, 121}, // Lydian
+ { 0x10A00, 0x10A5F, 108}, // Kharoshthi
+ { 0x12000, 0x123FF, 110}, // Cuneiform
+ { 0x12400, 0x1247F, 110}, // Cuneiform Numbers and Punctuation
+ { 0x1D000, 0x1D0FF, 88}, // Byzantine Musical Symbols
+ { 0x1D100, 0x1D1FF, 88}, // Musical Symbols
+ { 0x1D200, 0x1D24F, 88}, // Ancient Greek Musical Notation
+ { 0x1D300, 0x1D35F, 109}, // Tai Xuan Jing Symbols
+ { 0x1D360, 0x1D37F, 111}, // Counting Rod Numerals
+ { 0x1D400, 0x1D7FF, 89}, // Mathematical Alphanumeric Symbols
+ { 0x1F000, 0x1F02F, 122}, // Mahjong Tiles
+ { 0x1F030, 0x1F09F, 122}, // Domino Tiles
+ { 0x20000, 0x2A6DF, 59}, // CJK Unified Ideographs Extension B
+ { 0x2F800, 0x2FA1F, 61}, // CJK Compatibility Ideographs Supplement
+ { 0xE0000, 0xE007F, 92}, // Tags
+ { 0xE0100, 0xE01EF, 91}, // Variation Selectors Supplement
+ { 0xF0000, 0xFFFFD, 90}, // Private Use (plane 15)
+ {0x100000, 0x10FFFD, 90}, // Private Use (plane 16)
+};
+
+static int
+_compare_range (const void *_key, const void *_item, void *_arg)
+{
+ hb_codepoint_t cp = *((hb_codepoint_t *) _key);
+ const Range *range = (Range *) _item;
+
+ if (cp < range->start)
+ return -1;
+ else if (cp <= range->end)
+ return 0;
+ else
+ return 1;
+}
+
+/**
+ * hb_get_unicode_range_bit:
+ * Returns the bit to be set in os/2 ulUnicodeRange for a given codepoint.
+ **/
+static unsigned int
+hb_get_unicode_range_bit (hb_codepoint_t cp)
+{
+ Range *range = (Range*) hb_bsearch_r (&cp, os2UnicodeRangesSorted,
+ sizeof (os2UnicodeRangesSorted) / sizeof(Range),
+ sizeof(Range),
+ _compare_range, nullptr);
+ if (range != NULL)
+ return range->bit;
+ return -1;
+}
+
+} /* namespace OT */
+
+#endif /* HB_OT_OS2_UNICODE_RANGES_HH */
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 a64e9d03919..867b936278b 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
@@ -34,6 +34,11 @@
#include "hb-ot-shape-private.hh" /* XXX Remove */
+/* buffer var allocations */
+#define indic_category() complex_var_u8_0() /* indic_category_t */
+#define indic_position() complex_var_u8_1() /* indic_position_t */
+
+
#define INDIC_TABLE_ELEMENT_TYPE uint16_t
/* Cateories used in the OpenType spec:
@@ -77,29 +82,29 @@ enum indic_category_t {
/* Visual positions in a syllable from left to right. */
enum indic_position_t {
- POS_START,
+ POS_START = 0,
- POS_RA_TO_BECOME_REPH,
- POS_PRE_M,
- POS_PRE_C,
+ POS_RA_TO_BECOME_REPH = 1,
+ POS_PRE_M = 2,
+ POS_PRE_C = 3,
- POS_BASE_C,
- POS_AFTER_MAIN,
+ POS_BASE_C = 4,
+ POS_AFTER_MAIN = 5,
- POS_ABOVE_C,
+ POS_ABOVE_C = 6,
- POS_BEFORE_SUB,
- POS_BELOW_C,
- POS_AFTER_SUB,
+ POS_BEFORE_SUB = 7,
+ POS_BELOW_C = 8,
+ POS_AFTER_SUB = 9,
- POS_BEFORE_POST,
- POS_POST_C,
- POS_AFTER_POST,
+ POS_BEFORE_POST = 10,
+ POS_POST_C = 11,
+ POS_AFTER_POST = 12,
- POS_FINAL_C,
- POS_SMVD,
+ POS_FINAL_C = 13,
+ POS_SMVD = 14,
- POS_END
+ POS_END = 15
};
/* Categories used in IndicSyllabicCategory.txt from UCD. */
@@ -186,4 +191,211 @@ enum indic_matra_category_t {
HB_INTERNAL INDIC_TABLE_ELEMENT_TYPE
hb_indic_get_categories (hb_codepoint_t u);
+
+static inline bool
+is_one_of (const hb_glyph_info_t &info, unsigned int flags)
+{
+ /* If it ligated, all bets are off. */
+ if (_hb_glyph_info_ligated (&info)) return false;
+ return !!(FLAG_UNSAFE (info.indic_category()) & flags);
+}
+
+static inline bool
+is_joiner (const hb_glyph_info_t &info)
+{
+ return is_one_of (info, JOINER_FLAGS);
+}
+
+static inline bool
+is_consonant (const hb_glyph_info_t &info)
+{
+ return is_one_of (info, CONSONANT_FLAGS);
+}
+
+static inline bool
+is_halant (const hb_glyph_info_t &info)
+{
+ return is_one_of (info, FLAG (OT_H));
+}
+
+#define IN_HALF_BLOCK(u, Base) (((u) & ~0x7Fu) == (Base))
+
+#define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900u))
+#define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980u))
+#define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00u))
+#define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80u))
+#define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00u))
+#define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80u))
+#define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00u))
+#define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80u))
+#define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00u))
+#define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80u))
+
+
+#define MATRA_POS_LEFT(u) POS_PRE_M
+#define MATRA_POS_RIGHT(u) ( \
+ IS_DEVA(u) ? POS_AFTER_SUB : \
+ IS_BENG(u) ? POS_AFTER_POST : \
+ IS_GURU(u) ? POS_AFTER_POST : \
+ IS_GUJR(u) ? POS_AFTER_POST : \
+ IS_ORYA(u) ? POS_AFTER_POST : \
+ IS_TAML(u) ? POS_AFTER_POST : \
+ IS_TELU(u) ? (u <= 0x0C42u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
+ IS_KNDA(u) ? (u < 0x0CC3u || u > 0xCD6u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
+ IS_MLYM(u) ? POS_AFTER_POST : \
+ IS_SINH(u) ? POS_AFTER_SUB : \
+ /*default*/ POS_AFTER_SUB \
+ )
+#define MATRA_POS_TOP(u) ( /* BENG and MLYM don't have top matras. */ \
+ IS_DEVA(u) ? POS_AFTER_SUB : \
+ IS_GURU(u) ? POS_AFTER_POST : /* Deviate from spec */ \
+ IS_GUJR(u) ? POS_AFTER_SUB : \
+ IS_ORYA(u) ? POS_AFTER_MAIN : \
+ IS_TAML(u) ? POS_AFTER_SUB : \
+ IS_TELU(u) ? POS_BEFORE_SUB : \
+ IS_KNDA(u) ? POS_BEFORE_SUB : \
+ IS_SINH(u) ? POS_AFTER_SUB : \
+ /*default*/ POS_AFTER_SUB \
+ )
+#define MATRA_POS_BOTTOM(u) ( \
+ IS_DEVA(u) ? POS_AFTER_SUB : \
+ IS_BENG(u) ? POS_AFTER_SUB : \
+ IS_GURU(u) ? POS_AFTER_POST : \
+ IS_GUJR(u) ? POS_AFTER_POST : \
+ IS_ORYA(u) ? POS_AFTER_SUB : \
+ IS_TAML(u) ? POS_AFTER_POST : \
+ IS_TELU(u) ? POS_BEFORE_SUB : \
+ IS_KNDA(u) ? POS_BEFORE_SUB : \
+ IS_MLYM(u) ? POS_AFTER_POST : \
+ IS_SINH(u) ? POS_AFTER_SUB : \
+ /*default*/ POS_AFTER_SUB \
+ )
+
+static inline indic_position_t
+matra_position_indic (hb_codepoint_t u, indic_position_t side)
+{
+ switch ((int) side)
+ {
+ case POS_PRE_C: return MATRA_POS_LEFT (u);
+ case POS_POST_C: return MATRA_POS_RIGHT (u);
+ case POS_ABOVE_C: return MATRA_POS_TOP (u);
+ case POS_BELOW_C: return MATRA_POS_BOTTOM (u);
+ };
+ return side;
+}
+
+/* XXX
+ * This is a hack for now. We should move this data into the main Indic table.
+ * Or completely remove it and just check in the tables.
+ */
+static const hb_codepoint_t ra_chars[] = {
+ 0x0930u, /* Devanagari */
+ 0x09B0u, /* Bengali */
+ 0x09F0u, /* Bengali */
+ 0x0A30u, /* Gurmukhi */ /* No Reph */
+ 0x0AB0u, /* Gujarati */
+ 0x0B30u, /* Oriya */
+ 0x0BB0u, /* Tamil */ /* No Reph */
+ 0x0C30u, /* Telugu */ /* Reph formed only with ZWJ */
+ 0x0CB0u, /* Kannada */
+ 0x0D30u, /* Malayalam */ /* No Reph, Logical Repha */
+
+ 0x0DBBu, /* Sinhala */ /* Reph formed only with ZWJ */
+};
+
+static inline bool
+is_ra (hb_codepoint_t u)
+{
+ for (unsigned int i = 0; i < ARRAY_LENGTH (ra_chars); i++)
+ if (u == ra_chars[i])
+ return true;
+ return false;
+}
+
+static inline void
+set_indic_properties (hb_glyph_info_t &info)
+{
+ hb_codepoint_t u = info.codepoint;
+ unsigned int type = hb_indic_get_categories (u);
+ indic_category_t cat = (indic_category_t) (type & 0x7Fu);
+ indic_position_t pos = (indic_position_t) (type >> 8);
+
+
+ /*
+ * Re-assign category
+ */
+
+ /* The following act more like the Bindus. */
+ if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0953u, 0x0954u)))
+ cat = OT_SM;
+ /* The following act like consonants. */
+ else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0x0A72u, 0x0A73u,
+ 0x1CF5u, 0x1CF6u)))
+ cat = OT_C;
+ /* TODO: The following should only be allowed after a Visarga.
+ * For now, just treat them like regular tone marks. */
+ else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x1CE2u, 0x1CE8u)))
+ cat = OT_A;
+ /* TODO: The following should only be allowed after some of
+ * the nasalization marks, maybe only for U+1CE9..U+1CF1.
+ * For now, just treat them like tone marks. */
+ else if (unlikely (u == 0x1CEDu))
+ cat = OT_A;
+ /* The following take marks in standalone clusters, similar to Avagraha. */
+ else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0xA8F2u, 0xA8F7u,
+ 0x1CE9u, 0x1CECu,
+ 0x1CEEu, 0x1CF1u)))
+ {
+ cat = OT_Symbol;
+ static_assert (((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol), "");
+ }
+ else if (unlikely (u == 0x0A51u))
+ {
+ /* https://github.com/harfbuzz/harfbuzz/issues/524 */
+ cat = OT_M;
+ pos = POS_BELOW_C;
+ }
+
+ /* According to ScriptExtensions.txt, these Grantha marks may also be used in Tamil,
+ * so the Indic shaper needs to know their categories. */
+ 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/harfbuzz/harfbuzz/issues/552 */
+
+ 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 (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u)))
+ cat = OT_PLACEHOLDER;
+ else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
+
+
+ /*
+ * Re-assign position.
+ */
+
+ if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS))
+ {
+ pos = POS_BASE_C;
+ if (is_ra (u))
+ cat = OT_Ra;
+ }
+ else if (cat == OT_M)
+ {
+ pos = matra_position_indic (u, pos);
+ }
+ else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) /* | FLAG (OT_VD) */ | FLAG (OT_A) | FLAG (OT_Symbol))))
+ {
+ pos = POS_SMVD;
+ }
+
+ if (unlikely (u == 0x0B01u)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub in the spec. */
+
+
+
+ info.indic_category() = cat;
+ info.indic_position() = pos;
+}
+
+
#endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc
index 9d150e0d3c1..32ad86a5f32 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
@@ -27,226 +27,12 @@
#include "hb-ot-shape-complex-indic-private.hh"
#include "hb-ot-layout-private.hh"
-/* buffer var allocations */
-#define indic_category() complex_var_u8_0() /* indic_category_t */
-#define indic_position() complex_var_u8_1() /* indic_position_t */
-
/*
* Indic shaper.
*/
-#define IN_HALF_BLOCK(u, Base) (((u) & ~0x7Fu) == (Base))
-
-#define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900u))
-#define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980u))
-#define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00u))
-#define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80u))
-#define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00u))
-#define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80u))
-#define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00u))
-#define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80u))
-#define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00u))
-#define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80u))
-
-
-#define MATRA_POS_LEFT(u) POS_PRE_M
-#define MATRA_POS_RIGHT(u) ( \
- IS_DEVA(u) ? POS_AFTER_SUB : \
- IS_BENG(u) ? POS_AFTER_POST : \
- IS_GURU(u) ? POS_AFTER_POST : \
- IS_GUJR(u) ? POS_AFTER_POST : \
- IS_ORYA(u) ? POS_AFTER_POST : \
- IS_TAML(u) ? POS_AFTER_POST : \
- IS_TELU(u) ? (u <= 0x0C42u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
- IS_KNDA(u) ? (u < 0x0CC3u || u > 0xCD6u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
- IS_MLYM(u) ? POS_AFTER_POST : \
- IS_SINH(u) ? POS_AFTER_SUB : \
- /*default*/ POS_AFTER_SUB \
- )
-#define MATRA_POS_TOP(u) ( /* BENG and MLYM don't have top matras. */ \
- IS_DEVA(u) ? POS_AFTER_SUB : \
- IS_GURU(u) ? POS_AFTER_POST : /* Deviate from spec */ \
- IS_GUJR(u) ? POS_AFTER_SUB : \
- IS_ORYA(u) ? POS_AFTER_MAIN : \
- IS_TAML(u) ? POS_AFTER_SUB : \
- IS_TELU(u) ? POS_BEFORE_SUB : \
- IS_KNDA(u) ? POS_BEFORE_SUB : \
- IS_SINH(u) ? POS_AFTER_SUB : \
- /*default*/ POS_AFTER_SUB \
- )
-#define MATRA_POS_BOTTOM(u) ( \
- IS_DEVA(u) ? POS_AFTER_SUB : \
- IS_BENG(u) ? POS_AFTER_SUB : \
- IS_GURU(u) ? POS_AFTER_POST : \
- IS_GUJR(u) ? POS_AFTER_POST : \
- IS_ORYA(u) ? POS_AFTER_SUB : \
- IS_TAML(u) ? POS_AFTER_POST : \
- IS_TELU(u) ? POS_BEFORE_SUB : \
- IS_KNDA(u) ? POS_BEFORE_SUB : \
- IS_MLYM(u) ? POS_AFTER_POST : \
- IS_SINH(u) ? POS_AFTER_SUB : \
- /*default*/ POS_AFTER_SUB \
- )
-
-static inline indic_position_t
-matra_position (hb_codepoint_t u, indic_position_t side)
-{
- switch ((int) side)
- {
- case POS_PRE_C: return MATRA_POS_LEFT (u);
- case POS_POST_C: return MATRA_POS_RIGHT (u);
- case POS_ABOVE_C: return MATRA_POS_TOP (u);
- case POS_BELOW_C: return MATRA_POS_BOTTOM (u);
- };
- return side;
-}
-
-/* XXX
- * This is a hack for now. We should move this data into the main Indic table.
- * Or completely remove it and just check in the tables.
- */
-static const hb_codepoint_t ra_chars[] = {
- 0x0930u, /* Devanagari */
- 0x09B0u, /* Bengali */
- 0x09F0u, /* Bengali */
- 0x0A30u, /* Gurmukhi */ /* No Reph */
- 0x0AB0u, /* Gujarati */
- 0x0B30u, /* Oriya */
- 0x0BB0u, /* Tamil */ /* No Reph */
- 0x0C30u, /* Telugu */ /* Reph formed only with ZWJ */
- 0x0CB0u, /* Kannada */
- 0x0D30u, /* Malayalam */ /* No Reph, Logical Repha */
-
- 0x0DBBu, /* Sinhala */ /* Reph formed only with ZWJ */
-};
-
-static inline bool
-is_ra (hb_codepoint_t u)
-{
- for (unsigned int i = 0; i < ARRAY_LENGTH (ra_chars); i++)
- if (u == ra_chars[i])
- return true;
- return false;
-}
-
-static inline bool
-is_one_of (const hb_glyph_info_t &info, unsigned int flags)
-{
- /* If it ligated, all bets are off. */
- if (_hb_glyph_info_ligated (&info)) return false;
- return !!(FLAG_UNSAFE (info.indic_category()) & flags);
-}
-
-static inline bool
-is_joiner (const hb_glyph_info_t &info)
-{
- return is_one_of (info, JOINER_FLAGS);
-}
-
-static inline bool
-is_consonant (const hb_glyph_info_t &info)
-{
- return is_one_of (info, CONSONANT_FLAGS);
-}
-
-static inline bool
-is_halant (const hb_glyph_info_t &info)
-{
- return is_one_of (info, FLAG (OT_H));
-}
-
-static inline void
-set_indic_properties (hb_glyph_info_t &info)
-{
- hb_codepoint_t u = info.codepoint;
- unsigned int type = hb_indic_get_categories (u);
- indic_category_t cat = (indic_category_t) (type & 0x7Fu);
- indic_position_t pos = (indic_position_t) (type >> 8);
-
-
- /*
- * Re-assign category
- */
-
- /* The following act more like the Bindus. */
- if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0953u, 0x0954u)))
- cat = OT_SM;
- /* The following act like consonants. */
- else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0x0A72u, 0x0A73u,
- 0x1CF5u, 0x1CF6u)))
- cat = OT_C;
- /* TODO: The following should only be allowed after a Visarga.
- * For now, just treat them like regular tone marks. */
- else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x1CE2u, 0x1CE8u)))
- cat = OT_A;
- /* TODO: The following should only be allowed after some of
- * the nasalization marks, maybe only for U+1CE9..U+1CF1.
- * For now, just treat them like tone marks. */
- else if (unlikely (u == 0x1CEDu))
- cat = OT_A;
- /* The following take marks in standalone clusters, similar to Avagraha. */
- else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0xA8F2u, 0xA8F7u,
- 0x1CE9u, 0x1CECu,
- 0x1CEEu, 0x1CF1u)))
- {
- cat = OT_Symbol;
- static_assert (((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol), "");
- }
- else if (unlikely (u == 0x0A51u))
- {
- /* https://github.com/harfbuzz/harfbuzz/issues/524 */
- cat = OT_M;
- pos = POS_BELOW_C;
- }
-
- /* According to ScriptExtensions.txt, these Grantha marks may also be used in Tamil,
- * so the Indic shaper needs to know their categories. */
- 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/harfbuzz/harfbuzz/issues/552 */
-
- 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 (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u)))
- cat = OT_PLACEHOLDER;
- else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
-
-
- /*
- * Re-assign position.
- */
-
- if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS))
- {
- pos = POS_BASE_C;
- if (is_ra (u))
- cat = OT_Ra;
- }
- else if (cat == OT_M)
- {
- pos = matra_position (u, pos);
- }
- else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) /* | FLAG (OT_VD) */ | FLAG (OT_A) | FLAG (OT_Symbol))))
- {
- pos = POS_SMVD;
- }
-
- if (unlikely (u == 0x0B01u)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub in the spec. */
-
-
-
- info.indic_category() = cat;
- info.indic_position() = pos;
-}
-
-/*
- * Things above this line should ideally be moved to the Indic table itself.
- */
-
-
/*
* Indic configurations. Note that we do not want to keep every single script-specific
* behavior in these tables necessarily. This should mainly be used for per-script
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-private.hh
new file mode 100644
index 00000000000..f90ef967440
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-private.hh
@@ -0,0 +1,124 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH
+#define HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH
+
+#include "hb-private.hh"
+
+#include "hb-ot-shape-complex-indic-private.hh"
+
+
+/* buffer var allocations */
+#define khmer_category() indic_category() /* khmer_category_t */
+#define khmer_position() indic_position() /* khmer_position_t */
+
+
+typedef indic_category_t khmer_category_t;
+typedef indic_position_t khmer_position_t;
+
+
+static inline khmer_position_t
+matra_position_khmer (khmer_position_t side)
+{
+ switch ((int) side)
+ {
+ case POS_PRE_C:
+ return POS_PRE_M;
+
+ case POS_POST_C:
+ case POS_ABOVE_C:
+ case POS_BELOW_C:
+ return POS_AFTER_POST;
+
+ default:
+ return side;
+ };
+}
+
+static inline bool
+is_consonant_or_vowel (const hb_glyph_info_t &info)
+{
+ return is_one_of (info, CONSONANT_FLAGS | FLAG (OT_V));
+}
+
+static inline bool
+is_coeng (const hb_glyph_info_t &info)
+{
+ return is_one_of (info, FLAG (OT_Coeng));
+}
+
+static inline void
+set_khmer_properties (hb_glyph_info_t &info)
+{
+ hb_codepoint_t u = info.codepoint;
+ unsigned int type = hb_indic_get_categories (u);
+ khmer_category_t cat = (khmer_category_t) (type & 0x7Fu);
+ khmer_position_t pos = (khmer_position_t) (type >> 8);
+
+
+ /*
+ * Re-assign category
+ */
+
+ 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, 0x17CDu, 0x17D1u) ||
+ u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */
+ {
+ /* These can occur mid-syllable (eg. before matras), even though Unicode marks them as Syllable_Modifier.
+ * https://github.com/roozbehp/unicode-data/issues/5 */
+ cat = OT_M;
+ pos = POS_ABOVE_C;
+ }
+ else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER;
+ else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
+
+
+ /*
+ * Re-assign position.
+ */
+
+ if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS))
+ {
+ pos = POS_BASE_C;
+ if (u == 0x179Au)
+ cat = OT_Ra;
+ }
+ else if (cat == OT_M)
+ {
+ pos = matra_position_khmer (pos);
+ }
+ else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol))))
+ {
+ pos = POS_SMVD;
+ }
+
+ info.khmer_category() = cat;
+ info.khmer_position() = pos;
+}
+
+
+#endif /* HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc
index 2db4f6097d8..304879d8fbb 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc
@@ -24,119 +24,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-indic-private.hh"
+#include "hb-ot-shape-complex-khmer-private.hh"
#include "hb-ot-layout-private.hh"
-/* buffer var allocations */
-#define khmer_category() complex_var_u8_0() /* khmer_category_t */
-#define khmer_position() complex_var_u8_1() /* khmer_position_t */
-
-
-/*
- * Khmer shaper.
- */
-
-typedef indic_category_t khmer_category_t;
-typedef indic_position_t khmer_position_t;
-
-
-static inline khmer_position_t
-matra_position (khmer_position_t side)
-{
- switch ((int) side)
- {
- case POS_PRE_C:
- return POS_PRE_M;
-
- case POS_POST_C:
- case POS_ABOVE_C:
- case POS_BELOW_C:
- return POS_AFTER_POST;
-
- default:
- return side;
- };
-}
-
-static inline bool
-is_one_of (const hb_glyph_info_t &info, unsigned int flags)
-{
- /* If it ligated, all bets are off. */
- if (_hb_glyph_info_ligated (&info)) return false;
- return !!(FLAG_UNSAFE (info.khmer_category()) & flags);
-}
-
-static inline bool
-is_joiner (const hb_glyph_info_t &info)
-{
- return is_one_of (info, JOINER_FLAGS);
-}
-
-static inline bool
-is_consonant (const hb_glyph_info_t &info)
-{
- return is_one_of (info, CONSONANT_FLAGS | FLAG (OT_V));
-}
-
-static inline bool
-is_coeng (const hb_glyph_info_t &info)
-{
- return is_one_of (info, FLAG (OT_Coeng));
-}
-
-static inline void
-set_khmer_properties (hb_glyph_info_t &info)
-{
- hb_codepoint_t u = info.codepoint;
- unsigned int type = hb_indic_get_categories (u);
- khmer_category_t cat = (khmer_category_t) (type & 0x7Fu);
- khmer_position_t pos = (khmer_position_t) (type >> 8);
-
-
- /*
- * Re-assign category
- */
-
- 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, 0x17CDu, 0x17D1u) ||
- u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */
- {
- /* These can occur mid-syllable (eg. before matras), even though Unicode marks them as Syllable_Modifier.
- * https://github.com/roozbehp/unicode-data/issues/5 */
- cat = OT_M;
- pos = POS_ABOVE_C;
- }
- else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER;
- else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
-
-
- /*
- * Re-assign position.
- */
-
- if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS))
- {
- pos = POS_BASE_C;
- if (u == 0x179Au)
- cat = OT_Ra;
- }
- else if (cat == OT_M)
- {
- pos = matra_position (pos);
- }
- else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol))))
- {
- pos = POS_SMVD;
- }
-
- info.khmer_category() = cat;
- info.khmer_position() = pos;
-}
-
-/*
- * Things above this line should ideally be moved to the Indic table itself.
- */
-
/*
* Khmer shaper.
@@ -404,7 +294,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
/* Mark all subsequent consonants as below. */
for (unsigned int i = base + 1; i < end; i++)
- if (is_consonant (info[i]))
+ if (is_consonant_or_vowel (info[i]))
info[i].khmer_position() = POS_BELOW_C;
/* Mark final consonants. A final consonant is one appearing after a matra,
@@ -412,7 +302,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
for (unsigned int i = base + 1; i < end; i++)
if (info[i].khmer_category() == OT_M) {
for (unsigned int j = i + 1; j < end; j++)
- if (is_consonant (info[j])) {
+ if (is_consonant_or_vowel (info[j])) {
info[j].khmer_position() = POS_FINAL_C;
break;
}
@@ -455,7 +345,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
{
unsigned int last = base;
for (unsigned int i = base + 1; i < end; i++)
- if (is_consonant (info[i]))
+ if (is_consonant_or_vowel (info[i]))
{
for (unsigned int j = last + 1; j < i; j++)
if (info[j].khmer_position() < POS_SMVD)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh
index ed87404305b..fb67dd42e64 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh
@@ -36,28 +36,29 @@
static const unsigned char _myanmar_syllable_machine_trans_keys[] = {
1u, 32u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u,
3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u,
- 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, 5u, 8u,
- 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u,
- 3u, 30u, 3u, 29u, 1u, 32u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u,
- 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 32u, 8u, 8u, 0
+ 3u, 29u, 3u, 29u, 3u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u,
+ 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u,
+ 3u, 29u, 3u, 30u, 3u, 29u, 1u, 32u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u,
+ 3u, 29u, 3u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 32u, 8u, 8u,
+ 0
};
static const char _myanmar_syllable_machine_key_spans[] = {
32, 28, 25, 4, 25, 23, 21, 21,
27, 27, 27, 27, 16, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 25, 4,
- 25, 23, 21, 21, 27, 27, 27, 27,
- 28, 27, 32, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 32, 1
+ 27, 27, 28, 27, 27, 27, 27, 25,
+ 4, 25, 23, 21, 21, 27, 27, 27,
+ 27, 28, 27, 32, 27, 27, 27, 27,
+ 27, 28, 27, 27, 27, 27, 32, 1
};
static const short _myanmar_syllable_machine_index_offsets[] = {
0, 33, 62, 88, 93, 119, 143, 165,
187, 215, 243, 271, 299, 316, 344, 372,
- 400, 428, 456, 484, 512, 540, 568, 594,
- 599, 625, 649, 671, 693, 721, 749, 777,
- 805, 834, 862, 895, 923, 951, 979, 1007,
- 1035, 1063, 1091, 1119, 1147, 1180
+ 400, 428, 456, 485, 513, 541, 569, 597,
+ 623, 628, 654, 678, 700, 722, 750, 778,
+ 806, 834, 863, 891, 924, 952, 980, 1008,
+ 1036, 1064, 1093, 1121, 1149, 1177, 1205, 1238
};
static const char _myanmar_syllable_machine_indicies[] = {
@@ -105,7 +106,7 @@ static const char _myanmar_syllable_machine_indicies[] = {
21, 21, 21, 27, 21, 21, 28, 29,
30, 31, 32, 33, 34, 35, 36, 21,
22, 21, 24, 24, 21, 25, 21, 26,
- 21, 21, 21, 21, 21, 21, 21, 35,
+ 21, 21, 21, 21, 21, 21, 21, 43,
21, 21, 21, 21, 21, 21, 32, 33,
34, 35, 36, 21, 22, 21, 24, 24,
21, 25, 21, 26, 21, 21, 21, 21,
@@ -119,106 +120,114 @@ static const char _myanmar_syllable_machine_indicies[] = {
21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 32, 21, 34, 21, 36, 21,
22, 21, 24, 24, 21, 25, 21, 26,
- 21, 21, 21, 21, 21, 21, 21, 35,
- 21, 21, 28, 21, 30, 21, 32, 33,
- 34, 35, 36, 21, 22, 21, 24, 24,
- 21, 25, 21, 26, 21, 21, 21, 21,
- 21, 21, 21, 35, 21, 21, 28, 21,
- 21, 21, 32, 33, 34, 35, 36, 21,
- 22, 21, 24, 24, 21, 25, 21, 26,
- 21, 21, 21, 21, 21, 21, 21, 35,
- 21, 21, 28, 29, 30, 21, 32, 33,
- 34, 35, 36, 21, 22, 23, 24, 24,
- 21, 25, 21, 26, 21, 21, 21, 21,
- 21, 21, 21, 27, 21, 21, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 21,
- 3, 3, 43, 5, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 44, 43, 43,
- 43, 43, 43, 43, 14, 43, 43, 43,
- 18, 43, 3, 3, 43, 5, 43, 3,
- 3, 43, 5, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 14, 43, 43, 43, 18,
- 43, 45, 43, 3, 3, 43, 5, 43,
- 14, 43, 43, 43, 43, 43, 43, 43,
- 46, 43, 43, 43, 43, 43, 43, 14,
- 43, 3, 3, 43, 5, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 46, 43,
- 43, 43, 43, 43, 43, 14, 43, 3,
- 3, 43, 5, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 14, 43, 2, 43, 3,
- 3, 43, 5, 43, 6, 43, 43, 43,
- 43, 43, 43, 43, 47, 43, 43, 47,
- 43, 43, 43, 14, 48, 43, 43, 18,
- 43, 2, 43, 3, 3, 43, 5, 43,
- 6, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 14,
- 43, 43, 43, 18, 43, 2, 43, 3,
- 3, 43, 5, 43, 6, 43, 43, 43,
- 43, 43, 43, 43, 47, 43, 43, 43,
- 43, 43, 43, 14, 48, 43, 43, 18,
- 43, 2, 43, 3, 3, 43, 5, 43,
- 6, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 14,
- 48, 43, 43, 18, 43, 22, 23, 24,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 32, 33,
+ 34, 35, 36, 43, 21, 22, 21, 24,
+ 24, 21, 25, 21, 26, 21, 21, 21,
+ 21, 21, 21, 21, 43, 21, 21, 28,
+ 21, 30, 21, 32, 33, 34, 35, 36,
+ 21, 22, 21, 24, 24, 21, 25, 21,
+ 26, 21, 21, 21, 21, 21, 21, 21,
+ 43, 21, 21, 28, 21, 21, 21, 32,
+ 33, 34, 35, 36, 21, 22, 21, 24,
24, 21, 25, 21, 26, 21, 21, 21,
- 21, 21, 21, 21, 49, 21, 21, 28,
- 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 21, 22, 50, 24, 24, 21, 25,
+ 21, 21, 21, 21, 43, 21, 21, 28,
+ 29, 30, 21, 32, 33, 34, 35, 36,
+ 21, 22, 23, 24, 24, 21, 25, 21,
+ 26, 21, 21, 21, 21, 21, 21, 21,
+ 27, 21, 21, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 21, 3, 3, 44,
+ 5, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 45, 44, 44, 44, 44, 44,
+ 44, 14, 44, 44, 44, 18, 44, 3,
+ 3, 44, 5, 44, 3, 3, 44, 5,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 14, 44, 44, 44, 18, 44, 46, 44,
+ 3, 3, 44, 5, 44, 14, 44, 44,
+ 44, 44, 44, 44, 44, 47, 44, 44,
+ 44, 44, 44, 44, 14, 44, 3, 3,
+ 44, 5, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 47, 44, 44, 44, 44,
+ 44, 44, 14, 44, 3, 3, 44, 5,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 14, 44, 2, 44, 3, 3, 44, 5,
+ 44, 6, 44, 44, 44, 44, 44, 44,
+ 44, 48, 44, 44, 48, 44, 44, 44,
+ 14, 49, 44, 44, 18, 44, 2, 44,
+ 3, 3, 44, 5, 44, 6, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 14, 44, 44, 44,
+ 18, 44, 2, 44, 3, 3, 44, 5,
+ 44, 6, 44, 44, 44, 44, 44, 44,
+ 44, 48, 44, 44, 44, 44, 44, 44,
+ 14, 49, 44, 44, 18, 44, 2, 44,
+ 3, 3, 44, 5, 44, 6, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 14, 49, 44, 44,
+ 18, 44, 22, 23, 24, 24, 21, 25,
21, 26, 21, 21, 21, 21, 21, 21,
- 21, 27, 21, 21, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 21, 1, 1,
- 2, 3, 3, 3, 43, 5, 43, 6,
- 1, 43, 43, 43, 43, 1, 43, 8,
- 43, 43, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 43, 1, 43, 2,
- 43, 3, 3, 43, 5, 43, 6, 43,
- 43, 43, 43, 43, 43, 43, 8, 43,
- 43, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 43, 2, 43, 3, 3, 43,
- 5, 43, 6, 43, 43, 43, 43, 43,
- 43, 43, 17, 43, 43, 43, 43, 43,
- 43, 14, 15, 16, 17, 18, 43, 2,
- 43, 3, 3, 43, 5, 43, 6, 43,
- 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 14, 15, 16,
- 17, 18, 43, 2, 43, 3, 3, 43,
- 5, 43, 6, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 14, 15, 16, 43, 18, 43, 2,
- 43, 3, 3, 43, 5, 43, 6, 43,
- 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 14, 43, 16,
- 43, 18, 43, 2, 43, 3, 3, 43,
- 5, 43, 6, 43, 43, 43, 43, 43,
- 43, 43, 17, 43, 43, 10, 43, 12,
- 43, 14, 15, 16, 17, 18, 43, 2,
- 43, 3, 3, 43, 5, 43, 6, 43,
- 43, 43, 43, 43, 43, 43, 17, 43,
- 43, 10, 43, 43, 43, 14, 15, 16,
- 17, 18, 43, 2, 43, 3, 3, 43,
- 5, 43, 6, 43, 43, 43, 43, 43,
- 43, 43, 17, 43, 43, 10, 11, 12,
- 43, 14, 15, 16, 17, 18, 43, 2,
- 3, 3, 3, 43, 5, 43, 6, 43,
- 43, 43, 43, 43, 43, 43, 8, 43,
- 43, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 43, 1, 1, 51, 51, 51,
- 51, 51, 51, 51, 51, 1, 51, 51,
- 51, 51, 1, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 1, 51, 52, 51, 0
+ 21, 50, 21, 21, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 21, 22,
+ 51, 24, 24, 21, 25, 21, 26, 21,
+ 21, 21, 21, 21, 21, 21, 27, 21,
+ 21, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 21, 1, 1, 2, 3, 3,
+ 3, 44, 5, 44, 6, 1, 44, 44,
+ 44, 44, 1, 44, 8, 44, 44, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 44, 1, 44, 2, 44, 3, 3,
+ 44, 5, 44, 6, 44, 44, 44, 44,
+ 44, 44, 44, 8, 44, 44, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 44,
+ 2, 44, 3, 3, 44, 5, 44, 6,
+ 44, 44, 44, 44, 44, 44, 44, 52,
+ 44, 44, 44, 44, 44, 44, 14, 15,
+ 16, 17, 18, 44, 2, 44, 3, 3,
+ 44, 5, 44, 6, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 14, 15, 16, 17, 18, 44,
+ 2, 44, 3, 3, 44, 5, 44, 6,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 14, 15,
+ 16, 44, 18, 44, 2, 44, 3, 3,
+ 44, 5, 44, 6, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 14, 44, 16, 44, 18, 44,
+ 2, 44, 3, 3, 44, 5, 44, 6,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 14, 15,
+ 16, 17, 18, 52, 44, 2, 44, 3,
+ 3, 44, 5, 44, 6, 44, 44, 44,
+ 44, 44, 44, 44, 52, 44, 44, 10,
+ 44, 12, 44, 14, 15, 16, 17, 18,
+ 44, 2, 44, 3, 3, 44, 5, 44,
+ 6, 44, 44, 44, 44, 44, 44, 44,
+ 52, 44, 44, 10, 44, 44, 44, 14,
+ 15, 16, 17, 18, 44, 2, 44, 3,
+ 3, 44, 5, 44, 6, 44, 44, 44,
+ 44, 44, 44, 44, 52, 44, 44, 10,
+ 11, 12, 44, 14, 15, 16, 17, 18,
+ 44, 2, 3, 3, 3, 44, 5, 44,
+ 6, 44, 44, 44, 44, 44, 44, 44,
+ 8, 44, 44, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 44, 1, 1, 53,
+ 53, 53, 53, 53, 53, 53, 53, 1,
+ 53, 53, 53, 53, 1, 53, 53, 53,
+ 53, 53, 53, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 1, 53, 54, 53,
+ 0
};
static const char _myanmar_syllable_machine_trans_targs[] = {
- 0, 1, 22, 0, 0, 23, 29, 32,
- 35, 44, 36, 40, 41, 42, 25, 38,
- 39, 37, 28, 43, 45, 0, 2, 12,
- 0, 3, 9, 13, 14, 18, 19, 20,
- 5, 16, 17, 15, 8, 21, 4, 6,
- 7, 10, 11, 0, 24, 26, 27, 30,
- 31, 33, 34, 0, 0
+ 0, 1, 23, 0, 0, 24, 30, 33,
+ 36, 46, 37, 42, 43, 44, 26, 39,
+ 40, 41, 29, 45, 47, 0, 2, 12,
+ 0, 3, 9, 13, 14, 19, 20, 21,
+ 5, 16, 17, 18, 8, 22, 4, 6,
+ 7, 10, 11, 15, 0, 25, 27, 28,
+ 31, 32, 34, 35, 38, 0, 0
};
static const char _myanmar_syllable_machine_trans_actions[] = {
@@ -227,8 +236,8 @@ static const char _myanmar_syllable_machine_trans_actions[] = {
0, 0, 0, 0, 0, 6, 0, 0,
7, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 8, 0, 0, 0, 0,
- 0, 0, 0, 9, 10
+ 0, 0, 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 0, 9, 10
};
static const char _myanmar_syllable_machine_to_state_actions[] = {
@@ -237,7 +246,7 @@ static const char _myanmar_syllable_machine_to_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 0, 0
};
static const char _myanmar_syllable_machine_from_state_actions[] = {
@@ -246,16 +255,16 @@ static const char _myanmar_syllable_machine_from_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 0, 0
};
static const short _myanmar_syllable_machine_eof_trans[] = {
0, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44,
- 22, 22, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 52, 52
+ 22, 22, 22, 22, 22, 22, 22, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 22, 22, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 54, 54
};
static const int myanmar_syllable_machine_start = 0;
@@ -289,7 +298,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 293 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 302 "hb-ot-shape-complex-myanmar-machine.hh"
{
cs = myanmar_syllable_machine_start;
ts = 0;
@@ -306,7 +315,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 310 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 319 "hb-ot-shape-complex-myanmar-machine.hh"
{
int _slen;
int _trans;
@@ -320,7 +329,7 @@ _resume:
#line 1 "NONE"
{ts = p;}
break;
-#line 324 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 333 "hb-ot-shape-complex-myanmar-machine.hh"
}
_keys = _myanmar_syllable_machine_trans_keys + (cs<<1);
@@ -370,7 +379,7 @@ _eof_trans:
#line 90 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p;p--;{ found_syllable (non_myanmar_cluster); }}
break;
-#line 374 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 383 "hb-ot-shape-complex-myanmar-machine.hh"
}
_again:
@@ -379,7 +388,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
-#line 383 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 392 "hb-ot-shape-complex-myanmar-machine.hh"
}
if ( ++p != pe )
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl
index 45733ac733e..0cd84fa1b88 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl
@@ -70,7 +70,7 @@ k = (Ra As H); # Kinzi
c = C|Ra; # is_consonant
medial_group = MY? MR? MW? MH? As?;
-main_vowel_group = VPre* VAbv* VBlw* A* (DB As?)?;
+main_vowel_group = (VPre.VS?)* VAbv* VBlw* A* (DB As?)?;
post_vowel_group = VPst MH? As* VAbv* A* (DB As?)?;
pwo_tone_group = PT A* DB? As?;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-private.hh
new file mode 100644
index 00000000000..04f81bd1227
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-private.hh
@@ -0,0 +1,171 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH
+#define HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH
+
+#include "hb-private.hh"
+
+#include "hb-ot-shape-complex-indic-private.hh"
+
+
+/* buffer var allocations */
+#define myanmar_category() indic_category() /* myanmar_category_t */
+#define myanmar_position() indic_position() /* myanmar_position_t */
+
+
+/* Note: This enum is duplicated in the -machine.rl source file.
+ * Not sure how to avoid duplication. */
+enum myanmar_category_t {
+ OT_As = 18, /* Asat */
+ OT_D0 = 20, /* Digit zero */
+ OT_DB = OT_N, /* Dot below */
+ OT_GB = OT_PLACEHOLDER,
+ OT_MH = 21, /* Various consonant medial types */
+ OT_MR = 22, /* Various consonant medial types */
+ OT_MW = 23, /* Various consonant medial types */
+ OT_MY = 24, /* Various consonant medial types */
+ OT_PT = 25, /* Pwo and other tones */
+ OT_VAbv = 26,
+ OT_VBlw = 27,
+ OT_VPre = 28,
+ OT_VPst = 29,
+ OT_VS = 30, /* Variation selectors */
+ OT_P = 31, /* Punctuation */
+ OT_D = 32, /* Digits except zero */
+};
+
+
+static inline void
+set_myanmar_properties (hb_glyph_info_t &info)
+{
+ hb_codepoint_t u = info.codepoint;
+ unsigned int type = hb_indic_get_categories (u);
+ indic_category_t cat = (indic_category_t) (type & 0x7Fu);
+ indic_position_t pos = (indic_position_t) (type >> 8);
+
+ /* Myanmar
+ * http://www.microsoft.com/typography/OpenTypeDev/myanmar/intro.htm#analyze
+ */
+ if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)))
+ cat = (indic_category_t) OT_VS;
+
+ switch (u)
+ {
+ case 0x104Eu:
+ cat = (indic_category_t) OT_C; /* The spec says C, IndicSyllableCategory doesn't have. */
+ break;
+
+ case 0x002Du: case 0x00A0u: case 0x00D7u: case 0x2012u:
+ case 0x2013u: case 0x2014u: case 0x2015u: case 0x2022u:
+ case 0x25CCu: case 0x25FBu: case 0x25FCu: case 0x25FDu:
+ case 0x25FEu:
+ cat = (indic_category_t) OT_GB;
+ break;
+
+ case 0x1004u: case 0x101Bu: case 0x105Au:
+ cat = (indic_category_t) OT_Ra;
+ break;
+
+ case 0x1032u: case 0x1036u:
+ cat = (indic_category_t) OT_A;
+ break;
+
+ case 0x1039u:
+ cat = (indic_category_t) OT_H;
+ break;
+
+ case 0x103Au:
+ cat = (indic_category_t) OT_As;
+ break;
+
+ case 0x1041u: case 0x1042u: case 0x1043u: case 0x1044u:
+ case 0x1045u: case 0x1046u: case 0x1047u: case 0x1048u:
+ case 0x1049u: case 0x1090u: case 0x1091u: case 0x1092u:
+ case 0x1093u: case 0x1094u: case 0x1095u: case 0x1096u:
+ case 0x1097u: case 0x1098u: case 0x1099u:
+ cat = (indic_category_t) OT_D;
+ break;
+
+ case 0x1040u:
+ cat = (indic_category_t) OT_D; /* XXX The spec says D0, but Uniscribe doesn't seem to do. */
+ break;
+
+ case 0x103Eu: case 0x1060u:
+ cat = (indic_category_t) OT_MH;
+ break;
+
+ case 0x103Cu:
+ cat = (indic_category_t) OT_MR;
+ break;
+
+ case 0x103Du: case 0x1082u:
+ cat = (indic_category_t) OT_MW;
+ break;
+
+ case 0x103Bu: case 0x105Eu: case 0x105Fu:
+ cat = (indic_category_t) OT_MY;
+ break;
+
+ case 0x1063u: case 0x1064u: case 0x1069u: case 0x106Au:
+ case 0x106Bu: case 0x106Cu: case 0x106Du: case 0xAA7Bu:
+ cat = (indic_category_t) OT_PT;
+ break;
+
+ case 0x1038u: case 0x1087u: case 0x1088u: case 0x1089u:
+ case 0x108Au: case 0x108Bu: case 0x108Cu: case 0x108Du:
+ case 0x108Fu: case 0x109Au: case 0x109Bu: case 0x109Cu:
+ cat = (indic_category_t) OT_SM;
+ break;
+
+ case 0x104Au: case 0x104Bu:
+ cat = (indic_category_t) OT_P;
+ break;
+
+ case 0xAA74u: case 0xAA75u: case 0xAA76u:
+ /* https://github.com/roozbehp/unicode-data/issues/3 */
+ cat = (indic_category_t) OT_C;
+ break;
+ }
+
+ if (cat == OT_M)
+ {
+ switch ((int) pos)
+ {
+ case POS_PRE_C: cat = (indic_category_t) OT_VPre;
+ pos = POS_PRE_M; break;
+ case POS_ABOVE_C: cat = (indic_category_t) OT_VAbv; break;
+ case POS_BELOW_C: cat = (indic_category_t) OT_VBlw; break;
+ case POS_POST_C: cat = (indic_category_t) OT_VPst; break;
+ }
+ }
+
+ info.myanmar_category() = (myanmar_category_t) cat;
+ info.myanmar_position() = pos;
+}
+
+
+#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc
index 5ea1dbff27a..3c57bc1ff66 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc
@@ -24,11 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-indic-private.hh"
-
-/* buffer var allocations */
-#define myanmar_category() complex_var_u8_0() /* myanmar_category_t */
-#define myanmar_position() complex_var_u8_1() /* myanmar_position_t */
+#include "hb-ot-shape-complex-myanmar-private.hh"
/*
@@ -127,153 +123,6 @@ enum syllable_type_t {
#include "hb-ot-shape-complex-myanmar-machine.hh"
-/* Note: This enum is duplicated in the -machine.rl source file.
- * Not sure how to avoid duplication. */
-enum myanmar_category_t {
- OT_As = 18, /* Asat */
- OT_D0 = 20, /* Digit zero */
- OT_DB = OT_N, /* Dot below */
- OT_GB = OT_PLACEHOLDER,
- OT_MH = 21, /* Various consonant medial types */
- OT_MR = 22, /* Various consonant medial types */
- OT_MW = 23, /* Various consonant medial types */
- OT_MY = 24, /* Various consonant medial types */
- OT_PT = 25, /* Pwo and other tones */
- OT_VAbv = 26,
- OT_VBlw = 27,
- OT_VPre = 28,
- OT_VPst = 29,
- OT_VS = 30, /* Variation selectors */
- OT_P = 31, /* Punctuation */
- OT_D = 32, /* Digits except zero */
-};
-
-
-static inline bool
-is_one_of (const hb_glyph_info_t &info, unsigned int flags)
-{
- /* If it ligated, all bets are off. */
- if (_hb_glyph_info_ligated (&info)) return false;
- return !!(FLAG_UNSAFE (info.myanmar_category()) & flags);
-}
-
-static inline bool
-is_consonant (const hb_glyph_info_t &info)
-{
- return is_one_of (info, CONSONANT_FLAGS);
-}
-
-
-static inline void
-set_myanmar_properties (hb_glyph_info_t &info)
-{
- hb_codepoint_t u = info.codepoint;
- unsigned int type = hb_indic_get_categories (u);
- indic_category_t cat = (indic_category_t) (type & 0x7Fu);
- indic_position_t pos = (indic_position_t) (type >> 8);
-
- /* Myanmar
- * http://www.microsoft.com/typography/OpenTypeDev/myanmar/intro.htm#analyze
- */
- if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)))
- cat = (indic_category_t) OT_VS;
-
- switch (u)
- {
- case 0x104Eu:
- cat = (indic_category_t) OT_C; /* The spec says C, IndicSyllableCategory doesn't have. */
- break;
-
- case 0x002Du: case 0x00A0u: case 0x00D7u: case 0x2012u:
- case 0x2013u: case 0x2014u: case 0x2015u: case 0x2022u:
- case 0x25CCu: case 0x25FBu: case 0x25FCu: case 0x25FDu:
- case 0x25FEu:
- cat = (indic_category_t) OT_GB;
- break;
-
- case 0x1004u: case 0x101Bu: case 0x105Au:
- cat = (indic_category_t) OT_Ra;
- break;
-
- case 0x1032u: case 0x1036u:
- cat = (indic_category_t) OT_A;
- break;
-
- case 0x1039u:
- cat = (indic_category_t) OT_H;
- break;
-
- case 0x103Au:
- cat = (indic_category_t) OT_As;
- break;
-
- case 0x1041u: case 0x1042u: case 0x1043u: case 0x1044u:
- case 0x1045u: case 0x1046u: case 0x1047u: case 0x1048u:
- case 0x1049u: case 0x1090u: case 0x1091u: case 0x1092u:
- case 0x1093u: case 0x1094u: case 0x1095u: case 0x1096u:
- case 0x1097u: case 0x1098u: case 0x1099u:
- cat = (indic_category_t) OT_D;
- break;
-
- case 0x1040u:
- cat = (indic_category_t) OT_D; /* XXX The spec says D0, but Uniscribe doesn't seem to do. */
- break;
-
- case 0x103Eu: case 0x1060u:
- cat = (indic_category_t) OT_MH;
- break;
-
- case 0x103Cu:
- cat = (indic_category_t) OT_MR;
- break;
-
- case 0x103Du: case 0x1082u:
- cat = (indic_category_t) OT_MW;
- break;
-
- case 0x103Bu: case 0x105Eu: case 0x105Fu:
- cat = (indic_category_t) OT_MY;
- break;
-
- case 0x1063u: case 0x1064u: case 0x1069u: case 0x106Au:
- case 0x106Bu: case 0x106Cu: case 0x106Du: case 0xAA7Bu:
- cat = (indic_category_t) OT_PT;
- break;
-
- case 0x1038u: case 0x1087u: case 0x1088u: case 0x1089u:
- case 0x108Au: case 0x108Bu: case 0x108Cu: case 0x108Du:
- case 0x108Fu: case 0x109Au: case 0x109Bu: case 0x109Cu:
- cat = (indic_category_t) OT_SM;
- break;
-
- case 0x104Au: case 0x104Bu:
- cat = (indic_category_t) OT_P;
- break;
-
- case 0xAA74u: case 0xAA75u: case 0xAA76u:
- /* https://github.com/roozbehp/unicode-data/issues/3 */
- cat = (indic_category_t) OT_C;
- break;
- }
-
- if (cat == OT_M)
- {
- switch ((int) pos)
- {
- case POS_PRE_C: cat = (indic_category_t) OT_VPre;
- pos = POS_PRE_M; break;
- case POS_ABOVE_C: cat = (indic_category_t) OT_VAbv; break;
- case POS_BELOW_C: cat = (indic_category_t) OT_VBlw; break;
- case POS_POST_C: cat = (indic_category_t) OT_VPst; break;
- }
- }
-
- info.myanmar_category() = (myanmar_category_t) cat;
- info.myanmar_position() = pos;
-}
-
-
-
static void
setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_buffer_t *buffer,
@@ -374,6 +223,11 @@ initial_reordering_consonant_syllable (hb_buffer_t *buffer,
{
continue;
}
+ if (info[i].myanmar_category() == OT_VS)
+ {
+ info[i].myanmar_position() = info[i - 1].myanmar_position();
+ continue;
+ }
if (pos == POS_AFTER_MAIN && info[i].myanmar_category() == OT_VBlw)
{
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh
index e767865bc4b..0bf3ad3024a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh
@@ -36,281 +36,279 @@
#line 38 "hb-ot-shape-complex-use-machine.hh"
static const unsigned char _use_syllable_machine_trans_keys[] = {
- 1u, 1u, 12u, 12u, 1u, 15u, 1u, 15u, 1u, 1u, 12u, 12u, 0u, 43u, 21u, 21u,
- 8u, 39u, 8u, 39u, 1u, 15u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u,
- 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u, 4u, 4u, 13u, 13u,
- 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u,
+ 12u, 12u, 1u, 15u, 1u, 1u, 12u, 12u, 0u, 43u, 21u, 21u, 8u, 39u, 8u, 39u,
+ 1u, 15u, 1u, 1u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u,
8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 1u, 15u, 12u, 12u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u,
- 42u, 42u, 1u, 5u, 0
+ 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u, 4u, 4u, 13u, 13u, 8u, 39u,
+ 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u,
+ 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
+ 8u, 39u, 1u, 15u, 12u, 12u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u, 42u, 42u,
+ 1u, 5u, 0
};
static const char _use_syllable_machine_key_spans[] = {
- 1, 1, 15, 15, 1, 1, 44, 1,
- 32, 32, 15, 32, 32, 32, 19, 19,
- 19, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 9, 1, 1,
- 32, 32, 32, 32, 19, 19, 19, 32,
+ 1, 15, 1, 1, 44, 1, 32, 32,
+ 15, 1, 32, 32, 32, 19, 19, 19,
+ 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 9, 1, 1, 32,
+ 32, 32, 32, 19, 19, 19, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 15, 1, 39, 32, 22, 2,
- 1, 5
+ 32, 15, 1, 39, 32, 22, 2, 1,
+ 5
};
static const short _use_syllable_machine_index_offsets[] = {
- 0, 2, 4, 20, 36, 38, 40, 85,
- 87, 120, 153, 169, 202, 235, 268, 288,
- 308, 328, 361, 394, 427, 460, 493, 526,
- 559, 592, 625, 658, 691, 724, 734, 736,
- 738, 771, 804, 837, 870, 890, 910, 930,
- 963, 996, 1029, 1062, 1095, 1128, 1161, 1194,
- 1227, 1260, 1293, 1309, 1311, 1351, 1384, 1407,
- 1410, 1412
+ 0, 2, 18, 20, 22, 67, 69, 102,
+ 135, 151, 153, 186, 219, 252, 272, 292,
+ 312, 345, 378, 411, 444, 477, 510, 543,
+ 576, 609, 642, 675, 708, 718, 720, 722,
+ 755, 788, 821, 854, 874, 894, 914, 947,
+ 980, 1013, 1046, 1079, 1112, 1145, 1178, 1211,
+ 1244, 1277, 1293, 1295, 1335, 1368, 1391, 1394,
+ 1396
};
static const char _use_syllable_machine_indicies[] = {
- 1, 0, 3, 2, 1, 2, 2, 2,
+ 1, 0, 3, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 4, 2, 5, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 6, 0, 5, 0, 8, 7,
- 9, 10, 11, 9, 12, 10, 11, 11,
- 13, 11, 11, 5, 14, 11, 11, 15,
- 9, 9, 16, 17, 11, 11, 18, 19,
- 20, 21, 22, 23, 24, 18, 25, 26,
- 27, 28, 29, 30, 11, 31, 32, 33,
- 11, 11, 11, 34, 11, 36, 35, 38,
- 37, 37, 1, 39, 37, 37, 40, 37,
- 37, 37, 37, 37, 41, 42, 43, 44,
- 45, 46, 47, 48, 42, 49, 41, 50,
- 51, 52, 53, 37, 54, 55, 56, 37,
- 38, 37, 37, 1, 39, 37, 37, 40,
- 37, 37, 37, 37, 37, 57, 42, 43,
- 44, 45, 46, 47, 48, 42, 49, 50,
- 50, 51, 52, 53, 37, 54, 55, 56,
- 37, 1, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 4,
- 58, 38, 37, 37, 1, 39, 37, 37,
- 40, 37, 37, 37, 37, 37, 37, 42,
- 43, 44, 45, 46, 47, 48, 42, 49,
- 50, 50, 51, 52, 53, 37, 54, 55,
- 56, 37, 38, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 42, 43, 44, 45, 46, 37, 37, 37,
- 37, 37, 37, 51, 52, 53, 37, 54,
- 55, 56, 37, 38, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 43, 44, 45, 46, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 54, 55, 56, 37, 38, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 44, 45, 46, 37,
- 38, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 45, 46, 37, 38, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 46, 37,
- 38, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 44, 45, 46, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 54, 55, 56,
- 37, 38, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 44, 45, 46, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 55,
- 56, 37, 38, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 44, 45, 46, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 56, 37, 38, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 43, 44, 45, 46, 37, 37,
- 37, 37, 37, 37, 51, 52, 53, 37,
- 54, 55, 56, 37, 38, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 43, 44, 45, 46, 37,
- 37, 37, 37, 37, 37, 37, 52, 53,
- 37, 54, 55, 56, 37, 38, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 43, 44, 45, 46,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 53, 37, 54, 55, 56, 37, 38, 37,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 42, 43, 44, 45,
- 46, 37, 48, 42, 37, 37, 37, 51,
- 52, 53, 37, 54, 55, 56, 37, 38,
- 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 42, 43, 44,
- 45, 46, 37, 59, 42, 37, 37, 37,
- 51, 52, 53, 37, 54, 55, 56, 37,
- 38, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 42, 43,
- 44, 45, 46, 37, 37, 42, 37, 37,
- 37, 51, 52, 53, 37, 54, 55, 56,
- 37, 38, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 42,
- 43, 44, 45, 46, 47, 48, 42, 37,
- 37, 37, 51, 52, 53, 37, 54, 55,
- 56, 37, 38, 37, 37, 1, 39, 37,
- 37, 40, 37, 37, 37, 37, 37, 37,
- 42, 43, 44, 45, 46, 47, 48, 42,
- 49, 37, 50, 51, 52, 53, 37, 54,
- 55, 56, 37, 38, 37, 37, 1, 39,
- 37, 37, 40, 37, 37, 37, 37, 37,
- 37, 42, 43, 44, 45, 46, 47, 48,
- 42, 49, 41, 50, 51, 52, 53, 37,
- 54, 55, 56, 37, 61, 60, 60, 60,
- 60, 60, 60, 60, 62, 60, 12, 63,
- 61, 60, 13, 64, 64, 5, 8, 64,
- 64, 65, 64, 64, 64, 64, 64, 66,
- 18, 19, 20, 21, 22, 23, 24, 18,
- 25, 27, 27, 28, 29, 30, 64, 31,
- 32, 33, 64, 13, 64, 64, 5, 8,
- 64, 64, 65, 64, 64, 64, 64, 64,
- 64, 18, 19, 20, 21, 22, 23, 24,
- 18, 25, 27, 27, 28, 29, 30, 64,
- 31, 32, 33, 64, 13, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 18, 19, 20, 21, 22, 64,
- 64, 64, 64, 64, 64, 28, 29, 30,
- 64, 31, 32, 33, 64, 13, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 19, 20, 21, 22,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 31, 32, 33, 64, 13, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 20, 21,
- 22, 64, 13, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 21, 22, 64, 13, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 22, 64, 13, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 20, 21, 22, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 31,
- 32, 33, 64, 13, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 20, 21, 22, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 32, 33, 64, 13, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 20, 21, 22, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 33, 64, 13, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 19, 20, 21, 22,
- 64, 64, 64, 64, 64, 64, 28, 29,
- 30, 64, 31, 32, 33, 64, 13, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 19, 20, 21,
- 22, 64, 64, 64, 64, 64, 64, 64,
- 29, 30, 64, 31, 32, 33, 64, 13,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 19, 20,
- 21, 22, 64, 64, 64, 64, 64, 64,
- 64, 64, 30, 64, 31, 32, 33, 64,
- 13, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 18, 19,
- 20, 21, 22, 64, 24, 18, 64, 64,
- 64, 28, 29, 30, 64, 31, 32, 33,
- 64, 13, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 18,
- 19, 20, 21, 22, 64, 67, 18, 64,
- 64, 64, 28, 29, 30, 64, 31, 32,
- 33, 64, 13, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 18, 19, 20, 21, 22, 64, 64, 18,
- 64, 64, 64, 28, 29, 30, 64, 31,
- 32, 33, 64, 13, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 18, 19, 20, 21, 22, 23, 24,
- 18, 64, 64, 64, 28, 29, 30, 64,
- 31, 32, 33, 64, 13, 64, 64, 5,
- 8, 64, 64, 65, 64, 64, 64, 64,
- 64, 64, 18, 19, 20, 21, 22, 23,
- 24, 18, 25, 64, 27, 28, 29, 30,
- 64, 31, 32, 33, 64, 5, 68, 68,
+ 4, 2, 3, 2, 6, 5, 7, 8,
+ 9, 7, 10, 8, 9, 9, 11, 9,
+ 9, 3, 12, 9, 9, 13, 7, 7,
+ 14, 15, 9, 9, 16, 17, 18, 19,
+ 20, 21, 22, 16, 23, 24, 25, 26,
+ 27, 28, 9, 29, 30, 31, 9, 9,
+ 9, 32, 9, 34, 33, 36, 35, 35,
+ 37, 1, 35, 35, 38, 35, 35, 35,
+ 35, 35, 39, 40, 41, 42, 43, 44,
+ 45, 46, 40, 47, 39, 48, 49, 50,
+ 51, 35, 52, 53, 54, 35, 36, 35,
+ 35, 37, 1, 35, 35, 38, 35, 35,
+ 35, 35, 35, 55, 40, 41, 42, 43,
+ 44, 45, 46, 40, 47, 48, 48, 49,
+ 50, 51, 35, 52, 53, 54, 35, 37,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 57, 56, 37,
+ 56, 36, 35, 35, 37, 1, 35, 35,
+ 38, 35, 35, 35, 35, 35, 35, 40,
+ 41, 42, 43, 44, 45, 46, 40, 47,
+ 48, 48, 49, 50, 51, 35, 52, 53,
+ 54, 35, 36, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 40, 41, 42, 43, 44, 35, 35, 35,
+ 35, 35, 35, 49, 50, 51, 35, 52,
+ 53, 54, 35, 36, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 41, 42, 43, 44, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 52, 53, 54, 35, 36, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 42, 43, 44, 35,
+ 36, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 43, 44, 35, 36, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 44, 35,
+ 36, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 42, 43, 44, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 52, 53, 54,
+ 35, 36, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 42, 43, 44, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 53,
+ 54, 35, 36, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 42, 43, 44, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 54, 35, 36, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 41, 42, 43, 44, 35, 35,
+ 35, 35, 35, 35, 49, 50, 51, 35,
+ 52, 53, 54, 35, 36, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 41, 42, 43, 44, 35,
+ 35, 35, 35, 35, 35, 35, 50, 51,
+ 35, 52, 53, 54, 35, 36, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 41, 42, 43, 44,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 51, 35, 52, 53, 54, 35, 36, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 40, 41, 42, 43,
+ 44, 35, 46, 40, 35, 35, 35, 49,
+ 50, 51, 35, 52, 53, 54, 35, 36,
+ 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 40, 41, 42,
+ 43, 44, 35, 58, 40, 35, 35, 35,
+ 49, 50, 51, 35, 52, 53, 54, 35,
+ 36, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 40, 41,
+ 42, 43, 44, 35, 35, 40, 35, 35,
+ 35, 49, 50, 51, 35, 52, 53, 54,
+ 35, 36, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 40,
+ 41, 42, 43, 44, 45, 46, 40, 35,
+ 35, 35, 49, 50, 51, 35, 52, 53,
+ 54, 35, 36, 35, 35, 37, 1, 35,
+ 35, 38, 35, 35, 35, 35, 35, 35,
+ 40, 41, 42, 43, 44, 45, 46, 40,
+ 47, 35, 48, 49, 50, 51, 35, 52,
+ 53, 54, 35, 36, 35, 35, 37, 1,
+ 35, 35, 38, 35, 35, 35, 35, 35,
+ 35, 40, 41, 42, 43, 44, 45, 46,
+ 40, 47, 39, 48, 49, 50, 51, 35,
+ 52, 53, 54, 35, 60, 59, 59, 59,
+ 59, 59, 59, 59, 61, 59, 10, 62,
+ 60, 59, 11, 63, 63, 3, 6, 63,
+ 63, 64, 63, 63, 63, 63, 63, 65,
+ 16, 17, 18, 19, 20, 21, 22, 16,
+ 23, 25, 25, 26, 27, 28, 63, 29,
+ 30, 31, 63, 11, 63, 63, 3, 6,
+ 63, 63, 64, 63, 63, 63, 63, 63,
+ 63, 16, 17, 18, 19, 20, 21, 22,
+ 16, 23, 25, 25, 26, 27, 28, 63,
+ 29, 30, 31, 63, 11, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 16, 17, 18, 19, 20, 63,
+ 63, 63, 63, 63, 63, 26, 27, 28,
+ 63, 29, 30, 31, 63, 11, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 17, 18, 19, 20,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 29, 30, 31, 63, 11, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 18, 19,
+ 20, 63, 11, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 19, 20, 63, 11, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 20, 63, 11, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 18, 19, 20, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 29,
+ 30, 31, 63, 11, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 18, 19, 20, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 30, 31, 63, 11, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 18, 19, 20, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 31, 63, 11, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 17, 18, 19, 20,
+ 63, 63, 63, 63, 63, 63, 26, 27,
+ 28, 63, 29, 30, 31, 63, 11, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 17, 18, 19,
+ 20, 63, 63, 63, 63, 63, 63, 63,
+ 27, 28, 63, 29, 30, 31, 63, 11,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 17, 18,
+ 19, 20, 63, 63, 63, 63, 63, 63,
+ 63, 63, 28, 63, 29, 30, 31, 63,
+ 11, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 16, 17,
+ 18, 19, 20, 63, 22, 16, 63, 63,
+ 63, 26, 27, 28, 63, 29, 30, 31,
+ 63, 11, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 16,
+ 17, 18, 19, 20, 63, 66, 16, 63,
+ 63, 63, 26, 27, 28, 63, 29, 30,
+ 31, 63, 11, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 16, 17, 18, 19, 20, 63, 63, 16,
+ 63, 63, 63, 26, 27, 28, 63, 29,
+ 30, 31, 63, 11, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 16, 17, 18, 19, 20, 21, 22,
+ 16, 63, 63, 63, 26, 27, 28, 63,
+ 29, 30, 31, 63, 11, 63, 63, 3,
+ 6, 63, 63, 64, 63, 63, 63, 63,
+ 63, 63, 16, 17, 18, 19, 20, 21,
+ 22, 16, 23, 63, 25, 26, 27, 28,
+ 63, 29, 30, 31, 63, 3, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 4, 67, 6, 67, 8,
+ 63, 63, 63, 8, 63, 63, 11, 63,
+ 63, 3, 6, 63, 63, 64, 63, 63,
+ 63, 63, 63, 63, 16, 17, 18, 19,
+ 20, 21, 22, 16, 23, 24, 25, 26,
+ 27, 28, 63, 29, 30, 31, 63, 11,
+ 63, 63, 3, 6, 63, 63, 64, 63,
+ 63, 63, 63, 63, 63, 16, 17, 18,
+ 19, 20, 21, 22, 16, 23, 24, 25,
+ 26, 27, 28, 63, 29, 30, 31, 63,
+ 69, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 6, 68, 8, 68, 10,
- 64, 64, 64, 10, 64, 64, 13, 64,
- 64, 5, 8, 64, 64, 65, 64, 64,
- 64, 64, 64, 64, 18, 19, 20, 21,
- 22, 23, 24, 18, 25, 26, 27, 28,
- 29, 30, 64, 31, 32, 33, 64, 13,
- 64, 64, 5, 8, 64, 64, 65, 64,
- 64, 64, 64, 64, 64, 18, 19, 20,
- 21, 22, 23, 24, 18, 25, 26, 27,
- 28, 29, 30, 64, 31, 32, 33, 64,
- 70, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 70, 71, 69, 70,
- 71, 69, 71, 69, 10, 68, 68, 68,
- 10, 68, 0
+ 68, 68, 68, 68, 69, 70, 68, 69,
+ 70, 68, 70, 68, 8, 67, 67, 67,
+ 8, 67, 0
};
static const char _use_syllable_machine_trans_targs[] = {
- 6, 9, 6, 2, 0, 32, 4, 6,
- 3, 7, 8, 6, 29, 6, 50, 51,
- 52, 54, 34, 35, 36, 37, 38, 45,
- 46, 48, 53, 49, 42, 43, 44, 39,
- 40, 41, 57, 6, 6, 6, 6, 10,
- 1, 28, 12, 13, 14, 15, 16, 23,
- 24, 26, 27, 20, 21, 22, 17, 18,
- 19, 11, 6, 25, 6, 30, 31, 6,
- 6, 5, 33, 47, 6, 6, 55, 56
+ 4, 8, 4, 31, 2, 4, 1, 5,
+ 6, 4, 28, 4, 49, 50, 51, 53,
+ 33, 34, 35, 36, 37, 44, 45, 47,
+ 52, 48, 41, 42, 43, 38, 39, 40,
+ 56, 4, 4, 4, 4, 7, 0, 27,
+ 11, 12, 13, 14, 15, 22, 23, 25,
+ 26, 19, 20, 21, 16, 17, 18, 10,
+ 4, 9, 24, 4, 29, 30, 4, 4,
+ 3, 32, 46, 4, 4, 54, 55
};
static const char _use_syllable_machine_trans_actions[] = {
- 1, 2, 3, 0, 0, 4, 0, 5,
- 0, 0, 2, 8, 0, 9, 10, 10,
- 4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 4, 4, 0, 0, 0, 0,
- 0, 0, 0, 11, 12, 13, 14, 15,
- 0, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 2, 16, 0, 17, 0, 0, 18,
- 19, 0, 4, 0, 20, 21, 0, 0
+ 1, 0, 2, 3, 0, 4, 0, 0,
+ 7, 8, 0, 9, 10, 10, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 3, 0, 0, 0, 0, 0, 0,
+ 0, 11, 12, 13, 14, 7, 0, 7,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 7, 0, 0, 0, 0, 0, 0, 7,
+ 15, 0, 0, 16, 0, 0, 17, 18,
+ 0, 3, 0, 19, 20, 0, 0
};
static const char _use_syllable_machine_to_state_actions[] = {
- 0, 0, 0, 0, 0, 0, 6, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0
+ 0
};
static const char _use_syllable_machine_from_state_actions[] = {
- 0, 0, 0, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 6, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0
+ 0
};
static const short _use_syllable_machine_eof_trans[] = {
- 1, 3, 3, 1, 1, 8, 0, 36,
- 38, 38, 59, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 61, 64, 61,
- 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 69, 69, 65, 65, 70, 70,
- 70, 69
+ 1, 3, 3, 6, 0, 34, 36, 36,
+ 57, 57, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 36, 60, 63, 60, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 68, 68, 64, 64, 69, 69, 69,
+ 68
};
-static const int use_syllable_machine_start = 6;
-static const int use_syllable_machine_first_final = 6;
+static const int use_syllable_machine_start = 4;
+static const int use_syllable_machine_first_final = 4;
static const int use_syllable_machine_error = -1;
-static const int use_syllable_machine_en_main = 6;
+static const int use_syllable_machine_en_main = 4;
#line 38 "hb-ot-shape-complex-use-machine.rl"
@@ -337,7 +335,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 341 "hb-ot-shape-complex-use-machine.hh"
+#line 339 "hb-ot-shape-complex-use-machine.hh"
{
cs = use_syllable_machine_start;
ts = 0;
@@ -354,7 +352,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 358 "hb-ot-shape-complex-use-machine.hh"
+#line 356 "hb-ot-shape-complex-use-machine.hh"
{
int _slen;
int _trans;
@@ -364,11 +362,11 @@ find_syllables (hb_buffer_t *buffer)
goto _test_eof;
_resume:
switch ( _use_syllable_machine_from_state_actions[cs] ) {
- case 7:
+ case 6:
#line 1 "NONE"
{ts = p;}
break;
-#line 372 "hb-ot-shape-complex-use-machine.hh"
+#line 370 "hb-ot-shape-complex-use-machine.hh"
}
_keys = _use_syllable_machine_trans_keys + (cs<<1);
@@ -386,6 +384,10 @@ _eof_trans:
goto _again;
switch ( _use_syllable_machine_trans_actions[_trans] ) {
+ case 7:
+#line 1 "NONE"
+ {te = p+1;}
+ break;
case 12:
#line 130 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (independent_cluster); }}
@@ -406,7 +408,7 @@ _eof_trans:
#line 130 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (independent_cluster); }}
break;
- case 16:
+ case 15:
#line 131 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (virama_terminated_cluster); }}
break;
@@ -414,43 +416,37 @@ _eof_trans:
#line 132 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (standard_cluster); }}
break;
- case 18:
+ case 17:
#line 133 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }}
break;
- case 17:
+ case 16:
#line 134 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (numeral_cluster); }}
break;
- case 21:
+ case 20:
#line 135 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (symbol_cluster); }}
break;
- case 19:
+ case 18:
#line 136 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (broken_cluster); }}
break;
- case 20:
+ case 19:
#line 137 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (non_cluster); }}
break;
- case 3:
+ case 1:
#line 132 "hb-ot-shape-complex-use-machine.rl"
{{p = ((te))-1;}{ found_syllable (standard_cluster); }}
break;
- case 5:
+ case 4:
#line 136 "hb-ot-shape-complex-use-machine.rl"
{{p = ((te))-1;}{ found_syllable (broken_cluster); }}
break;
- case 1:
+ case 2:
#line 1 "NONE"
{ switch( act ) {
- case 2:
- {{p = ((te))-1;} found_syllable (virama_terminated_cluster); }
- break;
- case 3:
- {{p = ((te))-1;} found_syllable (standard_cluster); }
- break;
case 7:
{{p = ((te))-1;} found_syllable (broken_cluster); }
break;
@@ -460,19 +456,7 @@ _eof_trans:
}
}
break;
- case 15:
-#line 1 "NONE"
- {te = p+1;}
-#line 131 "hb-ot-shape-complex-use-machine.rl"
- {act = 2;}
- break;
- case 2:
-#line 1 "NONE"
- {te = p+1;}
-#line 132 "hb-ot-shape-complex-use-machine.rl"
- {act = 3;}
- break;
- case 4:
+ case 3:
#line 1 "NONE"
{te = p+1;}
#line 136 "hb-ot-shape-complex-use-machine.rl"
@@ -484,16 +468,16 @@ _eof_trans:
#line 137 "hb-ot-shape-complex-use-machine.rl"
{act = 8;}
break;
-#line 488 "hb-ot-shape-complex-use-machine.hh"
+#line 472 "hb-ot-shape-complex-use-machine.hh"
}
_again:
switch ( _use_syllable_machine_to_state_actions[cs] ) {
- case 6:
+ case 5:
#line 1 "NONE"
{ts = 0;}
break;
-#line 497 "hb-ot-shape-complex-use-machine.hh"
+#line 481 "hb-ot-shape-complex-use-machine.hh"
}
if ( ++p != pe )
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 89b776390b7..11fb47020ac 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
@@ -100,7 +100,7 @@ final_consonants = FAbv* FBlw* FPst* FM?;
virama_terminated_cluster =
(R|CS)? (B | GB) VS?
consonant_modifiers
- H
+ ZWJ?.H.ZWJ?
;
standard_cluster =
(R|CS)? (B | GB) VS?
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh
index 3e763ae3936..f7ded133d6b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh
@@ -92,6 +92,6 @@ enum use_category_t {
};
HB_INTERNAL USE_TABLE_ELEMENT_TYPE
-hb_use_get_categories (hb_codepoint_t u);
+hb_use_get_category (hb_codepoint_t u);
#endif /* HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH */
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 a67ef061122..6823392f4b4 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
@@ -690,7 +690,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
}; /* Table items: 5424; occupancy: 73% */
USE_TABLE_ELEMENT_TYPE
-hb_use_get_categories (hb_codepoint_t u)
+hb_use_get_category (hb_codepoint_t u)
{
switch (u >> 12)
{
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc
index 62acd697bdd..ee7653b51ce 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc
@@ -262,7 +262,7 @@ setup_masks_use (const hb_ot_shape_plan_t *plan,
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 0; i < count; i++)
- info[i].use_category() = hb_use_get_categories (info[i].codepoint);
+ info[i].use_category() = hb_use_get_category (info[i].codepoint);
}
static void
@@ -505,7 +505,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_glyph_info_t dottedcircle = {0};
if (!font->get_nominal_glyph (0x25CCu, &dottedcircle.codepoint))
return;
- dottedcircle.use_category() = hb_use_get_categories (0x25CC);
+ dottedcircle.use_category() = hb_use_get_category (0x25CC);
buffer->clear_output ();
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 6b228790af8..c7b46053d8c 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
@@ -200,8 +200,7 @@ position_mark (const hb_ot_shape_plan_t *plan,
unsigned int combining_class)
{
hb_glyph_extents_t mark_extents;
- if (!font->get_glyph_extents (buffer->info[i].codepoint,
- &mark_extents))
+ if (!font->get_glyph_extents (buffer->info[i].codepoint, &mark_extents))
return;
hb_position_t y_gap = font->y_scale / 16;
@@ -322,7 +321,9 @@ position_around_base (const hb_ot_shape_plan_t *plan,
base_extents.y_bearing += buffer->pos[base].y_offset;
unsigned int lig_id = _hb_glyph_info_get_lig_id (&buffer->info[base]);
- unsigned int num_lig_components = _hb_glyph_info_get_lig_num_comps (&buffer->info[base]);
+ /* Use integer for num_lig_components such that it doesn't convert to unsigned
+ * when we divide or multiply by it. */
+ int num_lig_components = _hb_glyph_info_get_lig_num_comps (&buffer->info[base]);
hb_position_t x_offset = 0, y_offset = 0;
if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) {
@@ -331,7 +332,7 @@ position_around_base (const hb_ot_shape_plan_t *plan,
}
hb_glyph_extents_t component_extents = base_extents;
- unsigned int last_lig_component = (unsigned int) -1;
+ int last_lig_component = -1;
unsigned int last_combining_class = 255;
hb_glyph_extents_t cluster_extents = base_extents; /* Initialization is just to shut gcc up. */
hb_glyph_info_t *info = buffer->info;
@@ -340,7 +341,7 @@ position_around_base (const hb_ot_shape_plan_t *plan,
{
if (num_lig_components > 1) {
unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&info[i]);
- unsigned int this_lig_component = _hb_glyph_info_get_lig_comp (&info[i]) - 1;
+ int this_lig_component = _hb_glyph_info_get_lig_comp (&info[i]) - 1;
/* Conditions for attaching to the last component. */
if (!lig_id || lig_id != this_lig_id || this_lig_component >= num_lig_components)
this_lig_component = num_lig_components - 1;
@@ -526,7 +527,7 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan,
break;
case t::SPACE_4_EM_18:
- pos[i].x_advance = font->x_scale * 4 / 18;
+ pos[i].x_advance = (int64_t) font->x_scale * 4 / 18;
break;
case t::SPACE_FIGURE:
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 fc5dd1084d2..263d65c0ccb 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
@@ -41,7 +41,7 @@
#include "hb-set-private.hh"
#include "hb-ot-layout-gsubgpos-private.hh"
-#include "hb-aat-layout-private.hh"
+//#include "hb-aat-layout-private.hh"
static hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'),
@@ -787,6 +787,8 @@ hb_ot_position (hb_ot_shape_context_t *c)
_hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
_hb_buffer_deallocate_gsubgpos_vars (c->buffer);
+
+ //hb_aat_layout_position (c->font, c->buffer);
}
static inline void
@@ -957,7 +959,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
hb_set_t *copy = hb_set_create ();
do {
copy->set (glyphs);
- for (hb_codepoint_t lookup_index = -1; hb_set_next (lookups, &lookup_index);)
+ for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);)
hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
} while (!copy->is_equal (glyphs));
hb_set_destroy (copy);
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 62c9fb278fc..daa496e98cd 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
@@ -51,6 +51,9 @@
#include <stdio.h>
#include <stdarg.h>
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#include <intrin.h>
+#endif
#define HB_PASTE1(a,b) a##b
#define HB_PASTE(a,b) HB_PASTE1(a,b)
@@ -120,10 +123,11 @@ extern "C" void hb_free_impl(void *ptr);
#endif
#ifndef HB_INTERNAL
-# if !defined(__MINGW32__) && !defined(__CYGWIN__)
+# if !defined(HB_NO_VISIBILITY) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_MSC_VER) && !defined(__SUNPRO_CC)
# define HB_INTERNAL __attribute__((__visibility__("hidden")))
# else
# define HB_INTERNAL
+# define HB_NO_VISIBILITY 1
# endif
#endif
@@ -135,6 +139,11 @@ extern "C" void hb_free_impl(void *ptr);
#define HB_FUNC __func__
#endif
+#ifdef __SUNPRO_CC
+/* https://github.com/harfbuzz/harfbuzz/issues/630 */
+#define __restrict
+#endif
+
/*
* Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411
* HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch
@@ -154,6 +163,9 @@ extern "C" void hb_free_impl(void *ptr);
#if defined(__clang__) && __cplusplus >= 201103L
/* clang's fallthrough annotations are only available starting in C++11. */
# define HB_FALLTHROUGH [[clang::fallthrough]]
+#elif __GNUC__ >= 7
+ /* GNU fallthrough attribute is available from GCC7 */
+# define HB_FALLTHROUGH __attribute__((fallthrough))
#elif defined(_MSC_VER)
/*
* MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):
@@ -221,6 +233,12 @@ static int errno = 0; /* Use something better? */
* https://developer.android.com/tools/sdk/ndk/index.html
*/
# define HB_USE_ATEXIT 1
+# elif defined(__APPLE__)
+/* For macOS and related platforms, the atexit man page indicates
+ * that it will be invoked when the library is unloaded, not only
+ * at application exit.
+ */
+# define HB_USE_ATEXIT 1
# endif
#endif
@@ -304,64 +322,189 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
typedef const struct _hb_void_t *hb_void_t;
#define HB_VOID ((const _hb_void_t *) nullptr)
-/* Return the number of 1 bits in mask. */
-static inline HB_CONST_FUNC unsigned int
-_hb_popcount32 (uint32_t mask)
-{
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
- return __builtin_popcount (mask);
-#else
- /* "HACKMEM 169" */
- uint32_t y;
- y = (mask >> 1) &033333333333;
- y = mask - y - ((y >>1) & 033333333333);
- return (((y + (y >> 3)) & 030707070707) % 077);
-#endif
-}
+/* Return the number of 1 bits in v. */
+template <typename T>
static inline HB_CONST_FUNC unsigned int
-_hb_popcount64 (uint64_t mask)
+_hb_popcount (T v)
{
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
- if (sizeof (long) >= sizeof (mask))
- return __builtin_popcountl (mask);
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && defined(__OPTIMIZE__)
+ if (sizeof (T) <= sizeof (unsigned int))
+ return __builtin_popcount (v);
+
+ if (sizeof (T) <= sizeof (unsigned long))
+ return __builtin_popcountl (v);
+
+ if (sizeof (T) <= sizeof (unsigned long long))
+ return __builtin_popcountll (v);
#endif
- return _hb_popcount32 (mask & 0xFFFFFFFF) + _hb_popcount32 (mask >> 32);
+
+ if (sizeof (T) <= 4)
+ {
+ /* "HACKMEM 169" */
+ uint32_t y;
+ y = (v >> 1) &033333333333;
+ y = v - y - ((y >>1) & 033333333333);
+ return (((y + (y >> 3)) & 030707070707) % 077);
+ }
+
+ if (sizeof (T) == 8)
+ {
+ unsigned int shift = 32;
+ return _hb_popcount<uint32_t> ((uint32_t) v) + _hb_popcount ((uint32_t) (v >> shift));
+ }
+
+ if (sizeof (T) == 16)
+ {
+ unsigned int shift = 64;
+ return _hb_popcount<uint64_t> ((uint64_t) v) + _hb_popcount ((uint64_t) (v >> shift));
+ }
+
+ assert (0);
}
-template <typename T> static inline unsigned int _hb_popcount (T mask);
-template <> inline unsigned int _hb_popcount<uint32_t> (uint32_t mask) { return _hb_popcount32 (mask); }
-template <> inline unsigned int _hb_popcount<uint64_t> (uint64_t mask) { return _hb_popcount64 (mask); }
/* Returns the number of bits needed to store number */
+template <typename T>
static inline HB_CONST_FUNC unsigned int
-_hb_bit_storage (unsigned int number)
+_hb_bit_storage (T v)
{
+ if (unlikely (!v)) return 0;
+
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
- return likely (number) ? (sizeof (unsigned int) * 8 - __builtin_clz (number)) : 0;
-#else
- unsigned int n_bits = 0;
- while (number) {
- n_bits++;
- number >>= 1;
+ if (sizeof (T) <= sizeof (unsigned int))
+ return sizeof (unsigned int) * 8 - __builtin_clz (v);
+
+ if (sizeof (T) <= sizeof (unsigned long))
+ return sizeof (unsigned long) * 8 - __builtin_clzl (v);
+
+ if (sizeof (T) <= sizeof (unsigned long long))
+ return sizeof (unsigned long long) * 8 - __builtin_clzll (v);
+#endif
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ if (sizeof (T) <= sizeof (unsigned int))
+ {
+ unsigned long where;
+ _BitScanReverse (&where, v);
+ return 1 + where;
}
- return n_bits;
+# if _WIN64
+ if (sizeof (T) <= 8)
+ {
+ unsigned long where;
+ _BitScanReverse64 (&where, v);
+ return 1 + where;
+ }
+# endif
#endif
+
+ if (sizeof (T) <= 4)
+ {
+ /* "bithacks" */
+ const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
+ const unsigned int S[] = {1, 2, 4, 8, 16};
+ unsigned int r = 0;
+ for (int i = 4; i >= 0; i--)
+ if (v & b[i])
+ {
+ v >>= S[i];
+ r |= S[i];
+ }
+ return r + 1;
+ }
+ if (sizeof (T) <= 8)
+ {
+ /* "bithacks" */
+ const uint64_t b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000, 0xFFFFFFFF00000000};
+ const unsigned int S[] = {1, 2, 4, 8, 16, 32};
+ unsigned int r = 0;
+ for (int i = 5; i >= 0; i--)
+ if (v & b[i])
+ {
+ v >>= S[i];
+ r |= S[i];
+ }
+ return r + 1;
+ }
+ if (sizeof (T) == 16)
+ {
+ unsigned int shift = 64;
+ return (v >> shift) ? _hb_bit_storage<uint64_t> ((uint64_t) v >> shift) + shift :
+ _hb_bit_storage<uint64_t> ((uint64_t) v);
+ }
+
+ assert (0);
}
-/* Returns the number of zero bits in the least significant side of number */
+/* Returns the number of zero bits in the least significant side of v */
+template <typename T>
static inline HB_CONST_FUNC unsigned int
-_hb_ctz (unsigned int number)
+_hb_ctz (T v)
{
+ if (unlikely (!v)) return 0;
+
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
- return likely (number) ? __builtin_ctz (number) : 0;
-#else
- unsigned int n_bits = 0;
- if (unlikely (!number)) return 0;
- while (!(number & 1)) {
- n_bits++;
- number >>= 1;
+ if (sizeof (T) <= sizeof (unsigned int))
+ return __builtin_ctz (v);
+
+ if (sizeof (T) <= sizeof (unsigned long))
+ return __builtin_ctzl (v);
+
+ if (sizeof (T) <= sizeof (unsigned long long))
+ return __builtin_ctzll (v);
+#endif
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ if (sizeof (T) <= sizeof (unsigned int))
+ {
+ unsigned long where;
+ _BitScanForward (&where, v);
+ return where;
}
- return n_bits;
+# if _WIN64
+ if (sizeof (T) <= 8)
+ {
+ unsigned long where;
+ _BitScanForward64 (&where, v);
+ return where;
+ }
+# endif
#endif
+
+ if (sizeof (T) <= 4)
+ {
+ /* "bithacks" */
+ unsigned int c = 32;
+ v &= - (int32_t) v;
+ if (v) c--;
+ if (v & 0x0000FFFF) c -= 16;
+ if (v & 0x00FF00FF) c -= 8;
+ if (v & 0x0F0F0F0F) c -= 4;
+ if (v & 0x33333333) c -= 2;
+ if (v & 0x55555555) c -= 1;
+ return c;
+ }
+ if (sizeof (T) <= 8)
+ {
+ /* "bithacks" */
+ unsigned int c = 64;
+ v &= - (int64_t) (v);
+ if (v) c--;
+ if (v & 0x00000000FFFFFFFF) c -= 32;
+ if (v & 0x0000FFFF0000FFFF) c -= 16;
+ if (v & 0x00FF00FF00FF00FF) c -= 8;
+ if (v & 0x0F0F0F0F0F0F0F0F) c -= 4;
+ if (v & 0x3333333333333333) c -= 2;
+ if (v & 0x5555555555555555) c -= 1;
+ return c;
+ }
+ if (sizeof (T) == 16)
+ {
+ unsigned int shift = 64;
+ return (uint64_t) v ? _hb_bit_storage<uint64_t> ((uint64_t) v) :
+ _hb_bit_storage<uint64_t> ((uint64_t) v >> shift) + shift;
+ }
+
+ assert (0);
}
static inline bool
@@ -370,6 +513,12 @@ _hb_unsigned_int_mul_overflows (unsigned int count, unsigned int size)
return (size > 0) && (count >= ((unsigned int) -1) / size);
}
+static inline unsigned int
+_hb_ceil_to_4 (unsigned int v)
+{
+ return ((v - 1) | 3) + 1;
+}
+
/* arrays and maps */
@@ -402,36 +551,45 @@ struct hb_prealloced_array_t
return &array[len - 1];
}
- inline bool resize (unsigned int size)
+ /* Allocate for size but don't adjust len. */
+ inline bool alloc(unsigned int size)
{
- if (unlikely (size > allocated))
- {
- /* Need to reallocate */
-
- unsigned int new_allocated = allocated;
- while (size >= new_allocated)
- new_allocated += (new_allocated >> 1) + 8;
-
- Type *new_array = nullptr;
-
- if (array == static_array) {
- new_array = (Type *) calloc (new_allocated, sizeof (Type));
- if (new_array)
- memcpy (new_array, array, len * sizeof (Type));
- } else {
- bool overflows = (new_allocated < allocated) || _hb_unsigned_int_mul_overflows (new_allocated, sizeof (Type));
- if (likely (!overflows)) {
- new_array = (Type *) realloc (array, new_allocated * sizeof (Type));
- }
- }
+ if (likely (size <= allocated))
+ return true;
+
+ /* Reallocate */
+
+ unsigned int new_allocated = allocated;
+ while (size >= new_allocated)
+ new_allocated += (new_allocated >> 1) + 8;
- if (unlikely (!new_array))
- return false;
+ Type *new_array = nullptr;
- array = new_array;
- allocated = new_allocated;
+ if (array == static_array) {
+ new_array = (Type *) calloc (new_allocated, sizeof (Type));
+ if (new_array)
+ memcpy (new_array, array, len * sizeof (Type));
+ } else {
+ bool overflows = (new_allocated < allocated) || _hb_unsigned_int_mul_overflows (new_allocated, sizeof (Type));
+ if (likely (!overflows)) {
+ new_array = (Type *) realloc (array, new_allocated * sizeof (Type));
+ }
}
+ if (unlikely (!new_array))
+ return false;
+
+ array = new_array;
+ allocated = new_allocated;
+
+ return true;
+ }
+
+ inline bool resize (unsigned int size)
+ {
+ if (!alloc (size))
+ return false;
+
len = size;
return true;
}
@@ -472,6 +630,11 @@ struct hb_prealloced_array_t
return nullptr;
}
+ inline void qsort (int (*cmp)(const void*, const void*))
+ {
+ ::qsort (array, len, sizeof (Type), cmp);
+ }
+
inline void qsort (void)
{
::qsort (array, len, sizeof (Type), Type::cmp);
@@ -483,25 +646,34 @@ struct hb_prealloced_array_t
}
template <typename T>
- inline Type *bsearch (T *x)
+ inline Type *lsearch (const T &x)
+ {
+ for (unsigned int i = 0; i < len; i++)
+ if (0 == this->array[i].cmp (&x))
+ return &array[i];
+ return nullptr;
+ }
+
+ template <typename T>
+ inline Type *bsearch (const T &x)
{
unsigned int i;
return bfind (x, &i) ? &array[i] : nullptr;
}
template <typename T>
- inline const Type *bsearch (T *x) const
+ inline const Type *bsearch (const T &x) const
{
unsigned int i;
return bfind (x, &i) ? &array[i] : nullptr;
}
template <typename T>
- inline bool bfind (T *x, unsigned int *i) const
+ inline bool bfind (const T &x, unsigned int *i) const
{
int min = 0, max = (int) this->len - 1;
while (min <= max)
{
int mid = (min + max) / 2;
- int c = this->array[mid].cmp (x);
+ int c = this->array[mid].cmp (&x);
if (c < 0)
max = mid - 1;
else if (c > 0)
@@ -512,7 +684,7 @@ struct hb_prealloced_array_t
return true;
}
}
- if (max < 0 || (max < (int) this->len && this->array[max].cmp (x) > 0))
+ if (max < 0 || (max < (int) this->len && this->array[max].cmp (&x) > 0))
max++;
*i = max;
return false;
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 576c169e678..3615c50e9e2 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
@@ -109,51 +109,60 @@ struct hb_set_t
unsigned int i = m / ELT_BITS;
unsigned int j = m & ELT_MASK;
- for (; j < ELT_BITS; j++)
- if (v[i] & (elt_t (1) << j))
- goto found;
- for (i++; i < len (); i++)
- if (v[i])
- for (j = 0; j < ELT_BITS; j++)
- if (v[i] & (elt_t (1) << j))
- goto found;
+ const elt_t vv = v[i] & ~((elt_t (1) << j) - 1);
+ for (const elt_t *p = &vv; i < len (); p = &v[++i])
+ if (*p)
+ {
+ *codepoint = i * ELT_BITS + elt_get_min (*p);
+ return true;
+ }
*codepoint = INVALID;
return false;
+ }
+ inline bool previous (hb_codepoint_t *codepoint) const
+ {
+ unsigned int m = (*codepoint - 1) & MASK;
+ if (m == MASK)
+ {
+ *codepoint = INVALID;
+ return false;
+ }
+ unsigned int i = m / ELT_BITS;
+ unsigned int j = m & ELT_MASK;
- found:
- *codepoint = i * ELT_BITS + j;
- return true;
+ const elt_t vv = v[i] & ((elt_t (1) << (j + 1)) - 1);
+ for (const elt_t *p = &vv; (int) i >= 0; p = &v[--i])
+ if (*p)
+ {
+ *codepoint = i * ELT_BITS + elt_get_max (*p);
+ return true;
+ }
+
+ *codepoint = INVALID;
+ return false;
}
inline hb_codepoint_t get_min (void) const
{
for (unsigned int i = 0; i < len (); i++)
if (v[i])
- {
- elt_t e = v[i];
- for (unsigned int j = 0; j < ELT_BITS; j++)
- if (e & (elt_t (1) << j))
- return i * ELT_BITS + j;
- }
+ return i * ELT_BITS + elt_get_min (v[i]);
return INVALID;
}
inline hb_codepoint_t get_max (void) const
{
for (int i = len () - 1; i >= 0; i--)
if (v[i])
- {
- elt_t e = v[i];
- for (int j = ELT_BITS - 1; j >= 0; j--)
- if (e & (elt_t (1) << j))
- return i * ELT_BITS + j;
- }
+ return i * ELT_BITS + elt_get_max (v[i]);
return 0;
}
- static const unsigned int PAGE_BITS = 8192; /* Use to tune. */
+ typedef unsigned long long elt_t;
+ static const unsigned int PAGE_BITS = 1024;
static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, "");
- typedef uint64_t elt_t;
+ static inline unsigned int elt_get_min (const elt_t &elt) { return _hb_ctz (elt); }
+ static inline unsigned int elt_get_max (const elt_t &elt) { return _hb_bit_storage (elt) - 1; }
#if 0 && HAVE_VECTOR_SIZE
/* The vectorized version does not work with clang as non-const
@@ -273,7 +282,7 @@ struct hb_set_t
{
page->add (g);
- array++;
+ array = (const T *) ((const char *) array + stride);
count--;
}
while (count && (g = *array, start <= g && g < end));
@@ -302,7 +311,7 @@ struct hb_set_t
last_g = g;
page->add (g);
- array++;
+ array = (const T *) ((const char *) array + stride);
count--;
}
while (count && (g = *array, g < end));
@@ -380,6 +389,7 @@ struct hb_set_t
unsigned int na = pages.len;
unsigned int nb = other->pages.len;
+ unsigned int next_page = na;
unsigned int count = 0;
unsigned int a = 0, b = 0;
@@ -421,27 +431,47 @@ struct hb_set_t
{
a--;
b--;
- Op::process (page_at (--count).v, page_at (a).v, other->page_at (b).v);
+ count--;
+ page_map[count] = page_map[a];
+ Op::process (page_at (count).v, page_at (a).v, other->page_at (b).v);
}
else if (page_map[a - 1].major > other->page_map[b - 1].major)
{
- a--;
- if (Op::passthru_left)
- page_at (--count).v = page_at (a).v;
+ a--;
+ if (Op::passthru_left)
+ {
+ count--;
+ page_map[count] = page_map[a];
+ }
}
else
{
- b--;
- if (Op::passthru_right)
- page_at (--count).v = other->page_at (b).v;
+ b--;
+ if (Op::passthru_right)
+ {
+ count--;
+ page_map[count].major = other->page_map[b].major;
+ page_map[count].index = next_page++;
+ page_at (count).v = other->page_at (b).v;
+ }
}
}
if (Op::passthru_left)
while (a)
- page_at (--count).v = page_at (--a).v;
+ {
+ a--;
+ count--;
+ page_map[count] = page_map [a];
+ }
if (Op::passthru_right)
while (b)
- page_at (--count).v = other->page_at (--b).v;
+ {
+ b--;
+ count--;
+ page_map[count].major = other->page_map[b].major;
+ page_map[count].index = next_page++;
+ page_at (count).v = other->page_at (b).v;
+ }
assert (!count);
}
@@ -470,13 +500,13 @@ struct hb_set_t
page_map_t map = {get_major (*codepoint), 0};
unsigned int i;
- page_map.bfind (&map, &i);
- if (i < page_map.len)
+ page_map.bfind (map, &i);
+ if (i < page_map.len && page_map[i].major == map.major)
{
if (pages[page_map[i].index].next (codepoint))
{
*codepoint += page_map[i].major * page_t::PAGE_BITS;
- return true;
+ return true;
}
i++;
}
@@ -492,6 +522,37 @@ struct hb_set_t
*codepoint = INVALID;
return false;
}
+ inline bool previous (hb_codepoint_t *codepoint) const
+ {
+ if (unlikely (*codepoint == INVALID)) {
+ *codepoint = get_max ();
+ return *codepoint != INVALID;
+ }
+
+ page_map_t map = {get_major (*codepoint), 0};
+ unsigned int i;
+ page_map.bfind (map, &i);
+ if (i < page_map.len && page_map[i].major == map.major)
+ {
+ if (pages[page_map[i].index].previous (codepoint))
+ {
+ *codepoint += page_map[i].major * page_t::PAGE_BITS;
+ return true;
+ }
+ }
+ i--;
+ for (; (int) i >= 0; i--)
+ {
+ hb_codepoint_t m = pages[page_map[i].index].get_max ();
+ if (m != INVALID)
+ {
+ *codepoint = page_map[i].major * page_t::PAGE_BITS + m;
+ return true;
+ }
+ }
+ *codepoint = INVALID;
+ return false;
+ }
inline bool next_range (hb_codepoint_t *first, hb_codepoint_t *last) const
{
hb_codepoint_t i;
@@ -503,12 +564,31 @@ struct hb_set_t
return false;
}
+ /* TODO Speed up. */
*last = *first = i;
while (next (&i) && i == *last + 1)
(*last)++;
return true;
}
+ inline bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
+ {
+ hb_codepoint_t i;
+
+ i = *first;
+ if (!previous (&i))
+ {
+ *last = *first = INVALID;
+ return false;
+ }
+
+ /* TODO Speed up. */
+ *last = *first = i;
+ while (previous (&i) && i == *first - 1)
+ (*first)--;
+
+ return true;
+ }
inline unsigned int get_population (void) const
{
@@ -541,7 +621,7 @@ struct hb_set_t
{
page_map_t map = {get_major (g), pages.len};
unsigned int i;
- if (!page_map.bfind (&map, &i))
+ if (!page_map.bfind (map, &i))
{
if (!resize (pages.len + 1))
return nullptr;
@@ -555,7 +635,7 @@ struct hb_set_t
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);
+ const page_map_t *found = page_map.bsearch (key);
if (found)
return &pages[found->index];
return nullptr;
@@ -563,7 +643,7 @@ struct hb_set_t
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);
+ const page_map_t *found = page_map.bsearch (key);
if (found)
return &pages[found->index];
return nullptr;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc
index 0b4f871e852..07cf9d09b55 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc
@@ -50,6 +50,13 @@ hb_set_create (void)
return set;
}
+static const hb_set_t _hb_set_nil = {
+ HB_OBJECT_HEADER_STATIC,
+ true, /* in_error */
+
+ {0} /* elts */
+};
+
/**
* hb_set_get_empty:
*
@@ -60,13 +67,6 @@ hb_set_create (void)
hb_set_t *
hb_set_get_empty (void)
{
- static const hb_set_t _hb_set_nil = {
- HB_OBJECT_HEADER_STATIC,
- true, /* in_error */
-
- {0} /* elts */
- };
-
return const_cast<hb_set_t *> (&_hb_set_nil);
}
@@ -437,7 +437,9 @@ hb_set_get_max (const hb_set_t *set)
* @set: a set.
* @codepoint: (inout):
*
- *
+ * Gets the next number in @set that is greater than current value of @codepoint.
+ *
+ * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
*
* Return value: whether there was a next value.
*
@@ -451,6 +453,26 @@ hb_set_next (const hb_set_t *set,
}
/**
+ * hb_set_previous:
+ * @set: a set.
+ * @codepoint: (inout):
+ *
+ * Gets the previous number in @set that is slower than current value of @codepoint.
+ *
+ * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
+ *
+ * Return value: whether there was a previous value.
+ *
+ * Since: 1.8.0
+ **/
+hb_bool_t
+hb_set_previous (const hb_set_t *set,
+ hb_codepoint_t *codepoint)
+{
+ return set->previous (codepoint);
+}
+
+/**
* hb_set_next_range:
* @set: a set.
* @first: (out): output first codepoint in the range.
@@ -459,6 +481,8 @@ hb_set_next (const hb_set_t *set,
* Gets the next consecutive range of numbers in @set that
* are greater than current value of @last.
*
+ * Set @last to %HB_SET_VALUE_INVALID to get started.
+ *
* Return value: whether there was a next range.
*
* Since: 0.9.7
@@ -470,3 +494,26 @@ hb_set_next_range (const hb_set_t *set,
{
return set->next_range (first, last);
}
+
+/**
+ * hb_set_previous_range:
+ * @set: a set.
+ * @first: (inout): input current first and output first codepoint in the range.
+ * @last: (out): output last codepoint in the range.
+ *
+ * Gets the previous consecutive range of numbers in @set that
+ * are greater than current value of @last.
+ *
+ * Set @first to %HB_SET_VALUE_INVALID to get started.
+ *
+ * Return value: whether there was a previous range.
+ *
+ * Since: 1.8.0
+ **/
+hb_bool_t
+hb_set_previous_range (const hb_set_t *set,
+ hb_codepoint_t *first,
+ hb_codepoint_t *last)
+{
+ return set->previous_range (first, last);
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h
index 2ce406073ce..b0f82f82208 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h
@@ -129,25 +129,36 @@ hb_set_symmetric_difference (hb_set_t *set,
HB_EXTERN unsigned int
hb_set_get_population (const hb_set_t *set);
-/* Returns -1 if set empty. */
+/* Returns HB_SET_VALUE_INVALID if set empty. */
HB_EXTERN hb_codepoint_t
hb_set_get_min (const hb_set_t *set);
-/* Returns -1 if set empty. */
+/* Returns HB_SET_VALUE_INVALID if set empty. */
HB_EXTERN hb_codepoint_t
hb_set_get_max (const hb_set_t *set);
-/* Pass -1 in to get started. */
+/* Pass HB_SET_VALUE_INVALID in to get started. */
HB_EXTERN hb_bool_t
hb_set_next (const hb_set_t *set,
hb_codepoint_t *codepoint);
-/* Pass -1 for first and last to get started. */
+/* Pass HB_SET_VALUE_INVALID in to get started. */
+HB_EXTERN hb_bool_t
+hb_set_previous (const hb_set_t *set,
+ hb_codepoint_t *codepoint);
+
+/* Pass HB_SET_VALUE_INVALID for first and last to get started. */
HB_EXTERN hb_bool_t
hb_set_next_range (const hb_set_t *set,
hb_codepoint_t *first,
hb_codepoint_t *last);
+/* Pass HB_SET_VALUE_INVALID for first and last to get started. */
+HB_EXTERN hb_bool_t
+hb_set_previous_range (const hb_set_t *set,
+ hb_codepoint_t *first,
+ hb_codepoint_t *last);
+
HB_END_DECLS
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc
new file mode 100644
index 00000000000..0b84c856c2b
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc
@@ -0,0 +1,307 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger, Roderick Sheeter
+ */
+
+#include "hb-open-type-private.hh"
+#include "hb-ot-glyf-table.hh"
+#include "hb-set.h"
+#include "hb-subset-glyf.hh"
+#include "hb-subset-plan.hh"
+
+static bool
+_calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf,
+ hb_prealloced_array_t<hb_codepoint_t> &glyph_ids,
+ hb_bool_t drop_hints,
+ bool *use_short_loca /* OUT */,
+ unsigned int *glyf_size /* OUT */,
+ unsigned int *loca_size /* OUT */,
+ hb_prealloced_array_t<unsigned int> *instruction_ranges /* OUT */)
+{
+ unsigned int total = 0;
+ for (unsigned int i = 0; i < glyph_ids.len; i++)
+ {
+ hb_codepoint_t next_glyph = glyph_ids[i];
+ unsigned int *instruction_start = instruction_ranges->push();
+ unsigned int *instruction_end = instruction_ranges->push();
+ *instruction_start = 0;
+ *instruction_end = 0;
+
+ unsigned int start_offset, end_offset;
+ if (unlikely (!(glyf.get_offsets(next_glyph, &start_offset, &end_offset)
+ && glyf.remove_padding(start_offset, &end_offset))))
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Invalid gid %d", next_glyph);
+ continue;
+ }
+ if (end_offset - start_offset < OT::glyf::GlyphHeader::static_size)
+ continue; /* 0-length glyph */
+
+ if (drop_hints)
+ {
+ if (unlikely (!glyf.get_instruction_offsets(start_offset, end_offset,
+ instruction_start, instruction_end)))
+ {
+ DEBUG_MSG(SUBSET, nullptr, "Unable to get instruction offsets for %d", next_glyph);
+ return false;
+ }
+ }
+
+ total += end_offset - start_offset - (*instruction_end - *instruction_start);
+ /* round2 so short loca will work */
+ total += total % 2;
+ }
+
+ *glyf_size = total;
+ *use_short_loca = (total <= 131070);
+ *loca_size = (glyph_ids.len + 1)
+ * (*use_short_loca ? sizeof(OT::HBUINT16) : sizeof(OT::HBUINT32));
+
+ DEBUG_MSG(SUBSET, nullptr, "preparing to subset glyf: final size %d, loca size %d, using %s loca",
+ total,
+ *loca_size,
+ *use_short_loca ? "short" : "long");
+ return true;
+}
+
+static bool
+_write_loca_entry (unsigned int id,
+ unsigned int offset,
+ bool is_short,
+ void *loca_prime,
+ unsigned int loca_size)
+{
+ unsigned int entry_size = is_short ? sizeof (OT::HBUINT16) : sizeof (OT::HBUINT32);
+ if ((id + 1) * entry_size <= loca_size)
+ {
+ if (is_short) {
+ ((OT::HBUINT16*) loca_prime) [id].set (offset / 2);
+ } else {
+ ((OT::HBUINT32*) loca_prime) [id].set (offset);
+ }
+ return true;
+ }
+
+ // Offset was not written because the write is out of bounds.
+ DEBUG_MSG (SUBSET,
+ nullptr,
+ "WARNING: Attempted to write an out of bounds loca entry at index %d. Loca size is %d.",
+ id,
+ loca_size);
+ return false;
+}
+
+static void
+_update_components (hb_subset_plan_t * plan,
+ char * glyph_start,
+ unsigned int length)
+
+{
+ OT::glyf::CompositeGlyphHeader::Iterator iterator;
+ if (OT::glyf::CompositeGlyphHeader::get_iterator (glyph_start,
+ length,
+ &iterator))
+ {
+ do
+ {
+ hb_codepoint_t new_gid;
+ if (!hb_subset_plan_new_gid_for_old_id (plan,
+ iterator.current->glyphIndex,
+ &new_gid))
+ continue;
+
+ ((OT::glyf::CompositeGlyphHeader *) iterator.current)->glyphIndex.set (new_gid);
+ } while (iterator.move_to_next());
+ }
+}
+
+static bool _remove_composite_instruction_flag(char *glyf_prime, unsigned int length)
+{
+ /* remove WE_HAVE_INSTRUCTIONS from flags in dest */
+ OT::glyf::CompositeGlyphHeader::Iterator composite_it;
+ if (unlikely (!OT::glyf::CompositeGlyphHeader::get_iterator (glyf_prime, length, &composite_it))) return false;
+ const OT::glyf::CompositeGlyphHeader *glyph;
+ do {
+ glyph = composite_it.current;
+ OT::HBUINT16 *flags = const_cast<OT::HBUINT16 *> (&glyph->flags);
+ flags->set ( (uint16_t) *flags & ~OT::glyf::CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS);
+ } while (composite_it.move_to_next());
+ return true;
+}
+
+static bool
+_write_glyf_and_loca_prime (hb_subset_plan_t *plan,
+ const OT::glyf::accelerator_t &glyf,
+ const char *glyf_data,
+ bool use_short_loca,
+ hb_prealloced_array_t<unsigned int> &instruction_ranges,
+ unsigned int glyf_prime_size,
+ char *glyf_prime_data /* OUT */,
+ unsigned int loca_prime_size,
+ char *loca_prime_data /* OUT */)
+{
+ hb_prealloced_array_t<hb_codepoint_t> &glyph_ids = plan->gids_to_retain_sorted;
+ char *glyf_prime_data_next = glyf_prime_data;
+
+ bool success = true;
+ for (unsigned int i = 0; i < glyph_ids.len; i++)
+ {
+ unsigned int start_offset, end_offset;
+ if (unlikely (!(glyf.get_offsets (glyph_ids[i], &start_offset, &end_offset)
+ && glyf.remove_padding(start_offset, &end_offset))))
+ end_offset = start_offset = 0;
+ unsigned int instruction_start = instruction_ranges[i * 2];
+ unsigned int instruction_end = instruction_ranges[i * 2 + 1];
+
+ int length = end_offset - start_offset - (instruction_end - instruction_start);
+ length += length % 2;
+
+ if (glyf_prime_data_next + length > glyf_prime_data + glyf_prime_size)
+ {
+ DEBUG_MSG (SUBSET,
+ nullptr,
+ "WARNING: Attempted to write an out of bounds glyph entry for gid %d (length %d)",
+ i, length);
+ return false;
+ }
+
+ if (instruction_start == instruction_end)
+ memcpy (glyf_prime_data_next, glyf_data + start_offset, length);
+ else
+ {
+ memcpy (glyf_prime_data_next, glyf_data + start_offset, instruction_start - start_offset);
+ memcpy (glyf_prime_data_next + instruction_start - start_offset, glyf_data + instruction_end, end_offset - instruction_end);
+ /* if the instructions end at the end this was a composite glyph, else simple */
+ if (instruction_end == end_offset)
+ {
+ if (unlikely (!_remove_composite_instruction_flag (glyf_prime_data_next, length))) return false;
+ }
+ else
+ /* zero instruction length, which is just before instruction_start */
+ memset (glyf_prime_data_next + instruction_start - start_offset - 2, 0, 2);
+ }
+
+ success = success && _write_loca_entry (i,
+ glyf_prime_data_next - glyf_prime_data,
+ use_short_loca,
+ loca_prime_data,
+ loca_prime_size);
+ _update_components (plan, glyf_prime_data_next, length);
+
+ glyf_prime_data_next += length;
+ }
+
+ success = success && _write_loca_entry (glyph_ids.len,
+ glyf_prime_data_next - glyf_prime_data,
+ use_short_loca,
+ loca_prime_data,
+ loca_prime_size);
+ return success;
+}
+
+static bool
+_hb_subset_glyf_and_loca (const OT::glyf::accelerator_t &glyf,
+ const char *glyf_data,
+ hb_subset_plan_t *plan,
+ bool *use_short_loca,
+ hb_blob_t **glyf_prime /* OUT */,
+ hb_blob_t **loca_prime /* OUT */)
+{
+ // TODO(grieger): Sanity check allocation size for the new table.
+ hb_prealloced_array_t<hb_codepoint_t> &glyphs_to_retain = plan->gids_to_retain_sorted;
+
+ unsigned int glyf_prime_size;
+ unsigned int loca_prime_size;
+ hb_prealloced_array_t<unsigned int> instruction_ranges;
+ instruction_ranges.init();
+
+ if (unlikely (!_calculate_glyf_and_loca_prime_size (glyf,
+ glyphs_to_retain,
+ plan->drop_hints,
+ use_short_loca,
+ &glyf_prime_size,
+ &loca_prime_size,
+ &instruction_ranges))) {
+ instruction_ranges.finish();
+ return false;
+ }
+
+ char *glyf_prime_data = (char *) calloc (1, glyf_prime_size);
+ char *loca_prime_data = (char *) calloc (1, loca_prime_size);
+ if (unlikely (!_write_glyf_and_loca_prime (plan, glyf, glyf_data,
+ *use_short_loca,
+ instruction_ranges,
+ glyf_prime_size, glyf_prime_data,
+ loca_prime_size, loca_prime_data))) {
+ free (glyf_prime_data);
+ free (loca_prime_data);
+ instruction_ranges.finish();
+ return false;
+ }
+ instruction_ranges.finish();
+
+ *glyf_prime = hb_blob_create (glyf_prime_data,
+ glyf_prime_size,
+ HB_MEMORY_MODE_READONLY,
+ glyf_prime_data,
+ free);
+ *loca_prime = hb_blob_create (loca_prime_data,
+ loca_prime_size,
+ HB_MEMORY_MODE_READONLY,
+ loca_prime_data,
+ free);
+ return true;
+}
+
+/**
+ * hb_subset_glyf:
+ * Subsets the glyph table according to a provided plan.
+ *
+ * Return value: subsetted glyf table.
+ *
+ * Since: 1.7.5
+ **/
+bool
+hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
+ bool *use_short_loca, /* OUT */
+ hb_blob_t **glyf_prime, /* OUT */
+ hb_blob_t **loca_prime /* OUT */)
+{
+ hb_blob_t *glyf_blob = OT::Sanitizer<OT::glyf>().sanitize (plan->source->reference_table (HB_OT_TAG_glyf));
+ const char *glyf_data = hb_blob_get_data(glyf_blob, nullptr);
+
+ OT::glyf::accelerator_t glyf;
+ glyf.init(plan->source);
+ bool result = _hb_subset_glyf_and_loca (glyf,
+ glyf_data,
+ plan,
+ use_short_loca,
+ glyf_prime,
+ loca_prime);
+
+ hb_blob_destroy (glyf_blob);
+ glyf.fini();
+
+ return result;
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh
new file mode 100644
index 00000000000..99b76db9bbe
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger
+ */
+
+#ifndef HB_SUBSET_GLYF_HH
+#define HB_SUBSET_GLYF_HH
+
+#include "hb-private.hh"
+
+#include "hb-subset-plan.hh"
+
+HB_INTERNAL bool
+hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
+ bool *use_short_loca, /* OUT */
+ hb_blob_t **glyf_prime /* OUT */,
+ hb_blob_t **loca_prime /* OUT */);
+
+#endif /* HB_SUBSET_GLYF_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc
new file mode 100644
index 00000000000..c4003dd3ad1
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc
@@ -0,0 +1,119 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod
+ */
+
+#include "hb-object-private.hh"
+#include "hb-subset-private.hh"
+#include "hb-set-private.hh"
+
+/**
+ * hb_subset_input_create_or_fail:
+ *
+ * Return value: New subset input.
+ *
+ * Since: 1.8.0
+ **/
+hb_subset_input_t *
+hb_subset_input_create_or_fail (void)
+{
+ hb_subset_input_t *input = hb_object_create<hb_subset_input_t>();
+
+ if (unlikely (!input))
+ return nullptr;
+
+ input->unicodes = hb_set_create ();
+ input->glyphs = hb_set_create ();
+
+ return input;
+}
+
+/**
+ * hb_subset_input_reference: (skip)
+ * @subset_input: a subset_input.
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.8.0
+ **/
+hb_subset_input_t *
+hb_subset_input_reference (hb_subset_input_t *subset_input)
+{
+ return hb_object_reference (subset_input);
+}
+
+/**
+ * hb_subset_input_destroy:
+ * @subset_input: a subset_input.
+ *
+ * Since: 1.8.0
+ **/
+void
+hb_subset_input_destroy(hb_subset_input_t *subset_input)
+{
+ if (!hb_object_destroy (subset_input)) return;
+
+ hb_set_destroy (subset_input->unicodes);
+ hb_set_destroy (subset_input->glyphs);
+
+ free (subset_input);
+}
+
+/**
+ * hb_subset_input_unicode_set:
+ * @subset_input: a subset_input.
+ *
+ * Since: 1.8.0
+ **/
+HB_EXTERN hb_set_t *
+hb_subset_input_unicode_set (hb_subset_input_t *subset_input)
+{
+ return subset_input->unicodes;
+}
+
+/**
+ * hb_subset_input_glyph_set:
+ * @subset_input: a subset_input.
+ *
+ * Since: 1.8.0
+ **/
+HB_EXTERN hb_set_t *
+hb_subset_input_glyph_set (hb_subset_input_t *subset_input)
+{
+ return subset_input->glyphs;
+}
+
+/**
+ * hb_subset_input_drop_hints:
+ * @subset_input: a subset_input.
+ *
+ * Since: 1.8.0
+ **/
+HB_EXTERN hb_bool_t *
+hb_subset_input_drop_hints (hb_subset_input_t *subset_input)
+{
+ return &subset_input->drop_hints;
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
new file mode 100644
index 00000000000..f8a09efe4d1
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
@@ -0,0 +1,227 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger, Roderick Sheeter
+ */
+
+#include "hb-subset-private.hh"
+
+#include "hb-subset-plan.hh"
+#include "hb-ot-cmap-table.hh"
+#include "hb-ot-glyf-table.hh"
+
+static int
+_hb_codepoint_t_cmp (const void *pa, const void *pb)
+{
+ hb_codepoint_t a = * (hb_codepoint_t *) pa;
+ hb_codepoint_t b = * (hb_codepoint_t *) pb;
+
+ return a < b ? -1 : a > b ? +1 : 0;
+}
+
+hb_bool_t
+hb_subset_plan_new_gid_for_codepoint (hb_subset_plan_t *plan,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *new_gid)
+{
+ // TODO actual map, delete this garbage.
+ for (unsigned int i = 0; i < plan->codepoints.len; i++)
+ {
+ if (plan->codepoints[i] != codepoint) continue;
+ if (!hb_subset_plan_new_gid_for_old_id(plan, plan->gids_to_retain[i], new_gid))
+ {
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+hb_bool_t
+hb_subset_plan_new_gid_for_old_id (hb_subset_plan_t *plan,
+ hb_codepoint_t old_gid,
+ hb_codepoint_t *new_gid)
+{
+ // the index in old_gids is the new gid; only up to codepoints.len are valid
+ for (unsigned int i = 0; i < plan->gids_to_retain_sorted.len; i++)
+ {
+ if (plan->gids_to_retain_sorted[i] == old_gid)
+ {
+ *new_gid = i;
+ return true;
+ }
+ }
+ return false;
+}
+
+hb_bool_t
+hb_subset_plan_add_table (hb_subset_plan_t *plan,
+ hb_tag_t tag,
+ hb_blob_t *contents)
+{
+ hb_blob_t *source_blob = plan->source->reference_table (tag);
+ DEBUG_MSG(SUBSET, nullptr, "add table %c%c%c%c, dest %d bytes, source %d bytes", HB_UNTAG(tag), hb_blob_get_length (contents), hb_blob_get_length (source_blob));
+ hb_blob_destroy (source_blob);
+ return hb_subset_face_add_table(plan->dest, tag, contents);
+}
+
+static void
+_populate_codepoints (hb_set_t *input_codepoints,
+ hb_prealloced_array_t<hb_codepoint_t>& plan_codepoints)
+{
+ plan_codepoints.alloc (hb_set_get_population (input_codepoints));
+ hb_codepoint_t cp = -1;
+ while (hb_set_next (input_codepoints, &cp)) {
+ hb_codepoint_t *wr = plan_codepoints.push();
+ *wr = cp;
+ }
+ plan_codepoints.qsort (_hb_codepoint_t_cmp);
+}
+
+static void
+_add_gid_and_children (const OT::glyf::accelerator_t &glyf,
+ hb_codepoint_t gid,
+ hb_set_t *gids_to_retain)
+{
+ if (hb_set_has (gids_to_retain, gid))
+ // Already visited this gid, ignore.
+ return;
+
+ hb_set_add (gids_to_retain, gid);
+
+ OT::glyf::CompositeGlyphHeader::Iterator composite;
+ if (glyf.get_composite (gid, &composite))
+ {
+ do
+ {
+ _add_gid_and_children (glyf, (hb_codepoint_t) composite.current->glyphIndex, gids_to_retain);
+ } while (composite.move_to_next());
+ }
+}
+
+static void
+_populate_gids_to_retain (hb_face_t *face,
+ hb_prealloced_array_t<hb_codepoint_t>& codepoints,
+ hb_prealloced_array_t<hb_codepoint_t>& old_gids,
+ hb_prealloced_array_t<hb_codepoint_t>& old_gids_sorted)
+{
+ OT::cmap::accelerator_t cmap;
+ OT::glyf::accelerator_t glyf;
+ cmap.init (face);
+ glyf.init (face);
+
+ hb_auto_array_t<unsigned int> bad_indices;
+
+ old_gids.alloc (codepoints.len);
+ for (unsigned int i = 0; i < codepoints.len; i++)
+ {
+ hb_codepoint_t gid;
+ if (!cmap.get_nominal_glyph (codepoints[i], &gid))
+ {
+ gid = -1;
+ *(bad_indices.push ()) = i;
+ }
+ *(old_gids.push ()) = gid;
+ }
+
+ /* Generally there shouldn't be any */
+ while (bad_indices.len > 0)
+ {
+ unsigned int i = bad_indices[bad_indices.len - 1];
+ bad_indices.pop ();
+ DEBUG_MSG(SUBSET, nullptr, "Drop U+%04X; no gid", codepoints[i]);
+ codepoints.remove (i);
+ old_gids.remove (i);
+ }
+
+ // Populate a full set of glyphs to retain by adding all referenced
+ // composite glyphs.
+ // TODO expand with glyphs reached by G*
+ hb_set_t * all_gids_to_retain = hb_set_create ();
+ _add_gid_and_children (glyf, 0, all_gids_to_retain);
+ for (unsigned int i = 0; i < old_gids.len; i++)
+ _add_gid_and_children (glyf, old_gids[i], all_gids_to_retain);
+
+ // Transfer to a sorted list.
+ old_gids_sorted.alloc (hb_set_get_population (all_gids_to_retain));
+ hb_codepoint_t gid = HB_SET_VALUE_INVALID;
+ while (hb_set_next (all_gids_to_retain, &gid))
+ *(old_gids_sorted.push ()) = gid;
+
+ hb_set_destroy (all_gids_to_retain);
+ glyf.fini ();
+ cmap.fini ();
+}
+
+/**
+ * hb_subset_plan_create:
+ * Computes a plan for subsetting the supplied face according
+ * to a provide profile and input. The plan describes
+ * which tables and glyphs should be retained.
+ *
+ * Return value: New subset plan.
+ *
+ * Since: 1.7.5
+ **/
+hb_subset_plan_t *
+hb_subset_plan_create (hb_face_t *face,
+ hb_subset_profile_t *profile,
+ hb_subset_input_t *input)
+{
+ hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> ();
+
+ plan->codepoints.init();
+ plan->gids_to_retain.init();
+ plan->gids_to_retain_sorted.init();
+ plan->source = hb_face_reference (face);
+ plan->dest = hb_subset_face_create ();
+ plan->drop_hints = input->drop_hints;
+
+ _populate_codepoints (input->unicodes, plan->codepoints);
+ _populate_gids_to_retain (face,
+ plan->codepoints,
+ plan->gids_to_retain,
+ plan->gids_to_retain_sorted);
+
+ return plan;
+}
+
+/**
+ * hb_subset_plan_destroy:
+ *
+ * Since: 1.7.5
+ **/
+void
+hb_subset_plan_destroy (hb_subset_plan_t *plan)
+{
+ if (!hb_object_destroy (plan)) return;
+
+ plan->codepoints.finish ();
+ plan->gids_to_retain.finish ();
+ plan->gids_to_retain_sorted.finish ();
+
+ hb_face_destroy (plan->source);
+ hb_face_destroy (plan->dest);
+
+ free (plan);
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh
new file mode 100644
index 00000000000..d1b66b44d54
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger, Roderick Sheeter
+ */
+
+#ifndef HB_SUBSET_PLAN_HH
+#define HB_SUBSET_PLAN_HH
+
+#include "hb-private.hh"
+
+#include "hb-subset.h"
+
+#include "hb-object-private.hh"
+
+struct hb_subset_plan_t {
+ hb_object_header_t header;
+ ASSERT_POD ();
+
+ hb_bool_t drop_hints;
+
+ // TODO(Q1) actual map, drop this crap
+ // Look at me ma, I'm a poor mans map codepoint : new gid
+ // codepoints is sorted and aligned with gids_to_retain.
+
+ // These first two lists provide a mapping from cp -> gid
+ // As a result it does not list the full set of glyphs to retain.
+ hb_prealloced_array_t<hb_codepoint_t> codepoints;
+ hb_prealloced_array_t<hb_codepoint_t> gids_to_retain;
+
+ // This list contains the complete set of glyphs to retain and may contain
+ // more glyphs then the lists above.
+ hb_prealloced_array_t<hb_codepoint_t> gids_to_retain_sorted;
+
+ // Plan is only good for a specific source/dest so keep them with it
+ hb_face_t *source;
+ hb_face_t *dest;
+};
+
+typedef struct hb_subset_plan_t hb_subset_plan_t;
+
+HB_INTERNAL hb_subset_plan_t *
+hb_subset_plan_create (hb_face_t *face,
+ hb_subset_profile_t *profile,
+ hb_subset_input_t *input);
+
+HB_INTERNAL hb_bool_t
+hb_subset_plan_new_gid_for_old_id(hb_subset_plan_t *plan,
+ hb_codepoint_t old_gid,
+ hb_codepoint_t *new_gid /* OUT */);
+
+HB_INTERNAL hb_bool_t
+hb_subset_plan_new_gid_for_codepoint(hb_subset_plan_t *plan,
+ hb_codepoint_t codepont,
+ hb_codepoint_t *new_gid /* OUT */);
+
+HB_INTERNAL hb_bool_t
+hb_subset_plan_add_table(hb_subset_plan_t *plan,
+ hb_tag_t tag,
+ hb_blob_t *contents);
+
+HB_INTERNAL void
+hb_subset_plan_destroy (hb_subset_plan_t *plan);
+
+#endif /* HB_SUBSET_PLAN_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh
new file mode 100644
index 00000000000..5fa72527671
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger, Roderick Sheeter
+ */
+
+#ifndef HB_SUBSET_PRIVATE_HH
+#define HB_SUBSET_PRIVATE_HH
+
+
+#include "hb-private.hh"
+
+#include "hb-subset.h"
+
+#include "hb-font-private.hh"
+
+typedef struct hb_subset_face_data_t hb_subset_face_data_t;
+
+struct hb_subset_input_t {
+ hb_object_header_t header;
+ ASSERT_POD ();
+
+ hb_set_t *unicodes;
+ hb_set_t *glyphs;
+
+ hb_bool_t drop_hints;
+ /* TODO
+ *
+ * features
+ * lookups
+ * nameIDs
+ * ...
+ */
+};
+
+HB_INTERNAL hb_face_t *
+hb_subset_face_create (void);
+
+HB_INTERNAL hb_bool_t
+hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob);
+
+#endif /* HB_SUBSET_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
new file mode 100644
index 00000000000..9ebe5d31da2
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
@@ -0,0 +1,339 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod
+ */
+
+#include "hb-private.hh"
+#include "hb-object-private.hh"
+#include "hb-open-type-private.hh"
+
+#include "hb-subset-glyf.hh"
+#include "hb-subset-private.hh"
+#include "hb-subset-plan.hh"
+
+#include "hb-open-file-private.hh"
+#include "hb-ot-cmap-table.hh"
+#include "hb-ot-glyf-table.hh"
+#include "hb-ot-hdmx-table.hh"
+#include "hb-ot-head-table.hh"
+#include "hb-ot-hhea-table.hh"
+#include "hb-ot-hmtx-table.hh"
+#include "hb-ot-maxp-table.hh"
+#include "hb-ot-os2-table.hh"
+
+
+#ifndef HB_NO_VISIBILITY
+const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
+#endif
+
+
+struct hb_subset_profile_t {
+ hb_object_header_t header;
+ ASSERT_POD ();
+};
+
+/**
+ * hb_subset_profile_create:
+ *
+ * Return value: New profile with default settings.
+ *
+ * Since: 1.8.0
+ **/
+hb_subset_profile_t *
+hb_subset_profile_create ()
+{
+ return hb_object_create<hb_subset_profile_t>();
+}
+
+/**
+ * hb_subset_profile_destroy:
+ *
+ * Since: 1.8.0
+ **/
+void
+hb_subset_profile_destroy (hb_subset_profile_t *profile)
+{
+ if (!hb_object_destroy (profile)) return;
+
+ free (profile);
+}
+
+template<typename TableType>
+static bool
+_subset (hb_subset_plan_t *plan)
+{
+ OT::Sanitizer<TableType> sanitizer;
+
+ hb_blob_t *source_blob = sanitizer.sanitize (plan->source->reference_table (TableType::tableTag));
+ const TableType *table = OT::Sanitizer<TableType>::lock_instance (source_blob);
+
+ hb_bool_t result = false;
+ if (table != &OT::Null(TableType))
+ result = table->subset(plan);
+
+ hb_blob_destroy (source_blob);
+ hb_tag_t tag = TableType::tableTag;
+ DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!");
+ return result;
+}
+
+
+/*
+ * A face that has add_table().
+ */
+
+struct hb_subset_face_data_t
+{
+ struct table_entry_t
+ {
+ inline int cmp (const hb_tag_t *t) const
+ {
+ if (*t < tag) return -1;
+ if (*t > tag) return -1;
+ return 0;
+ }
+
+ hb_tag_t tag;
+ hb_blob_t *blob;
+ };
+
+ hb_prealloced_array_t<table_entry_t, 32> tables;
+};
+
+static hb_subset_face_data_t *
+_hb_subset_face_data_create (void)
+{
+ hb_subset_face_data_t *data = (hb_subset_face_data_t *) calloc (1, sizeof (hb_subset_face_data_t));
+ if (unlikely (!data))
+ return nullptr;
+
+ return data;
+}
+
+static void
+_hb_subset_face_data_destroy (void *user_data)
+{
+ hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data;
+
+ for (unsigned int i = 0; i < data->tables.len; i++)
+ hb_blob_destroy (data->tables[i].blob);
+
+ data->tables.finish ();
+
+ free (data);
+}
+
+static hb_blob_t *
+_hb_subset_face_data_reference_blob (hb_subset_face_data_t *data)
+{
+
+ unsigned int table_count = data->tables.len;
+ unsigned int face_length = table_count * 16 + 12;
+
+ for (unsigned int i = 0; i < table_count; i++)
+ face_length += _hb_ceil_to_4 (hb_blob_get_length (data->tables.array[i].blob));
+
+ char *buf = (char *) malloc (face_length);
+ if (unlikely (!buf))
+ return nullptr;
+
+ OT::hb_serialize_context_t c (buf, face_length);
+ OT::OpenTypeFontFile *f = c.start_serialize<OT::OpenTypeFontFile> ();
+
+ bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
+ hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
+
+ OT::Supplier<hb_tag_t> tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0]));
+ OT::Supplier<hb_blob_t *> blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0]));
+ bool ret = f->serialize_single (&c,
+ sfnt_tag,
+ tags_supplier,
+ blobs_supplier,
+ table_count);
+
+ c.end_serialize ();
+
+ if (unlikely (!ret))
+ {
+ free (buf);
+ return nullptr;
+ }
+
+ return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free);
+}
+
+static hb_blob_t *
+_hb_subset_face_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data)
+{
+ hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data;
+
+ if (!tag)
+ return _hb_subset_face_data_reference_blob (data);
+
+ hb_subset_face_data_t::table_entry_t *entry = data->tables.lsearch (tag);
+ if (entry)
+ return hb_blob_reference (entry->blob);
+
+ return nullptr;
+}
+
+/* TODO: Move this to hb-face.h and rename to hb_face_builder_create()
+ * with hb_face_builder_add_table(). */
+hb_face_t *
+hb_subset_face_create (void)
+{
+ hb_subset_face_data_t *data = _hb_subset_face_data_create ();
+ if (unlikely (!data)) return hb_face_get_empty ();
+
+ return hb_face_create_for_tables (_hb_subset_face_reference_table,
+ data,
+ _hb_subset_face_data_destroy);
+}
+
+hb_bool_t
+hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
+{
+ if (unlikely (face->destroy != _hb_subset_face_data_destroy))
+ return false;
+
+ hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data;
+ hb_subset_face_data_t::table_entry_t *entry = data->tables.push ();
+ if (unlikely (!entry))
+ return false;
+
+ entry->tag = tag;
+ entry->blob = hb_blob_reference (blob);
+
+ return true;
+}
+
+static bool
+_subset_table (hb_subset_plan_t *plan,
+ hb_tag_t tag)
+{
+ DEBUG_MSG(SUBSET, nullptr, "begin subset %c%c%c%c", HB_UNTAG(tag));
+ bool result = true;
+ switch (tag) {
+ case HB_OT_TAG_glyf:
+ result = _subset<const OT::glyf> (plan);
+ break;
+ case HB_OT_TAG_hdmx:
+ result = _subset<const OT::hdmx> (plan);
+ break;
+ case HB_OT_TAG_head:
+ // TODO that won't work well if there is no glyf
+ DEBUG_MSG(SUBSET, nullptr, "skip head, handled by glyf");
+ result = true;
+ break;
+ case HB_OT_TAG_hhea:
+ DEBUG_MSG(SUBSET, nullptr, "skip hhea handled by hmtx");
+ return true;
+ case HB_OT_TAG_hmtx:
+ result = _subset<const OT::hmtx> (plan);
+ break;
+ case HB_OT_TAG_maxp:
+ result = _subset<const OT::maxp> (plan);
+ break;
+ case HB_OT_TAG_loca:
+ DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf");
+ return true;
+ case HB_OT_TAG_cmap:
+ result = _subset<const OT::cmap> (plan);
+ break;
+ case HB_OT_TAG_os2:
+ result = _subset<const OT::os2> (plan);
+ break;
+ default:
+ hb_blob_t *source_table = hb_face_reference_table(plan->source, tag);
+ if (likely (source_table))
+ result = hb_subset_plan_add_table(plan, tag, source_table);
+ else
+ result = false;
+ hb_blob_destroy (source_table);
+ break;
+ }
+ DEBUG_MSG(SUBSET, nullptr, "subset %c%c%c%c %s", HB_UNTAG(tag), result ? "ok" : "FAILED");
+ return result;
+}
+
+static bool
+_should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag)
+{
+ switch (tag) {
+ case HB_TAG ('c', 'v', 'a', 'r'): /* hint table, fallthrough */
+ case HB_TAG ('c', 'v', 't', ' '): /* hint table, fallthrough */
+ case HB_TAG ('f', 'p', 'g', 'm'): /* hint table, fallthrough */
+ case HB_TAG ('p', 'r', 'e', 'p'): /* hint table, fallthrough */
+ case HB_TAG ('h', 'd', 'm', 'x'): /* hint table, fallthrough */
+ case HB_TAG ('V', 'D', 'M', 'X'): /* hint table, fallthrough */
+ return plan->drop_hints;
+ case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */
+ case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */
+ case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */
+ case HB_TAG ('D', 'S', 'I', 'G'):
+ return true;
+ default:
+ return false;
+ }
+}
+
+/**
+ * hb_subset:
+ * @source: font face data to be subset.
+ * @profile: profile to use for the subsetting.
+ * @input: input to use for the subsetting.
+ *
+ * Subsets a font according to provided profile and input.
+ **/
+hb_face_t *
+hb_subset (hb_face_t *source,
+ hb_subset_profile_t *profile,
+ hb_subset_input_t *input)
+{
+ if (unlikely (!profile || !input || !source)) return hb_face_get_empty();
+
+ hb_subset_plan_t *plan = hb_subset_plan_create (source, profile, input);
+
+ hb_tag_t table_tags[32];
+ unsigned int offset = 0, count;
+ bool success = true;
+ do {
+ count = ARRAY_LENGTH (table_tags);
+ hb_face_get_table_tags (source, offset, &count, table_tags);
+ for (unsigned int i = 0; i < count; i++)
+ {
+ hb_tag_t tag = table_tags[i];
+ if (_should_drop_table(plan, tag))
+ {
+ DEBUG_MSG(SUBSET, nullptr, "drop %c%c%c%c", HB_UNTAG(tag));
+ continue;
+ }
+ success = success && _subset_table (plan, tag);
+ }
+ } while (count == ARRAY_LENGTH (table_tags));
+
+ hb_face_t *result = success ? hb_face_reference(plan->dest) : hb_face_get_empty();
+ hb_subset_plan_destroy (plan);
+ return result;
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
new file mode 100644
index 00000000000..55ce25b0a1a
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Rod Sheeter
+ */
+
+#ifndef HB_SUBSET_H
+#define HB_SUBSET_H
+
+#include "hb.h"
+
+HB_BEGIN_DECLS
+
+/*
+ * hb_subset_profile_t
+ * Things that change based on target environment, e.g. OS.
+ * Threadsafe for multiple concurrent subset operations.
+ */
+
+typedef struct hb_subset_profile_t hb_subset_profile_t;
+
+HB_EXTERN hb_subset_profile_t *
+hb_subset_profile_create (void);
+
+HB_EXTERN void
+hb_subset_profile_destroy (hb_subset_profile_t *profile);
+
+/*
+ * hb_subset_input_t
+ *
+ * Things that change based on the input. Characters to keep, etc.
+ */
+
+typedef struct hb_subset_input_t hb_subset_input_t;
+
+HB_EXTERN hb_subset_input_t *
+hb_subset_input_create_or_fail (void);
+
+HB_EXTERN hb_subset_input_t *
+hb_subset_input_reference (hb_subset_input_t *subset_input);
+
+HB_EXTERN void
+hb_subset_input_destroy (hb_subset_input_t *subset_input);
+
+HB_EXTERN hb_set_t *
+hb_subset_input_unicode_set (hb_subset_input_t *subset_input);
+
+HB_EXTERN hb_set_t *
+hb_subset_input_glyph_set (hb_subset_input_t *subset_input);
+
+HB_EXTERN hb_bool_t *
+hb_subset_input_drop_hints (hb_subset_input_t *subset_input);
+
+/* hb_subset() */
+
+HB_EXTERN hb_face_t *
+hb_subset (hb_face_t *source,
+ hb_subset_profile_t *profile,
+ hb_subset_input_t *input);
+
+HB_END_DECLS
+
+#endif /* HB_SUBSET_H */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc
index 5e05baa869b..cd25769db1a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc
@@ -1025,8 +1025,6 @@ retry:
pos->x_advance = x_mult * (int32_t) info->mask;
pos->x_offset = x_mult * (backward ? -info->var1.i32 : info->var1.i32);
pos->y_offset = y_mult * info->var2.i32;
-
- info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
}
if (backward)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc
index 72de189d825..d221e9da221 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc
@@ -37,7 +37,9 @@
using namespace OT;
+#ifndef HB_NO_VISIBILITY
const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
+#endif
int
main (int argc, char **argv)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc
index 4b429eab3c2..636b0037542 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc
@@ -101,7 +101,7 @@ main (int argc, char **argv)
bool ret = true;
char line[BUFSIZ], out[BUFSIZ];
- while (fgets (line, sizeof(line), stdin) != 0)
+ while (fgets (line, sizeof(line), stdin) != nullptr)
{
hb_buffer_clear_contents (buf);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc
new file mode 100644
index 00000000000..dbc5fa426de
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2018 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Garret Rieger
+ */
+
+#include "hb-private.hh"
+
+#include "hb-ot-os2-unicode-ranges.hh"
+
+void
+test (hb_codepoint_t cp, unsigned int bit)
+{
+ if (OT::hb_get_unicode_range_bit (cp) != bit)
+ {
+ fprintf (stderr, "got incorrect bit (%d) for cp 0x%X. Should have been %d.",
+ OT::hb_get_unicode_range_bit (cp),
+ cp,
+ bit);
+ abort();
+ }
+}
+
+void
+test_get_unicode_range_bit (void)
+{
+ test (0x0000, 0);
+ test (0x0042, 0);
+ test (0x007F, 0);
+ test (0x0080, 1);
+
+ test (0x30A0, 50);
+ test (0x30B1, 50);
+ test (0x30FF, 50);
+
+ test (0x10FFFD, 90);
+
+ test (0x30000, -1);
+ test (0x110000, -1);
+}
+
+int
+main (void)
+{
+ test_get_unicode_range_bit ();
+ return 0;
+}