summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-joining-list.py104
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc8
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc12
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh8
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc148
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc151
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh157
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh6
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh147
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh8
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh18
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh84
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh67
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh8
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-joining-list.hh47
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc35
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh25
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh30
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh27
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc14
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc11
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh9
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build70
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING21
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt105
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py63
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make54
37 files changed, 625 insertions, 835 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
index c18adac2d10..c341d405009 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
@@ -248,6 +248,7 @@ harfbuzz-deprecated-symbols.txt: $(srcdir)/hb-deprecated.h
GENERATORS = \
+ gen-arabic-joining-list.py \
gen-arabic-table.py \
gen-def.py \
gen-emoji-table.py \
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
index 4ad11e2bc65..8bb29120644 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources
@@ -105,6 +105,7 @@ HB_BASE_sources = \
hb-ot-post-macroman.hh \
hb-ot-post-table.hh \
hb-ot-shape-complex-arabic-fallback.hh \
+ hb-ot-shape-complex-arabic-joining-list.hh \
hb-ot-shape-complex-arabic-table.hh \
hb-ot-shape-complex-arabic-win1256.hh \
hb-ot-shape-complex-arabic.cc \
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-joining-list.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-joining-list.py
new file mode 100644
index 00000000000..78c44c35db8
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-joining-list.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python3
+
+"""usage: ./gen-arabic-joining-table.py ArabicShaping.txt Scripts.txt
+
+Input files:
+* https://unicode.org/Public/UCD/latest/ucd/ArabicShaping.txt
+* https://unicode.org/Public/UCD/latest/ucd/Scripts.txt
+"""
+
+import os.path, sys
+
+if len (sys.argv) != 3:
+ sys.exit (__doc__)
+
+files = [open (x, encoding='utf-8') for x in sys.argv[1:]]
+
+headers = [[f.readline (), f.readline ()] for f in files]
+while files[0].readline ().find ('##################') < 0:
+ pass
+
+def read (f):
+ mapping = {}
+ for line in f:
+
+ j = line.find ('#')
+ if j >= 0:
+ line = line[:j]
+
+ fields = [x.strip () for x in line.split (';')]
+ if len (fields) == 1:
+ continue
+
+ uu = fields[0].split ('..')
+ start = int (uu[0], 16)
+ if len (uu) == 1:
+ end = start
+ else:
+ end = int (uu[1], 16)
+
+ t = fields[1]
+
+ for u in range (start, end + 1):
+ mapping[u] = t
+
+ return mapping
+
+def read_joining_uu (f):
+ values = set ()
+ for line in f:
+
+ if line[0] == '#':
+ continue
+
+ fields = [x.strip () for x in line.split (';')]
+ if len (fields) == 1:
+ continue
+
+ values.add (int (fields[0], 16))
+
+ return sorted (values)
+
+def print_has_arabic_joining (scripts, joining_uu):
+
+ print ("static bool")
+ print ("has_arabic_joining (hb_script_t script)")
+ print ("{")
+ print (" /* List of scripts that have data in arabic-table. */")
+ print (" switch ((int) script)")
+ print (" {")
+
+ for script in sorted ({scripts[u] for u in joining_uu if scripts[u] not in {'Common', 'Inherited'}}):
+ print (" case HB_SCRIPT_{}:".format (script.upper ()))
+
+ print (" return true;")
+ print ()
+ print (" default:")
+ print (" return false;")
+ print (" }")
+ print ("}")
+ print ()
+
+print ("/* == Start of generated function == */")
+print ("/*")
+print (" * The following function is generated by running:")
+print (" *")
+print (" * ./gen-arabic-joining-list.py ArabicShaping.txt Scripts.txt")
+print (" *")
+print (" * on files with these headers:")
+print (" *")
+for h in headers:
+ for l in h:
+ print (" * %s" % (l.strip ()))
+print (" */")
+print ()
+print ("#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_JOINING_LIST_HH")
+print ("#define HB_OT_SHAPE_COMPLEX_ARABIC_JOINING_LIST_HH")
+print ()
+
+print_has_arabic_joining (read (files[1]), read_joining_uu (files[0]))
+
+print ()
+print ("#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_JOINING_LIST_HH */")
+print ()
+print ("/* == End of generated function == */")
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc
index e64eb0ee650..bc6c978b38c 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc
@@ -348,8 +348,8 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
if (buf_size)
*buf = '\0';
- assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
- buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
+ assert ((!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)) ||
+ (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS));
if (!buffer->have_positions)
flags |= HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS;
@@ -434,8 +434,8 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
end_ptr = &end;
*end_ptr = buf;
- assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
- buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
+ assert ((!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)) ||
+ (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS));
if (buf_len == -1)
buf_len = strlen (buf);
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 c368c93d9e4..4fadbb78d23 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
@@ -617,8 +617,8 @@ hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int en
void
hb_buffer_t::guess_segment_properties ()
{
- assert (content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
- (!len && content_type == HB_BUFFER_CONTENT_TYPE_INVALID));
+ assert ((content_type == HB_BUFFER_CONTENT_TYPE_UNICODE) ||
+ (!len && (content_type == HB_BUFFER_CONTENT_TYPE_INVALID)));
/* If script is set to INVALID, guess from buffer contents */
if (props.script == HB_SCRIPT_INVALID) {
@@ -1513,8 +1513,8 @@ hb_buffer_add_utf (hb_buffer_t *buffer,
typedef typename utf_t::codepoint_t T;
const hb_codepoint_t replacement = buffer->replacement;
- assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
- (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID));
+ assert ((buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE) ||
+ (!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)));
if (unlikely (hb_object_is_immutable (buffer)))
return;
@@ -1834,8 +1834,8 @@ void
hb_buffer_normalize_glyphs (hb_buffer_t *buffer)
{
assert (buffer->have_positions);
- assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS ||
- (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID));
+ assert ((buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS) ||
+ (!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)));
bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh
index afbc4a7cb39..332ece31cd4 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh
@@ -133,9 +133,11 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
region_count = varStore->varStore.get_region_index_count (get_ivs ());
if (do_blend)
{
- scalars.resize (region_count);
- varStore->varStore.get_scalars (get_ivs (), coords, num_coords,
- &scalars[0], region_count);
+ if (unlikely (!scalars.resize (region_count)))
+ set_error ();
+ else
+ varStore->varStore.get_scalars (get_ivs (), coords, num_coords,
+ &scalars[0], region_count);
}
seen_blend = true;
}
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 95d3fc27fb2..7bde50df5ba 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
@@ -721,7 +721,10 @@ hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
return false;
hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data;
+
hb_face_builder_data_t::table_entry_t *entry = data->tables.push ();
+ if (data->tables.in_error())
+ return false;
entry->tag = tag;
entry->blob = hb_blob_reference (blob);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc
index 058f65ae69c..f93bb8853ca 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc
@@ -41,7 +41,7 @@
* @short_description: GLib integration
* @include: hb-glib.h
*
- * Functions for using HarfBuzz with the GLib library.
+ * Functions for using HarfBuzz with the GLib library.
*
* HarfBuzz supports using GLib to provide Unicode data, by attaching
* GLib functions to the virtual methods in a #hb_unicode_funcs_t function
@@ -49,130 +49,6 @@
**/
-#if !GLIB_CHECK_VERSION(2,29,14)
-static const hb_script_t
-glib_script_to_script[] =
-{
- HB_SCRIPT_COMMON,
- HB_SCRIPT_INHERITED,
- HB_SCRIPT_ARABIC,
- HB_SCRIPT_ARMENIAN,
- HB_SCRIPT_BENGALI,
- HB_SCRIPT_BOPOMOFO,
- HB_SCRIPT_CHEROKEE,
- HB_SCRIPT_COPTIC,
- HB_SCRIPT_CYRILLIC,
- HB_SCRIPT_DESERET,
- HB_SCRIPT_DEVANAGARI,
- HB_SCRIPT_ETHIOPIC,
- HB_SCRIPT_GEORGIAN,
- HB_SCRIPT_GOTHIC,
- HB_SCRIPT_GREEK,
- HB_SCRIPT_GUJARATI,
- HB_SCRIPT_GURMUKHI,
- HB_SCRIPT_HAN,
- HB_SCRIPT_HANGUL,
- HB_SCRIPT_HEBREW,
- HB_SCRIPT_HIRAGANA,
- HB_SCRIPT_KANNADA,
- HB_SCRIPT_KATAKANA,
- HB_SCRIPT_KHMER,
- HB_SCRIPT_LAO,
- HB_SCRIPT_LATIN,
- HB_SCRIPT_MALAYALAM,
- HB_SCRIPT_MONGOLIAN,
- HB_SCRIPT_MYANMAR,
- HB_SCRIPT_OGHAM,
- HB_SCRIPT_OLD_ITALIC,
- HB_SCRIPT_ORIYA,
- HB_SCRIPT_RUNIC,
- HB_SCRIPT_SINHALA,
- HB_SCRIPT_SYRIAC,
- HB_SCRIPT_TAMIL,
- HB_SCRIPT_TELUGU,
- HB_SCRIPT_THAANA,
- HB_SCRIPT_THAI,
- HB_SCRIPT_TIBETAN,
- HB_SCRIPT_CANADIAN_SYLLABICS,
- HB_SCRIPT_YI,
- HB_SCRIPT_TAGALOG,
- HB_SCRIPT_HANUNOO,
- HB_SCRIPT_BUHID,
- HB_SCRIPT_TAGBANWA,
-
- /* Unicode-4.0 additions */
- HB_SCRIPT_BRAILLE,
- HB_SCRIPT_CYPRIOT,
- HB_SCRIPT_LIMBU,
- HB_SCRIPT_OSMANYA,
- HB_SCRIPT_SHAVIAN,
- HB_SCRIPT_LINEAR_B,
- HB_SCRIPT_TAI_LE,
- HB_SCRIPT_UGARITIC,
-
- /* Unicode-4.1 additions */
- HB_SCRIPT_NEW_TAI_LUE,
- HB_SCRIPT_BUGINESE,
- HB_SCRIPT_GLAGOLITIC,
- HB_SCRIPT_TIFINAGH,
- HB_SCRIPT_SYLOTI_NAGRI,
- HB_SCRIPT_OLD_PERSIAN,
- HB_SCRIPT_KHAROSHTHI,
-
- /* Unicode-5.0 additions */
- HB_SCRIPT_UNKNOWN,
- HB_SCRIPT_BALINESE,
- HB_SCRIPT_CUNEIFORM,
- HB_SCRIPT_PHOENICIAN,
- HB_SCRIPT_PHAGS_PA,
- HB_SCRIPT_NKO,
-
- /* Unicode-5.1 additions */
- HB_SCRIPT_KAYAH_LI,
- HB_SCRIPT_LEPCHA,
- HB_SCRIPT_REJANG,
- HB_SCRIPT_SUNDANESE,
- HB_SCRIPT_SAURASHTRA,
- HB_SCRIPT_CHAM,
- HB_SCRIPT_OL_CHIKI,
- HB_SCRIPT_VAI,
- HB_SCRIPT_CARIAN,
- HB_SCRIPT_LYCIAN,
- HB_SCRIPT_LYDIAN,
-
- /* Unicode-5.2 additions */
- HB_SCRIPT_AVESTAN,
- HB_SCRIPT_BAMUM,
- HB_SCRIPT_EGYPTIAN_HIEROGLYPHS,
- HB_SCRIPT_IMPERIAL_ARAMAIC,
- HB_SCRIPT_INSCRIPTIONAL_PAHLAVI,
- HB_SCRIPT_INSCRIPTIONAL_PARTHIAN,
- HB_SCRIPT_JAVANESE,
- HB_SCRIPT_KAITHI,
- HB_SCRIPT_TAI_THAM,
- HB_SCRIPT_LISU,
- HB_SCRIPT_MEETEI_MAYEK,
- HB_SCRIPT_OLD_SOUTH_ARABIAN,
- HB_SCRIPT_OLD_TURKIC,
- HB_SCRIPT_SAMARITAN,
- HB_SCRIPT_TAI_VIET,
-
- /* Unicode-6.0 additions */
- HB_SCRIPT_BATAK,
- HB_SCRIPT_BRAHMI,
- HB_SCRIPT_MANDAIC,
-
- /* Unicode-6.1 additions */
- HB_SCRIPT_CHAKMA,
- HB_SCRIPT_MEROITIC_CURSIVE,
- HB_SCRIPT_MEROITIC_HIEROGLYPHS,
- HB_SCRIPT_MIAO,
- HB_SCRIPT_SHARADA,
- HB_SCRIPT_SORA_SOMPENG,
- HB_SCRIPT_TAKRI
-};
-#endif
-
/**
* hb_glib_script_to_script:
* @script: The GUnicodeScript identifier to query
@@ -187,17 +63,7 @@ glib_script_to_script[] =
hb_script_t
hb_glib_script_to_script (GUnicodeScript script)
{
-#if GLIB_CHECK_VERSION(2,29,14)
return (hb_script_t) g_unicode_script_to_iso15924 (script);
-#else
- if (likely ((unsigned int) script < ARRAY_LENGTH (glib_script_to_script)))
- return glib_script_to_script[script];
-
- if (unlikely (script == G_UNICODE_SCRIPT_INVALID_CODE))
- return HB_SCRIPT_INVALID;
-
- return HB_SCRIPT_UNKNOWN;
-#endif
}
/**
@@ -214,19 +80,7 @@ hb_glib_script_to_script (GUnicodeScript script)
GUnicodeScript
hb_glib_script_from_script (hb_script_t script)
{
-#if GLIB_CHECK_VERSION(2,29,14)
return g_unicode_script_from_iso15924 (script);
-#else
- unsigned int count = ARRAY_LENGTH (glib_script_to_script);
- for (unsigned int i = 0; i < count; i++)
- if (glib_script_to_script[i] == script)
- return (GUnicodeScript) i;
-
- if (unlikely (script == HB_SCRIPT_INVALID))
- return G_UNICODE_SCRIPT_INVALID_CODE;
-
- return G_UNICODE_SCRIPT_UNKNOWN;
-#endif
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc
index c1dcc24c26e..008a39e414c 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc
@@ -192,45 +192,13 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t a,
hb_codepoint_t b,
hb_codepoint_t *ab,
- void *user_data HB_UNUSED)
+ void *user_data)
{
-#if U_ICU_VERSION_MAJOR_NUM >= 49
- {
- const UNormalizer2 *normalizer = (const UNormalizer2 *) user_data;
- UChar32 ret = unorm2_composePair (normalizer, a, b);
- if (ret < 0) return false;
- *ab = ret;
- return true;
- }
-#endif
-
- /* We don't ifdef-out the fallback code such that compiler always
- * sees it and makes sure it's compilable. */
-
- UChar utf16[4], normalized[5];
- unsigned int len;
- hb_bool_t ret, err;
- UErrorCode icu_err;
-
- len = 0;
- err = false;
- U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), a, err);
- if (err) return false;
- U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), b, err);
- if (err) return false;
-
- icu_err = U_ZERO_ERROR;
- len = unorm2_normalize (unorm2_getNFCInstance (&icu_err), utf16, len, normalized, ARRAY_LENGTH (normalized), &icu_err);
- if (U_FAILURE (icu_err))
- return false;
- if (u_countChar32 (normalized, len) == 1) {
- U16_GET_UNSAFE (normalized, 0, *ab);
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
+ const UNormalizer2 *normalizer = (const UNormalizer2 *) user_data;
+ UChar32 ret = unorm2_composePair (normalizer, a, b);
+ if (ret < 0) return false;
+ *ab = ret;
+ return true;
}
static hb_bool_t
@@ -238,97 +206,30 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t ab,
hb_codepoint_t *a,
hb_codepoint_t *b,
- void *user_data HB_UNUSED)
+ void *user_data)
{
-#if U_ICU_VERSION_MAJOR_NUM >= 49
+ const UNormalizer2 *normalizer = (const UNormalizer2 *) user_data;
+ UChar decomposed[4];
+ int len;
+ UErrorCode icu_err = U_ZERO_ERROR;
+ len = unorm2_getRawDecomposition (normalizer, ab, decomposed,
+ ARRAY_LENGTH (decomposed), &icu_err);
+ if (U_FAILURE (icu_err) || len < 0) return false;
+
+ len = u_countChar32 (decomposed, len);
+ if (len == 1)
{
- const UNormalizer2 *normalizer = (const UNormalizer2 *) user_data;
- UChar decomposed[4];
- int len;
- UErrorCode icu_err = U_ZERO_ERROR;
- len = unorm2_getRawDecomposition (normalizer, ab, decomposed,
- ARRAY_LENGTH (decomposed), &icu_err);
- if (U_FAILURE (icu_err) || len < 0) return false;
-
- len = u_countChar32 (decomposed, len);
- if (len == 1) {
- U16_GET_UNSAFE (decomposed, 0, *a);
- *b = 0;
- return *a != ab;
- } else if (len == 2) {
- len = 0;
- U16_NEXT_UNSAFE (decomposed, len, *a);
- U16_NEXT_UNSAFE (decomposed, len, *b);
- }
- return true;
- }
-#endif
-
- /* We don't ifdef-out the fallback code such that compiler always
- * sees it and makes sure it's compilable. */
-
- UChar utf16[2], normalized[2 * 19/*HB_UNICODE_MAX_DECOMPOSITION_LEN*/ + 1];
- unsigned int len;
- hb_bool_t ret, err;
- UErrorCode icu_err;
-
- /* This function is a monster! Maybe it wasn't a good idea adding a
- * pairwise decompose API... */
- /* Watchout for the dragons. Err, watchout for macros changing len. */
-
- len = 0;
- err = false;
- U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), ab, err);
- if (err) return false;
-
- icu_err = U_ZERO_ERROR;
- len = unorm2_normalize (unorm2_getNFDInstance (&icu_err), utf16, len, normalized, ARRAY_LENGTH (normalized), &icu_err);
- if (U_FAILURE (icu_err))
- return false;
-
- len = u_countChar32 (normalized, len);
-
- if (len == 1) {
- U16_GET_UNSAFE (normalized, 0, *a);
+ U16_GET_UNSAFE (decomposed, 0, *a);
*b = 0;
- ret = *a != ab;
- } else if (len == 2) {
+ return *a != ab;
+ }
+ else if (len == 2)
+ {
len = 0;
- U16_NEXT_UNSAFE (normalized, len, *a);
- U16_NEXT_UNSAFE (normalized, len, *b);
-
- /* Here's the ugly part: if ab decomposes to a single character and
- * that character decomposes again, we have to detect that and undo
- * the second part :-(. */
- UChar recomposed[20];
- icu_err = U_ZERO_ERROR;
- unorm2_normalize (unorm2_getNFCInstance (&icu_err), normalized, len, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
- if (U_FAILURE (icu_err))
- return false;
- hb_codepoint_t c;
- U16_GET_UNSAFE (recomposed, 0, c);
- if (c != *a && c != ab) {
- *a = c;
- *b = 0;
- }
- ret = true;
- } else {
- /* If decomposed to more than two characters, take the last one,
- * and recompose the rest to get the first component. */
- U16_PREV_UNSAFE (normalized, len, *b); /* Changes len in-place. */
- UChar recomposed[18 * 2];
- icu_err = U_ZERO_ERROR;
- len = unorm2_normalize (unorm2_getNFCInstance (&icu_err), normalized, len, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
- if (U_FAILURE (icu_err))
- return false;
- /* We expect that recomposed has exactly one character now. */
- if (unlikely (u_countChar32 (recomposed, len) != 1))
- return false;
- U16_GET_UNSAFE (recomposed, 0, *a);
- ret = true;
+ U16_NEXT_UNSAFE (decomposed, len, *a);
+ U16_NEXT_UNSAFE (decomposed, len, *b);
}
-
- return ret;
+ return true;
}
@@ -341,11 +242,9 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_
static hb_unicode_funcs_t *create ()
{
void *user_data = nullptr;
-#if U_ICU_VERSION_MAJOR_NUM >= 49
UErrorCode icu_err = U_ZERO_ERROR;
user_data = (void *) unorm2_getNFCInstance (&icu_err);
assert (user_data);
-#endif
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
index e1296c391ad..7228f777272 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
@@ -1087,7 +1087,8 @@ struct cff1
if (num_glyphs != sc.get_num_glyphs ())
{ fini (); return; }
- privateDicts.resize (fdCount);
+ if (unlikely (!privateDicts.resize (fdCount)))
+ { fini (); return; }
for (unsigned int i = 0; i < fdCount; i++)
privateDicts[i].init ();
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh
index 075a0d4ef72..829217feaa2 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh
@@ -441,7 +441,8 @@ struct cff2
{ fini (); return; }
fdCount = fdArray->count;
- privateDicts.resize (fdCount);
+ if (!privateDicts.resize (fdCount))
+ { fini (); return; }
/* parse font dicts and gather private dicts */
for (unsigned int i = 0; i < fdCount; i++)
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 bae6a628306..cc48379bb8a 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
@@ -57,14 +57,14 @@ struct CmapSubtableFormat0
}
void collect_mapping (hb_set_t *unicodes, /* OUT */
- hb_map_t *mapping /* OUT */) const
+ hb_map_t *mapping /* OUT */) const
{
for (unsigned i = 0; i < 256; i++)
if (glyphIdArray[i])
{
- hb_codepoint_t glyph = glyphIdArray[i];
- unicodes->add (i);
- mapping->set (i, glyph);
+ hb_codepoint_t glyph = glyphIdArray[i];
+ unicodes->add (i);
+ mapping->set (i, glyph);
}
}
@@ -389,41 +389,41 @@ struct CmapSubtableFormat4
}
void collect_mapping (hb_set_t *unicodes, /* OUT */
- hb_map_t *mapping /* OUT */) const
+ hb_map_t *mapping /* OUT */) const
{
unsigned count = this->segCount;
if (count && this->startCount[count - 1] == 0xFFFFu)
- count--; /* Skip sentinel segment. */
+ count--; /* Skip sentinel segment. */
for (unsigned i = 0; i < count; i++)
{
- hb_codepoint_t start = this->startCount[i];
- hb_codepoint_t end = this->endCount[i];
- unsigned rangeOffset = this->idRangeOffset[i];
- if (rangeOffset == 0)
- {
- for (hb_codepoint_t codepoint = start; codepoint <= end; codepoint++)
- {
- hb_codepoint_t gid = (codepoint + this->idDelta[i]) & 0xFFFFu;
- if (unlikely (!gid))
- continue;
- unicodes->add (codepoint);
- mapping->set (codepoint, gid);
- }
- }
- else
- {
- for (hb_codepoint_t codepoint = start; codepoint <= end; codepoint++)
- {
- unsigned index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount;
- if (unlikely (index >= this->glyphIdArrayLength))
- break;
- hb_codepoint_t gid = this->glyphIdArray[index];
- if (unlikely (!gid))
- continue;
- unicodes->add (codepoint);
- mapping->set (codepoint, gid);
- }
- }
+ hb_codepoint_t start = this->startCount[i];
+ hb_codepoint_t end = this->endCount[i];
+ unsigned rangeOffset = this->idRangeOffset[i];
+ if (rangeOffset == 0)
+ {
+ for (hb_codepoint_t codepoint = start; codepoint <= end; codepoint++)
+ {
+ hb_codepoint_t gid = (codepoint + this->idDelta[i]) & 0xFFFFu;
+ if (unlikely (!gid))
+ continue;
+ unicodes->add (codepoint);
+ mapping->set (codepoint, gid);
+ }
+ }
+ else
+ {
+ for (hb_codepoint_t codepoint = start; codepoint <= end; codepoint++)
+ {
+ unsigned index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount;
+ if (unlikely (index >= this->glyphIdArrayLength))
+ break;
+ hb_codepoint_t gid = this->glyphIdArray[index];
+ if (unlikely (!gid))
+ continue;
+ unicodes->add (codepoint);
+ mapping->set (codepoint, gid);
+ }
+ }
}
}
@@ -448,7 +448,7 @@ struct CmapSubtableFormat4
}
void collect_mapping (hb_set_t *unicodes, /* OUT */
- hb_map_t *mapping /* OUT */) const
+ hb_map_t *mapping /* OUT */) const
{
accelerator_t accel (this);
accel.collect_mapping (unicodes, mapping);
@@ -557,17 +557,17 @@ struct CmapSubtableTrimmed
}
void collect_mapping (hb_set_t *unicodes, /* OUT */
- hb_map_t *mapping /* OUT */) const
+ hb_map_t *mapping /* OUT */) const
{
hb_codepoint_t start_cp = startCharCode;
unsigned count = glyphIdArray.len;
for (unsigned i = 0; i < count; i++)
if (glyphIdArray[i])
{
- hb_codepoint_t unicode = start_cp + i;
- hb_codepoint_t glyphid = glyphIdArray[i];
- unicodes->add (unicode);
- mapping->set (unicode, glyphid);
+ hb_codepoint_t unicode = start_cp + i;
+ hb_codepoint_t glyphid = glyphIdArray[i];
+ unicodes->add (unicode);
+ mapping->set (unicode, glyphid);
}
}
@@ -630,31 +630,31 @@ struct CmapSubtableLongSegmented
}
void collect_mapping (hb_set_t *unicodes, /* OUT */
- hb_map_t *mapping, /* OUT */
- unsigned num_glyphs) const
+ hb_map_t *mapping, /* OUT */
+ unsigned num_glyphs) const
{
for (unsigned i = 0; i < this->groups.len; i++)
{
hb_codepoint_t start = this->groups[i].startCharCode;
hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
- (hb_codepoint_t) HB_UNICODE_MAX);
+ (hb_codepoint_t) HB_UNICODE_MAX);
hb_codepoint_t gid = this->groups[i].glyphID;
if (!gid)
{
- /* Intention is: if (hb_is_same (T, CmapSubtableFormat13)) continue; */
- if (! T::group_get_glyph (this->groups[i], end)) continue;
- start++;
- gid++;
+ /* Intention is: if (hb_is_same (T, CmapSubtableFormat13)) continue; */
+ if (! T::group_get_glyph (this->groups[i], end)) continue;
+ start++;
+ gid++;
}
if (unlikely ((unsigned int) gid >= num_glyphs)) continue;
if (unlikely ((unsigned int) (gid + end - start) >= num_glyphs))
- end = start + (hb_codepoint_t) num_glyphs - gid;
+ end = start + (hb_codepoint_t) num_glyphs - gid;
for (unsigned cp = start; cp <= end; cp++)
{
- unicodes->add (cp);
- mapping->set (cp, gid);
- gid++;
+ unicodes->add (cp);
+ mapping->set (cp, gid);
+ gid++;
}
}
}
@@ -1108,6 +1108,9 @@ struct CmapSubtableFormat14
return;
}
+ if (unlikely (!c->check_success (!obj_indices.in_error ())))
+ return;
+
int tail_len = init_tail - c->tail;
c->check_assign (this->length, c->length () - table_initpos + tail_len);
c->check_assign (this->record.len,
@@ -1363,38 +1366,38 @@ struct cmap
unsigned format = (base+_.subtable).u.format;
if (!plan->glyphs_requested->is_empty ())
{
- hb_set_t unicodes_set;
- hb_map_t cp_glyphid_map;
- (base+_.subtable).collect_mapping (&unicodes_set, &cp_glyphid_map);
-
- auto table_iter =
- + hb_zip (unicodes_set.iter(), unicodes_set.iter() | hb_map(cp_glyphid_map))
- | hb_filter (plan->_glyphset, hb_second)
- | hb_filter ([plan] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t>& p)
- {
- return plan->unicodes->has (p.first) ||
- plan->glyphs_requested->has (p.second);
- })
- | hb_map ([plan] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t>& p_org)
- {
- return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (p_org.first, plan->glyph_map->get(p_org.second));
- })
- ;
-
- if (format == 4) c->copy (_, table_iter, 4u, base, plan, &format4objidx);
- else if (format == 12) c->copy (_, table_iter, 12u, base, plan, &format12objidx);
- else if (format == 14) c->copy (_, table_iter, 14u, base, plan, &format14objidx);
+ hb_set_t unicodes_set;
+ hb_map_t cp_glyphid_map;
+ (base+_.subtable).collect_mapping (&unicodes_set, &cp_glyphid_map);
+
+ auto table_iter =
+ + hb_zip (unicodes_set.iter(), unicodes_set.iter() | hb_map(cp_glyphid_map))
+ | hb_filter (plan->_glyphset, hb_second)
+ | hb_filter ([plan] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t>& p)
+ {
+ return plan->unicodes->has (p.first) ||
+ plan->glyphs_requested->has (p.second);
+ })
+ | hb_map ([plan] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t>& p_org)
+ {
+ return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (p_org.first, plan->glyph_map->get(p_org.second));
+ })
+ ;
+
+ if (format == 4) c->copy (_, table_iter, 4u, base, plan, &format4objidx);
+ else if (format == 12) c->copy (_, table_iter, 12u, base, plan, &format12objidx);
+ else if (format == 14) c->copy (_, table_iter, 14u, base, plan, &format14objidx);
}
/* when --gids option is not used, we iterate input unicodes instead of
* all codepoints in each subtable, which is more efficient */
else
{
- hb_set_t unicodes_set;
- (base+_.subtable).collect_unicodes (&unicodes_set);
+ hb_set_t unicodes_set;
+ (base+_.subtable).collect_unicodes (&unicodes_set);
- if (format == 4) c->copy (_, + it | hb_filter (unicodes_set, hb_first), 4u, base, plan, &format4objidx);
- else if (format == 12) c->copy (_, + it | hb_filter (unicodes_set, hb_first), 12u, base, plan, &format12objidx);
- else if (format == 14) c->copy (_, it, 14u, base, plan, &format14objidx);
+ if (format == 4) c->copy (_, + it | hb_filter (unicodes_set, hb_first), 4u, base, plan, &format4objidx);
+ else if (format == 12) c->copy (_, + it | hb_filter (unicodes_set, hb_first), 12u, base, plan, &format12objidx);
+ else if (format == 14) c->copy (_, it, 14u, base, plan, &format14objidx);
}
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh
index 2500fbe3f22..aaa1c37c64b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh
@@ -455,7 +455,9 @@ struct IndexSubtableRecord
unsigned int old_cbdt_prime_length = bitmap_size_context->cbdt_prime->length;
// Set to invalid state to indicate filling glyphs is not yet started.
- records->resize (records->length + 1);
+ if (unlikely (!records->resize (records->length + 1)))
+ return_trace (c->serializer->check_success (false));
+
(*records)[records->length - 1].firstGlyphIndex = 1;
(*records)[records->length - 1].lastGlyphIndex = 0;
bitmap_size_context->size += IndexSubtableRecord::min_size;
@@ -565,6 +567,8 @@ struct IndexSubtableArray
hb_vector_t<hb_pair_t<hb_codepoint_t, const IndexSubtableRecord*>> lookup;
build_lookup (c, bitmap_size_context, &lookup);
+ if (unlikely (lookup.in_error ()))
+ return c->serializer->check_success (false);
bitmap_size_context->size = 0;
bitmap_size_context->num_tables = 0;
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 ce7ffa9d1f8..5470bd96da3 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
@@ -91,7 +91,10 @@ struct glyf
static bool
_add_loca_and_head (hb_subset_plan_t * plan, Iterator padded_offsets)
{
- unsigned max_offset = + padded_offsets | hb_reduce(hb_add, 0);
+ unsigned max_offset =
+ + padded_offsets
+ | hb_reduce (hb_add, 0)
+ ;
unsigned num_offsets = padded_offsets.len () + 1;
bool use_short_loca = max_offset < 0x1FFFF;
unsigned entry_size = use_short_loca ? 2 : 4;
@@ -104,18 +107,18 @@ struct glyf
entry_size, num_offsets, max_offset, entry_size * num_offsets);
if (use_short_loca)
- _write_loca (padded_offsets, 1, hb_array ((HBUINT16*) loca_prime_data, num_offsets));
+ _write_loca (padded_offsets, 1, hb_array ((HBUINT16 *) loca_prime_data, num_offsets));
else
- _write_loca (padded_offsets, 0, hb_array ((HBUINT32*) loca_prime_data, num_offsets));
+ _write_loca (padded_offsets, 0, hb_array ((HBUINT32 *) loca_prime_data, num_offsets));
- hb_blob_t * loca_blob = hb_blob_create (loca_prime_data,
- entry_size * num_offsets,
- HB_MEMORY_MODE_WRITABLE,
- loca_prime_data,
- free);
+ hb_blob_t *loca_blob = hb_blob_create (loca_prime_data,
+ entry_size * num_offsets,
+ HB_MEMORY_MODE_WRITABLE,
+ loca_prime_data,
+ free);
bool result = plan->add_table (HB_OT_TAG_loca, loca_blob)
- && _add_head_and_set_loca_version (plan, use_short_loca);
+ && _add_head_and_set_loca_version (plan, use_short_loca);
hb_blob_destroy (loca_blob);
return result;
@@ -238,6 +241,7 @@ struct glyf
struct CompositeGlyphChain
{
+ protected:
enum composite_glyph_flag_t
{
ARG_1_AND_2_ARE_WORDS = 0x0001,
@@ -254,6 +258,7 @@ struct glyf
UNSCALED_COMPONENT_OFFSET = 0x1000
};
+ public:
unsigned int get_size () const
{
unsigned int size = min_size;
@@ -272,6 +277,13 @@ struct glyf
return size;
}
+ void set_glyph_index (hb_codepoint_t new_gid) { glyphIndex = new_gid; }
+ hb_codepoint_t get_glyph_index () const { return glyphIndex; }
+
+ void drop_instructions_flag () { flags = (uint16_t) flags & ~WE_HAVE_INSTRUCTIONS; }
+ bool has_instructions () const { return flags & WE_HAVE_INSTRUCTIONS; }
+
+ bool has_more () const { return flags & MORE_COMPONENTS; }
bool is_use_my_metrics () const { return flags & USE_MY_METRICS; }
bool is_anchored () const { return !(flags & ARGS_ARE_XY_VALUES); }
void get_anchor_points (unsigned int &point1, unsigned int &point2) const
@@ -360,7 +372,7 @@ struct glyf
return tx || ty;
}
- public:
+ protected:
HBUINT16 flags;
HBGlyphID glyphIndex;
public:
@@ -379,7 +391,7 @@ struct glyf
bool __more__ () const { return current; }
void __next__ ()
{
- if (!(current->flags & CompositeGlyphChain::MORE_COMPONENTS)) { current = nullptr; return; }
+ if (!current->has_more ()) { current = nullptr; return; }
const CompositeGlyphChain *possible = &StructAfter<CompositeGlyphChain,
CompositeGlyphChain> (*current);
@@ -409,6 +421,8 @@ struct glyf
PHANTOM_COUNT = 4
};
+ struct accelerator_t;
+
struct Glyph
{
enum simple_glyph_flag_t
@@ -428,11 +442,12 @@ struct glyf
{
bool has_data () const { return numberOfContours; }
- bool get_extents (hb_font_t *font, hb_codepoint_t gid, hb_glyph_extents_t *extents) const
+ bool get_extents (hb_font_t *font, const accelerator_t &glyf_accelerator,
+ hb_codepoint_t gid, hb_glyph_extents_t *extents) const
{
/* Undocumented rasterizer behavior: shift glyph to the left by (lsb - xMin), i.e., xMin = lsb */
/* extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax); */
- extents->x_bearing = font->em_scale_x (font->face->table.hmtx->get_side_bearing (gid));
+ extents->x_bearing = font->em_scale_x (glyf_accelerator.hmtx->get_side_bearing (gid));
extents->y_bearing = font->em_scale_y (hb_max (yMin, yMax));
extents->width = font->em_scale_x (hb_max (xMin, xMax) - hb_min (xMin, xMax));
extents->height = font->em_scale_y (hb_min (yMin, yMax) - hb_max (yMin, yMax));
@@ -606,10 +621,10 @@ struct glyf
}
/* Read x & y coordinates */
- return (read_points (p, points_, bytes,
- [] (contour_point_t &p, float v) { p.x = v; }, FLAG_X_SHORT, FLAG_X_SAME) &&
- read_points (p, points_, bytes,
- [] (contour_point_t &p, float v) { p.y = v; }, FLAG_Y_SHORT, FLAG_Y_SAME));
+ return read_points (p, points_, bytes, [] (contour_point_t &p, float v) { p.x = v; },
+ FLAG_X_SHORT, FLAG_X_SAME)
+ && read_points (p, points_, bytes, [] (contour_point_t &p, float v) { p.y = v; },
+ FLAG_Y_SHORT, FLAG_Y_SAME);
}
};
@@ -632,7 +647,7 @@ struct glyf
last = &item;
if (unlikely (!last)) return 0;
- if ((uint16_t) last->flags & CompositeGlyphChain::WE_HAVE_INSTRUCTIONS)
+ if (last->has_instructions ())
start = (char *) last - &bytes + last->get_size ();
if (unlikely (start > end)) return 0;
return end - start;
@@ -642,11 +657,10 @@ struct glyf
* If removing hints it falls out of that. */
const Glyph trim_padding () const { return Glyph (bytes); }
- /* remove WE_HAVE_INSTRUCTIONS flag from composite glyph */
void drop_hints ()
{
for (const auto &_ : get_iterator ())
- *const_cast<OT::HBUINT16 *> (&_.flags) = (uint16_t) _.flags & ~OT::glyf::CompositeGlyphChain::WE_HAVE_INSTRUCTIONS;
+ const_cast<CompositeGlyphChain &> (_).drop_instructions_flag ();
}
/* Chop instructions off the end */
@@ -693,8 +707,7 @@ struct glyf
/* Note: Recursively calls itself.
* all_points includes phantom points
*/
- template<typename T>
- bool get_points (T glyph_for_gid, hb_font_t *font,
+ bool get_points (hb_font_t *font, const accelerator_t &glyf_accelerator,
contour_point_vector_t &all_points /* OUT */,
bool phantom_only = false,
unsigned int depth = 0) const
@@ -716,20 +729,17 @@ struct glyf
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only)))
return false;
break;
- default: return false; /* empty glyph */
}
- hb_face_t *face = font->face;
-
/* Init phantom points */
if (unlikely (!points.resize (points.length + PHANTOM_COUNT))) return false;
hb_array_t<contour_point_t> phantoms = points.sub_array (points.length - PHANTOM_COUNT, PHANTOM_COUNT);
{
for (unsigned i = 0; i < PHANTOM_COUNT; ++i) phantoms[i].init ();
- int h_delta = (int) header->xMin - face->table.hmtx->get_side_bearing (gid);
- int v_orig = (int) header->yMax + face->table.vmtx->get_side_bearing (gid);
- unsigned h_adv = face->table.hmtx->get_advance (gid);
- unsigned v_adv = face->table.vmtx->get_advance (gid);
+ int h_delta = (int) header->xMin - glyf_accelerator.hmtx->get_side_bearing (gid);
+ int v_orig = (int) header->yMax + glyf_accelerator.vmtx->get_side_bearing (gid);
+ unsigned h_adv = glyf_accelerator.hmtx->get_advance (gid);
+ unsigned v_adv = glyf_accelerator.vmtx->get_advance (gid);
phantoms[PHANTOM_LEFT].x = h_delta;
phantoms[PHANTOM_RIGHT].x = h_adv + h_delta;
phantoms[PHANTOM_TOP].y = v_orig;
@@ -737,7 +747,7 @@ struct glyf
}
#ifndef HB_NO_VAR
- if (unlikely (!face->table.gvar->apply_deltas_to_points (gid, font, points.as_array ())))
+ if (unlikely (!glyf_accelerator.gvar->apply_deltas_to_points (gid, font, points.as_array ())))
return false;
#endif
@@ -751,8 +761,10 @@ struct glyf
for (auto &item : get_composite_iterator ())
{
contour_point_vector_t comp_points;
- if (unlikely (!glyph_for_gid (item.glyphIndex).get_points (glyph_for_gid, font, comp_points, phantom_only, depth + 1))
- || comp_points.length < PHANTOM_COUNT)
+ if (unlikely (!glyf_accelerator.glyph_for_gid (item.get_glyph_index ())
+ .get_points (font, glyf_accelerator, comp_points,
+ phantom_only, depth + 1)
+ || comp_points.length < PHANTOM_COUNT))
return false;
/* Copy phantom points from component if USE_MY_METRICS flag set */
@@ -787,7 +799,8 @@ struct glyf
all_points.extend (phantoms);
} break;
- default: return false;
+ default:
+ all_points.extend (phantoms);
}
if (depth == 0) /* Apply at top level */
@@ -803,10 +816,11 @@ struct glyf
return true;
}
- bool get_extents (hb_font_t *font, hb_glyph_extents_t *extents) const
+ bool get_extents (hb_font_t *font, const accelerator_t &glyf_accelerator,
+ hb_glyph_extents_t *extents) const
{
if (type == EMPTY) return true; /* Empty glyph; zero extents. */
- return header->get_extents (font, gid, extents);
+ return header->get_extents (font, glyf_accelerator, gid, extents);
}
hb_bytes_t get_bytes () const { return bytes; }
@@ -836,6 +850,11 @@ struct glyf
num_glyphs = 0;
loca_table = nullptr;
glyf_table = nullptr;
+#ifndef HB_NO_VAR
+ gvar = nullptr;
+#endif
+ hmtx = nullptr;
+ vmtx = nullptr;
face = face_;
const OT::head &head = *face->table.head;
if (head.indexToLocFormat > 1 || head.glyphDataFormat > 0)
@@ -845,6 +864,11 @@ struct glyf
loca_table = hb_sanitize_context_t ().reference_table<loca> (face);
glyf_table = hb_sanitize_context_t ().reference_table<glyf> (face);
+#ifndef HB_NO_VAR
+ gvar = face->table.gvar;
+#endif
+ hmtx = face->table.hmtx;
+ vmtx = face->table.vmtx;
num_glyphs = hb_max (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1;
num_glyphs = hb_min (num_glyphs, face->get_num_glyphs ());
@@ -860,6 +884,8 @@ struct glyf
template<typename T>
bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer) const
{
+ if (gid >= num_glyphs) return false;
+
/* Making this alloc free is not that easy
https://github.com/harfbuzz/harfbuzz/issues/2095
mostly because of gvar handling in VF fonts,
@@ -867,8 +893,7 @@ struct glyf
contour_point_vector_t all_points;
bool phantom_only = !consumer.is_consuming_contour_points ();
- if (unlikely (!glyph_for_gid (gid).get_points ([this] (hb_codepoint_t gid) -> const Glyph { return this->glyph_for_gid (gid); },
- font, all_points, phantom_only)))
+ if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, phantom_only)))
return false;
if (consumer.is_consuming_contour_points ())
@@ -887,7 +912,6 @@ struct glyf
return true;
}
- public:
#ifndef HB_NO_VAR
struct points_aggregator_t
{
@@ -944,34 +968,36 @@ struct glyf
contour_point_t *get_phantoms_sink () { return phantoms; }
};
- unsigned int
+ public:
+ unsigned
get_advance_var (hb_font_t *font, hb_codepoint_t gid, bool is_vertical) const
{
+ if (unlikely (gid >= num_glyphs)) return 0;
+
bool success = false;
contour_point_t phantoms[PHANTOM_COUNT];
- if (likely (font->num_coords == face->table.gvar->get_axis_count ()))
+ if (likely (font->num_coords == gvar->get_axis_count ()))
success = get_points (font, gid, points_aggregator_t (font, nullptr, phantoms));
if (unlikely (!success))
- return is_vertical
- ? face->table.vmtx->get_advance (gid)
- : face->table.hmtx->get_advance (gid);
+ return is_vertical ? vmtx->get_advance (gid) : hmtx->get_advance (gid);
- return is_vertical
- ? roundf (phantoms[PHANTOM_TOP].y - phantoms[PHANTOM_BOTTOM].y)
- : roundf (phantoms[PHANTOM_RIGHT].x - phantoms[PHANTOM_LEFT].x);
+ float result = is_vertical
+ ? phantoms[PHANTOM_TOP].y - phantoms[PHANTOM_BOTTOM].y
+ : phantoms[PHANTOM_RIGHT].x - phantoms[PHANTOM_LEFT].x;
+ return hb_clamp (roundf (result), 0.f, (float) UINT_MAX / 2);
}
int get_side_bearing_var (hb_font_t *font, hb_codepoint_t gid, bool is_vertical) const
{
+ if (unlikely (gid >= num_glyphs)) return 0;
+
hb_glyph_extents_t extents;
contour_point_t phantoms[PHANTOM_COUNT];
if (unlikely (!get_points (font, gid, points_aggregator_t (font, &extents, phantoms))))
- return is_vertical
- ? face->table.vmtx->get_side_bearing (gid)
- : face->table.hmtx->get_side_bearing (gid);
+ return is_vertical ? vmtx->get_side_bearing (gid) : hmtx->get_side_bearing (gid);
return is_vertical
? ceilf (phantoms[PHANTOM_TOP].y) - extents.y_bearing
@@ -979,22 +1005,25 @@ struct glyf
}
#endif
+ public:
bool get_extents (hb_font_t *font, hb_codepoint_t gid, hb_glyph_extents_t *extents) const
{
if (unlikely (gid >= num_glyphs)) return false;
+
#ifndef HB_NO_VAR
- if (font->num_coords && font->num_coords == face->table.gvar->get_axis_count ())
+ if (font->num_coords && font->num_coords == gvar->get_axis_count ())
return get_points (font, gid, points_aggregator_t (font, extents, nullptr));
#endif
- return glyph_for_gid (gid).get_extents (font, extents);
+ return glyph_for_gid (gid).get_extents (font, *this, extents);
}
const Glyph
glyph_for_gid (hb_codepoint_t gid, bool needs_padding_removal = false) const
{
- unsigned int start_offset, end_offset;
if (unlikely (gid >= num_glyphs)) return Glyph ();
+ unsigned int start_offset, end_offset;
+
if (short_offset)
{
const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataZ.arrayZ;
@@ -1027,7 +1056,7 @@ struct glyf
gids_to_retain->add (gid);
for (auto &item : glyph_for_gid (gid).get_composite_iterator ())
- add_gid_and_children (item.glyphIndex, gids_to_retain, depth);
+ add_gid_and_children (item.get_glyph_index (), gids_to_retain, depth);
}
#ifdef HB_EXPERIMENTAL_API
@@ -1151,6 +1180,12 @@ struct glyf
{ return get_points (font, gid, path_builder_t (font, draw_helper)); }
#endif
+#ifndef HB_NO_VAR
+ const gvar_accelerator_t *gvar;
+#endif
+ const hmtx_accelerator_t *hmtx;
+ const vmtx_accelerator_t *vmtx;
+
private:
bool short_offset;
unsigned int num_glyphs;
@@ -1175,7 +1210,7 @@ struct glyf
hb_bytes_t dest_glyph = dest_start.copy (c);
dest_glyph = hb_bytes_t (&dest_glyph, dest_glyph.length + dest_end.copy (c).length);
unsigned int pad_length = padding ();
- DEBUG_MSG (SUBSET, nullptr, "serialize %d byte glyph, width %d pad %d", dest_glyph.length, dest_glyph.length + pad_length, pad_length);
+ DEBUG_MSG (SUBSET, nullptr, "serialize %d byte glyph, width %d pad %d", dest_glyph.length, dest_glyph.length + pad_length, pad_length);
HBUINT8 pad;
pad = 0;
@@ -1191,8 +1226,8 @@ struct glyf
for (auto &_ : Glyph (dest_glyph).get_composite_iterator ())
{
hb_codepoint_t new_gid;
- if (plan->new_gid_for_old_gid (_.glyphIndex, &new_gid))
- ((OT::glyf::CompositeGlyphChain *) &_)->glyphIndex = new_gid;
+ if (plan->new_gid_for_old_gid (_.get_glyph_index (), &new_gid))
+ const_cast<CompositeGlyphChain &> (_).set_glyph_index (new_gid);
}
if (plan->drop_hints) Glyph (dest_glyph).drop_hints ();
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh
index 7361a088b32..3140dd6328d 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh
@@ -963,7 +963,7 @@ struct Feature
out->lookupIndex.serialize (c->serializer, l, it);
return_trace (bool (it) || subset_featureParams
- || (tag && *tag == HB_TAG ('p', 'r', 'e', 'f')));
+ || (tag && *tag == HB_TAG ('p', 'r', 'e', 'f')));
}
bool sanitize (hb_sanitize_context_t *c,
@@ -2527,9 +2527,9 @@ struct VariationStore
if (major >= inner_maps.length)
{
- for (unsigned i = 0; i < inner_maps.length; i++)
- inner_maps[i].fini ();
- return_trace (false);
+ for (unsigned i = 0; i < inner_maps.length; i++)
+ inner_maps[i].fini ();
+ return_trace (false);
}
inner_maps[major].add (minor);
}
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 c2bad052802..437e760f64d 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
@@ -205,7 +205,7 @@ struct CaretValueFormat3
if (unlikely (!out)) return_trace (false);
return_trace (out->deviceTable.serialize_copy (c->serializer, deviceTable, this, c->serializer->to_bias (out),
- hb_serialize_context_t::Head, c->plan->layout_variation_idx_map));
+ hb_serialize_context_t::Head, c->plan->layout_variation_idx_map));
}
void collect_variation_indices (hb_set_t *layout_variation_indices) const
@@ -626,8 +626,8 @@ struct GDEF
if (major >= (this+varStore).get_sub_table_count ()) break;
if (major != last_major)
{
- new_minor = 0;
- ++new_major;
+ new_minor = 0;
+ ++new_major;
}
unsigned new_idx = (new_major << 16) + new_minor;
@@ -653,8 +653,8 @@ struct GDEF
{
subset_markglyphsetsdef = out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this);
if (!subset_markglyphsetsdef &&
- version.to_int () == 0x00010002u)
- out->version.minor = 0;
+ version.to_int () == 0x00010002u)
+ out->version.minor = 0;
}
bool subset_varstore = true;
@@ -662,13 +662,13 @@ struct GDEF
{
subset_varstore = out->varStore.serialize_subset (c, varStore, this);
if (!subset_varstore && version.to_int () == 0x00010003u)
- out->version.minor = 2;
+ out->version.minor = 2;
}
return_trace (subset_glyphclassdef || subset_attachlist ||
- subset_ligcaretlist || subset_markattachclassdef ||
- (out->version.to_int () >= 0x00010002u && subset_markglyphsetsdef) ||
- (out->version.to_int () >= 0x00010003u && subset_varstore));
+ subset_ligcaretlist || subset_markattachclassdef ||
+ (out->version.to_int () >= 0x00010002u && subset_markglyphsetsdef) ||
+ (out->version.to_int () >= 0x00010003u && subset_varstore));
}
bool sanitize (hb_sanitize_context_t *c) const
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 2a3ebc9c174..2217d298fb4 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
@@ -161,7 +161,7 @@ struct ValueFormat : HBUINT16
}
void serialize_copy (hb_serialize_context_t *c, const void *base,
- const Value *values, const hb_map_t *layout_variation_idx_map) const
+ const Value *values, const hb_map_t *layout_variation_idx_map) const
{
unsigned int format = *this;
if (!format) return;
@@ -178,8 +178,8 @@ struct ValueFormat : HBUINT16
}
void collect_variation_indices (hb_collect_variation_indices_context_t *c,
- const void *base,
- const hb_array_t<const Value>& values) const
+ const void *base,
+ const hb_array_t<const Value>& values) const
{
unsigned format = *this;
unsigned i = 0;
@@ -243,7 +243,7 @@ struct ValueFormat : HBUINT16
}
bool copy_device (hb_serialize_context_t *c, const void *base,
- const Value *src_value, const hb_map_t *layout_variation_idx_map) const
+ const Value *src_value, const hb_map_t *layout_variation_idx_map) const
{
Value *dst_value = c->copy (*src_value);
@@ -324,7 +324,7 @@ static void SinglePos_serialize (hb_serialize_context_t *c,
const void *src,
Iterator it,
ValueFormat valFormat,
- const hb_map_t *layout_variation_idx_map);
+ const hb_map_t *layout_variation_idx_map);
struct AnchorFormat1
@@ -545,11 +545,11 @@ struct AnchorMatrix
bool serialize (hb_serialize_context_t *c,
unsigned num_rows,
AnchorMatrix const *offset_matrix,
- const hb_map_t *layout_variation_idx_map,
+ const hb_map_t *layout_variation_idx_map,
Iterator index_iter)
{
TRACE_SERIALIZE (this);
- if (!index_iter.len ()) return_trace (false);
+ if (!index_iter) return_trace (false);
if (unlikely (!c->extend_min ((*this)))) return_trace (false);
this->rows = num_rows;
@@ -558,9 +558,9 @@ struct AnchorMatrix
auto *offset = c->embed (offset_matrix->matrixZ[i]);
if (!offset) return_trace (false);
offset->serialize_copy (c, offset_matrix->matrixZ[i],
- offset_matrix, c->to_bias (this),
- hb_serialize_context_t::Head,
- layout_variation_idx_map);
+ offset_matrix, c->to_bias (this),
+ hb_serialize_context_t::Head,
+ layout_variation_idx_map);
}
return_trace (true);
@@ -668,7 +668,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
hb_requires (hb_is_source_of (Iterator, MarkRecord))>
bool serialize (hb_serialize_context_t *c,
const hb_map_t *klass_mapping,
- const hb_map_t *layout_variation_idx_map,
+ const hb_map_t *layout_variation_idx_map,
const void *base,
Iterator it)
{
@@ -732,7 +732,7 @@ struct SinglePosFormat1
const void *src,
Iterator it,
ValueFormat valFormat,
- const hb_map_t *layout_variation_idx_map)
+ const hb_map_t *layout_variation_idx_map)
{
auto out = c->extend_min (*this);
if (unlikely (!out)) return;
@@ -813,7 +813,7 @@ struct SinglePosFormat2
const hb_array_t<const Value> values_array = values.as_array (valueCount * sub_length);
for (unsigned i : + it
- | hb_map (hb_second))
+ | hb_map (hb_second))
valueFormat.collect_variation_indices (c, this, values_array.sub_array (i * sub_length, sub_length));
}
@@ -846,7 +846,7 @@ struct SinglePosFormat2
const void *src,
Iterator it,
ValueFormat valFormat,
- const hb_map_t *layout_variation_idx_map)
+ const hb_map_t *layout_variation_idx_map)
{
auto out = c->extend_min (*this);
if (unlikely (!out)) return;
@@ -937,7 +937,7 @@ struct SinglePos
const void *src,
Iterator glyph_val_iter_pairs,
ValueFormat valFormat,
- const hb_map_t *layout_variation_idx_map)
+ const hb_map_t *layout_variation_idx_map)
{
if (unlikely (!c->extend_min (u.format))) return;
unsigned format = 2;
@@ -980,7 +980,7 @@ SinglePos_serialize (hb_serialize_context_t *c,
const void *src,
Iterator it,
ValueFormat valFormat,
- const hb_map_t *layout_variation_idx_map)
+ const hb_map_t *layout_variation_idx_map)
{ c->start_embed<SinglePos> ()->serialize (c, src, it, valFormat, layout_variation_idx_map); }
@@ -1016,8 +1016,8 @@ struct PairValueRecord
}
void collect_variation_indices (hb_collect_variation_indices_context_t *c,
- const ValueFormat *valueFormats,
- const void *base) const
+ const ValueFormat *valueFormats,
+ const void *base) const
{
unsigned record1_len = valueFormats[0].get_len ();
unsigned record2_len = valueFormats[1].get_len ();
@@ -1074,7 +1074,7 @@ struct PairSet
}
void collect_variation_indices (hb_collect_variation_indices_context_t *c,
- const ValueFormat *valueFormats) const
+ const ValueFormat *valueFormats) const
{
unsigned len1 = valueFormats[0].get_len ();
unsigned len2 = valueFormats[1].get_len ();
@@ -1355,12 +1355,12 @@ struct PairPosFormat2
{
for (const unsigned class2_idx : class2_set.iter ())
{
- unsigned start_offset = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
- if (valueFormat1.has_device ())
- valueFormat1.collect_variation_indices (c, this, values_array.sub_array (start_offset, len1));
+ unsigned start_offset = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
+ if (valueFormat1.has_device ())
+ valueFormat1.collect_variation_indices (c, this, values_array.sub_array (start_offset, len1));
- if (valueFormat2.has_device ())
- valueFormat2.collect_variation_indices (c, this, values_array.sub_array (start_offset+len1, len2));
+ if (valueFormat2.has_device ())
+ valueFormat2.collect_variation_indices (c, this, values_array.sub_array (start_offset+len1, len2));
}
}
}
@@ -1428,17 +1428,17 @@ struct PairPosFormat2
+ hb_range ((unsigned) class1Count)
| hb_filter (klass1_map)
| hb_apply ([&] (const unsigned class1_idx)
- {
- + hb_range ((unsigned) class2Count)
- | hb_filter (klass2_map)
- | hb_apply ([&] (const unsigned class2_idx)
- {
- unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
- valueFormat1.serialize_copy (c->serializer, this, &values[idx], c->plan->layout_variation_idx_map);
- valueFormat2.serialize_copy (c->serializer, this, &values[idx + len1], c->plan->layout_variation_idx_map);
- })
- ;
- })
+ {
+ + hb_range ((unsigned) class2Count)
+ | hb_filter (klass2_map)
+ | hb_apply ([&] (const unsigned class2_idx)
+ {
+ unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
+ valueFormat1.serialize_copy (c->serializer, this, &values[idx], c->plan->layout_variation_idx_map);
+ valueFormat2.serialize_copy (c->serializer, this, &values[idx + len1], c->plan->layout_variation_idx_map);
+ })
+ ;
+ })
;
const hb_set_t &glyphset = *c->plan->_glyphset_gsub;
@@ -1547,7 +1547,7 @@ struct EntryExitRecord
EntryExitRecord* copy (hb_serialize_context_t *c,
const void *src_base,
const void *dst_base,
- const hb_map_t *layout_variation_idx_map) const
+ const hb_map_t *layout_variation_idx_map) const
{
TRACE_SERIALIZE (this);
auto *out = c->embed (this);
@@ -1707,7 +1707,7 @@ struct CursivePosFormat1
void serialize (hb_serialize_context_t *c,
Iterator it,
const void *src_base,
- const hb_map_t *layout_variation_idx_map)
+ const hb_map_t *layout_variation_idx_map)
{
if (unlikely (!c->extend_min ((*this)))) return;
this->format = 1;
@@ -2065,11 +2065,11 @@ struct MarkLigPosFormat1
unsigned row_count = lig_array[i].rows;
for (unsigned row : + hb_range (row_count))
{
- + hb_range ((unsigned) classCount)
- | hb_filter (klass_mapping)
- | hb_map ([&] (const unsigned col) { return row * (unsigned) classCount + col; })
- | hb_sink (lig_indexes)
- ;
+ + hb_range ((unsigned) classCount)
+ | hb_filter (klass_mapping)
+ | hb_map ([&] (const unsigned col) { return row * (unsigned) classCount + col; })
+ | hb_sink (lig_indexes)
+ ;
}
lig_array[i].collect_variation_indices (c, lig_indexes.iter ());
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 ea82b08d6f5..2f41d678199 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
@@ -1575,8 +1575,8 @@ struct GSUB : GSUBGPOS
hb_face_t *face) const;
void closure_lookups (hb_face_t *face,
- const hb_set_t *glyphs,
- hb_set_t *lookup_indexes /* IN/OUT */) const
+ const hb_set_t *glyphs,
+ hb_set_t *lookup_indexes /* IN/OUT */) const
{ GSUBGPOS::closure_lookups<SubstLookup> (face, glyphs, lookup_indexes); }
typedef GSUBGPOS::accelerator_t<GSUB> accelerator_t;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh
index 5877933729b..03a578cec08 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh
@@ -89,6 +89,9 @@ struct hb_closure_context_t :
bool is_lookup_done (unsigned int lookup_index)
{
+ if (done_lookups->in_error ())
+ return true;
+
/* Have we visited this lookup with the current set of glyphs? */
return done_lookups->get (lookup_index) == glyphs->get_population ();
}
@@ -163,6 +166,9 @@ struct hb_closure_lookups_context_t :
if (lookup_count++ > HB_MAX_LOOKUP_INDICES)
return true;
+ if (visited_lookups->in_error ())
+ return true;
+
return visited_lookups->has (lookup_index);
}
@@ -624,56 +630,53 @@ struct hb_ot_apply_context_t :
return true;
}
- void _set_glyph_class (hb_codepoint_t glyph_index,
- unsigned int class_guess = 0,
- bool ligature = false,
- bool component = false) const
+ void _set_glyph_props (hb_codepoint_t glyph_index,
+ unsigned int class_guess = 0,
+ bool ligature = false,
+ bool component = false) const
{
- unsigned int props = _hb_glyph_info_get_glyph_props (&buffer->cur());
-
- props |= HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED;
+ unsigned int add_in = _hb_glyph_info_get_glyph_props (&buffer->cur()) &
+ HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE;
+ add_in |= HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED;
if (ligature)
{
- props |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED;
+ add_in |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED;
/* In the only place that the MULTIPLIED bit is used, Uniscribe
* seems to only care about the "last" transformation between
* Ligature and Multiple substitutions. Ie. if you ligate, expand,
* and ligate again, it forgives the multiplication and acts as
* if only ligation happened. As such, clear MULTIPLIED bit.
*/
- props &= ~HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
+ add_in &= ~HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
}
if (component)
- props |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
-
+ add_in |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
if (likely (has_glyph_classes))
- props = (props & ~HB_OT_LAYOUT_GLYPH_PROPS_CLASS_MASK) | gdef.get_glyph_props (glyph_index);
+ _hb_glyph_info_set_glyph_props (&buffer->cur(), add_in | gdef.get_glyph_props (glyph_index));
else if (class_guess)
- props = (props & ~HB_OT_LAYOUT_GLYPH_PROPS_CLASS_MASK) | class_guess;
-
- _hb_glyph_info_set_glyph_props (&buffer->cur(), props);
+ _hb_glyph_info_set_glyph_props (&buffer->cur(), add_in | class_guess);
}
void replace_glyph (hb_codepoint_t glyph_index) const
{
- _set_glyph_class (glyph_index);
+ _set_glyph_props (glyph_index);
buffer->replace_glyph (glyph_index);
}
void replace_glyph_inplace (hb_codepoint_t glyph_index) const
{
- _set_glyph_class (glyph_index);
+ _set_glyph_props (glyph_index);
buffer->cur().codepoint = glyph_index;
}
void replace_glyph_with_ligature (hb_codepoint_t glyph_index,
unsigned int class_guess) const
{
- _set_glyph_class (glyph_index, class_guess, true);
+ _set_glyph_props (glyph_index, class_guess, true);
buffer->replace_glyph (glyph_index);
}
void output_glyph_for_component (hb_codepoint_t glyph_index,
unsigned int class_guess) const
{
- _set_glyph_class (glyph_index, class_guess, false, true);
+ _set_glyph_props (glyph_index, class_guess, false, true);
buffer->output_glyph (glyph_index);
}
};
@@ -1446,7 +1449,7 @@ struct Rule
}
const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
- (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
+ (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
for (unsigned i = 0; i < (unsigned) lookupCount; i++)
c->copy (lookupRecord[i], lookup_map);
@@ -1582,8 +1585,8 @@ struct RuleSet
auto o_snap = c->serializer->snapshot ();
if (!o->serialize_subset (c, _, this, lookup_map, klass_map))
{
- out->rule.pop ();
- c->serializer->revert (o_snap);
+ out->rule.pop ();
+ c->serializer->revert (o_snap);
}
}
@@ -1715,7 +1718,7 @@ struct ContextFormat1
;
out->coverage.serialize (c->serializer, out)
- .serialize (c->serializer, new_coverage.iter ());
+ .serialize (c->serializer, new_coverage.iter ());
return_trace (bool (new_coverage));
}
@@ -1863,12 +1866,12 @@ struct ContextFormat2
auto *o = out->ruleSet.serialize_append (c->serializer);
if (unlikely (!o))
{
- ret = false;
- break;
+ ret = false;
+ break;
}
if (o->serialize_subset (c, _.second, this, lookup_map, &klass_map))
- non_zero_index = index;
+ non_zero_index = index;
index++;
}
@@ -2777,13 +2780,19 @@ struct ChainContextFormat2
hb_map_t backtrack_klass_map;
out->backtrackClassDef.serialize_subset (c, backtrackClassDef, this, &backtrack_klass_map);
+ if (unlikely (!c->serializer->check_success (!backtrack_klass_map.in_error ())))
+ return_trace (false);
// subset inputClassDef based on glyphs survived in Coverage subsetting
hb_map_t input_klass_map;
out->inputClassDef.serialize_subset (c, inputClassDef, this, &input_klass_map);
+ if (unlikely (!c->serializer->check_success (!input_klass_map.in_error ())))
+ return_trace (false);
hb_map_t lookahead_klass_map;
out->lookaheadClassDef.serialize_subset (c, lookaheadClassDef, this, &lookahead_klass_map);
+ if (unlikely (!c->serializer->check_success (!lookahead_klass_map.in_error ())))
+ return_trace (false);
unsigned non_zero_index = 0, index = 0;
bool ret = true;
@@ -2803,7 +2812,7 @@ struct ChainContextFormat2
&backtrack_klass_map,
&input_klass_map,
&lookahead_klass_map))
- non_zero_index = index;
+ non_zero_index = index;
index++;
}
@@ -3259,7 +3268,7 @@ struct GSUBGPOS
template <typename TLookup>
void closure_lookups (hb_face_t *face,
const hb_set_t *glyphs,
- hb_set_t *lookup_indexes /* IN/OUT */) const
+ hb_set_t *lookup_indexes /* IN/OUT */) const
{
hb_set_t visited_lookups, inactive_lookups;
OT::hb_closure_lookups_context_t c (face, glyphs, &visited_lookups, &inactive_lookups);
@@ -3319,7 +3328,7 @@ struct GSUBGPOS
{
const Feature& f = get_feature (i);
if ((!f.featureParams.is_null ()) || f.intersects_lookup_indexes (lookup_indexes))
- feature_indexes->add (i);
+ feature_indexes->add (i);
}
#ifndef HB_NO_VAR
if (version.to_int () >= 0x00010001u)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh
index 4e052b0c263..f3bb15581a1 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh
@@ -80,14 +80,14 @@ enum hb_ot_layout_glyph_props_flags_t
HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE = 0x04u,
HB_OT_LAYOUT_GLYPH_PROPS_MARK = 0x08u,
- HB_OT_LAYOUT_GLYPH_PROPS_CLASS_MASK = HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH |
- HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE |
- HB_OT_LAYOUT_GLYPH_PROPS_MARK,
-
/* The following are used internally; not derived from GDEF. */
HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED = 0x10u,
HB_OT_LAYOUT_GLYPH_PROPS_LIGATED = 0x20u,
HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED = 0x40u,
+
+ HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
+ HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
+ HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED
};
HB_MARK_AS_FLAG_T (hb_ot_layout_glyph_props_flags_t);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh
index b46976d46b3..ece3c28466b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh
@@ -215,6 +215,8 @@ struct name
this->count = it.len ();
NameRecord *name_records = (NameRecord *) calloc (it.len (), NameRecord::static_size);
+ if (unlikely (!name_records)) return_trace (false);
+
hb_array_t<NameRecord> records (name_records, it.len ());
for (const NameRecord& record : it)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-joining-list.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-joining-list.hh
new file mode 100644
index 00000000000..1403103336d
--- /dev/null
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-joining-list.hh
@@ -0,0 +1,47 @@
+/* == Start of generated function == */
+/*
+ * The following function is generated by running:
+ *
+ * ./gen-arabic-joining-list.py ArabicShaping.txt Scripts.txt
+ *
+ * on files with these headers:
+ *
+ * # ArabicShaping-13.0.0.txt
+ * # Date: 2020-01-31, 23:55:00 GMT [KW, RP]
+ * # Scripts-13.0.0.txt
+ * # Date: 2020-01-22, 00:07:43 GMT
+ */
+
+#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_JOINING_LIST_HH
+#define HB_OT_SHAPE_COMPLEX_ARABIC_JOINING_LIST_HH
+
+static bool
+has_arabic_joining (hb_script_t script)
+{
+ /* List of scripts that have data in arabic-table. */
+ switch ((int) script)
+ {
+ case HB_SCRIPT_ADLAM:
+ case HB_SCRIPT_ARABIC:
+ case HB_SCRIPT_CHORASMIAN:
+ case HB_SCRIPT_HANIFI_ROHINGYA:
+ case HB_SCRIPT_KAITHI:
+ case HB_SCRIPT_MANDAIC:
+ case HB_SCRIPT_MANICHAEAN:
+ case HB_SCRIPT_MONGOLIAN:
+ case HB_SCRIPT_NKO:
+ case HB_SCRIPT_PHAGS_PA:
+ case HB_SCRIPT_PSALTER_PAHLAVI:
+ case HB_SCRIPT_SOGDIAN:
+ case HB_SCRIPT_SYRIAC:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_JOINING_LIST_HH */
+
+/* == End of generated function == */
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 10f5822c003..981df2d5970 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
@@ -32,6 +32,7 @@
#include "hb-ot-shape-complex-use.hh"
#include "hb-ot-shape-complex-arabic.hh"
+#include "hb-ot-shape-complex-arabic-joining-list.hh"
#include "hb-ot-shape-complex-vowel-constraints.hh"
/* buffer var allocations */
@@ -152,40 +153,6 @@ struct use_shape_plan_t
arabic_shape_plan_t *arabic_plan;
};
-static bool
-has_arabic_joining (hb_script_t script)
-{
- /* List of scripts that have data in arabic-table. */
- switch ((int) script)
- {
- /* Unicode-1.1 additions */
- case HB_SCRIPT_ARABIC:
-
- /* Unicode-3.0 additions */
- case HB_SCRIPT_MONGOLIAN:
- case HB_SCRIPT_SYRIAC:
-
- /* Unicode-5.0 additions */
- case HB_SCRIPT_NKO:
- case HB_SCRIPT_PHAGS_PA:
-
- /* Unicode-6.0 additions */
- case HB_SCRIPT_MANDAIC:
-
- /* Unicode-7.0 additions */
- case HB_SCRIPT_MANICHAEAN:
- case HB_SCRIPT_PSALTER_PAHLAVI:
-
- /* Unicode-9.0 additions */
- case HB_SCRIPT_ADLAM:
-
- return true;
-
- default:
- return false;
- }
-}
-
static void *
data_create_use (const hb_ot_shape_plan_t *plan)
{
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh
index 6dce45ea249..4d4e6dcae4a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh
@@ -138,10 +138,10 @@ struct TupleVariationHeader
return scalar;
}
- bool has_peak () const { return (tupleIndex & TuppleIndex::EmbeddedPeakTuple); }
- bool has_intermediate () const { return (tupleIndex & TuppleIndex::IntermediateRegion); }
- bool has_private_points () const { return (tupleIndex & TuppleIndex::PrivatePointNumbers); }
- unsigned int get_index () const { return (tupleIndex & TuppleIndex::TupleIndexMask); }
+ bool has_peak () const { return tupleIndex & TuppleIndex::EmbeddedPeakTuple; }
+ bool has_intermediate () const { return tupleIndex & TuppleIndex::IntermediateRegion; }
+ bool has_private_points () const { return tupleIndex & TuppleIndex::PrivatePointNumbers; }
+ unsigned get_index () const { return tupleIndex & TuppleIndex::TupleIndexMask; }
protected:
struct TuppleIndex : HBUINT16
@@ -483,15 +483,10 @@ struct gvar
return likely (var_data.length >= GlyphVariationData::min_size) ? var_data : hb_bytes_t ();
}
- bool is_long_offset () const { return (flags & 1) != 0; }
+ bool is_long_offset () const { return flags & 1; }
- unsigned int get_offset (unsigned int i) const
- {
- if (is_long_offset ())
- return get_long_offset_array ()[i];
- else
- return get_short_offset_array ()[i] * 2;
- }
+ unsigned get_offset (unsigned i) const
+ { return is_long_offset () ? get_long_offset_array ()[i] : get_short_offset_array ()[i] * 2; }
const HBUINT32 * get_long_offset_array () const { return (const HBUINT32 *) &offsetZ; }
const HBUINT16 *get_short_offset_array () const { return (const HBUINT16 *) &offsetZ; }
@@ -540,6 +535,8 @@ struct gvar
/* num_coords should exactly match gvar's axisCount due to how GlyphVariationData tuples are aligned */
if (!font->num_coords || font->num_coords != table->axisCount) return true;
+ if (unlikely (glyph >= table->glyphCount)) return true;
+
hb_bytes_t var_data_bytes = table->get_glyph_var_data_bytes (table.get_blob (), glyph);
if (!var_data_bytes.as<GlyphVariationData> ()->has_data ()) return true;
hb_vector_t<unsigned int> shared_indices;
@@ -655,8 +652,8 @@ no_more_gaps:
/* apply specified / inferred deltas to points */
for (unsigned int i = 0; i < points.length; i++)
{
- points[i].x += (float) roundf (deltas[i].x);
- points[i].y += (float) roundf (deltas[i].y);
+ points[i].x += roundf (deltas[i].x);
+ points[i].y += roundf (deltas[i].y);
}
} while (iterator.move_to_next ());
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh
index 4fb4f4ef40a..4566153a593 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-serialize.hh
@@ -172,6 +172,8 @@ struct hb_serialize_context_t
propagate_error (packed, packed_map);
if (unlikely (!current)) return;
+ if (unlikely (in_error())) return;
+
assert (!current->next);
/* Only "pack" if there exist other objects... Otherwise, don't bother.
@@ -187,6 +189,8 @@ struct hb_serialize_context_t
template <typename Type = void>
Type *push ()
{
+ if (unlikely (in_error ())) return start_embed<Type> ();
+
object_t *obj = object_pool.alloc ();
if (unlikely (!obj))
check_success (false);
@@ -203,6 +207,8 @@ struct hb_serialize_context_t
{
object_t *obj = current;
if (unlikely (!obj)) return;
+ if (unlikely (in_error())) return;
+
current = current->next;
revert (obj->head, obj->tail);
obj->fini ();
@@ -217,6 +223,8 @@ struct hb_serialize_context_t
{
object_t *obj = current;
if (unlikely (!obj)) return 0;
+ if (unlikely (in_error())) return 0;
+
current = current->next;
obj->tail = head;
obj->next = nullptr;
@@ -248,25 +256,34 @@ struct hb_serialize_context_t
packed.push (obj);
- if (unlikely (packed.in_error ()))
+ if (unlikely (packed.in_error ())) {
+ // obj wasn't successfully added to packed, so clean it up otherwise it's
+ // links will be leaked.
+ propagate_error (packed);
+ obj->fini ();
return 0;
+ }
objidx = packed.length - 1;
if (share) packed_map.set (obj, objidx);
+ propagate_error (packed_map);
return objidx;
}
void revert (snapshot_t snap)
{
+ if (unlikely (in_error ())) return;
assert (snap.current == current);
current->links.shrink (snap.num_links);
revert (snap.head, snap.tail);
}
+
void revert (char *snap_head,
char *snap_tail)
{
+ if (unlikely (in_error ())) return;
assert (snap_head <= head);
assert (tail <= snap_tail);
head = snap_head;
@@ -276,6 +293,7 @@ struct hb_serialize_context_t
void discard_stale_objects ()
{
+ if (unlikely (in_error ())) return;
while (packed.length > 1 &&
packed.tail ()->head < tail)
{
@@ -294,6 +312,7 @@ struct hb_serialize_context_t
unsigned bias = 0)
{
static_assert (sizeof (T) == 2 || sizeof (T) == 4, "");
+ if (unlikely (in_error ())) return;
if (!objidx)
return;
@@ -313,6 +332,7 @@ struct hb_serialize_context_t
unsigned to_bias (const void *base) const
{
+ if (unlikely (in_error ())) return 0;
if (!base) return 0;
assert (current);
assert (current->head <= (const char *) base);
@@ -357,7 +377,11 @@ struct hb_serialize_context_t
}
}
- unsigned int length () const { return this->head - current->head; }
+ unsigned int length () const
+ {
+ if (unlikely (!current)) return 0;
+ return this->head - current->head;
+ }
void align (unsigned int alignment)
{
@@ -445,6 +469,8 @@ struct hb_serialize_context_t
template <typename Type>
Type *extend_size (Type *obj, unsigned int size)
{
+ if (unlikely (in_error ())) return nullptr;
+
assert (this->start <= (char *) obj);
assert ((char *) obj <= this->head);
assert ((char *) obj + size >= this->head);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc
index cf4e1525a25..017fb91b69f 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc
@@ -132,6 +132,8 @@ hb_shape_full (hb_font_t *font,
unsigned int num_features,
const char * const *shaper_list)
{
+ if (unlikely (hb_object_is_immutable (buffer))) return false;
+
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached2 (font->face, &buffer->props,
features, num_features,
font->coords, font->num_coords,
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh
index 3400892830c..422b20b8d07 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff-common.hh
@@ -110,7 +110,11 @@ struct str_encoder_t
void copy_str (const byte_str_t &str)
{
unsigned int offset = buff.length;
- buff.resize (offset + str.length);
+ if (unlikely (!buff.resize (offset + str.length)))
+ {
+ set_error ();
+ return;
+ }
if (unlikely (buff.length < offset + str.length))
{
set_error ();
@@ -412,7 +416,8 @@ struct parsed_cs_str_vec_t : hb_vector_t<parsed_cs_str_t>
void init (unsigned int len_ = 0)
{
SUPER::init ();
- resize (len_);
+ if (unlikely (!resize (len_)))
+ return;
for (unsigned int i = 0; i < length; i++)
(*this)[i].init ();
}
@@ -528,11 +533,16 @@ struct subr_remaps_t
void init (unsigned int fdCount)
{
- local_remaps.resize (fdCount);
+ if (unlikely (!local_remaps.resize (fdCount))) return;
for (unsigned int i = 0; i < fdCount; i++)
local_remaps[i].init ();
}
+ bool in_error()
+ {
+ return local_remaps.in_error ();
+ }
+
void create (subr_closures_t& closures)
{
global_remap.create (closures.global_closure);
@@ -591,10 +601,19 @@ struct subr_subsetter_t
parsed_charstrings.init (plan->num_output_glyphs ());
parsed_global_subrs.init (acc.globalSubrs->count);
- parsed_local_subrs.resize (acc.fdCount);
+
+ if (unlikely (remaps.in_error()
+ || parsed_charstrings.in_error ()
+ || parsed_global_subrs.in_error ())) {
+ return false;
+ }
+
+ if (unlikely (!parsed_local_subrs.resize (acc.fdCount))) return false;
+
for (unsigned int i = 0; i < acc.fdCount; i++)
{
parsed_local_subrs[i].init (acc.privateDicts[i].localSubrs->count);
+ if (unlikely (parsed_local_subrs[i].in_error ())) return false;
}
if (unlikely (!closures.valid))
return false;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc
index f16b2533a6c..df322f8451c 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc
@@ -406,7 +406,12 @@ struct cff_subset_plan {
hb_codepoint_t code, last_code = CFF_UNDEF_CODE;
hb_vector_t<hb_codepoint_t> supp_codes;
- subset_enc_code_ranges.resize (0);
+ if (unlikely (!subset_enc_code_ranges.resize (0)))
+ {
+ plan->check_success (false);
+ return;
+ }
+
supp_size = 0;
supp_codes.init ();
@@ -465,7 +470,12 @@ struct cff_subset_plan {
unsigned int size0, size_ranges;
hb_codepoint_t sid, last_sid = CFF_UNDEF_CODE;
- subset_charset_ranges.resize (0);
+ if (unlikely (!subset_charset_ranges.resize (0)))
+ {
+ plan->check_success (false);
+ return;
+ }
+
unsigned int glyph;
for (glyph = 1; glyph < plan->num_output_glyphs (); glyph++)
{
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 b16f5077cc9..24beada3e8c 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
@@ -146,7 +146,7 @@ static inline void
gpos->collect_variation_indices (&c);
gdef->remap_layout_variation_indices (layout_variation_indices, layout_variation_idx_map);
-
+
gdef.destroy ();
gpos.destroy ();
}
@@ -181,7 +181,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
const hb_set_t *input_glyphs_to_retain,
bool close_over_gsub,
bool close_over_gpos,
- bool close_over_gdef)
+ bool close_over_gdef)
{
OT::cmap::accelerator_t cmap;
OT::glyf::accelerator_t glyf;
@@ -314,8 +314,11 @@ hb_subset_plan_t *
hb_subset_plan_create (hb_face_t *face,
hb_subset_input_t *input)
{
- hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> ();
+ hb_subset_plan_t *plan;
+ if (unlikely (!(plan = hb_object_create<hb_subset_plan_t> ())))
+ return const_cast<hb_subset_plan_t *> (&Null (hb_subset_plan_t));
+ plan->successful = true;
plan->drop_hints = input->drop_hints;
plan->desubroutinize = input->desubroutinize;
plan->retain_gids = input->retain_gids;
@@ -346,7 +349,7 @@ hb_subset_plan_create (hb_face_t *face,
input->glyphs,
!input->drop_tables->has (HB_OT_TAG_GSUB),
!input->drop_tables->has (HB_OT_TAG_GPOS),
- !input->drop_tables->has (HB_OT_TAG_GDEF));
+ !input->drop_tables->has (HB_OT_TAG_GDEF));
_create_old_gid_to_new_gid_map (face,
input->retain_gids,
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 7a85b5137d1..e9f603dd1d6 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
@@ -39,6 +39,7 @@ struct hb_subset_plan_t
{
hb_object_header_t header;
+ bool successful : 1;
bool drop_hints : 1;
bool desubroutinize : 1;
bool retain_gids : 1;
@@ -89,6 +90,14 @@ struct hb_subset_plan_t
public:
+ bool in_error () const { return !successful; }
+
+ bool check_success(bool success)
+ {
+ successful = (successful && success);
+ return successful;
+ }
+
/*
* The set of input glyph ids which will be retained in the subset.
* Does NOT include ids kept due to retain_gids. You probably want to use
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 31127392b2e..8b77ecd45aa 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
@@ -241,6 +241,8 @@ hb_subset (hb_face_t *source, hb_subset_input_t *input)
if (unlikely (!input || !source)) return hb_face_get_empty ();
hb_subset_plan_t *plan = hb_subset_plan_create (source, input);
+ if (unlikely (plan->in_error ()))
+ return hb_face_get_empty ();
hb_set_t tags_set;
bool success = true;
@@ -261,6 +263,7 @@ hb_subset (hb_face_t *source, hb_subset_input_t *input)
end:
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.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh
index 203267e8300..274a0e98dbf 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh
@@ -107,6 +107,7 @@
#pragma GCC diagnostic warning "-Wmaybe-uninitialized"
#pragma GCC diagnostic warning "-Wmissing-format-attribute"
#pragma GCC diagnostic warning "-Wundef"
+#pragma GCC diagnostic warning "-Wunused-but-set-variable"
#endif
/* Ignored currently, but should be fixed at some point. */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build
index 6da8e839b50..186563365e1 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build
@@ -104,6 +104,7 @@ hb_base_sources = files(
'hb-ot-post-macroman.hh',
'hb-ot-post-table.hh',
'hb-ot-shape-complex-arabic-fallback.hh',
+ 'hb-ot-shape-complex-arabic-joining-list.hh',
'hb-ot-shape-complex-arabic-table.hh',
'hb-ot-shape-complex-arabic-win1256.hh',
'hb-ot-shape-complex-arabic.cc',
@@ -397,6 +398,16 @@ else
hb_so_version = '0'
endif
+if get_option('fuzzer_ldflags') != ''
+ extra_hb_cpp_args += ['-DHB_CUSTOM_MALLOC']
+ hb_sources += 'failing-alloc.c'
+ hb_subset_sources += 'failing-alloc.c'
+ hb_icu_sources += 'failing-alloc.c'
+ hb_gobject_sources += 'failing-alloc.c'
+endif
+
+darwin_versions = [hb_version_int, '@0@.0.0'.format(hb_version_int)]
+
libharfbuzz = library('harfbuzz', hb_sources,
include_directories: incconfig,
dependencies: harfbuzz_deps,
@@ -404,6 +415,7 @@ libharfbuzz = library('harfbuzz', hb_sources,
soversion: hb_so_version,
version: version,
install: true,
+ darwin_versions: darwin_versions,
link_language: 'c',
)
@@ -427,6 +439,7 @@ libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
soversion: hb_so_version,
version: version,
install: true,
+ darwin_versions: darwin_versions,
link_language: 'c',
)
@@ -475,21 +488,20 @@ if get_option('tests').enabled()
endforeach
compiled_tests = {
- 'test-array': 'test-array.cc',
+ 'test-algs': ['test-algs.cc', 'hb-static.cc'],
+ 'test-array': ['test-array.cc'],
+ 'test-iter': ['test-iter.cc', 'hb-static.cc'],
+ 'test-meta': ['test-meta.cc', 'hb-static.cc'],
'test-number': ['test-number.cc', 'hb-number.cc'],
- 'test-ot-tag': 'hb-ot-tag.cc',
- 'test-unicode-ranges': 'test-unicode-ranges.cc',
+ 'test-ot-tag': ['hb-ot-tag.cc'],
+ 'test-unicode-ranges': ['test-unicode-ranges.cc'],
+ 'test-bimap': ['test-bimap.cc', 'hb-static.cc'],
}
- if cpp.get_id() != 'msvc'
- # TODO: MSVC doesn't like these, fix them
- compiled_tests += {
- 'test-algs': ['test-algs.cc', 'hb-static.cc'],
- 'test-bimap': ['test-bimap.cc', 'hb-static.cc'],
- 'test-iter': ['test-iter.cc', 'hb-static.cc'],
- 'test-meta': ['test-meta.cc', 'hb-static.cc'],
- }
- endif
foreach name, source : compiled_tests
+ if cpp.get_id() == 'msvc' and source.contains('hb-static.cc')
+ # TODO: MSVC doesn't like tests having hb-static.cc, fix them
+ continue
+ endif
test(name, executable(name, source,
include_directories: incconfig,
cpp_args: cpp_args + ['-DMAIN', '-UNDEBUG'],
@@ -528,6 +540,7 @@ if have_icu and not have_icu_builtin
soversion: hb_so_version,
version: version,
install: true,
+ darwin_versions: darwin_versions,
# ICU links to stdc++ anyway so the default linker is good
# link_language: 'c',
)
@@ -553,11 +566,12 @@ cmake_config = configuration_data()
cmake_config.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
cmake_config.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
cmake_config.set('HB_LIBTOOL_VERSION_INFO', hb_libtool_version_info)
-cmake_config.set('have_gobject', have_gobject ? 'true' : 'false')
+cmake_config.set('have_gobject', '@0@'.format(have_gobject))
configure_file(input: 'harfbuzz-config.cmake.in',
output: 'harfbuzz-config.cmake',
configuration: cmake_config,
- install_dir: get_option('libdir') / 'cmake' / 'harfbuzz')
+ install_dir: join_paths(get_option('libdir'), 'cmake', 'harfbuzz'),
+)
libharfbuzz_gobject_dep = null_dep
if have_gobject
@@ -594,7 +608,7 @@ if have_gobject
output: 'hb-gobject-enums.h',
command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'],
install: true,
- install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(),
+ install_dir: join_paths(get_option('prefix'), get_option('includedir'), meson.project_name()),
)
hb_gobject_sources += [enum_c]
@@ -613,6 +627,7 @@ if have_gobject
soversion: hb_so_version,
version: version,
install: true,
+ darwin_versions: darwin_versions,
link_language: 'c',
)
@@ -631,8 +646,9 @@ if have_gobject
if build_gir
conf.set('HAVE_INTROSPECTION', 1)
- hb_gen_files_gir = gnome.generate_gir(libharfbuzz, libharfbuzz_gobject,
+ hb_gen_files_gir = gnome.generate_gir(libharfbuzz_gobject,
sources: [hb_headers, hb_sources, hb_gobject_headers, hb_gobject_sources, enum_h],
+ dependencies: libharfbuzz_dep,
namespace: 'HarfBuzz',
nsversion: '0.0',
identifier_prefix: 'hb_',
@@ -654,10 +670,16 @@ if have_gobject
'--cflags-end'])
endif
+ if build_gir
+ libharfbuzz_gobject_sources = hb_gen_files_gir
+ else
+ libharfbuzz_gobject_sources = hb_gobject_sources
+ endif
+
libharfbuzz_gobject_dep = declare_dependency(
link_with: libharfbuzz_gobject,
include_directories: incsrc,
- sources: build_gir ? hb_gen_files_gir : hb_gobject_sources,
+ sources: libharfbuzz_gobject_sources,
dependencies: [glib_dep, gobject_dep])
pkgmod.generate(libharfbuzz_gobject,
@@ -698,14 +720,22 @@ if get_option('tests').enabled()
env.set('HBHEADERS', ' '.join(HBHEADERS))
if cpp.get_id() != 'msvc' and not meson.is_cross_build() # ensure the local tools are usable
- dist_check_script += ['check-libstdc++', 'check-static-inits', 'check-symbols']
+ if meson.version().version_compare('>=0.55')
+ dist_check_script += 'check-libstdc++'
+ endif
+ dist_check_script += ['check-static-inits', 'check-symbols']
endif
foreach name : dist_check_script
+ if name == 'check-symbols'
+ test_depends = defs_list
+ else
+ test_depends = []
+ endif
test(name, find_program(name + '.py'),
env: env,
- depends: name == 'check-symbols' ? defs_list : [],
- suite: ['src'] + (name == 'check-static-inits' ? ['slow'] : []),
+ depends: test_depends,
+ suite: ['src'],
)
endforeach
endif
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING b/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING
deleted file mode 100644
index 9e841e7a26e..00000000000
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING
+++ /dev/null
@@ -1,21 +0,0 @@
- MIT License
-
- Copyright (c) Microsoft Corporation.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt b/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt
deleted file mode 100644
index 8a177fde8ec..00000000000
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-# IndicShapingInvalidCluster.txt
-# Date: 2015-03-12, 21:17:00 GMT [AG]
-# Date: 2019-11-08, 23:22:00 GMT [AG]
-#
-# This file defines the following property:
-#
-# Indic_Shaping_Invalid_Cluster
-#
-# Scope: This file enumerates sequences of characters that should be treated as invalid clusters
-
- 0905 0946 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT E
- 0905 093E ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AA
- 0930 094D 0907 ; # DEVANAGARI LETTER RA, DEVANAGARI SIGN VIRAMA, DEVANAGARI LETTER I
- 0909 0941 ; # DEVANAGARI LETTER U, DEVANAGARI VOWEL SIGN U
- 090F 0945 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN CANDRA E
- 090F 0946 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN SHORT E
- 090F 0947 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN E
- 0905 0949 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA O
- 0906 0945 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN CANDRA E
- 0905 094A ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT O
- 0906 0946 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN SHORT E
- 0905 094B ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN O
- 0906 0947 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN E
- 0905 094C ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AU
- 0906 0948 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN AI
- 0905 0945 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA E
- 0905 093A ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OE
- 0905 093B ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OOE
- 0906 093A ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN OE
- 0905 094F ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AW
- 0905 0956 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UE
- 0905 0957 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UUE
- 0985 09BE ; # BENGALI LETTER A, BENGALI VOWEL SIGN AA
- 098B 09C3 ; # BENGALI LETTER VOCALIC R, BENGALI VOWEL SIGN VOCALIC R
- 098C 09E2 ; # BENGALI LETTER VOCALIC L, BENGALI VOWEL SIGN VOCALIC L
- 0A05 0A3E ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AA
- 0A72 0A3F ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN I
- 0A72 0A40 ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN II
- 0A73 0A41 ; # GURMUKHI URA, GURMUKHI VOWEL SIGN U
- 0A73 0A42 ; # GURMUKHI URA, GURMUKHI VOWEL SIGN UU
- 0A72 0A47 ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN EE
- 0A05 0A48 ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AI
- 0A73 0A4B ; # GURMUKHI URA, GURMUKHI VOWEL SIGN OO
- 0A05 0A4C ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AU
- 0A85 0ABE ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA
- 0A85 0AC5 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA E
- 0A85 0AC7 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN E
- 0A85 0AC8 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AI
- 0A85 0AC9 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA O
- 0A85 0ACB ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN O
- 0A85 0ABE 0AC5 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI VOWEL SIGN CANDRA E
- 0A85 0ACC ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AU
- 0A85 0ABE 0AC8 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI VOWEL SIGN AI
- 0AC5 0ABE ; # GUJARATI VOWEL SIGN CANDRA E, GUJARATI VOWEL SIGN AA
- 0B05 0B3E ; # ORIYA LETTER A, ORIYA VOWEL SIGN AA
- 0B0F 0B57 ; # ORIYA LETTER E, ORIYA AU LENGTH MARK
- 0B13 0B57 ; # ORIYA LETTER O, ORIYA AU LENGTH MARK
- 0B85 0BC2 ; # TAMIL LETTER A, TAMIL VOWEL SIGN UU
- 0C12 0C55 ; # TELUGU LETTER O, TELUGU LENGTH MARK
- 0C12 0C4C ; # TELUGU LETTER O, TELUGU VOWEL SIGN AU
- 0C3F 0C55 ; # TELUGU VOWEL SIGN I, TELUGU LENGTH MARK
- 0C46 0C55 ; # TELUGU VOWEL SIGN E, TELUGU LENGTH MARK
- 0C4A 0C55 ; # TELUGU VOWEL SIGN O, TELUGU LENGTH MARK
- 0C89 0CBE ; # KANNADA LETTER U, KANNADA VOWEL SIGN AA
- 0C92 0CCC ; # KANNADA LETTER O, KANNADA VOWEL SIGN AU
- 0C8B 0CBE ; # KANNADA LETTER VOCALIC R, KANNADA VOWEL SIGN AA
- 0D07 0D57 ; # MALAYALAM LETTER I, MALAYALAM AU LENGTH MARK
- 0D09 0D57 ; # MALAYALAM LETTER U, MALAYALAM AU LENGTH MARK
- 0D0E 0D46 ; # MALAYALAM LETTER E, MALAYALAM VOWEL SIGN E
- 0D12 0D3E ; # MALAYALAM LETTER O, MALAYALAM VOWEL SIGN AA
- 0D12 0D57 ; # MALAYALAM LETTER O, MALAYALAM AU LENGTH MARK
- 0D85 0DCF ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN AELA-PILLA
- 0D85 0DD0 ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN KETTI AEDA-PILLA
- 0D85 0DD1 ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN DIGA AEDA-PILLA
- 0D8B 0DDF ; # SINHALA LETTER UYANNA, SINHALA VOWEL SIGN GAYANUKITTA
- 0D8D 0DD8 ; # SINHALA LETTER IRUYANNA, SINHALA VOWEL SIGN GAETTA-PILLA
- 0D8F 0DDF ; # SINHALA LETTER ILUYANNA, SINHALA VOWEL SIGN GAYANUKITTA
- 0D91 0DCA ; # SINHALA LETTER EYANNA, SINHALA SIGN AL-LAKUNA
- 0D91 0DD9 ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA
- 0D91 0DDA ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN DIGA KOMBUVA
- 0D91 0DDC ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA
- 0D91 0DDD ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA
- 0D91 0DDD ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA
- 0D94 0DDF ; # SINHALA LETTER OYANNA, SINHALA VOWEL SIGN GAYANUKITTA
- 11005 11038 ; # BRAHMI LETTER A, BRAHMI VOWEL SIGN AA
- 1100B 1103E ; # BRAHMI LETTER VOCALIC R, BRAHMI VOWEL SIGN VOCALIC R
- 1100F 11042 ; # BRAHMI LETTER E, BRAHMI VOWEL SIGN E
- 11680 116AD ; # TAKRI LETTER A, TAKRI VOWEL SIGN AA
- 11686 116B2 ; # TAKRI LETTER E, TAKRI VOWEL SIGN E
- 11680 116B4 ; # TAKRI LETTER A, TAKRI VOWEL SIGN O
- 11680 116B5 ; # TAKRI LETTER A, TAKRI VOWEL SIGN AU
- 112B0 112E0 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AA
- 112B0 112E5 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN E
- 112B0 112E6 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AI
- 112B0 112E7 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN O
- 112B0 112E8 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AU
- 11481 114B0 ; # TIRHUTA LETTER A, TIRHUTA VOWEL SIGN AA
- 114AA 114B5 ; # TIRHUTA LETTER LA, TIRHUTA VOWEL SIGN VOCALIC R
- 114AA 114B6 ; # TIRHUTA LETTER LA, TIRHUTA VOWEL SIGN VOCALIC RR
- 1148B 114BA ; # TIRHUTA LETTER E, TIRHUTA VOWEL SIGN SHORT E
- 1148D 114BA ; # TIRHUTA LETTER O, TIRHUTA VOWEL SIGN SHORT E
- 11600 11639 ; # MODI LETTER A, MODI VOWEL SIGN E
- 11600 1163A ; # MODI LETTER A, MODI VOWEL SIGN AI
- 11601 11639 ; # MODI LETTER AA, MODI VOWEL SIGN E
- 11601 1163A ; # MODI LETTER AA, MODI VOWEL SIGN AI
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py
deleted file mode 100644
index fd8504800f2..00000000000
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python3
-
-import sys
-import array
-from gi.repository import HarfBuzz as hb
-from gi.repository import GLib
-
-fontdata = open (sys.argv[1], 'rb').read ()
-text = sys.argv[2]
-# Need to create GLib.Bytes explicitly until this bug is fixed:
-# https://bugzilla.gnome.org/show_bug.cgi?id=729541
-blob = hb.glib_blob_create (GLib.Bytes.new (fontdata))
-face = hb.face_create (blob, 0)
-del blob
-font = hb.font_create (face)
-upem = hb.face_get_upem (face)
-del face
-hb.font_set_scale (font, upem, upem)
-#hb.ft_font_set_funcs (font)
-hb.ot_font_set_funcs (font)
-
-buf = hb.buffer_create ()
-class Debugger (object):
- def message (self, buf, font, msg, data, _x_what_is_this):
- print (msg)
- return True
-debugger = Debugger ()
-hb.buffer_set_message_func (buf, debugger.message, 1, 0)
-
-##
-## Add text to buffer
-##
-#
-# See https://github.com/harfbuzz/harfbuzz/pull/271
-#
-# If you do not care about cluster values reflecting Python
-# string indices, then this is quickest way to add text to
-# buffer:
-# hb.buffer_add_utf8 (buf, text.encode('utf-8'), 0, -1)
-# Otherwise, then following handles both narrow and wide
-# Python builds (the first item in the array is BOM, so we skip it):
-if sys.maxunicode == 0x10FFFF:
- hb.buffer_add_utf32 (buf, array.array ('I', text.encode ('utf-32'))[1:], 0, -1)
-else:
- hb.buffer_add_utf16 (buf, array.array ('H', text.encode ('utf-16'))[1:], 0, -1)
-
-
-hb.buffer_guess_segment_properties (buf)
-
-hb.shape (font, buf, [])
-del font
-
-infos = hb.buffer_get_glyph_infos (buf)
-positions = hb.buffer_get_glyph_positions (buf)
-
-for info, pos in zip (infos, positions):
- gid = info.codepoint
- cluster = info.cluster
- x_advance = pos.x_advance
- x_offset = pos.x_offset
- y_offset = pos.y_offset
-
- print ("gid%d=%d@%d,%d+%d" % (gid, cluster, x_advance, x_offset, y_offset))
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make b/Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make
deleted file mode 100644
index c2d879a3947..00000000000
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env -S make -f
-
-all: packtab \
- hb-ot-shape-complex-arabic-table.hh hb-unicode-emoji-table.hh \
- hb-ot-shape-complex-indic-table.cc hb-ot-tag-table.hh \
- hb-ucd-table.hh hb-ot-shape-complex-use-table.cc \
- hb-ot-shape-complex-vowel-constraints.cc
-
-.PHONY: all clean packtab
-
-hb-ot-shape-complex-arabic-table.hh: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt
- ./$^ > $@ || ($(RM) $@; false)
-hb-unicode-emoji-table.hh: gen-emoji-table.py emoji-data.txt
- ./$^ > $@ || ($(RM) $@; false)
-hb-ot-shape-complex-indic-table.cc: gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt
- ./$^ > $@ || ($(RM) $@; false)
-hb-ot-tag-table.hh: gen-tag-table.py languagetags language-subtag-registry
- ./$^ > $@ || ($(RM) $@; false)
-hb-ucd-table.hh: gen-ucd-table.py ucd.nounihan.grouped.zip hb-common.h
- ./$^ > $@ || ($(RM) $@; false)
-hb-ot-shape-complex-use-table.cc: gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt
- ./$^ > $@ || ($(RM) $@; false)
-hb-ot-shape-complex-vowel-constraints.cc: gen-vowel-constraints.py ms-use/IndicShapingInvalidCluster.txt Scripts.txt
- ./$^ > $@ || ($(RM) $@; false)
-
-packtab:
- /usr/bin/env python3 -c "import packTab" 2>/dev/null || /usr/bin/env python3 -m pip install git+https://github.com/harfbuzz/packtab
-
-ArabicShaping.txt:
- curl -O https://unicode.org/Public/UCD/latest/ucd/ArabicShaping.txt
-UnicodeData.txt:
- curl -O https://unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
-Blocks.txt:
- curl -O https://unicode.org/Public/UCD/latest/ucd/Blocks.txt
-emoji-data.txt:
- curl -O https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
-IndicSyllabicCategory.txt:
- curl -O https://unicode.org/Public/UCD/latest/ucd/IndicSyllabicCategory.txt
-IndicPositionalCategory.txt:
- curl -O https://unicode.org/Public/UCD/latest/ucd/IndicPositionalCategory.txt
-languagetags:
- curl -O https://docs.microsoft.com/en-us/typography/opentype/spec/languagetags
-language-subtag-registry:
- curl -O https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
-ucd.nounihan.grouped.zip:
- curl -O https://unicode.org/Public/UCD/latest/ucdxml/ucd.nounihan.grouped.zip
-Scripts.txt:
- curl -O https://unicode.org/Public/UCD/latest/ucd/Scripts.txt
-
-clean:
- $(RM) \
- ArabicShaping.txt UnicodeData.txt Blocks.txt emoji-data.txt \
- IndicSyllabicCategory.txt IndicPositionalCategory.txt \
- languagetags language-subtag-registry ucd.nounihan.grouped.zip Scripts.txt