summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-06-15 04:38:41 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-06-15 04:38:41 +0000
commit355b4e5dc0f07541a7603df5f55f71a695efac0e (patch)
tree8bbeca1ce735daad723d233f3c9e07a8b74d9ead /Build/source/libs/harfbuzz/harfbuzz-src/src
parent098cc2296d980a8010ae5af080098957ffea72c5 (diff)
harfbuzz 1.8.1
git-svn-id: svn://tug.org/texlive/trunk@48018 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.am21
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources1
-rwxr-xr-xBuild/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py5
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc8
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh53
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh14
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh22
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc40
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h6
-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.cc10
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh13
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh23
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc22
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc51
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc17
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc21
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc10
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h3
23 files changed, 252 insertions, 98 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
index be9cd73ca4e..9d5662e4a35 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
@@ -105,6 +105,17 @@ endif
DIST_SUBDIRS += hb-ucdn
+BUILT_SOURCES += \
+ hb-version.h
+
+$(srcdir)/hb-version.h: hb-version.h.in $(top_srcdir)/configure.ac
+ $(AM_V_GEN) $(SED) \
+ -e 's/[@]HB_VERSION_MAJOR@/$(HB_VERSION_MAJOR)/' \
+ -e 's/[@]HB_VERSION_MINOR@/$(HB_VERSION_MINOR)/' \
+ -e 's/[@]HB_VERSION_MICRO@/$(HB_VERSION_MICRO)/' \
+ -e 's/[@]HB_VERSION@/$(HB_VERSION)/' \
+ "$<" > "$@" || ($(RM) "$@"; false)
+
# Put the library together
HBLIBS += $(HBNONPCLIBS)
@@ -147,7 +158,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = harfbuzz.pc
cmakedir = $(libdir)/cmake/harfbuzz
cmake_DATA = harfbuzz-config.cmake
-EXTRA_DIST += harfbuzz.pc.in harfbuzz-config.cmake.in
+EXTRA_DIST += hb-version.h.in harfbuzz.pc.in harfbuzz-config.cmake.in
lib_LTLIBRARIES += libharfbuzz-subset.la
libharfbuzz_subset_la_SOURCES = $(HB_SUBSET_sources)
@@ -266,13 +277,13 @@ endif
check: $(DEF_FILES) # For check-symbols.sh
CLEANFILES += $(DEF_FILES)
harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
- $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
harfbuzz-subset.def: $(HB_SUBSET_headers)
- $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
harfbuzz-icu.def: $(HB_ICU_headers)
- $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
harfbuzz-gobject.def: $(HB_GOBJECT_headers)
- $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+ $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
GENERATORS = \
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
index 299af983157..0bc9e589eef 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
@@ -203,6 +203,7 @@ HB_ICU_headers = hb-icu.h
# Sources for libharfbuzz-subset
HB_SUBSET_sources = \
+ hb-static.cc \
hb-subset.cc \
hb-subset-glyf.cc \
hb-subset-input.cc \
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 413ce11d648..6aa5f881c73 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
@@ -155,8 +155,7 @@ globals().update(property_values)
def is_BASE(U, UISC, UGC):
- # Consonant_Initial_Postfixed is new in Unicode 11; not in the spec.
- return (UISC in [Number, Consonant, Consonant_Initial_Postfixed, Consonant_Head_Letter,
+ return (UISC in [Number, Consonant, Consonant_Head_Letter,
#SPEC-DRAFT Consonant_Placeholder,
Tone_Letter,
Vowel_Independent #SPEC-DRAFT
@@ -178,7 +177,9 @@ def is_BASE_OTHER(U, UISC, UGC):
def is_CGJ(U, UISC, UGC):
return U == 0x034F
def is_CONS_FINAL(U, UISC, UGC):
+ # Consonant_Initial_Postfixed is new in Unicode 11; not in the spec.
return ((UISC == Consonant_Final and UGC != Lo) or
+ UISC == Consonant_Initial_Postfixed or
UISC == Consonant_Succeeding_Repha)
def is_CONS_FINAL_MOD(U, UISC, UGC):
#SPEC-DRAFT return UISC in [Consonant_Final_Modifier, Syllable_Modifier]
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
index b8d7e84d7c7..2fef09d03d3 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
@@ -514,7 +514,7 @@ hb_face_get_table_tags (hb_face_t *face,
unsigned int *table_count, /* IN/OUT */
hb_tag_t *table_tags /* OUT */)
{
- if (face->destroy != _hb_face_for_data_closure_destroy)
+ if (face->destroy != (hb_destroy_func_t) _hb_face_for_data_closure_destroy)
{
if (table_count)
*table_count = 0;
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 69132386470..7caafba839f 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
@@ -119,7 +119,7 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
if (font->immutable)
return;
- if (font->destroy != _hb_ft_font_destroy)
+ if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
return;
hb_ft_font_t *ft_font = (hb_ft_font_t *) font->user_data;
@@ -139,7 +139,7 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
int
hb_ft_font_get_load_flags (hb_font_t *font)
{
- if (font->destroy != _hb_ft_font_destroy)
+ if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
return 0;
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data;
@@ -150,7 +150,7 @@ hb_ft_font_get_load_flags (hb_font_t *font)
FT_Face
hb_ft_font_get_face (hb_font_t *font)
{
- if (font->destroy != _hb_ft_font_destroy)
+ if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
return nullptr;
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data;
@@ -615,7 +615,7 @@ hb_ft_font_create (FT_Face ft_face,
void
hb_ft_font_changed (hb_font_t *font)
{
- if (font->destroy != _hb_ft_font_destroy)
+ if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
return;
hb_ft_font_t *ft_font = (hb_ft_font_t *) font->user_data;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh
index 76c40877383..d3d4ddeda70 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh
@@ -105,7 +105,7 @@ struct hb_map_t
/* Switch to new, empty, array. */
population = occupancy = 0;
mask = new_size - 1;
- prime = _hb_prime_for (power);
+ prime = prime_for (power);
items = new_items;
/* Insert back old items. */
@@ -198,6 +198,57 @@ struct hb_map_t
}
return tombstone == INVALID ? i : tombstone;
}
+
+ static inline unsigned int prime_for (unsigned int shift)
+ {
+ /* Following comment and table copied from glib. */
+ /* Each table size has an associated prime modulo (the first prime
+ * lower than the table size) used to find the initial bucket. Probing
+ * then works modulo 2^n. The prime modulo is necessary to get a
+ * good distribution with poor hash functions.
+ */
+ /* Not declaring static to make all kinds of compilers happy... */
+ /*static*/ const unsigned int prime_mod [32] =
+ {
+ 1, /* For 1 << 0 */
+ 2,
+ 3,
+ 7,
+ 13,
+ 31,
+ 61,
+ 127,
+ 251,
+ 509,
+ 1021,
+ 2039,
+ 4093,
+ 8191,
+ 16381,
+ 32749,
+ 65521, /* For 1 << 16 */
+ 131071,
+ 262139,
+ 524287,
+ 1048573,
+ 2097143,
+ 4194301,
+ 8388593,
+ 16777213,
+ 33554393,
+ 67108859,
+ 134217689,
+ 268435399,
+ 536870909,
+ 1073741789,
+ 2147483647 /* For 1 << 31 */
+ };
+
+ if (unlikely (shift >= ARRAY_LENGTH (prime_mod)))
+ return prime_mod[ARRAY_LENGTH (prime_mod) - 1];
+
+ return prime_mod[shift];
+ }
};
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 6e57195b3f4..bd72fe6bf6c 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
@@ -1156,10 +1156,13 @@ struct SubstLookup : Lookup
return_trace (dispatch (c));
}
- inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
+ inline hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const
{
TRACE_CLOSURE (this);
- c->set_recurse_func (dispatch_recurse_func<hb_closure_context_t>);
+ if (!c->should_visit_lookup (this_index))
+ return_trace (HB_VOID);
+
+ c->set_recurse_func (dispatch_closure_recurse_func);
return_trace (dispatch (c));
}
@@ -1258,6 +1261,13 @@ struct SubstLookup : Lookup
template <typename context_t>
static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
+ static inline hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
+ {
+ if (!c->should_visit_lookup (lookup_index))
+ return HB_VOID;
+ return dispatch_recurse_func (c, lookup_index);
+ }
+
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
{ return Lookup::dispatch<SubstLookupSubTable> (c); }
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 3cf9d578205..661085d515b 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
@@ -32,6 +32,7 @@
#include "hb-private.hh"
#include "hb-debug.hh"
#include "hb-buffer-private.hh"
+#include "hb-map-private.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-set-private.hh"
@@ -59,6 +60,20 @@ struct hb_closure_context_t :
return HB_VOID;
}
+ bool should_visit_lookup (unsigned int lookup_index)
+ {
+ if (is_lookup_done (lookup_index))
+ return false;
+ done_lookups->set (lookup_index, glyphs->get_population ());
+ return true;
+ }
+
+ bool is_lookup_done (unsigned int lookup_index)
+ {
+ // Have we visited this lookup with the current set of glyphs?
+ return done_lookups->get (lookup_index) == glyphs->get_population ();
+ }
+
hb_face_t *face;
hb_set_t *glyphs;
recurse_func_t recurse_func;
@@ -67,14 +82,19 @@ struct hb_closure_context_t :
hb_closure_context_t (hb_face_t *face_,
hb_set_t *glyphs_,
+ hb_map_t *done_lookups_,
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_),
glyphs (glyphs_),
recurse_func (nullptr),
nesting_level_left (nesting_level_left_),
- debug_depth (0) {}
+ debug_depth (0),
+ done_lookups (done_lookups_) {}
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
+
+ private:
+ hb_map_t *done_lookups;
};
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 8d1471a332b..655c36c1c28 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
@@ -44,6 +44,7 @@
#include "hb-ot-color-sbix-table.hh"
#include "hb-ot-color-svg-table.hh"
#include "hb-ot-name-table.hh"
+#include "hb-map-private.hh"
hb_ot_layout_t *
@@ -943,11 +944,46 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
unsigned int lookup_index,
hb_set_t *glyphs)
{
- OT::hb_closure_context_t c (face, glyphs);
+ hb_auto_t<hb_map_t> done_lookups;
+ OT::hb_closure_context_t c (face, glyphs, &done_lookups);
const OT::SubstLookup& l = _get_gsub (face).get_lookup (lookup_index);
- l.closure (&c);
+ l.closure (&c, lookup_index);
+}
+
+/**
+ * hb_ot_layout_lookups_substitute_closure:
+ *
+ * Compute the transitive closure of glyphs needed for all of the
+ * provided lookups.
+ *
+ * Since: 1.8.1
+ **/
+void
+hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
+ const hb_set_t *lookups,
+ hb_set_t *glyphs)
+{
+ hb_auto_t<hb_map_t> done_lookups;
+ OT::hb_closure_context_t c (face, glyphs, &done_lookups);
+ const OT::GSUB& gsub = _get_gsub (face);
+
+ unsigned int glyphs_length;
+ do
+ {
+ glyphs_length = glyphs->get_population ();
+ if (lookups != nullptr)
+ {
+ for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);)
+ gsub.get_lookup (lookup_index).closure (&c, lookup_index);
+ }
+ else
+ {
+ for (unsigned int i = 0; i < gsub.get_lookup_count (); i++)
+ gsub.get_lookup (i).closure (&c, i);
+ }
+ } while (glyphs_length != glyphs->get_population ());
}
/*
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 d82dc022614..0278796221d 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
@@ -277,6 +277,12 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
hb_set_t *glyphs
/*TODO , hb_bool_t inclusive */);
+HB_EXTERN void
+hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
+ const hb_set_t *lookups,
+ hb_set_t *glyphs);
+
+
#ifdef HB_NOT_IMPLEMENTED
/* Note: You better have GDEF when using this API, or marks won't do much. */
HB_EXTERN hb_bool_t
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 9cc7d33de57..14315338cf2 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
@@ -281,7 +281,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1A30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1A40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, B, SUB, SUB, SUB, SUB, O,
+ /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, FAbv, SUB, SUB, SUB, SUB, O,
/* 1A60 */ H, VPst, VAbv, VPst, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VAbv, VBlw, VPst, VPre, VPre,
/* 1A70 */ VPre, VPre, VPre, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VAbv, FM, FM, O, O, FBlw,
/* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
index c20b110e216..36e0bf9c3cf 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
@@ -957,15 +957,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
hb_set_t *lookups = hb_set_create ();
hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, lookups);
-
- /* And find transitive closure. */
- hb_set_t *copy = hb_set_create ();
- do {
- copy->set (glyphs);
- 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);
+ hb_ot_layout_lookups_substitute_closure (font->face, lookups, glyphs);
hb_set_destroy (lookups);
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 429bab0035a..32e335495cf 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
@@ -147,7 +147,7 @@ extern "C" void hb_free_impl(void *ptr);
#define HB_FUNC __func__
#endif
-#ifdef __SUNPRO_CC
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
/* https://github.com/harfbuzz/harfbuzz/issues/630 */
#define __restrict
#endif
@@ -369,6 +369,7 @@ _hb_popcount (T v)
}
assert (0);
+ return 0; /* Shut up stupid compiler. */
}
/* Returns the number of bits needed to store number */
@@ -437,11 +438,12 @@ _hb_bit_storage (T v)
if (sizeof (T) == 16)
{
unsigned int shift = 64;
- return (v >> shift) ? _hb_bit_storage<uint64_t> ((uint64_t) v >> shift) + shift :
+ return (v >> shift) ? _hb_bit_storage<uint64_t> ((uint64_t) (v >> shift)) + shift :
_hb_bit_storage<uint64_t> ((uint64_t) v);
}
assert (0);
+ return 0; /* Shut up stupid compiler. */
}
/* Returns the number of zero bits in the least significant side of v */
@@ -514,6 +516,7 @@ _hb_ctz (T v)
}
assert (0);
+ return 0; /* Shut up stupid compiler. */
}
static inline bool
@@ -713,6 +716,9 @@ struct hb_vector_t
if (!alloc (size))
return false;
+ if (size > len)
+ memset (arrayZ + len, 0, (size - len) * sizeof (*arrayZ));
+
len = size;
return true;
}
@@ -1232,7 +1238,4 @@ round (double x)
#endif
-HB_INTERNAL unsigned int _hb_prime_for (unsigned int shift);
-
-
#endif /* HB_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh
index 50be93b84f5..ccd4d8df5f7 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
@@ -400,6 +400,19 @@ struct hb_set_t
return true;
}
+ inline bool is_subset (const hb_set_t *larger_set) const
+ {
+ if (get_population () > larger_set->get_population ())
+ return false;
+
+ hb_codepoint_t c = INVALID;
+ while (next (&c))
+ if (!larger_set->has (c))
+ return false;
+
+ return true;
+ }
+
template <class Op>
inline void process (const hb_set_t *other)
{
@@ -411,7 +424,7 @@ struct hb_set_t
unsigned int nb = other->pages.len;
unsigned int next_page = na;
- unsigned int count = 0;
+ unsigned int count = 0, newCount = 0;
unsigned int a = 0, b = 0;
for (; a < na && b < nb; )
{
@@ -439,8 +452,10 @@ struct hb_set_t
if (Op::passthru_right)
count += nb - b;
- if (!resize (count))
- return;
+ if (count > pages.len)
+ if (!resize (count))
+ return;
+ newCount = count;
/* Process in-place backward. */
a = na;
@@ -493,6 +508,8 @@ struct hb_set_t
page_at (count).v = other->page_at (b).v;
}
assert (!count);
+ if (pages.len > newCount)
+ resize (newCount);
}
inline void union_ (const hb_set_t *other)
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 b5753222602..25027e6c216 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc
@@ -267,11 +267,11 @@ hb_set_del_range (hb_set_t *set,
/**
* hb_set_is_equal:
* @set: a set.
- * @other:
+ * @other: other set.
*
*
*
- * Return value:
+ * Return value: %TRUE if the two sets are equal, %FALSE otherwise.
*
* Since: 0.9.7
**/
@@ -283,6 +283,24 @@ hb_set_is_equal (const hb_set_t *set,
}
/**
+ * hb_set_is_subset:
+ * @set: a set.
+ * @larger_set: other set.
+ *
+ *
+ *
+ * Return value: %TRUE if the @set is a subset of (or equal to) @larger_set, %FALSE otherwise.
+ *
+ * Since: 1.8.1
+ **/
+hb_bool_t
+hb_set_is_subset (const hb_set_t *set,
+ const hb_set_t *larger_set)
+{
+ return set->is_subset (larger_set);
+}
+
+/**
* hb_set_set:
* @set: a set.
* @other:
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 764d4eba832..ed0e05db2e4 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.h
@@ -104,6 +104,10 @@ HB_EXTERN hb_bool_t
hb_set_is_equal (const hb_set_t *set,
const hb_set_t *other);
+HB_EXTERN hb_bool_t
+hb_set_is_subset (const hb_set_t *set,
+ const hb_set_t *larger_set);
+
HB_EXTERN void
hb_set_set (hb_set_t *set,
const hb_set_t *other);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc
index aa0871d5b1e..e26e5c80154 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc
@@ -30,54 +30,3 @@
void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
/*thread_local*/ void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
#endif
-
-
-/* Following comment and table copied from glib. */
-/* Each table size has an associated prime modulo (the first prime
- * lower than the table size) used to find the initial bucket. Probing
- * then works modulo 2^n. The prime modulo is necessary to get a
- * good distribution with poor hash functions.
- */
-static const unsigned int prime_mod [] =
-{
- 1, /* For 1 << 0 */
- 2,
- 3,
- 7,
- 13,
- 31,
- 61,
- 127,
- 251,
- 509,
- 1021,
- 2039,
- 4093,
- 8191,
- 16381,
- 32749,
- 65521, /* For 1 << 16 */
- 131071,
- 262139,
- 524287,
- 1048573,
- 2097143,
- 4194301,
- 8388593,
- 16777213,
- 33554393,
- 67108859,
- 134217689,
- 268435399,
- 536870909,
- 1073741789,
- 2147483647 /* For 1 << 31 */
-};
-
-unsigned int _hb_prime_for (unsigned int shift)
-{
- if (unlikely (shift >= ARRAY_LENGTH (prime_mod)))
- return prime_mod[ARRAY_LENGTH (prime_mod) - 1];
-
- return prime_mod[shift];
-}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc
index c4003dd3ad1..39c5ac4f297 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc
@@ -45,6 +45,7 @@ hb_subset_input_create_or_fail (void)
input->unicodes = hb_set_create ();
input->glyphs = hb_set_create ();
+ input->drop_ot_layout = true;
return input;
}
@@ -117,3 +118,19 @@ hb_subset_input_drop_hints (hb_subset_input_t *subset_input)
{
return &subset_input->drop_hints;
}
+
+/**
+ * hb_subset_input_drop_ot_layout:
+ * @subset_input: a subset_input.
+ *
+ * If enabled ot layout tables will be dropped as part of
+ * the subsetting operation. Currently this defaults to
+ * true.
+ *
+ * Since: REPLACEME
+ **/
+HB_EXTERN hb_bool_t *
+hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input)
+{
+ return &subset_input->drop_ot_layout;
+}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
index 7100efc87c8..55c4e3f6193 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
@@ -54,8 +54,21 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf,
}
static void
+_gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain)
+{
+ // TODO(grieger): This uses all lookups, instead collect
+ // the set of lookups that are relevant.
+ // See fontTools implementation.
+ hb_ot_layout_lookups_substitute_closure (face,
+ nullptr,
+ gids_to_retain);
+}
+
+
+static void
_populate_gids_to_retain (hb_face_t *face,
const hb_set_t *unicodes,
+ bool close_over_gsub,
hb_set_t *unicodes_to_retain,
hb_map_t *codepoint_to_glyph,
hb_vector_t<hb_codepoint_t> *glyphs)
@@ -82,10 +95,12 @@ _populate_gids_to_retain (hb_face_t *face,
initial_gids_to_retain->add (gid);
}
+ if (close_over_gsub)
+ // Add all glyphs needed for GSUB substitutions.
+ _gsub_closure (face, initial_gids_to_retain);
+
// Populate a full set of glyphs to retain by adding all referenced
// composite glyphs.
- // TODO expand with glyphs reached by G*
-
hb_codepoint_t gid = HB_SET_VALUE_INVALID;
hb_set_t *all_gids_to_retain = hb_set_create ();
while (initial_gids_to_retain->next (&gid))
@@ -131,6 +146,7 @@ hb_subset_plan_create (hb_face_t *face,
hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> ();
plan->drop_hints = input->drop_hints;
+ plan->drop_ot_layout = input->drop_ot_layout;
plan->unicodes = hb_set_create();
plan->glyphs.init();
plan->source = hb_face_reference (face);
@@ -140,6 +156,7 @@ hb_subset_plan_create (hb_face_t *face,
_populate_gids_to_retain (face,
input->unicodes,
+ !plan->drop_ot_layout,
plan->unicodes,
plan->codepoint_to_glyph,
&plan->glyphs);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh
index c9904af8e40..f4b261df0d0 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh
@@ -41,6 +41,7 @@ struct hb_subset_plan_t
ASSERT_POD ();
hb_bool_t drop_hints;
+ hb_bool_t drop_ot_layout;
// For each cp that we'd like to retain maps to the corresponding gid.
hb_set_t *unicodes;
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
index 5fa72527671..6b2b207fff6 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh
@@ -44,6 +44,7 @@ struct hb_subset_input_t {
hb_set_t *glyphs;
hb_bool_t drop_hints;
+ hb_bool_t drop_ot_layout;
/* TODO
*
* features
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
index 6d388e29a26..b97c7633eb8 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
@@ -44,11 +44,6 @@
#include "hb-ot-post-table.hh"
-#if !defined(HB_SUBSET_BUILTIN)
-#include "hb-static.cc"
-#endif
-
-
struct hb_subset_profile_t {
hb_object_header_t header;
ASSERT_POD ();
@@ -221,7 +216,7 @@ hb_subset_face_create (void)
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))
+ if (unlikely (face->destroy != (hb_destroy_func_t) _hb_subset_face_data_destroy))
return false;
hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data;
@@ -302,10 +297,11 @@ _should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag)
case HB_TAG ('h', 'd', 'm', 'x'): /* hint table, fallthrough */
case HB_TAG ('V', 'D', 'M', 'X'): /* hint table, fallthrough */
return plan->drop_hints;
- // Drop Layout Tables until subsetting is supported.
+ // Drop Layout Tables if requested.
case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */
case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */
case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */
+ return plan->drop_ot_layout;
// Drop these tables below by default, list pulled
// from fontTools:
case HB_TAG ('B', 'A', 'S', 'E'):
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
index 409581c76f6..f6d2ae0a01b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
@@ -71,6 +71,9 @@ 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_EXTERN hb_bool_t *
+hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input);
+
/* hb_subset() */
HB_EXTERN hb_face_t *
hb_subset (hb_face_t *source,