changeset 40435:553eb1a50733

8163238: Upgrade to harfbuzz 1.3.0 in JDK 9 Reviewed-by: vadim, serb
author prr
date Tue, 09 Aug 2016 16:20:02 -0700
parents 49d6193f196f
children 94ae0ede53a5
files jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-serialize.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-deprecated.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-file-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cmap-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-glyf-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-head-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hhea-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hmtx-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-jstf-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-maxp-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-os2-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-table.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-table.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-table.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-normalize.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shaper-list.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn.cc jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/ucdn.c jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/ucdn.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn/unicodedata_db.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-utf-private.hh jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb.h
diffstat 80 files changed, 8122 insertions(+), 6045 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -104,7 +104,6 @@
 
   if (!length ||
       length >= 1u << 31 ||
-      data + length < data /* overflows */ ||
       !(blob = hb_object_create<hb_blob_t> ())) {
     if (destroy)
       destroy (user_data);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.h	Tue Aug 09 16:20:02 2016 -0700
@@ -64,7 +64,7 @@
 
 typedef struct hb_blob_t hb_blob_t;
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_create (const char        *data,
                 unsigned int       length,
                 hb_memory_mode_t   mode,
@@ -77,21 +77,21 @@
  * modify the parent data as that data may be
  * shared among multiple sub-blobs.
  */
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_create_sub_blob (hb_blob_t    *parent,
                          unsigned int  offset,
                          unsigned int  length);
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_get_empty (void);
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_blob_reference (hb_blob_t *blob);
 
-void
+HB_EXTERN void
 hb_blob_destroy (hb_blob_t *blob);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_blob_set_user_data (hb_blob_t          *blob,
                        hb_user_data_key_t *key,
                        void *              data,
@@ -99,25 +99,25 @@
                        hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_blob_get_user_data (hb_blob_t          *blob,
                        hb_user_data_key_t *key);
 
 
-void
+HB_EXTERN void
 hb_blob_make_immutable (hb_blob_t *blob);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_blob_is_immutable (hb_blob_t *blob);
 
 
-unsigned int
+HB_EXTERN unsigned int
 hb_blob_get_length (hb_blob_t *blob);
 
-const char *
+HB_EXTERN const char *
 hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
 
-char *
+HB_EXTERN char *
 hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -35,9 +35,36 @@
 #include "hb-unicode-private.hh"
 
 
+#ifndef HB_BUFFER_MAX_EXPANSION_FACTOR
+#define HB_BUFFER_MAX_EXPANSION_FACTOR 32
+#endif
+#ifndef HB_BUFFER_MAX_LEN_MIN
+#define HB_BUFFER_MAX_LEN_MIN 8192
+#endif
+#ifndef HB_BUFFER_MAX_LEN_DEFAULT
+#define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */
+#endif
+
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
 
+HB_MARK_AS_FLAG_T (hb_buffer_flags_t);
+HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t);
+
+enum hb_buffer_scratch_flags_t {
+  HB_BUFFER_SCRATCH_FLAG_DEFAULT                        = 0x00000000u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII                  = 0x00000001u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES         = 0x00000002u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK             = 0x00000004u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT            = 0x00000008u,
+  /* Reserved for complex shapers' internal use. */
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX0                       = 0x01000000u,
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX1                       = 0x02000000u,
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX2                       = 0x04000000u,
+  HB_BUFFER_SCRATCH_FLAG_COMPLEX3                       = 0x08000000u,
+};
+HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t);
+
 
 /*
  * hb_buffer_t
@@ -52,6 +79,8 @@
   hb_buffer_flags_t flags; /* BOT / EOT / etc. */
   hb_buffer_cluster_level_t cluster_level;
   hb_codepoint_t replacement; /* U+FFFD or something else. */
+  hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
+  unsigned int max_len; /* Maximum allowed len. */
 
   /* Buffer contents */
   hb_buffer_content_type_t content_type;
@@ -76,17 +105,13 @@
   inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
   inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
 
-  inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; }
-  inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; }
+  inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
+  inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
 
   inline bool has_separate_output (void) const { return info != out_info; }
 
   unsigned int serial;
 
-  /* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
-  uint8_t allocated_var_bytes[8];
-  const char *allocated_var_owner[8];
-
   /* Text before / after the main buffer contents.
    * Always in Unicode, and ordered outward.
    * Index 0 is for "pre-context", 1 for "post-context". */
@@ -94,6 +119,52 @@
   hb_codepoint_t context[2][CONTEXT_LENGTH];
   unsigned int context_len[2];
 
+  /* Debugging API */
+  hb_buffer_message_func_t message_func;
+  void *message_data;
+  hb_destroy_func_t message_destroy;
+
+  /* Internal debugging. */
+  /* The bits here reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
+#ifndef HB_NDEBUG
+  uint8_t allocated_var_bits;
+#endif
+  inline void allocate_var (unsigned int start, unsigned int count)
+  {
+#ifndef HB_NDEBUG
+    unsigned int end = start + count;
+    assert (end <= 8);
+    unsigned int bits = (1<<end) - (1<<start);
+    assert (0 == (allocated_var_bits & bits));
+    allocated_var_bits |= bits;
+#endif
+  }
+  inline void deallocate_var (unsigned int start, unsigned int count)
+  {
+#ifndef HB_NDEBUG
+    unsigned int end = start + count;
+    assert (end <= 8);
+    unsigned int bits = (1<<end) - (1<<start);
+    assert (bits == (allocated_var_bits & bits));
+    allocated_var_bits &= ~bits;
+#endif
+  }
+  inline void assert_var (unsigned int start, unsigned int count)
+  {
+#ifndef HB_NDEBUG
+    unsigned int end = start + count;
+    assert (end <= 8);
+    unsigned int bits = (1<<end) - (1<<start);
+    assert (bits == (allocated_var_bits & bits));
+#endif
+  }
+  inline void deallocate_var_all (void)
+  {
+#ifndef HB_NDEBUG
+    allocated_var_bits = 0;
+#endif
+  }
+
 
   /* Methods */
 
@@ -106,11 +177,6 @@
   { return len - idx; }
   inline unsigned int next_serial (void) { return serial++; }
 
-  HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const char *owner);
-  HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, const char *owner);
-  HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const char *owner);
-  HB_INTERNAL void deallocate_var_all (void);
-
   HB_INTERNAL void add (hb_codepoint_t  codepoint,
                         unsigned int    cluster);
   HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
@@ -203,18 +269,28 @@
   inline void clear_context (unsigned int side) { context_len[side] = 0; }
 
   HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *));
+
+  inline bool messaging (void) { return unlikely (message_func); }
+  inline bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4)
+  {
+    if (!messaging ())
+      return true;
+    va_list ap;
+    va_start (ap, fmt);
+    bool ret = message_impl (font, fmt, ap);
+    va_end (ap);
+    return ret;
+  }
+  HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0);
 };
 
 
-#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
+#define HB_BUFFER_XALLOCATE_VAR(b, func, var) \
   b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
-           sizeof (b->info[0].var), owner)
-#define HB_BUFFER_ALLOCATE_VAR(b, var) \
-        HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
-#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
-        HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
-#define HB_BUFFER_ASSERT_VAR(b, var) \
-        HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var)
+           sizeof (b->info[0].var))
+#define HB_BUFFER_ALLOCATE_VAR(b, var)          HB_BUFFER_XALLOCATE_VAR (b, allocate_var,   var ())
+#define HB_BUFFER_DEALLOCATE_VAR(b, var)        HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var ())
+#define HB_BUFFER_ASSERT_VAR(b, var)            HB_BUFFER_XALLOCATE_VAR (b, assert_var,     var ())
 
 
 #endif /* HB_BUFFER_PRIVATE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-serialize.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-serialize.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -36,11 +36,12 @@
 /**
  * hb_buffer_serialize_list_formats:
  *
- *
+ * Returns a list of supported buffer serialization formats.
  *
  * Return value: (transfer none):
+ * A string array of buffer serialization formats. Should not be freed.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 const char **
 hb_buffer_serialize_list_formats (void)
@@ -50,14 +51,17 @@
 
 /**
  * hb_buffer_serialize_format_from_string:
- * @str:
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string to parse
+ * @len: length of @str, or -1 if string is %NULL terminated
  *
- *
+ * Parses a string into an #hb_buffer_serialize_format_t. Does not check if
+ * @str is a valid buffer serialization format, use
+ * hb_buffer_serialize_list_formats() to get the list of supported formats.
  *
  * Return value:
+ * The parsed #hb_buffer_serialize_format_t.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 hb_buffer_serialize_format_t
 hb_buffer_serialize_format_from_string (const char *str, int len)
@@ -68,13 +72,15 @@
 
 /**
  * hb_buffer_serialize_format_to_string:
- * @format:
+ * @format: an #hb_buffer_serialize_format_t to convert.
  *
+ * Converts @format to the string corresponding it, or %NULL if it is not a valid
+ * #hb_buffer_serialize_format_t.
  *
+ * Return value: (transfer none):
+ * A %NULL terminated string corresponding to @format. Should not be freed.
  *
- * Return value:
- *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 const char *
 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format)
@@ -242,24 +248,51 @@
   return end - start;
 }
 
-/* Returns number of items, starting at start, that were serialized. */
 /**
  * hb_buffer_serialize_glyphs:
- * @buffer: a buffer.
- * @start:
- * @end:
- * @buf: (array length=buf_size):
- * @buf_size:
- * @buf_consumed: (out):
- * @font:
- * @format:
- * @flags:
+ * @buffer: an #hb_buffer_t buffer.
+ * @start: the first item in @buffer to serialize.
+ * @end: the last item in @buffer to serialize.
+ * @buf: (out) (array length=buf_size) (element-type uint8_t): output string to
+ *       write serialized buffer into.
+ * @buf_size: the size of @buf.
+ * @buf_consumed: (out) (allow-none): if not %NULL, will be set to the number of byes written into @buf.
+ * @font: (allow-none): the #hb_font_t used to shape this buffer, needed to
+ *        read glyph names and extents. If %NULL, and empty font will be used.
+ * @format: the #hb_buffer_serialize_format_t to use for formatting the output.
+ * @flags: the #hb_buffer_serialize_flags_t that control what glyph properties
+ *         to serialize.
  *
+ * Serializes @buffer into a textual representation of its glyph content,
+ * useful for showing the contents of the buffer, for example during debugging.
+ * There are currently two supported serialization formats:
  *
+ * ## text
+ * A human-readable, plain text format.
+ * The serialized glyphs will look something like:
+ *
+ * ```
+ * [uni0651=0@518,0+0|uni0628=0+1897]
+ * ```
+ * - The serialized glyphs are delimited with `[` and `]`.
+ * - Glyphs are separated with `|`
+ * - Each glyph starts with glyph name, or glyph index if
+ *   #HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES flag is set. Then,
+ *   - If #HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS is not set, `=` then #hb_glyph_info_t.cluster.
+ *   - If #HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS is not set, the #hb_glyph_position_t in the format:
+ *     - If both #hb_glyph_position_t.x_offset and #hb_glyph_position_t.y_offset are not 0, `@x_offset,y_offset`. Then,
+ *     - `+x_advance`, then `,y_advance` if #hb_glyph_position_t.y_advance is not 0. Then,
+ *   - If #HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS is set, the
+ *     #hb_glyph_extents_t in the format
+ *     `&lt;x_bearing,y_bearing,width,height&gt;`
+ *
+ * ## json
+ * TODO.
  *
  * Return value:
+ * The number of serialized items.
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 unsigned int
 hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
@@ -267,8 +300,8 @@
                             unsigned int end,
                             char *buf,
                             unsigned int buf_size,
-                            unsigned int *buf_consumed, /* May be NULL */
-                            hb_font_t *font, /* May be NULL */
+                            unsigned int *buf_consumed,
+                            hb_font_t *font,
                             hb_buffer_serialize_format_t format,
                             hb_buffer_serialize_flags_t flags)
 {
@@ -282,6 +315,9 @@
   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;
+
   if (unlikely (start == end))
     return 0;
 
@@ -355,7 +391,7 @@
 
 /**
  * hb_buffer_deserialize_glyphs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t buffer.
  * @buf: (array length=buf_len):
  * @buf_len:
  * @end_ptr: (out):
@@ -366,7 +402,7 @@
  *
  * Return value:
  *
- * Since: 0.9.2
+ * Since: 0.9.7
  **/
 hb_bool_t
 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -35,8 +35,26 @@
 #define HB_DEBUG_BUFFER (HB_DEBUG+0)
 #endif
 
+/**
+ * SECTION: hb-buffer
+ * @title: Buffers
+ * @short_description: Input and output buffers
+ * @include: hb.h
+ *
+ * Buffers serve dual role in HarfBuzz; they hold the input characters that are
+ * passed hb_shape(), and after shaping they hold the output glyphs.
+ **/
 
 /**
+ * hb_segment_properties_equal:
+ * @a: first #hb_segment_properties_t to compare.
+ * @b: second #hb_segment_properties_t to compare.
+ *
+ * Checks the equality of two #hb_segment_properties_t's.
+ *
+ * Return value:
+ * %true if all properties of @a equal those of @b, false otherwise.
+ *
  * Since: 0.9.7
  **/
 hb_bool_t
@@ -52,6 +70,14 @@
 }
 
 /**
+ * hb_segment_properties_hash:
+ * @p: #hb_segment_properties_t to hash.
+ *
+ * Creates a hash representing @p.
+ *
+ * Return value:
+ * A hash of @p.
+ *
  * Since: 0.9.7
  **/
 unsigned int
@@ -91,6 +117,11 @@
 {
   if (unlikely (in_error))
     return false;
+  if (unlikely (size > max_len))
+  {
+    in_error = true;
+    return false;
+  }
 
   unsigned int new_allocated = allocated;
   hb_glyph_position_t *new_pos = NULL;
@@ -152,6 +183,12 @@
   if (unlikely (!ensure (len + count))) return false;
 
   memmove (info + idx + count, info + idx, (len - idx) * sizeof (info[0]));
+  if (idx + count > len)
+  {
+    /* Under memory failure we might expose this area.  At least
+     * clean it up.  Oh well... */
+    memset (info + len, 0, (idx + count - len) * sizeof (info[0]));
+  }
   len += count;
   idx += count;
 
@@ -198,6 +235,7 @@
 
   hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
   props = default_props;
+  scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
 
   content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
   in_error = false;
@@ -210,11 +248,11 @@
   out_info = info;
 
   serial = 0;
-  memset (allocated_var_bytes, 0, sizeof allocated_var_bytes);
-  memset (allocated_var_owner, 0, sizeof allocated_var_owner);
 
   memset (context, 0, sizeof context);
   memset (context_len, 0, sizeof context_len);
+
+  deallocate_var_all ();
 }
 
 void
@@ -375,6 +413,8 @@
     idx = i;
     return true;
   }
+  if (unlikely (in_error))
+    return false;
 
   assert (i <= out_len + (len - idx));
 
@@ -392,6 +432,8 @@
     /* Tricky part: rewinding... */
     unsigned int count = out_len - i;
 
+    /* This will blow in our face if memory allocation fails later
+     * in this same lookup... */
     if (unlikely (idx < count && !shift_forward (count + 32))) return false;
 
     assert (idx >= count);
@@ -627,82 +669,19 @@
 }
 
 
-static inline void
-dump_var_allocation (const hb_buffer_t *buffer)
-{
-  char buf[80];
-  for (unsigned int i = 0; i < 8; i++)
-    buf[i] = '0' + buffer->allocated_var_bytes[7 - i];
-  buf[8] = '\0';
-  DEBUG_MSG (BUFFER, buffer,
-             "Current var allocation: %s",
-             buf);
-}
-
-void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
-  assert (byte_i < 8 && byte_i + count <= 8);
-
-  if (DEBUG_ENABLED (BUFFER))
-    dump_var_allocation (this);
-  DEBUG_MSG (BUFFER, this,
-             "Allocating var bytes %d..%d for %s",
-             byte_i, byte_i + count - 1, owner);
-
-  for (unsigned int i = byte_i; i < byte_i + count; i++) {
-    assert (!allocated_var_bytes[i]);
-    allocated_var_bytes[i]++;
-    allocated_var_owner[i] = owner;
-  }
-}
-
-void hb_buffer_t::deallocate_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
-  if (DEBUG_ENABLED (BUFFER))
-    dump_var_allocation (this);
-
-  DEBUG_MSG (BUFFER, this,
-             "Deallocating var bytes %d..%d for %s",
-             byte_i, byte_i + count - 1, owner);
-
-  assert (byte_i < 8 && byte_i + count <= 8);
-  for (unsigned int i = byte_i; i < byte_i + count; i++) {
-    assert (allocated_var_bytes[i]);
-    assert (0 == strcmp (allocated_var_owner[i], owner));
-    allocated_var_bytes[i]--;
-  }
-}
-
-void hb_buffer_t::assert_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
-  if (DEBUG_ENABLED (BUFFER))
-    dump_var_allocation (this);
-
-  DEBUG_MSG (BUFFER, this,
-             "Asserting var bytes %d..%d for %s",
-             byte_i, byte_i + count - 1, owner);
-
-  assert (byte_i < 8 && byte_i + count <= 8);
-  for (unsigned int i = byte_i; i < byte_i + count; i++) {
-    assert (allocated_var_bytes[i]);
-    assert (0 == strcmp (allocated_var_owner[i], owner));
-  }
-}
-
-void hb_buffer_t::deallocate_var_all (void)
-{
-  memset (allocated_var_bytes, 0, sizeof (allocated_var_bytes));
-  memset (allocated_var_owner, 0, sizeof (allocated_var_owner));
-}
-
 /* Public API */
 
 /**
  * hb_buffer_create: (Xconstructor)
  *
+ * Creates a new #hb_buffer_t with all properties to defaults.
  *
- *
- * Return value: (transfer full)
+ * Return value: (transfer full):
+ * A newly allocated #hb_buffer_t with a reference count of 1. The initial
+ * reference count should be released with hb_buffer_destroy() when you are done
+ * using the #hb_buffer_t. This function never returns %NULL. If memory cannot
+ * be allocated, a special #hb_buffer_t object will be returned on which
+ * hb_buffer_allocation_successful() returns %false.
  *
  * Since: 0.9.2
  **/
@@ -714,6 +693,8 @@
   if (!(buffer = hb_object_create<hb_buffer_t> ()))
     return hb_buffer_get_empty ();
 
+  buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
+
   buffer->reset ();
 
   return buffer;
@@ -738,6 +719,8 @@
     HB_BUFFER_FLAG_DEFAULT,
     HB_BUFFER_CLUSTER_LEVEL_DEFAULT,
     HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
+    HB_BUFFER_SCRATCH_FLAG_DEFAULT,
+    HB_BUFFER_MAX_LEN_DEFAULT,
 
     HB_BUFFER_CONTENT_TYPE_INVALID,
     HB_SEGMENT_PROPERTIES_DEFAULT,
@@ -753,11 +736,13 @@
 
 /**
  * hb_buffer_reference: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Increases the reference count on @buffer by one. This prevents @buffer from
+ * being destroyed until a matching call to hb_buffer_destroy() is made.
  *
  * Return value: (transfer full):
+ * The referenced #hb_buffer_t.
  *
  * Since: 0.9.2
  **/
@@ -769,9 +754,11 @@
 
 /**
  * hb_buffer_destroy: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Deallocate the @buffer.
+ * Decreases the reference count on @buffer by one. If the result is zero, then
+ * @buffer and all associated resources are freed. See hb_buffer_reference().
  *
  * Since: 0.9.2
  **/
@@ -784,13 +771,15 @@
 
   free (buffer->info);
   free (buffer->pos);
+  if (buffer->message_destroy)
+    buffer->message_destroy (buffer->message_data);
 
   free (buffer);
 }
 
 /**
  * hb_buffer_set_user_data: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @key:
  * @data:
  * @destroy:
@@ -814,7 +803,7 @@
 
 /**
  * hb_buffer_get_user_data: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @key:
  *
  *
@@ -833,10 +822,11 @@
 
 /**
  * hb_buffer_set_content_type:
- * @buffer: a buffer.
- * @content_type:
+ * @buffer: an #hb_buffer_t.
+ * @content_type: the type of buffer contents to set
  *
- *
+ * Sets the type of @buffer contents, buffers are either empty, contain
+ * characters (before shaping) or glyphs (the result of shaping).
  *
  * Since: 0.9.5
  **/
@@ -849,11 +839,12 @@
 
 /**
  * hb_buffer_get_content_type:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * see hb_buffer_set_content_type().
  *
  * Return value:
+ * The type of @buffer contents.
  *
  * Since: 0.9.5
  **/
@@ -866,7 +857,7 @@
 
 /**
  * hb_buffer_set_unicode_funcs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @unicode_funcs:
  *
  *
@@ -891,7 +882,7 @@
 
 /**
  * hb_buffer_get_unicode_funcs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  *
  *
@@ -907,10 +898,16 @@
 
 /**
  * hb_buffer_set_direction:
- * @buffer: a buffer.
- * @direction:
+ * @buffer: an #hb_buffer_t.
+ * @direction: the #hb_direction_t of the @buffer
  *
- *
+ * Set the text flow direction of the buffer. No shaping can happen without
+ * setting @buffer direction, and it controls the visual direction for the
+ * output glyphs; for RTL direction the glyphs will be reversed. Many layout
+ * features depend on the proper setting of the direction, for example,
+ * reversing RTL text before shaping, then shaping with LTR direction is not
+ * the same as keeping the text in logical order and shaping with RTL
+ * direction.
  *
  * Since: 0.9.2
  **/
@@ -927,11 +924,12 @@
 
 /**
  * hb_buffer_get_direction:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_direction()
  *
  * Return value:
+ * The direction of the @buffer.
  *
  * Since: 0.9.2
  **/
@@ -943,10 +941,18 @@
 
 /**
  * hb_buffer_set_script:
- * @buffer: a buffer.
- * @script:
+ * @buffer: an #hb_buffer_t.
+ * @script: an #hb_script_t to set.
  *
+ * Sets the script of @buffer to @script.
  *
+ * Script is crucial for choosing the proper shaping behaviour for scripts that
+ * require it (e.g. Arabic) and the which OpenType features defined in the font
+ * to be applied.
+ *
+ * You can pass one of the predefined #hb_script_t values, or use
+ * hb_script_from_string() or hb_script_from_iso15924_tag() to get the
+ * corresponding script from an ISO 15924 script tag.
  *
  * Since: 0.9.2
  **/
@@ -962,11 +968,12 @@
 
 /**
  * hb_buffer_get_script:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_script().
  *
  * Return value:
+ * The #hb_script_t of the @buffer.
  *
  * Since: 0.9.2
  **/
@@ -978,10 +985,18 @@
 
 /**
  * hb_buffer_set_language:
- * @buffer: a buffer.
- * @language:
+ * @buffer: an #hb_buffer_t.
+ * @language: an hb_language_t to set.
  *
+ * Sets the language of @buffer to @language.
  *
+ * Languages are crucial for selecting which OpenType feature to apply to the
+ * buffer which can result in applying language-specific behaviour. Languages
+ * are orthogonal to the scripts, and though they are related, they are
+ * different concepts and should not be confused with each other.
+ *
+ * Use hb_language_from_string() to convert from ISO 639 language codes to
+ * #hb_language_t.
  *
  * Since: 0.9.2
  **/
@@ -997,11 +1012,12 @@
 
 /**
  * hb_buffer_get_language:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_language().
  *
  * Return value: (transfer none):
+ * The #hb_language_t of the buffer. Must not be freed by the caller.
  *
  * Since: 0.9.2
  **/
@@ -1013,10 +1029,12 @@
 
 /**
  * hb_buffer_set_segment_properties:
- * @buffer: a buffer.
- * @props:
+ * @buffer: an #hb_buffer_t.
+ * @props: an #hb_segment_properties_t to use.
  *
- *
+ * Sets the segment properties of the buffer, a shortcut for calling
+ * hb_buffer_set_direction(), hb_buffer_set_script() and
+ * hb_buffer_set_language() individually.
  *
  * Since: 0.9.7
  **/
@@ -1032,10 +1050,10 @@
 
 /**
  * hb_buffer_get_segment_properties:
- * @buffer: a buffer.
- * @props: (out):
+ * @buffer: an #hb_buffer_t.
+ * @props: (out): the output #hb_segment_properties_t.
  *
- *
+ * Sets @props to the #hb_segment_properties_t of @buffer.
  *
  * Since: 0.9.7
  **/
@@ -1049,10 +1067,10 @@
 
 /**
  * hb_buffer_set_flags:
- * @buffer: a buffer.
- * @flags:
+ * @buffer: an #hb_buffer_t.
+ * @flags: the buffer flags to set.
  *
- *
+ * Sets @buffer flags to @flags. See #hb_buffer_flags_t.
  *
  * Since: 0.9.7
  **/
@@ -1068,11 +1086,12 @@
 
 /**
  * hb_buffer_get_flags:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_flags().
  *
  * Return value:
+ * The @buffer flags.
  *
  * Since: 0.9.7
  **/
@@ -1084,7 +1103,7 @@
 
 /**
  * hb_buffer_set_cluster_level:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @cluster_level:
  *
  *
@@ -1103,7 +1122,7 @@
 
 /**
  * hb_buffer_get_cluster_level:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  *
  *
@@ -1120,10 +1139,13 @@
 
 /**
  * hb_buffer_set_replacement_codepoint:
- * @buffer: a buffer.
- * @replacement:
+ * @buffer: an #hb_buffer_t.
+ * @replacement: the replacement #hb_codepoint_t
  *
+ * Sets the #hb_codepoint_t that replaces invalid entries for a given encoding
+ * when adding text to @buffer.
  *
+ * Default is %HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT.
  *
  * Since: 0.9.31
  **/
@@ -1139,11 +1161,12 @@
 
 /**
  * hb_buffer_get_replacement_codepoint:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * See hb_buffer_set_replacement_codepoint().
  *
  * Return value:
+ * The @buffer replacement #hb_codepoint_t.
  *
  * Since: 0.9.31
  **/
@@ -1156,9 +1179,10 @@
 
 /**
  * hb_buffer_reset:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Resets the buffer to its initial status, as if it was just newly created
+ * with hb_buffer_create().
  *
  * Since: 0.9.2
  **/
@@ -1170,9 +1194,10 @@
 
 /**
  * hb_buffer_clear_contents:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Similar to hb_buffer_reset(), but does not clear the Unicode functions and
+ * the replacement code point.
  *
  * Since: 0.9.11
  **/
@@ -1184,12 +1209,13 @@
 
 /**
  * hb_buffer_pre_allocate:
- * @buffer: a buffer.
- * @size:
+ * @buffer: an #hb_buffer_t.
+ * @size: number of items to pre allocate.
  *
- *
+ * Pre allocates memory for @buffer to fit at least @size number of items.
  *
  * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
  *
  * Since: 0.9.2
  **/
@@ -1201,11 +1227,12 @@
 
 /**
  * hb_buffer_allocation_successful:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
- *
+ * Check if allocating memory for the buffer succeeded.
  *
  * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
  *
  * Since: 0.9.2
  **/
@@ -1217,11 +1244,18 @@
 
 /**
  * hb_buffer_add:
- * @buffer: a buffer.
- * @codepoint:
- * @cluster:
+ * @buffer: an #hb_buffer_t.
+ * @codepoint: a Unicode code point.
+ * @cluster: the cluster value of @codepoint.
  *
+ * Appends a character with the Unicode value of @codepoint to @buffer, and
+ * gives it the initial cluster value of @cluster. Clusters can be any thing
+ * the client wants, they are usually used to refer to the index of the
+ * character in the input text stream and are output in
+ * #hb_glyph_info_t.cluster field.
  *
+ * This function does not check the validity of @codepoint, it is up to the
+ * caller to ensure it is a valid Unicode code point.
  *
  * Since: 0.9.7
  **/
@@ -1236,12 +1270,14 @@
 
 /**
  * hb_buffer_set_length:
- * @buffer: a buffer.
- * @length:
+ * @buffer: an #hb_buffer_t.
+ * @length: the new length of @buffer.
  *
- *
+ * Similar to hb_buffer_pre_allocate(), but clears any new items added at the
+ * end.
  *
  * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
  *
  * Since: 0.9.2
  **/
@@ -1276,11 +1312,13 @@
 
 /**
  * hb_buffer_get_length:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Returns the number of items in the buffer.
  *
- * Return value: buffer length.
+ * Return value:
+ * The @buffer length.
+ * The value valid as long as buffer has not been modified.
  *
  * Since: 0.9.2
  **/
@@ -1292,13 +1330,15 @@
 
 /**
  * hb_buffer_get_glyph_infos:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @length: (out): output array length.
  *
- * Returns buffer glyph information array.  Returned pointer
- * is valid as long as buffer contents are not modified.
+ * Returns @buffer glyph information array.  Returned pointer
+ * is valid as long as @buffer contents are not modified.
  *
- * Return value: (transfer none) (array length=length): buffer glyph information array.
+ * Return value: (transfer none) (array length=length):
+ * The @buffer glyph information array.
+ * The value valid as long as buffer has not been modified.
  *
  * Since: 0.9.2
  **/
@@ -1314,13 +1354,15 @@
 
 /**
  * hb_buffer_get_glyph_positions:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @length: (out): output length.
  *
- * Returns buffer glyph position array.  Returned pointer
- * is valid as long as buffer contents are not modified.
+ * Returns @buffer glyph position array.  Returned pointer
+ * is valid as long as @buffer contents are not modified.
  *
- * Return value: (transfer none) (array length=length): buffer glyph position array.
+ * Return value: (transfer none) (array length=length):
+ * The @buffer glyph position array.
+ * The value valid as long as buffer has not been modified.
  *
  * Since: 0.9.2
  **/
@@ -1339,7 +1381,7 @@
 
 /**
  * hb_buffer_reverse:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Reverses buffer contents.
  *
@@ -1353,7 +1395,7 @@
 
 /**
  * hb_buffer_reverse_range:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  * @start: start index.
  * @end: end index.
  *
@@ -1370,7 +1412,7 @@
 
 /**
  * hb_buffer_reverse_clusters:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Reverses buffer clusters.  That is, the buffer contents are
  * reversed, then each cluster (consecutive items having the
@@ -1386,7 +1428,7 @@
 
 /**
  * hb_buffer_guess_segment_properties:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
  * Sets unset buffer segment properties based on buffer Unicode
  * contents.  If buffer is not empty, it must have content type
@@ -1485,13 +1527,18 @@
 
 /**
  * hb_buffer_add_utf8:
- * @buffer: a buffer.
- * @text: (array length=text_length) (element-type uint8_t):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length) (element-type uint8_t): an array of UTF-8
+ *               characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * See hb_buffer_add_codepoints().
  *
+ * Replaces invalid UTF-8 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
  *
  * Since: 0.9.2
  **/
@@ -1507,13 +1554,17 @@
 
 /**
  * hb_buffer_add_utf16:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length): an array of UTF-16 characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * See hb_buffer_add_codepoints().
  *
+ * Replaces invalid UTF-16 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
  *
  * Since: 0.9.2
  **/
@@ -1529,13 +1580,17 @@
 
 /**
  * hb_buffer_add_utf32:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length): an array of UTF-32 characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * See hb_buffer_add_codepoints().
  *
+ * Replaces invalid UTF-32 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
  *
  * Since: 0.9.2
  **/
@@ -1551,13 +1606,18 @@
 
 /**
  * hb_buffer_add_latin1:
- * @buffer: a buffer.
- * @text: (array length=text_length) (element-type uint8_t):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length) (element-type uint8_t): an array of UTF-8
+ *               characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * Similar to hb_buffer_add_codepoints(), but allows only access to first 256
+ * Unicode code points that can fit in 8-bit strings.
  *
+ * <note>Has nothing to do with non-Unicode Latin-1 encoding.</note>
  *
  * Since: 0.9.39
  **/
@@ -1573,13 +1633,25 @@
 
 /**
  * hb_buffer_add_codepoints:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: a #hb_buffer_t to append characters to.
+ * @text: (array length=text_length): an array of Unicode code points to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first code point to add to the @buffer.
+ * @item_length: the number of code points to add to the @buffer, or -1 for the
+ *               end of @text (assuming it is %NULL terminated).
  *
+ * Appends characters from @text array to @buffer. The @item_offset is the
+ * position of the first character from @text that will be appended, and
+ * @item_length is the number of character. When shaping part of a larger text
+ * (e.g. a run of text from a paragraph), instead of passing just the substring
+ * corresponding to the run, it is preferable to pass the whole
+ * paragraph and specify the run start and length as @item_offset and
+ * @item_length, respectively, to give HarfBuzz the full context to be able,
+ * for example, to do cross-run Arabic shaping or properly handle combining
+ * marks at stat of run.
  *
+ * This function does not check the validity of @text, it is up to the caller
+ * to ensure it contains a valid Unicode code points.
  *
  * Since: 0.9.31
  **/
@@ -1651,9 +1723,12 @@
 
 /**
  * hb_buffer_normalize_glyphs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
  *
+ * Reorders a glyph buffer to have canonical in-cluster glyph order / position.
+ * The resulting clusters should behave identical to pre-reordering clusters.
  *
+ * <note>This has nothing to do with Unicode normalization.</note>
  *
  * Since: 0.9.2
  **/
@@ -1699,3 +1774,45 @@
     }
   }
 }
+
+/*
+ * Debugging.
+ */
+
+/**
+ * hb_buffer_set_message_func:
+ * @buffer: an #hb_buffer_t.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.3
+ **/
+void
+hb_buffer_set_message_func (hb_buffer_t *buffer,
+                            hb_buffer_message_func_t func,
+                            void *user_data, hb_destroy_func_t destroy)
+{
+  if (buffer->message_destroy)
+    buffer->message_destroy (buffer->message_data);
+
+  if (func) {
+    buffer->message_func = func;
+    buffer->message_data = user_data;
+    buffer->message_destroy = destroy;
+  } else {
+    buffer->message_func = NULL;
+    buffer->message_data = NULL;
+    buffer->message_destroy = NULL;
+  }
+}
+
+bool
+hb_buffer_t::message_impl (hb_font_t *font, const char *fmt, va_list ap)
+{
+  char buf[100];
+  vsnprintf (buf, sizeof (buf),  fmt, ap);
+  return (bool) this->message_func (this, font, buf, this->message_data);
+}
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer.h	Tue Aug 09 16:20:02 2016 -0700
@@ -40,7 +40,27 @@
 
 HB_BEGIN_DECLS
 
-
+/**
+ * hb_glyph_info_t:
+ * @codepoint: either a Unicode code point (before shaping) or a glyph index
+ *             (after shaping).
+ * @mask:
+ * @cluster: the index of the character in the original text that corresponds
+ *           to this #hb_glyph_info_t, or whatever the client passes to
+ *           hb_buffer_add(). More than one #hb_glyph_info_t can have the same
+ *           @cluster value, if they resulted from the same character (e.g. one
+ *           to many glyph substitution), and when more than one character gets
+ *           merged in the same glyph (e.g. many to one glyph substitution) the
+ *           #hb_glyph_info_t will have the smallest cluster value of them.
+ *           By default some characters are merged into the same cluster
+ *           (e.g. combining marks have the same cluster as their bases)
+ *           even if they are separate glyphs, hb_buffer_set_cluster_level()
+ *           allow selecting more fine-grained cluster handling.
+ *
+ * The #hb_glyph_info_t is the structure that holds information about the
+ * glyphs and their relation to input text.
+ *
+ */
 typedef struct hb_glyph_info_t {
   hb_codepoint_t codepoint;
   hb_mask_t      mask;
@@ -51,6 +71,22 @@
   hb_var_int_t   var2;
 } hb_glyph_info_t;
 
+/**
+ * hb_glyph_position_t:
+ * @x_advance: how much the line advances after drawing this glyph when setting
+ *             text in horizontal direction.
+ * @y_advance: how much the line advances after drawing this glyph when setting
+ *             text in vertical direction.
+ * @x_offset: how much the glyph moves on the X-axis before drawing it, this
+ *            should not affect how much the line advances.
+ * @y_offset: how much the glyph moves on the Y-axis before drawing it, this
+ *            should not affect how much the line advances.
+ *
+ * The #hb_glyph_position_t is the structure that holds the positions of the
+ * glyph in both horizontal and vertical directions. All positions in
+ * #hb_glyph_position_t are relative to the current point.
+ *
+ */
 typedef struct hb_glyph_position_t {
   hb_position_t  x_advance;
   hb_position_t  y_advance;
@@ -61,7 +97,16 @@
   hb_var_int_t   var;
 } hb_glyph_position_t;
 
-
+/**
+ * hb_segment_properties_t:
+ * @direction: the #hb_direction_t of the buffer, see hb_buffer_set_direction().
+ * @script: the #hb_script_t of the buffer, see hb_buffer_set_script().
+ * @language: the #hb_language_t of the buffer, see hb_buffer_set_language().
+ *
+ * The structure that holds various text properties of an #hb_buffer_t. Can be
+ * set and retrieved using hb_buffer_set_segment_properties() and
+ * hb_buffer_get_segment_properties(), respectively.
+ */
 typedef struct hb_segment_properties_t {
   hb_direction_t  direction;
   hb_script_t     script;
@@ -77,101 +122,125 @@
                                        NULL, \
                                        NULL}
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_segment_properties_equal (const hb_segment_properties_t *a,
                              const hb_segment_properties_t *b);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_segment_properties_hash (const hb_segment_properties_t *p);
 
 
 
-/*
- * hb_buffer_t
+/**
+ * hb_buffer_t:
+ *
+ * The main structure holding the input text and its properties before shaping,
+ * and output glyphs and their information after shaping.
  */
 
 typedef struct hb_buffer_t hb_buffer_t;
 
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
 hb_buffer_create (void);
 
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
 hb_buffer_get_empty (void);
 
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
 hb_buffer_reference (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_destroy (hb_buffer_t *buffer);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_set_user_data (hb_buffer_t        *buffer,
                          hb_user_data_key_t *key,
                          void *              data,
                          hb_destroy_func_t   destroy,
                          hb_bool_t           replace);
 
-void *
+HB_EXTERN void *
 hb_buffer_get_user_data (hb_buffer_t        *buffer,
                          hb_user_data_key_t *key);
 
-
+/**
+ * hb_buffer_content_type_t:
+ * @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
+ * @HB_BUFFER_CONTENT_TYPE_UNICODE: The buffer contains input characters (before shaping).
+ * @HB_BUFFER_CONTENT_TYPE_GLYPHS: The buffer contains output glyphs (after shaping).
+ */
 typedef enum {
   HB_BUFFER_CONTENT_TYPE_INVALID = 0,
   HB_BUFFER_CONTENT_TYPE_UNICODE,
   HB_BUFFER_CONTENT_TYPE_GLYPHS
 } hb_buffer_content_type_t;
 
-void
+HB_EXTERN void
 hb_buffer_set_content_type (hb_buffer_t              *buffer,
                             hb_buffer_content_type_t  content_type);
 
-hb_buffer_content_type_t
+HB_EXTERN hb_buffer_content_type_t
 hb_buffer_get_content_type (hb_buffer_t *buffer);
 
 
-void
+HB_EXTERN void
 hb_buffer_set_unicode_funcs (hb_buffer_t        *buffer,
                              hb_unicode_funcs_t *unicode_funcs);
 
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
 hb_buffer_get_unicode_funcs (hb_buffer_t        *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_direction (hb_buffer_t    *buffer,
                          hb_direction_t  direction);
 
-hb_direction_t
+HB_EXTERN hb_direction_t
 hb_buffer_get_direction (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_script (hb_buffer_t *buffer,
                       hb_script_t  script);
 
-hb_script_t
+HB_EXTERN hb_script_t
 hb_buffer_get_script (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_language (hb_buffer_t   *buffer,
                         hb_language_t  language);
 
 
-hb_language_t
+HB_EXTERN hb_language_t
 hb_buffer_get_language (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_set_segment_properties (hb_buffer_t *buffer,
                                   const hb_segment_properties_t *props);
 
-void
+HB_EXTERN void
 hb_buffer_get_segment_properties (hb_buffer_t *buffer,
                                   hb_segment_properties_t *props);
 
-void
+HB_EXTERN void
 hb_buffer_guess_segment_properties (hb_buffer_t *buffer);
 
 
-/*
+/**
+ * hb_buffer_flags_t:
+ * @HB_BUFFER_FLAG_DEFAULT: the default buffer flag.
+ * @HB_BUFFER_FLAG_BOT: flag indicating that special handling of the beginning
+ *                      of text paragraph can be applied to this buffer. Should usually
+ *                      be set, unless you are passing to the buffer only part
+ *                      of the text without the full context.
+ * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text
+ *                      paragraph can be applied to this buffer, similar to
+ *                      @HB_BUFFER_FLAG_EOT.
+ * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES:
+ *                      flag indication that character with Default_Ignorable
+ *                      Unicode property should use the corresponding glyph
+ *                      from the font, instead of hiding them (currently done
+ *                      by replacing them with the space glyph and zeroing the
+ *                      advance width.)
+ *
  * Since: 0.9.20
  */
 typedef enum { /*< flags >*/
@@ -181,11 +250,11 @@
   HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES    = 0x00000004u
 } hb_buffer_flags_t;
 
-void
+HB_EXTERN void
 hb_buffer_set_flags (hb_buffer_t       *buffer,
                      hb_buffer_flags_t  flags);
 
-hb_buffer_flags_t
+HB_EXTERN hb_buffer_flags_t
 hb_buffer_get_flags (hb_buffer_t *buffer);
 
 /*
@@ -198,93 +267,92 @@
   HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
 } hb_buffer_cluster_level_t;
 
-void
+HB_EXTERN void
 hb_buffer_set_cluster_level (hb_buffer_t               *buffer,
                              hb_buffer_cluster_level_t  cluster_level);
 
-hb_buffer_cluster_level_t
+HB_EXTERN hb_buffer_cluster_level_t
 hb_buffer_get_cluster_level (hb_buffer_t *buffer);
 
+/**
+ * HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT:
+ *
+ * The default code point for replacing invalid characters in a given encoding.
+ * Set to U+FFFD REPLACEMENT CHARACTER.
+ *
+ * Since: 0.9.31
+ */
 #define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu
 
-/* Sets codepoint used to replace invalid UTF-8/16/32 entries.
- * Default is 0xFFFDu. */
-void
+HB_EXTERN void
 hb_buffer_set_replacement_codepoint (hb_buffer_t    *buffer,
                                      hb_codepoint_t  replacement);
 
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
 hb_buffer_get_replacement_codepoint (hb_buffer_t    *buffer);
 
 
-/* Resets the buffer.  Afterwards it's as if it was just created,
- * except that it has a larger buffer allocated perhaps... */
-void
+HB_EXTERN void
 hb_buffer_reset (hb_buffer_t *buffer);
 
-/* Like reset, but does NOT clear unicode_funcs and replacement_codepoint. */
-void
+HB_EXTERN void
 hb_buffer_clear_contents (hb_buffer_t *buffer);
 
-/* Returns false if allocation failed */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_pre_allocate (hb_buffer_t  *buffer,
                         unsigned int  size);
 
 
-/* Returns false if allocation has failed before */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_allocation_successful (hb_buffer_t  *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_reverse (hb_buffer_t *buffer);
 
-void
+HB_EXTERN void
 hb_buffer_reverse_range (hb_buffer_t *buffer,
                          unsigned int start, unsigned int end);
 
-void
+HB_EXTERN void
 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
 
 
 /* Filling the buffer in */
 
-void
+HB_EXTERN void
 hb_buffer_add (hb_buffer_t    *buffer,
                hb_codepoint_t  codepoint,
                unsigned int    cluster);
 
-void
+HB_EXTERN void
 hb_buffer_add_utf8 (hb_buffer_t  *buffer,
                     const char   *text,
                     int           text_length,
                     unsigned int  item_offset,
                     int           item_length);
 
-void
+HB_EXTERN void
 hb_buffer_add_utf16 (hb_buffer_t    *buffer,
                      const uint16_t *text,
                      int             text_length,
                      unsigned int    item_offset,
                      int             item_length);
 
-void
+HB_EXTERN void
 hb_buffer_add_utf32 (hb_buffer_t    *buffer,
                      const uint32_t *text,
                      int             text_length,
                      unsigned int    item_offset,
                      int             item_length);
 
-/* Allows only access to first 256 Unicode codepoints. */
-void
+HB_EXTERN void
 hb_buffer_add_latin1 (hb_buffer_t   *buffer,
                       const uint8_t *text,
                       int            text_length,
                       unsigned int   item_offset,
                       int            item_length);
 
-/* Like add_utf32 but does NOT check for invalid Unicode codepoints. */
-void
+HB_EXTERN void
 hb_buffer_add_codepoints (hb_buffer_t          *buffer,
                           const hb_codepoint_t *text,
                           int                   text_length,
@@ -292,32 +360,25 @@
                           int                   item_length);
 
 
-/* Clears any new items added at the end */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_set_length (hb_buffer_t  *buffer,
                       unsigned int  length);
 
-/* Return value valid as long as buffer not modified */
-unsigned int
+HB_EXTERN unsigned int
 hb_buffer_get_length (hb_buffer_t *buffer);
 
 /* Getting glyphs out of the buffer */
 
-/* Return value valid as long as buffer not modified */
-hb_glyph_info_t *
+HB_EXTERN hb_glyph_info_t *
 hb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
                            unsigned int *length);
 
-/* Return value valid as long as buffer not modified */
-hb_glyph_position_t *
+HB_EXTERN hb_glyph_position_t *
 hb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
                                unsigned int *length);
 
 
-/* Reorders a glyph buffer to have canonical in-cluster glyph order / position.
- * The resulting clusters should behave identical to pre-reordering clusters.
- * NOTE: This has nothing to do with Unicode normalization. */
-void
+HB_EXTERN void
 hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
 
 
@@ -325,7 +386,16 @@
  * Serialize
  */
 
-/*
+/**
+ * hb_buffer_serialize_flags_t:
+ * @HB_BUFFER_SERIALIZE_FLAG_DEFAULT: serialize glyph names, clusters and positions.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS: do not serialize glyph cluster.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position information.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name.
+ * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents.
+ *
+ * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs().
+ *
  * Since: 0.9.20
  */
 typedef enum { /*< flags >*/
@@ -336,43 +406,67 @@
   HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS        = 0x00000008u
 } hb_buffer_serialize_flags_t;
 
+/**
+ * hb_buffer_serialize_format_t:
+ * @HB_BUFFER_SERIALIZE_FORMAT_TEXT: a human-readable, plain text format.
+ * @HB_BUFFER_SERIALIZE_FORMAT_JSON: a machine-readable JSON format.
+ * @HB_BUFFER_SERIALIZE_FORMAT_INVALID: invalid format.
+ *
+ * The buffer serialization and de-serialization format used in
+ * hb_buffer_serialize_glyphs() and hb_buffer_deserialize_glyphs().
+ *
+ * Since: 0.9.2
+ */
 typedef enum {
   HB_BUFFER_SERIALIZE_FORMAT_TEXT       = HB_TAG('T','E','X','T'),
   HB_BUFFER_SERIALIZE_FORMAT_JSON       = HB_TAG('J','S','O','N'),
   HB_BUFFER_SERIALIZE_FORMAT_INVALID    = HB_TAG_NONE
 } hb_buffer_serialize_format_t;
 
-/* len=-1 means str is NUL-terminated. */
-hb_buffer_serialize_format_t
+HB_EXTERN hb_buffer_serialize_format_t
 hb_buffer_serialize_format_from_string (const char *str, int len);
 
-const char *
+HB_EXTERN const char *
 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);
 
-const char **
+HB_EXTERN const char **
 hb_buffer_serialize_list_formats (void);
 
-/* Returns number of items, starting at start, that were serialized. */
-unsigned int
+HB_EXTERN unsigned int
 hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
                             unsigned int start,
                             unsigned int end,
                             char *buf,
                             unsigned int buf_size,
-                            unsigned int *buf_consumed, /* May be NULL */
-                            hb_font_t *font, /* May be NULL */
+                            unsigned int *buf_consumed,
+                            hb_font_t *font,
                             hb_buffer_serialize_format_t format,
                             hb_buffer_serialize_flags_t flags);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
                               const char *buf,
-                              int buf_len, /* -1 means nul-terminated */
-                              const char **end_ptr, /* May be NULL */
-                              hb_font_t *font, /* May be NULL */
+                              int buf_len,
+                              const char **end_ptr,
+                              hb_font_t *font,
                               hb_buffer_serialize_format_t format);
 
 
+/*
+ * Debugging.
+ */
+
+typedef hb_bool_t       (*hb_buffer_message_func_t)     (hb_buffer_t *buffer,
+                                                         hb_font_t   *font,
+                                                         const char  *message,
+                                                         void        *user_data);
+
+HB_EXTERN void
+hb_buffer_set_message_func (hb_buffer_t *buffer,
+                            hb_buffer_message_func_t func,
+                            void *user_data, hb_destroy_func_t destroy);
+
+
 HB_END_DECLS
 
 #endif /* HB_BUFFER_H */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -88,7 +88,7 @@
 /**
  * hb_tag_to_string:
  * @tag:
- * @buf: (array fixed-size=4):
+ * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t):
  *
  *
  *
@@ -281,12 +281,15 @@
 
 /**
  * hb_language_from_string:
- * @str: (array length=len) (element-type uint8_t):
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string representing
+ *       ISO 639 language code
+ * @len: length of the @str, or -1 if it is %NULL-terminated.
  *
- *
+ * Converts @str representing an ISO 639 language code to the corresponding
+ * #hb_language_t.
  *
  * Return value: (transfer none):
+ * The #hb_language_t corresponding to the ISO 639 language code.
  *
  * Since: 0.9.2
  **/
@@ -314,11 +317,13 @@
 
 /**
  * hb_language_to_string:
- * @language:
+ * @language: an #hb_language_t to convert.
  *
- *
+ * See hb_language_from_string().
  *
  * Return value: (transfer none):
+ * A %NULL-terminated string representing the @language. Must not be freed by
+ * the caller.
  *
  * Since: 0.9.2
  **/
@@ -357,11 +362,12 @@
 
 /**
  * hb_script_from_iso15924_tag:
- * @tag:
+ * @tag: an #hb_tag_t representing an ISO 15924 tag.
  *
- *
+ * Converts an ISO 15924 script tag to a corresponding #hb_script_t.
  *
  * Return value:
+ * An #hb_script_t corresponding to the ISO 15924 tag.
  *
  * Since: 0.9.2
  **/
@@ -401,28 +407,33 @@
 
 /**
  * hb_script_from_string:
- * @s: (array length=len) (element-type uint8_t):
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string representing an
+ *       ISO 15924 tag.
+ * @len: length of the @str, or -1 if it is %NULL-terminated.
  *
- *
+ * Converts a string @str representing an ISO 15924 script tag to a
+ * corresponding #hb_script_t. Shorthand for hb_tag_from_string() then
+ * hb_script_from_iso15924_tag().
  *
  * Return value:
+ * An #hb_script_t corresponding to the ISO 15924 tag.
  *
  * Since: 0.9.2
  **/
 hb_script_t
-hb_script_from_string (const char *s, int len)
+hb_script_from_string (const char *str, int len)
 {
-  return hb_script_from_iso15924_tag (hb_tag_from_string (s, len));
+  return hb_script_from_iso15924_tag (hb_tag_from_string (str, len));
 }
 
 /**
  * hb_script_to_iso15924_tag:
- * @script:
+ * @script: an #hb_script_ to convert.
  *
- *
+ * See hb_script_from_iso15924_tag().
  *
  * Return value:
+ * An #hb_tag_t representing an ISO 15924 script tag.
  *
  * Since: 0.9.2
  **/
@@ -496,6 +507,9 @@
     /* Unicode-8.0 additions */
     case HB_SCRIPT_OLD_HUNGARIAN:
 
+    /* Unicode-9.0 additions */
+    case HB_SCRIPT_ADLAM:
+
       return HB_DIRECTION_RTL;
   }
 
@@ -521,7 +535,7 @@
     }
   }
   hb_user_data_item_t item = {key, data, destroy};
-  bool ret = !!items.replace_or_insert (item, lock, replace);
+  bool ret = !!items.replace_or_insert (item, lock, (bool) replace);
 
   return ret;
 }
@@ -529,7 +543,7 @@
 void *
 hb_user_data_array_t::get (hb_user_data_key_t *key)
 {
-  hb_user_data_item_t item = {NULL };
+  hb_user_data_item_t item = {NULL, NULL, NULL};
 
   return items.find (key, &item, lock) ? item.data : NULL;
 }
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.h	Tue Aug 09 16:20:02 2016 -0700
@@ -98,16 +98,22 @@
 #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
 
 /* len=-1 means str is NUL-terminated. */
-hb_tag_t
+HB_EXTERN hb_tag_t
 hb_tag_from_string (const char *str, int len);
 
 /* buf should have 4 bytes. */
-void
+HB_EXTERN void
 hb_tag_to_string (hb_tag_t tag, char *buf);
 
 
-/* hb_direction_t */
-
+/**
+ * hb_direction_t:
+ * @HB_DIRECTION_INVALID: Initial, unset direction.
+ * @HB_DIRECTION_LTR: Text is set horizontally from left to right.
+ * @HB_DIRECTION_RTL: Text is set horizontally from right to left.
+ * @HB_DIRECTION_TTB: Text is set vertically from top to bottom.
+ * @HB_DIRECTION_BTT: Text is set vertically from bottom to top.
+ */
 typedef enum {
   HB_DIRECTION_INVALID = 0,
   HB_DIRECTION_LTR = 4,
@@ -117,10 +123,10 @@
 } hb_direction_t;
 
 /* len=-1 means str is NUL-terminated */
-hb_direction_t
+HB_EXTERN hb_direction_t
 hb_direction_from_string (const char *str, int len);
 
-const char *
+HB_EXTERN const char *
 hb_direction_to_string (hb_direction_t direction);
 
 #define HB_DIRECTION_IS_VALID(dir)      ((((unsigned int) (dir)) & ~3U) == 4)
@@ -136,16 +142,15 @@
 
 typedef const struct hb_language_impl_t *hb_language_t;
 
-/* len=-1 means str is NUL-terminated */
-hb_language_t
+HB_EXTERN hb_language_t
 hb_language_from_string (const char *str, int len);
 
-const char *
+HB_EXTERN const char *
 hb_language_to_string (hb_language_t language);
 
 #define HB_LANGUAGE_INVALID ((hb_language_t) NULL)
 
-hb_language_t
+HB_EXTERN hb_language_t
 hb_language_get_default (void);
 
 
@@ -306,6 +311,16 @@
   /*8.0*/ HB_SCRIPT_OLD_HUNGARIAN               = HB_TAG ('H','u','n','g'),
   /*8.0*/ HB_SCRIPT_SIGNWRITING                 = HB_TAG ('S','g','n','w'),
 
+  /*
+   * Since 1.3.0
+   */
+  /*9.0*/ HB_SCRIPT_ADLAM                       = HB_TAG ('A','d','l','m'),
+  /*9.0*/ HB_SCRIPT_BHAIKSUKI                   = HB_TAG ('B','h','k','s'),
+  /*9.0*/ HB_SCRIPT_MARCHEN                     = HB_TAG ('M','a','r','c'),
+  /*9.0*/ HB_SCRIPT_OSAGE                       = HB_TAG ('O','s','g','e'),
+  /*9.0*/ HB_SCRIPT_TANGUT                      = HB_TAG ('T','a','n','g'),
+  /*9.0*/ HB_SCRIPT_NEWA                        = HB_TAG ('N','e','w','a'),
+
   /* No script set. */
   HB_SCRIPT_INVALID                             = HB_TAG_NONE,
 
@@ -324,18 +339,16 @@
 
 /* Script functions */
 
-hb_script_t
+HB_EXTERN hb_script_t
 hb_script_from_iso15924_tag (hb_tag_t tag);
 
-/* sugar for tag_from_string() then script_from_iso15924_tag */
-/* len=-1 means s is NUL-terminated */
-hb_script_t
-hb_script_from_string (const char *s, int len);
+HB_EXTERN hb_script_t
+hb_script_from_string (const char *str, int len);
 
-hb_tag_t
+HB_EXTERN hb_tag_t
 hb_script_to_iso15924_tag (hb_script_t script);
 
-hb_direction_t
+HB_EXTERN hb_direction_t
 hb_script_get_horizontal_direction (hb_script_t script);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -27,7 +27,6 @@
  */
 
 #define HB_SHAPER coretext
-#define hb_coretext_shaper_face_data_t CGFont
 #include "hb-shaper-impl-private.hh"
 
 #include "hb-coretext.h"
@@ -78,6 +77,29 @@
  * shaper face data
  */
 
+static CTFontDescriptorRef
+get_last_resort_font_desc (void)
+{
+  // TODO Handle allocation failures?
+  CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize (CFSTR("LastResort"), 0);
+  CFArrayRef cascade_list = CFArrayCreate (kCFAllocatorDefault,
+                                           (const void **) &last_resort,
+                                           1,
+                                           &kCFTypeArrayCallBacks);
+  CFRelease (last_resort);
+  CFDictionaryRef attributes = CFDictionaryCreate (kCFAllocatorDefault,
+                                                   (const void **) &kCTFontCascadeListAttribute,
+                                                   (const void **) &cascade_list,
+                                                   1,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
+  CFRelease (cascade_list);
+
+  CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
+  CFRelease (attributes);
+  return font_desc;
+}
+
 static void
 release_data (void *info, const void *data, size_t size)
 {
@@ -87,14 +109,13 @@
   hb_blob_destroy ((hb_blob_t *) info);
 }
 
-hb_coretext_shaper_face_data_t *
-_hb_coretext_shaper_face_data_create (hb_face_t *face)
+static CGFontRef
+create_cg_font (hb_face_t *face)
 {
-  hb_coretext_shaper_face_data_t *data = NULL;
-
+  CGFontRef cg_font = NULL;
   if (face->destroy == (hb_destroy_func_t) CGFontRelease)
   {
-    data = CGFontRetain ((CGFontRef) face->user_data);
+    cg_font = CGFontRetain ((CGFontRef) face->user_data);
   }
   else
   {
@@ -107,13 +128,98 @@
     CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data);
     if (likely (provider))
     {
-      data = CGFontCreateWithDataProvider (provider);
+      cg_font = CGFontCreateWithDataProvider (provider);
+      if (unlikely (!cg_font))
+        DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
       CGDataProviderRelease (provider);
     }
   }
+  return cg_font;
+}
 
-  if (unlikely (!data)) {
-    DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
+static CTFontRef
+create_ct_font (CGFontRef cg_font, CGFloat font_size)
+{
+  CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
+  if (unlikely (!ct_font)) {
+    DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
+    return NULL;
+  }
+  CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute);
+
+  /* Create font copy with cascade list that has LastResort first; this speeds up CoreText
+   * font fallback which we don't need anyway. */
+  {
+    CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc ();
+    CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc);
+    CFRelease (last_resort_font_desc);
+    if (new_ct_font)
+    {
+      /* The CTFontCreateCopyWithAttributes call fails to stay on the same font
+       * when reconfiguring the cascade list and may switch to a different font
+       * when there are fonts that go by the same name, since the descriptor is
+       * just name and size.
+       *
+       * Avoid reconfiguring the cascade lists if the new font is outside the
+       * system locations that we cannot access from the sandboxed renderer
+       * process in Blink. This can be detected by the new file URL location
+       * that the newly found font points to. */
+      CFURLRef new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute);
+      // Keep reconfigured font if URL cannot be retrieved (seems to be the case
+      // on Mac OS 10.12 Sierra), speculative fix for crbug.com/625606
+      if (!original_url || !new_url || CFEqual (original_url, new_url)) {
+        CFRelease (ct_font);
+        ct_font = new_ct_font;
+      } else {
+        CFRelease (new_ct_font);
+        DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
+      }
+      if (new_url)
+        CFRelease (new_url);
+    }
+    else
+      DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed");
+  }
+
+  if (original_url)
+    CFRelease (original_url);
+  return ct_font;
+}
+
+struct hb_coretext_shaper_face_data_t {
+  CGFontRef cg_font;
+  CTFontRef ct_font;
+};
+
+hb_coretext_shaper_face_data_t *
+_hb_coretext_shaper_face_data_create (hb_face_t *face)
+{
+  hb_coretext_shaper_face_data_t *data = (hb_coretext_shaper_face_data_t *) calloc (1, sizeof (hb_coretext_shaper_face_data_t));
+  if (unlikely (!data))
+    return NULL;
+
+  data->cg_font = create_cg_font (face);
+  if (unlikely (!data->cg_font))
+  {
+    DEBUG_MSG (CORETEXT, face, "CGFont creation failed..");
+    free (data);
+    return NULL;
+  }
+
+  /* We use 36pt size instead of UPEM, because CoreText implements the 'trak' table,
+   * which can make the font too tight at large sizes.  36pt should be a good semi-neutral
+   * size.
+   *
+   * Since we always create CTFont at a fixed size, our CTFont lives in face_data
+   * instead of font_data.  Which is good, because when people change scale on
+   * hb_font_t, we won't need to update our CTFont. */
+  data->ct_font = create_ct_font (data->cg_font, 36.);
+  if (unlikely (!data->ct_font))
+  {
+    DEBUG_MSG (CORETEXT, face, "CTFont creation failed.");
+    CFRelease (data->cg_font);
+    free (data);
+    return NULL;
   }
 
   return data;
@@ -122,7 +228,9 @@
 void
 _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
 {
-  CFRelease (data);
+  CFRelease (data->ct_font);
+  CFRelease (data->cg_font);
+  free (data);
 }
 
 /*
@@ -133,7 +241,7 @@
 {
   if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
   hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-  return face_data;
+  return face_data->cg_font;
 }
 
 
@@ -141,49 +249,17 @@
  * shaper font data
  */
 
-struct hb_coretext_shaper_font_data_t {
-  CTFontRef ct_font;
-  CGFloat x_mult, y_mult; /* From CT space to HB space. */
-};
+struct hb_coretext_shaper_font_data_t {};
 
 hb_coretext_shaper_font_data_t *
-_hb_coretext_shaper_font_data_create (hb_font_t *font)
+_hb_coretext_shaper_font_data_create (hb_font_t *font HB_UNUSED)
 {
-  if (unlikely (!hb_coretext_shaper_face_data_ensure (font->face))) return NULL;
-
-  hb_coretext_shaper_font_data_t *data = (hb_coretext_shaper_font_data_t *) calloc (1, sizeof (hb_coretext_shaper_font_data_t));
-  if (unlikely (!data))
-    return NULL;
-
-  hb_face_t *face = font->face;
-  hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-
-  /* Choose a CoreText font size and calculate multipliers to convert to HarfBuzz space. */
-  /* TODO: use upem instead of 36? */
-  CGFloat font_size = 36.; /* Default... */
-  /* No idea if the following is even a good idea. */
-  if (font->y_ppem)
-    font_size = font->y_ppem;
-
-  if (font_size < 0)
-    font_size = -font_size;
-  data->x_mult = (CGFloat) font->x_scale / font_size;
-  data->y_mult = (CGFloat) font->y_scale / font_size;
-  data->ct_font = CTFontCreateWithGraphicsFont (face_data, font_size, NULL, NULL);
-  if (unlikely (!data->ct_font)) {
-    DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed");
-    free (data);
-    return NULL;
-  }
-
-  return data;
+  return (hb_coretext_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
 }
 
 void
 _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
 {
-  CFRelease (data->ct_font);
-  free (data);
 }
 
 
@@ -209,9 +285,10 @@
 CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font)
 {
-  if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL;
-  hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
-  return font_data->ct_font;
+  hb_face_t *face = font->face;
+  if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
+  hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
+  return face_data->ct_font;
 }
 
 
@@ -444,7 +521,10 @@
 {
   hb_face_t *face = font->face;
   hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-  hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
+
+  CGFloat ct_font_size = CTFontGetSize (face_data->ct_font);
+  CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
+  CGFloat y_mult = (CGFloat) font->y_scale / ct_font_size;
 
   /* Attach marks to their bases, to match the 'ot' shaper.
    * Adapted from hb-ot-shape:hb_form_clusters().
@@ -453,6 +533,7 @@
    * B1 M1 B2 M2, and B1-B2 form a ligature, M2's cluster will
    * continue pointing to B2 even though B2 was merged into B1's
    * cluster... */
+  if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
   {
     hb_unicode_funcs_t *unicode = buffer->unicode;
     unsigned int count = buffer->len;
@@ -575,7 +656,7 @@
           CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
           CFRelease (attributes);
 
-          range->font = CTFontCreateCopyWithAttributes (font_data->ct_font, 0.0, NULL, font_desc);
+          range->font = CTFontCreateCopyWithAttributes (face_data->ct_font, 0.0, NULL, font_desc);
           CFRelease (font_desc);
         }
         else
@@ -693,7 +774,6 @@
     scratch += old_scratch_used;
     scratch_size -= old_scratch_used;
   }
-retry:
   {
     string_ref = CFStringCreateWithCharactersNoCopy (NULL,
                                                      pchars, chars_len,
@@ -733,7 +813,7 @@
         CFRelease (lang);
       }
       CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
-                                      kCTFontAttributeName, font_data->ct_font);
+                                      kCTFontAttributeName, face_data->ct_font);
 
       if (num_features)
       {
@@ -826,7 +906,7 @@
        */
       CFDictionaryRef attributes = CTRunGetAttributes (run);
       CTFontRef run_ct_font = static_cast<CTFontRef>(CFDictionaryGetValue (attributes, kCTFontAttributeName));
-      if (!CFEqual (run_ct_font, font_data->ct_font))
+      if (!CFEqual (run_ct_font, face_data->ct_font))
       {
         /* The run doesn't use our main font instance.  We have to figure out
          * whether font fallback happened, or this is just CoreText giving us
@@ -846,15 +926,11 @@
          * backend.
          *
          * However, even that wouldn't work if we were passed in the CGFont to
-         * begin with.
-         *
-         * Webkit uses a slightly different approach: it installs LastResort
-         * as fallback chain, and then checks PS name of used font against
-         * LastResort.  That one is safe for any font except for LastResort,
-         * as opposed to ours, which can fail if we are using any uninstalled
-         * font that has the same name as an installed font.
+         * construct a hb_face to begin with.
          *
          * See: http://github.com/behdad/harfbuzz/pull/36
+         *
+         * Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098
          */
         bool matched = false;
         for (unsigned int i = 0; i < range_records.len; i++)
@@ -868,13 +944,13 @@
           CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
           if (run_cg_font)
           {
-            matched = CFEqual (run_cg_font, face_data);
+            matched = CFEqual (run_cg_font, face_data->cg_font);
             CFRelease (run_cg_font);
           }
         }
         if (!matched)
         {
-          CFStringRef font_ps_name = CTFontCopyName (font_data->ct_font, kCTFontPostScriptNameKey);
+          CFStringRef font_ps_name = CTFontCopyName (face_data->ct_font, kCTFontPostScriptNameKey);
           CFStringRef run_ps_name = CTFontCopyName (run_ct_font, kCTFontPostScriptNameKey);
           CFComparisonResult result = CFStringCompare (run_ps_name, font_ps_name, 0);
           CFRelease (run_ps_name);
@@ -994,7 +1070,6 @@
           positions = position_buf;
         }
         hb_glyph_info_t *info = run_info;
-        CGFloat x_mult = font_data->x_mult, y_mult = font_data->y_mult;
         if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
         {
           hb_position_t x_offset = (positions[0].x - advances_so_far) * x_mult;
@@ -1129,10 +1204,6 @@
  * AAT shaper
  */
 
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, face)
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, font)
-
-
 /*
  * shaper face data
  */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.h	Tue Aug 09 16:20:02 2016 -0700
@@ -44,14 +44,14 @@
 #define HB_CORETEXT_TAG_MORX HB_TAG('m','o','r','x')
 
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_coretext_face_create (CGFontRef cg_font);
 
 
-CGFontRef
+HB_EXTERN CGFontRef
 hb_coretext_face_get_cg_font (hb_face_t *face);
 
-CTFontRef
+HB_EXTERN CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-deprecated.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-deprecated.h	Tue Aug 09 16:20:02 2016 -0700
@@ -44,6 +44,16 @@
 #define HB_BUFFER_FLAGS_DEFAULT                 HB_BUFFER_FLAG_DEFAULT
 #define HB_BUFFER_SERIALIZE_FLAGS_DEFAULT       HB_BUFFER_SERIALIZE_FLAG_DEFAULT
 
+typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
+                                               hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                                               hb_codepoint_t *glyph,
+                                               void *user_data);
+
+HB_EXTERN void
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+                              hb_font_get_glyph_func_t func,
+                              void *user_data, hb_destroy_func_t destroy);
+
 #endif
 
 HB_END_DECLS
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.h	Tue Aug 09 16:20:02 2016 -0700
@@ -43,28 +43,28 @@
 
 typedef struct hb_face_t hb_face_t;
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_create (hb_blob_t    *blob,
                 unsigned int  index);
 
 typedef hb_blob_t * (*hb_reference_table_func_t)  (hb_face_t *face, hb_tag_t tag, void *user_data);
 
 /* calls destroy() when not needing user_data anymore */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_create_for_tables (hb_reference_table_func_t  reference_table_func,
                            void                      *user_data,
                            hb_destroy_func_t          destroy);
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_get_empty (void);
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_face_reference (hb_face_t *face);
 
-void
+HB_EXTERN void
 hb_face_destroy (hb_face_t *face);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_face_set_user_data (hb_face_t          *face,
                        hb_user_data_key_t *key,
                        void *              data,
@@ -72,43 +72,43 @@
                        hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_face_get_user_data (hb_face_t          *face,
                        hb_user_data_key_t *key);
 
-void
+HB_EXTERN void
 hb_face_make_immutable (hb_face_t *face);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_face_is_immutable (hb_face_t *face);
 
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_face_reference_table (hb_face_t *face,
                          hb_tag_t   tag);
 
-hb_blob_t *
+HB_EXTERN hb_blob_t *
 hb_face_reference_blob (hb_face_t *face);
 
-void
+HB_EXTERN void
 hb_face_set_index (hb_face_t    *face,
                    unsigned int  index);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_face_get_index (hb_face_t    *face);
 
-void
+HB_EXTERN void
 hb_face_set_upem (hb_face_t    *face,
                   unsigned int  upem);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_face_get_upem (hb_face_t *face);
 
-void
+HB_EXTERN void
 hb_face_set_glyph_count (hb_face_t    *face,
                          unsigned int  glyph_count);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_face_get_glyph_count (hb_face_t *face);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -106,7 +106,7 @@
    */
 
   hb_codepoint_t space;
-  bool has_space = font->get_glyph (' ', 0, &space);
+  bool has_space = (bool) font->get_nominal_glyph (' ', &space);
 
   buffer->clear_positions ();
 
@@ -123,7 +123,7 @@
       pos[i].y_advance = 0;
       continue;
     }
-    font->get_glyph (info[i].codepoint, 0, &info[i].codepoint);
+    font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
     font->get_glyph_advance_for_direction (info[i].codepoint,
                                            direction,
                                            &pos[i].x_advance,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -42,7 +42,10 @@
  */
 
 #define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
-  HB_FONT_FUNC_IMPLEMENT (glyph) \
+  HB_FONT_FUNC_IMPLEMENT (font_h_extents) \
+  HB_FONT_FUNC_IMPLEMENT (font_v_extents) \
+  HB_FONT_FUNC_IMPLEMENT (nominal_glyph) \
+  HB_FONT_FUNC_IMPLEMENT (variation_glyph) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
   HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
@@ -61,14 +64,6 @@
 
   hb_bool_t immutable;
 
-  /* Don't access these directly.  Call hb_font_get_*() instead. */
-
-  struct {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
-    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
-  } get;
-
   struct {
 #define HB_FONT_FUNC_IMPLEMENT(name) void *name;
     HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
@@ -80,6 +75,16 @@
     HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
   } destroy;
+
+  /* Don't access these directly.  Call font->get_*() instead. */
+  union get_t {
+    struct get_funcs_t {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
+      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+    } f;
+    void (*array[VAR]) (void);
+  } get;
 };
 
 
@@ -144,95 +149,133 @@
 
   /* Public getters */
 
-  inline hb_bool_t has_glyph (hb_codepoint_t unicode)
+  HB_INTERNAL bool has_func (unsigned int i);
+
+  /* has_* ... */
+#define HB_FONT_FUNC_IMPLEMENT(name) \
+  bool \
+  has_##name##_func (void) \
+  { \
+    hb_font_funcs_t *funcs = this->klass; \
+    unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \
+    return has_func (i); \
+  }
+  HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+
+  inline hb_bool_t get_font_h_extents (hb_font_extents_t *extents)
+  {
+    memset (extents, 0, sizeof (*extents));
+    return klass->get.f.font_h_extents (this, user_data,
+                                        extents,
+                                        klass->user_data.font_h_extents);
+  }
+  inline hb_bool_t get_font_v_extents (hb_font_extents_t *extents)
+  {
+    memset (extents, 0, sizeof (*extents));
+    return klass->get.f.font_v_extents (this, user_data,
+                                        extents,
+                                        klass->user_data.font_v_extents);
+  }
+
+  inline bool has_glyph (hb_codepoint_t unicode)
   {
     hb_codepoint_t glyph;
-    return get_glyph (unicode, 0, &glyph);
+    return get_nominal_glyph (unicode, &glyph);
   }
 
-  inline hb_bool_t get_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
-                              hb_codepoint_t *glyph)
+  inline hb_bool_t get_nominal_glyph (hb_codepoint_t unicode,
+                                      hb_codepoint_t *glyph)
   {
     *glyph = 0;
-    return klass->get.glyph (this, user_data,
-                             unicode, variation_selector, glyph,
-                             klass->user_data.glyph);
+    return klass->get.f.nominal_glyph (this, user_data,
+                                       unicode, glyph,
+                                       klass->user_data.nominal_glyph);
+  }
+
+  inline hb_bool_t get_variation_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                                        hb_codepoint_t *glyph)
+  {
+    *glyph = 0;
+    return klass->get.f.variation_glyph (this, user_data,
+                                         unicode, variation_selector, glyph,
+                                         klass->user_data.variation_glyph);
   }
 
   inline hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
   {
-    return klass->get.glyph_h_advance (this, user_data,
-                                       glyph,
-                                       klass->user_data.glyph_h_advance);
+    return klass->get.f.glyph_h_advance (this, user_data,
+                                         glyph,
+                                         klass->user_data.glyph_h_advance);
   }
 
   inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
   {
-    return klass->get.glyph_v_advance (this, user_data,
-                                       glyph,
-                                       klass->user_data.glyph_v_advance);
+    return klass->get.f.glyph_v_advance (this, user_data,
+                                         glyph,
+                                         klass->user_data.glyph_v_advance);
   }
 
   inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
                                        hb_position_t *x, hb_position_t *y)
   {
     *x = *y = 0;
-    return klass->get.glyph_h_origin (this, user_data,
-                                      glyph, x, y,
-                                      klass->user_data.glyph_h_origin);
+    return klass->get.f.glyph_h_origin (this, user_data,
+                                        glyph, x, y,
+                                        klass->user_data.glyph_h_origin);
   }
 
   inline hb_bool_t get_glyph_v_origin (hb_codepoint_t glyph,
                                        hb_position_t *x, hb_position_t *y)
   {
     *x = *y = 0;
-    return klass->get.glyph_v_origin (this, user_data,
-                                      glyph, x, y,
-                                      klass->user_data.glyph_v_origin);
+    return klass->get.f.glyph_v_origin (this, user_data,
+                                        glyph, x, y,
+                                        klass->user_data.glyph_v_origin);
   }
 
   inline hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph, hb_codepoint_t right_glyph)
   {
-    return klass->get.glyph_h_kerning (this, user_data,
-                                       left_glyph, right_glyph,
-                                       klass->user_data.glyph_h_kerning);
+    return klass->get.f.glyph_h_kerning (this, user_data,
+                                         left_glyph, right_glyph,
+                                         klass->user_data.glyph_h_kerning);
   }
 
   inline hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph)
   {
-    return klass->get.glyph_v_kerning (this, user_data,
-                                       top_glyph, bottom_glyph,
-                                       klass->user_data.glyph_v_kerning);
+    return klass->get.f.glyph_v_kerning (this, user_data,
+                                         top_glyph, bottom_glyph,
+                                         klass->user_data.glyph_v_kerning);
   }
 
   inline hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
                                       hb_glyph_extents_t *extents)
   {
     memset (extents, 0, sizeof (*extents));
-    return klass->get.glyph_extents (this, user_data,
-                                     glyph,
-                                     extents,
-                                     klass->user_data.glyph_extents);
+    return klass->get.f.glyph_extents (this, user_data,
+                                       glyph,
+                                       extents,
+                                       klass->user_data.glyph_extents);
   }
 
   inline hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
                                             hb_position_t *x, hb_position_t *y)
   {
     *x = *y = 0;
-    return klass->get.glyph_contour_point (this, user_data,
-                                           glyph, point_index,
-                                           x, y,
-                                           klass->user_data.glyph_contour_point);
+    return klass->get.f.glyph_contour_point (this, user_data,
+                                             glyph, point_index,
+                                             x, y,
+                                             klass->user_data.glyph_contour_point);
   }
 
   inline hb_bool_t get_glyph_name (hb_codepoint_t glyph,
                                    char *name, unsigned int size)
   {
     if (size) *name = '\0';
-    return klass->get.glyph_name (this, user_data,
-                                  glyph,
-                                  name, size,
-                                  klass->user_data.glyph_name);
+    return klass->get.f.glyph_name (this, user_data,
+                                    glyph,
+                                    name, size,
+                                    klass->user_data.glyph_name);
   }
 
   inline hb_bool_t get_glyph_from_name (const char *name, int len, /* -1 means nul-terminated */
@@ -240,15 +283,35 @@
   {
     *glyph = 0;
     if (len == -1) len = strlen (name);
-    return klass->get.glyph_from_name (this, user_data,
-                                       name, len,
-                                       glyph,
-                                       klass->user_data.glyph_from_name);
+    return klass->get.f.glyph_from_name (this, user_data,
+                                         name, len,
+                                         glyph,
+                                         klass->user_data.glyph_from_name);
   }
 
 
   /* A bit higher-level, and with fallback */
 
+  inline void get_extents_for_direction (hb_direction_t direction,
+                                         hb_font_extents_t *extents)
+  {
+    if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
+      if (!get_font_h_extents (extents))
+      {
+        extents->ascender = y_scale * .8;
+        extents->descender = y_scale - extents->ascender;
+        extents->line_gap = 0;
+      }
+    } else {
+      if (!get_font_v_extents (extents))
+      {
+        extents->ascender = x_scale / 2;
+        extents->descender = x_scale - extents->ascender;
+        extents->line_gap = 0;
+      }
+    }
+  }
+
   inline void get_glyph_advance_for_direction (hb_codepoint_t glyph,
                                                hb_direction_t direction,
                                                hb_position_t *x, hb_position_t *y)
@@ -268,7 +331,7 @@
   {
     *x = get_glyph_h_advance (glyph) / 2;
 
-    /* TODO use font_metrics.ascent */
+    /* TODO use font_extents.ascender */
     *y = y_scale;
   }
 
@@ -298,6 +361,26 @@
     }
   }
 
+  inline void add_glyph_h_origin (hb_codepoint_t glyph,
+                                  hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_h_origin (glyph, &origin_x, &origin_y);
+
+    *x += origin_x;
+    *y += origin_y;
+  }
+  inline void add_glyph_v_origin (hb_codepoint_t glyph,
+                                  hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_v_origin (glyph, &origin_x, &origin_y);
+
+    *x += origin_x;
+    *y += origin_y;
+  }
   inline void add_glyph_origin_for_direction (hb_codepoint_t glyph,
                                               hb_direction_t direction,
                                               hb_position_t *x, hb_position_t *y)
@@ -310,6 +393,26 @@
     *y += origin_y;
   }
 
+  inline void subtract_glyph_h_origin (hb_codepoint_t glyph,
+                                       hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_h_origin (glyph, &origin_x, &origin_y);
+
+    *x -= origin_x;
+    *y -= origin_y;
+  }
+  inline void subtract_glyph_v_origin (hb_codepoint_t glyph,
+                                       hb_position_t *x, hb_position_t *y)
+  {
+    hb_position_t origin_x, origin_y;
+
+    get_glyph_v_origin (glyph, &origin_x, &origin_y);
+
+    *x -= origin_x;
+    *y -= origin_y;
+  }
   inline void subtract_glyph_origin_for_direction (hb_codepoint_t glyph,
                                                    hb_direction_t direction,
                                                    hb_position_t *x, hb_position_t *y)
@@ -394,7 +497,7 @@
       hb_codepoint_t unichar;
       if (0 == strncmp (s, "uni", 3) &&
           hb_codepoint_parse (s + 3, len - 3, 16, &unichar) &&
-          get_glyph (unichar, 0, glyph))
+          get_nominal_glyph (unichar, glyph))
         return true;
     }
 
@@ -402,7 +505,13 @@
   }
 
   private:
-  inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t) (v * (int64_t) scale / face->get_upem ()); }
+  inline hb_position_t em_scale (int16_t v, int scale)
+  {
+    int upem = face->get_upem ();
+    int64_t scaled = v * (int64_t) scale;
+    scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */
+    return (hb_position_t) (scaled / upem);
+  }
 };
 
 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -45,130 +45,246 @@
  */
 
 static hb_bool_t
-hb_font_get_glyph_nil (hb_font_t *font,
-                       void *font_data HB_UNUSED,
-                       hb_codepoint_t unicode,
-                       hb_codepoint_t variation_selector,
-                       hb_codepoint_t *glyph,
-                       void *user_data HB_UNUSED)
+hb_font_get_font_h_extents_nil (hb_font_t *font,
+                                void *font_data HB_UNUSED,
+                                hb_font_extents_t *metrics,
+                                void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent->get_glyph (unicode, variation_selector, glyph);
+  memset (metrics, 0, sizeof (*metrics));
+  return false;
+}
+static hb_bool_t
+hb_font_get_font_h_extents_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_font_extents_t *metrics,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_font_h_extents (metrics);
+  if (ret) {
+    metrics->ascender = font->parent_scale_y_distance (metrics->ascender);
+    metrics->descender = font->parent_scale_y_distance (metrics->descender);
+    metrics->line_gap = font->parent_scale_y_distance (metrics->line_gap);
+  }
+  return ret;
+}
 
+static hb_bool_t
+hb_font_get_font_v_extents_nil (hb_font_t *font,
+                                void *font_data HB_UNUSED,
+                                hb_font_extents_t *metrics,
+                                void *user_data HB_UNUSED)
+{
+  memset (metrics, 0, sizeof (*metrics));
+  return false;
+}
+static hb_bool_t
+hb_font_get_font_v_extents_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_font_extents_t *metrics,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_font_v_extents (metrics);
+  if (ret) {
+    metrics->ascender = font->parent_scale_x_distance (metrics->ascender);
+    metrics->descender = font->parent_scale_x_distance (metrics->descender);
+    metrics->line_gap = font->parent_scale_x_distance (metrics->line_gap);
+  }
+  return ret;
+}
+
+static hb_bool_t
+hb_font_get_nominal_glyph_nil (hb_font_t *font HB_UNUSED,
+                               void *font_data HB_UNUSED,
+                               hb_codepoint_t unicode,
+                               hb_codepoint_t *glyph,
+                               void *user_data HB_UNUSED)
+{
   *glyph = 0;
   return false;
 }
+static hb_bool_t
+hb_font_get_nominal_glyph_parent (hb_font_t *font,
+                                  void *font_data HB_UNUSED,
+                                  hb_codepoint_t unicode,
+                                  hb_codepoint_t *glyph,
+                                  void *user_data HB_UNUSED)
+{
+  return font->parent->get_nominal_glyph (unicode, glyph);
+}
+
+static hb_bool_t
+hb_font_get_variation_glyph_nil (hb_font_t *font HB_UNUSED,
+                                 void *font_data HB_UNUSED,
+                                 hb_codepoint_t unicode,
+                                 hb_codepoint_t variation_selector,
+                                 hb_codepoint_t *glyph,
+                                 void *user_data HB_UNUSED)
+{
+  *glyph = 0;
+  return false;
+}
+static hb_bool_t
+hb_font_get_variation_glyph_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t unicode,
+                                    hb_codepoint_t variation_selector,
+                                    hb_codepoint_t *glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent->get_variation_glyph (unicode, variation_selector, glyph);
+}
+
 
 static hb_position_t
-hb_font_get_glyph_h_advance_nil (hb_font_t *font,
+hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
-
   return font->x_scale;
 }
+static hb_position_t
+hb_font_get_glyph_h_advance_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
+}
 
 static hb_position_t
-hb_font_get_glyph_v_advance_nil (hb_font_t *font,
+hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
-
+  /* TODO use font_extents.ascender+descender */
   return font->y_scale;
 }
+static hb_position_t
+hb_font_get_glyph_v_advance_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
+}
 
 static hb_bool_t
-hb_font_get_glyph_h_origin_nil (hb_font_t *font,
+hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
                                 void *font_data HB_UNUSED,
                                 hb_codepoint_t glyph,
                                 hb_position_t *x,
                                 hb_position_t *y,
                                 void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
-    if (ret)
-      font->parent_scale_position (x, y);
-    return ret;
-  }
-
   *x = *y = 0;
-  return false;
+  return true;
+}
+static hb_bool_t
+hb_font_get_glyph_h_origin_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_codepoint_t glyph,
+                                   hb_position_t *x,
+                                   hb_position_t *y,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
+  if (ret)
+    font->parent_scale_position (x, y);
+  return ret;
 }
 
 static hb_bool_t
-hb_font_get_glyph_v_origin_nil (hb_font_t *font,
+hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
                                 void *font_data HB_UNUSED,
                                 hb_codepoint_t glyph,
                                 hb_position_t *x,
                                 hb_position_t *y,
                                 void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
-    if (ret)
-      font->parent_scale_position (x, y);
-    return ret;
-  }
-
   *x = *y = 0;
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_v_origin_parent (hb_font_t *font,
+                                   void *font_data HB_UNUSED,
+                                   hb_codepoint_t glyph,
+                                   hb_position_t *x,
+                                   hb_position_t *y,
+                                   void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
+  if (ret)
+    font->parent_scale_position (x, y);
+  return ret;
+}
 
 static hb_position_t
-hb_font_get_glyph_h_kerning_nil (hb_font_t *font,
+hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t left_glyph,
                                  hb_codepoint_t right_glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
-
   return 0;
 }
+static hb_position_t
+hb_font_get_glyph_h_kerning_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t left_glyph,
+                                    hb_codepoint_t right_glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
+}
 
 static hb_position_t
-hb_font_get_glyph_v_kerning_nil (hb_font_t *font,
+hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  hb_codepoint_t top_glyph,
                                  hb_codepoint_t bottom_glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
-
   return 0;
 }
+static hb_position_t
+hb_font_get_glyph_v_kerning_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t top_glyph,
+                                    hb_codepoint_t bottom_glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
+}
 
 static hb_bool_t
-hb_font_get_glyph_extents_nil (hb_font_t *font,
+hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
                                void *font_data HB_UNUSED,
                                hb_codepoint_t glyph,
                                hb_glyph_extents_t *extents,
                                void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
-    if (ret) {
-      font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
-      font->parent_scale_distance (&extents->width, &extents->height);
-    }
-    return ret;
-  }
-
   memset (extents, 0, sizeof (*extents));
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_extents_parent (hb_font_t *font,
+                                  void *font_data HB_UNUSED,
+                                  hb_codepoint_t glyph,
+                                  hb_glyph_extents_t *extents,
+                                  void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
+  if (ret) {
+    font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
+    font->parent_scale_distance (&extents->width, &extents->height);
+  }
+  return ret;
+}
 
 static hb_bool_t
-hb_font_get_glyph_contour_point_nil (hb_font_t *font,
+hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
                                      void *font_data HB_UNUSED,
                                      hb_codepoint_t glyph,
                                      unsigned int point_index,
@@ -176,45 +292,63 @@
                                      hb_position_t *y,
                                      void *user_data HB_UNUSED)
 {
-  if (font->parent) {
-    hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
-    if (ret)
-      font->parent_scale_position (x, y);
-    return ret;
-  }
-
   *x = *y = 0;
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_contour_point_parent (hb_font_t *font,
+                                        void *font_data HB_UNUSED,
+                                        hb_codepoint_t glyph,
+                                        unsigned int point_index,
+                                        hb_position_t *x,
+                                        hb_position_t *y,
+                                        void *user_data HB_UNUSED)
+{
+  hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
+  if (ret)
+    font->parent_scale_position (x, y);
+  return ret;
+}
 
 static hb_bool_t
-hb_font_get_glyph_name_nil (hb_font_t *font,
+hb_font_get_glyph_name_nil (hb_font_t *font HB_UNUSED,
                             void *font_data HB_UNUSED,
                             hb_codepoint_t glyph,
                             char *name, unsigned int size,
                             void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent->get_glyph_name (glyph, name, size);
-
   if (size) *name = '\0';
   return false;
 }
+static hb_bool_t
+hb_font_get_glyph_name_parent (hb_font_t *font,
+                               void *font_data HB_UNUSED,
+                               hb_codepoint_t glyph,
+                               char *name, unsigned int size,
+                               void *user_data HB_UNUSED)
+{
+  return font->parent->get_glyph_name (glyph, name, size);
+}
 
 static hb_bool_t
-hb_font_get_glyph_from_name_nil (hb_font_t *font,
+hb_font_get_glyph_from_name_nil (hb_font_t *font HB_UNUSED,
                                  void *font_data HB_UNUSED,
                                  const char *name, int len, /* -1 means nul-terminated */
                                  hb_codepoint_t *glyph,
                                  void *user_data HB_UNUSED)
 {
-  if (font->parent)
-    return font->parent->get_glyph_from_name (name, len, glyph);
-
   *glyph = 0;
   return false;
 }
-
+static hb_bool_t
+hb_font_get_glyph_from_name_parent (hb_font_t *font,
+                                    void *font_data HB_UNUSED,
+                                    const char *name, int len, /* -1 means nul-terminated */
+                                    hb_codepoint_t *glyph,
+                                    void *user_data HB_UNUSED)
+{
+  return font->parent->get_glyph_from_name (name, len, glyph);
+}
 
 static const hb_font_funcs_t _hb_font_funcs_nil = {
   HB_OBJECT_HEADER_STATIC,
@@ -222,9 +356,44 @@
   true, /* immutable */
 
   {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
     HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+    {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
+      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+    }
+  }
+};
+static const hb_font_funcs_t _hb_font_funcs_parent = {
+  HB_OBJECT_HEADER_STATIC,
+
+  true, /* immutable */
+
+  {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+    HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+  },
+  {
+    {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_parent,
+      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+    }
   }
 };
 
@@ -246,7 +415,7 @@
   if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
     return hb_font_funcs_get_empty ();
 
-  ffuncs->get = _hb_font_funcs_nil.get;
+  ffuncs->get = _hb_font_funcs_parent.get;
 
   return ffuncs;
 }
@@ -263,7 +432,7 @@
 hb_font_funcs_t *
 hb_font_funcs_get_empty (void)
 {
-  return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil);
+  return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_parent);
 }
 
 /**
@@ -398,11 +567,11 @@
     ffuncs->destroy.name (ffuncs->user_data.name);                       \
                                                                          \
   if (func) {                                                            \
-    ffuncs->get.name = func;                                             \
+    ffuncs->get.f.name = func;                                           \
     ffuncs->user_data.name = user_data;                                  \
     ffuncs->destroy.name = destroy;                                      \
   } else {                                                               \
-    ffuncs->get.name = hb_font_get_##name##_nil;                         \
+    ffuncs->get.f.name = hb_font_get_##name##_parent;                    \
     ffuncs->user_data.name = NULL;                                       \
     ffuncs->destroy.name = NULL;                                         \
   }                                                                      \
@@ -411,10 +580,53 @@
 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
 
+bool
+hb_font_t::has_func (unsigned int i)
+{
+  if (parent && parent != hb_font_get_empty () && parent->has_func (i))
+    return true;
+  return this->klass->get.array[i] != _hb_font_funcs_parent.get.array[i];
+}
 
 /* Public getters */
 
 /**
+ * hb_font_get_h_extents:
+ * @font: a font.
+ * @extents: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.1.3
+ **/
+hb_bool_t
+hb_font_get_h_extents (hb_font_t *font,
+                       hb_font_extents_t *extents)
+{
+  return font->get_font_h_extents (extents);
+}
+
+/**
+ * hb_font_get_v_extents:
+ * @font: a font.
+ * @extents: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.1.3
+ **/
+hb_bool_t
+hb_font_get_v_extents (hb_font_t *font,
+                       hb_font_extents_t *extents)
+{
+  return font->get_font_v_extents (extents);
+}
+
+/**
  * hb_font_get_glyph:
  * @font: a font.
  * @unicode:
@@ -432,7 +644,50 @@
                    hb_codepoint_t unicode, hb_codepoint_t variation_selector,
                    hb_codepoint_t *glyph)
 {
-  return font->get_glyph (unicode, variation_selector, glyph);
+  if (unlikely (variation_selector))
+    return font->get_variation_glyph (unicode, variation_selector, glyph);
+  return font->get_nominal_glyph (unicode, glyph);
+}
+
+/**
+ * hb_font_get_nominal_glyph:
+ * @font: a font.
+ * @unicode:
+ * @glyph: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.2.3
+ **/
+hb_bool_t
+hb_font_get_nominal_glyph (hb_font_t *font,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t *glyph)
+{
+  return font->get_nominal_glyph (unicode, glyph);
+}
+
+/**
+ * hb_font_get_variation_glyph:
+ * @font: a font.
+ * @unicode:
+ * @variation_selector:
+ * @glyph: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.2.3
+ **/
+hb_bool_t
+hb_font_get_variation_glyph (hb_font_t *font,
+                             hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                             hb_codepoint_t *glyph)
+{
+  return font->get_variation_glyph (unicode, variation_selector, glyph);
 }
 
 /**
@@ -639,6 +894,23 @@
 /* A bit higher-level, and with fallback */
 
 /**
+ * hb_font_get_extents_for_direction:
+ * @font: a font.
+ * @direction:
+ * @extents:
+ *
+ *
+ *
+ * Since: 1.1.3
+ **/
+void
+hb_font_get_extents_for_direction (hb_font_t *font,
+                                   hb_direction_t direction,
+                                   hb_font_extents_t *extents)
+{
+  return font->get_extents_for_direction (direction, extents);
+}
+/**
  * hb_font_get_glyph_advance_for_direction:
  * @font: a font.
  * @glyph:
@@ -858,6 +1130,7 @@
     return hb_font_get_empty ();
 
   hb_face_make_immutable (face);
+  font->parent = hb_font_get_empty ();
   font->face = hb_face_reference (face);
   font->klass = hb_font_funcs_get_empty ();
 
@@ -917,8 +1190,8 @@
     NULL, /* parent */
     const_cast<hb_face_t *> (&_hb_face_nil),
 
-    0, /* x_scale */
-    0, /* y_scale */
+    1000, /* x_scale */
+    1000, /* y_scale */
 
     0, /* x_ppem */
     0, /* y_ppem */
@@ -1264,3 +1537,131 @@
   if (x_ppem) *x_ppem = font->x_ppem;
   if (y_ppem) *y_ppem = font->y_ppem;
 }
+
+
+#ifndef HB_DISABLE_DEPRECATED
+
+/*
+ * Deprecated get_glyph_func():
+ */
+
+struct hb_trampoline_closure_t
+{
+  void *user_data;
+  hb_destroy_func_t destroy;
+  unsigned int ref_count;
+};
+
+template <typename FuncType>
+struct hb_trampoline_t
+{
+  hb_trampoline_closure_t closure; /* Must be first. */
+  FuncType func;
+};
+
+template <typename FuncType>
+static hb_trampoline_t<FuncType> *
+trampoline_create (FuncType           func,
+                   void              *user_data,
+                   hb_destroy_func_t  destroy)
+{
+  typedef hb_trampoline_t<FuncType> trampoline_t;
+
+  trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
+
+  if (unlikely (!trampoline))
+    return NULL;
+
+  trampoline->closure.user_data = user_data;
+  trampoline->closure.destroy = destroy;
+  trampoline->closure.ref_count = 1;
+  trampoline->func = func;
+
+  return trampoline;
+}
+
+static void
+trampoline_reference (hb_trampoline_closure_t *closure)
+{
+  closure->ref_count++;
+}
+
+static void
+trampoline_destroy (void *user_data)
+{
+  hb_trampoline_closure_t *closure = (hb_trampoline_closure_t *) user_data;
+
+  if (--closure->ref_count)
+    return;
+
+  if (closure->destroy)
+    closure->destroy (closure->user_data);
+  free (closure);
+}
+
+typedef hb_trampoline_t<hb_font_get_glyph_func_t> hb_font_get_glyph_trampoline_t;
+
+static hb_bool_t
+hb_font_get_nominal_glyph_trampoline (hb_font_t *font,
+                                      void *font_data,
+                                      hb_codepoint_t unicode,
+                                      hb_codepoint_t *glyph,
+                                      void *user_data)
+{
+  hb_font_get_glyph_trampoline_t *trampoline = (hb_font_get_glyph_trampoline_t *) user_data;
+  return trampoline->func (font, font_data, unicode, 0, glyph, trampoline->closure.user_data);
+}
+
+static hb_bool_t
+hb_font_get_variation_glyph_trampoline (hb_font_t *font,
+                                        void *font_data,
+                                        hb_codepoint_t unicode,
+                                        hb_codepoint_t variation_selector,
+                                        hb_codepoint_t *glyph,
+                                        void *user_data)
+{
+  hb_font_get_glyph_trampoline_t *trampoline = (hb_font_get_glyph_trampoline_t *) user_data;
+  return trampoline->func (font, font_data, unicode, variation_selector, glyph, trampoline->closure.user_data);
+}
+
+/**
+ * hb_font_funcs_set_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ * Deprecated.  Use hb_font_funcs_set_nominal_glyph_func() and
+ * hb_font_funcs_set_variation_glyph_func() instead.
+ *
+ * Since: 0.9.2
+ * Deprecated: 1.2.3
+ **/
+void
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+                              hb_font_get_glyph_func_t func,
+                              void *user_data, hb_destroy_func_t destroy)
+{
+  hb_font_get_glyph_trampoline_t *trampoline;
+
+  trampoline = trampoline_create (func, user_data, destroy);
+  if (unlikely (!trampoline))
+  {
+    if (destroy)
+      destroy (user_data);
+    return;
+  }
+
+  hb_font_funcs_set_nominal_glyph_func (ffuncs,
+                                        hb_font_get_nominal_glyph_trampoline,
+                                        trampoline,
+                                        trampoline_destroy);
+
+  trampoline_reference (&trampoline->closure);
+  hb_font_funcs_set_variation_glyph_func (ffuncs,
+                                          hb_font_get_variation_glyph_trampoline,
+                                          trampoline,
+                                          trampoline_destroy);
+}
+
+#endif /* HB_DISABLE_DEPRECATED */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h	Tue Aug 09 16:20:02 2016 -0700
@@ -46,19 +46,19 @@
 
 typedef struct hb_font_funcs_t hb_font_funcs_t;
 
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
 hb_font_funcs_create (void);
 
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
 hb_font_funcs_get_empty (void);
 
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
 hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
 
-void
+HB_EXTERN void
 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_funcs_set_user_data (hb_font_funcs_t    *ffuncs,
                              hb_user_data_key_t *key,
                              void *              data,
@@ -66,19 +66,37 @@
                              hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_font_funcs_get_user_data (hb_font_funcs_t    *ffuncs,
                              hb_user_data_key_t *key);
 
 
-void
+HB_EXTERN void
 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
 
 
-/* glyph extents */
+/* font and glyph extents */
+
+/* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
+typedef struct hb_font_extents_t
+{
+  hb_position_t ascender; /* typographic ascender. */
+  hb_position_t descender; /* typographic descender. */
+  hb_position_t line_gap; /* suggested line spacing gap. */
+  /*< private >*/
+  hb_position_t reserved9;
+  hb_position_t reserved8;
+  hb_position_t reserved7;
+  hb_position_t reserved6;
+  hb_position_t reserved5;
+  hb_position_t reserved4;
+  hb_position_t reserved3;
+  hb_position_t reserved2;
+  hb_position_t reserved1;
+} hb_font_extents_t;
 
 /* Note that height is negative in coordinate systems that grow up. */
 typedef struct hb_glyph_extents_t
@@ -89,13 +107,23 @@
   hb_position_t height; /* distance from top to bottom side. */
 } hb_glyph_extents_t;
 
-
 /* func types */
 
-typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
-                                               hb_codepoint_t unicode, hb_codepoint_t variation_selector,
-                                               hb_codepoint_t *glyph,
-                                               void *user_data);
+typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,
+                                                       hb_font_extents_t *metrics,
+                                                       void *user_data);
+typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;
+typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;
+
+
+typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,
+                                                       hb_codepoint_t unicode,
+                                                       hb_codepoint_t *glyph,
+                                                       void *user_data);
+typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,
+                                                         hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                                                         hb_codepoint_t *glyph,
+                                                         void *user_data);
 
 
 typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
@@ -141,7 +169,7 @@
 /* func setters */
 
 /**
- * hb_font_funcs_set_glyph_func:
+ * hb_font_funcs_set_font_h_extents_func:
  * @ffuncs: font functions.
  * @func: (closure user_data) (destroy destroy) (scope notified):
  * @user_data:
@@ -149,12 +177,60 @@
  *
  *
  *
- * Since: 0.9.2
+ * Since: 1.1.2
  **/
-void
-hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
-                              hb_font_get_glyph_func_t func,
-                              void *user_data, hb_destroy_func_t destroy);
+HB_EXTERN void
+hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,
+                                       hb_font_get_font_h_extents_func_t func,
+                                       void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_font_v_extents_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.2
+ **/
+HB_EXTERN void
+hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,
+                                       hb_font_get_font_v_extents_func_t func,
+                                       void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_nominal_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.2.3
+ **/
+HB_EXTERN void
+hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
+                                      hb_font_get_nominal_glyph_func_t func,
+                                      void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_variation_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.2.3
+ **/
+HB_EXTERN void
+hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,
+                                        hb_font_get_variation_glyph_func_t func,
+                                        void *user_data, hb_destroy_func_t destroy);
 
 /**
  * hb_font_funcs_set_glyph_h_advance_func:
@@ -167,7 +243,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_h_advance_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -183,7 +259,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_v_advance_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -199,7 +275,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
                                        hb_font_get_glyph_h_origin_func_t func,
                                        void *user_data, hb_destroy_func_t destroy);
@@ -215,7 +291,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
                                        hb_font_get_glyph_v_origin_func_t func,
                                        void *user_data, hb_destroy_func_t destroy);
@@ -231,7 +307,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_h_kerning_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -247,7 +323,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_v_kerning_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
@@ -263,7 +339,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
                                       hb_font_get_glyph_extents_func_t func,
                                       void *user_data, hb_destroy_func_t destroy);
@@ -279,7 +355,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
                                             hb_font_get_glyph_contour_point_func_t func,
                                             void *user_data, hb_destroy_func_t destroy);
@@ -295,7 +371,7 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
                                    hb_font_get_glyph_name_func_t func,
                                    void *user_data, hb_destroy_func_t destroy);
@@ -311,110 +387,131 @@
  *
  * Since: 0.9.2
  **/
-void
+HB_EXTERN void
 hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
                                         hb_font_get_glyph_from_name_func_t func,
                                         void *user_data, hb_destroy_func_t destroy);
 
-
 /* func dispatch */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
+hb_font_get_h_extents (hb_font_t *font,
+                       hb_font_extents_t *extents);
+HB_EXTERN hb_bool_t
+hb_font_get_v_extents (hb_font_t *font,
+                       hb_font_extents_t *extents);
+
+HB_EXTERN hb_bool_t
+hb_font_get_nominal_glyph (hb_font_t *font,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t *glyph);
+HB_EXTERN hb_bool_t
+hb_font_get_variation_glyph (hb_font_t *font,
+                             hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+                             hb_codepoint_t *glyph);
+
+HB_EXTERN hb_position_t
+hb_font_get_glyph_h_advance (hb_font_t *font,
+                             hb_codepoint_t glyph);
+HB_EXTERN hb_position_t
+hb_font_get_glyph_v_advance (hb_font_t *font,
+                             hb_codepoint_t glyph);
+
+HB_EXTERN hb_bool_t
+hb_font_get_glyph_h_origin (hb_font_t *font,
+                            hb_codepoint_t glyph,
+                            hb_position_t *x, hb_position_t *y);
+HB_EXTERN hb_bool_t
+hb_font_get_glyph_v_origin (hb_font_t *font,
+                            hb_codepoint_t glyph,
+                            hb_position_t *x, hb_position_t *y);
+
+HB_EXTERN hb_position_t
+hb_font_get_glyph_h_kerning (hb_font_t *font,
+                             hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
+HB_EXTERN hb_position_t
+hb_font_get_glyph_v_kerning (hb_font_t *font,
+                             hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph);
+
+HB_EXTERN hb_bool_t
+hb_font_get_glyph_extents (hb_font_t *font,
+                           hb_codepoint_t glyph,
+                           hb_glyph_extents_t *extents);
+
+HB_EXTERN hb_bool_t
+hb_font_get_glyph_contour_point (hb_font_t *font,
+                                 hb_codepoint_t glyph, unsigned int point_index,
+                                 hb_position_t *x, hb_position_t *y);
+
+HB_EXTERN hb_bool_t
+hb_font_get_glyph_name (hb_font_t *font,
+                        hb_codepoint_t glyph,
+                        char *name, unsigned int size);
+HB_EXTERN hb_bool_t
+hb_font_get_glyph_from_name (hb_font_t *font,
+                             const char *name, int len, /* -1 means nul-terminated */
+                             hb_codepoint_t *glyph);
+
+
+/* high-level funcs, with fallback */
+
+/* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
+ * otherwise callse hb_font_get_variation_glyph(). */
+HB_EXTERN hb_bool_t
 hb_font_get_glyph (hb_font_t *font,
                    hb_codepoint_t unicode, hb_codepoint_t variation_selector,
                    hb_codepoint_t *glyph);
 
-hb_position_t
-hb_font_get_glyph_h_advance (hb_font_t *font,
-                             hb_codepoint_t glyph);
-hb_position_t
-hb_font_get_glyph_v_advance (hb_font_t *font,
-                             hb_codepoint_t glyph);
-
-hb_bool_t
-hb_font_get_glyph_h_origin (hb_font_t *font,
-                            hb_codepoint_t glyph,
-                            hb_position_t *x, hb_position_t *y);
-hb_bool_t
-hb_font_get_glyph_v_origin (hb_font_t *font,
-                            hb_codepoint_t glyph,
-                            hb_position_t *x, hb_position_t *y);
-
-hb_position_t
-hb_font_get_glyph_h_kerning (hb_font_t *font,
-                             hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
-hb_position_t
-hb_font_get_glyph_v_kerning (hb_font_t *font,
-                             hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph);
-
-hb_bool_t
-hb_font_get_glyph_extents (hb_font_t *font,
-                           hb_codepoint_t glyph,
-                           hb_glyph_extents_t *extents);
-
-hb_bool_t
-hb_font_get_glyph_contour_point (hb_font_t *font,
-                                 hb_codepoint_t glyph, unsigned int point_index,
-                                 hb_position_t *x, hb_position_t *y);
-
-hb_bool_t
-hb_font_get_glyph_name (hb_font_t *font,
-                        hb_codepoint_t glyph,
-                        char *name, unsigned int size);
-hb_bool_t
-hb_font_get_glyph_from_name (hb_font_t *font,
-                             const char *name, int len, /* -1 means nul-terminated */
-                             hb_codepoint_t *glyph);
-
-
-/* high-level funcs, with fallback */
-
-void
+HB_EXTERN void
+hb_font_get_extents_for_direction (hb_font_t *font,
+                                   hb_direction_t direction,
+                                   hb_font_extents_t *extents);
+HB_EXTERN void
 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
                                          hb_codepoint_t glyph,
                                          hb_direction_t direction,
                                          hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
                                         hb_codepoint_t glyph,
                                         hb_direction_t direction,
                                         hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
                                         hb_codepoint_t glyph,
                                         hb_direction_t direction,
                                         hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
                                              hb_codepoint_t glyph,
                                              hb_direction_t direction,
                                              hb_position_t *x, hb_position_t *y);
 
-void
+HB_EXTERN void
 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
                                          hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
                                          hb_direction_t direction,
                                          hb_position_t *x, hb_position_t *y);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
                                       hb_codepoint_t glyph,
                                       hb_direction_t direction,
                                       hb_glyph_extents_t *extents);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
                                             hb_codepoint_t glyph, unsigned int point_index,
                                             hb_direction_t direction,
                                             hb_position_t *x, hb_position_t *y);
 
 /* Generates gidDDD if glyph has no name. */
-void
+HB_EXTERN void
 hb_font_glyph_to_string (hb_font_t *font,
                          hb_codepoint_t glyph,
                          char *s, unsigned int size);
 /* Parses gidDDD and uniUUUU strings automatically. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_glyph_from_string (hb_font_t *font,
                            const char *s, int len, /* -1 means nul-terminated */
                            hb_codepoint_t *glyph);
@@ -426,22 +523,22 @@
 
 /* Fonts are very light-weight objects */
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_create (hb_face_t *face);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_create_sub_font (hb_font_t *parent);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_get_empty (void);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_reference (hb_font_t *font);
 
-void
+HB_EXTERN void
 hb_font_destroy (hb_font_t *font);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_set_user_data (hb_font_t          *font,
                        hb_user_data_key_t *key,
                        void *              data,
@@ -449,46 +546,46 @@
                        hb_bool_t           replace);
 
 
-void *
+HB_EXTERN void *
 hb_font_get_user_data (hb_font_t          *font,
                        hb_user_data_key_t *key);
 
-void
+HB_EXTERN void
 hb_font_make_immutable (hb_font_t *font);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_font_is_immutable (hb_font_t *font);
 
-void
+HB_EXTERN void
 hb_font_set_parent (hb_font_t *font,
                     hb_font_t *parent);
 
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_font_get_parent (hb_font_t *font);
 
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_font_get_face (hb_font_t *font);
 
 
-void
+HB_EXTERN void
 hb_font_set_funcs (hb_font_t         *font,
                    hb_font_funcs_t   *klass,
                    void              *font_data,
                    hb_destroy_func_t  destroy);
 
 /* Be *very* careful with this function! */
-void
+HB_EXTERN void
 hb_font_set_funcs_data (hb_font_t         *font,
                         void              *font_data,
                         hb_destroy_func_t  destroy);
 
 
-void
+HB_EXTERN void
 hb_font_set_scale (hb_font_t *font,
                    int x_scale,
                    int y_scale);
 
-void
+HB_EXTERN void
 hb_font_get_scale (hb_font_t *font,
                    int *x_scale,
                    int *y_scale);
@@ -496,12 +593,12 @@
 /*
  * A zero value means "no hinting in that direction"
  */
-void
+HB_EXTERN void
 hb_font_set_ppem (hb_font_t *font,
                   unsigned int x_ppem,
                   unsigned int y_ppem);
 
-void
+HB_EXTERN void
 hb_font_get_ppem (hb_font_t *font,
                   unsigned int *x_ppem,
                   unsigned int *y_ppem);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -70,11 +70,12 @@
 {
   FT_Face ft_face;
   int load_flags;
+  bool symbol; /* Whether selected cmap is symbol cmap. */
   bool unref; /* Whether to destroy ft_face when done. */
 };
 
 static hb_ft_font_t *
-_hb_ft_font_create (FT_Face ft_face, bool unref)
+_hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
 {
   hb_ft_font_t *ft_font = (hb_ft_font_t *) calloc (1, sizeof (hb_ft_font_t));
 
@@ -82,6 +83,7 @@
     return NULL;
 
   ft_font->ft_face = ft_face;
+  ft_font->symbol = symbol;
   ft_font->unref = unref;
 
   ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
@@ -90,10 +92,16 @@
 }
 
 static void
+_hb_ft_face_destroy (FT_Face ft_face)
+{
+  FT_Done_Face (ft_face);
+}
+
+static void
 _hb_ft_font_destroy (hb_ft_font_t *ft_font)
 {
   if (ft_font->unref)
-    FT_Done_Face (ft_font->ft_face);
+    _hb_ft_face_destroy (ft_font->ft_face);
 
   free (ft_font);
 }
@@ -155,21 +163,46 @@
 
 
 static hb_bool_t
-hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
-                 void *font_data,
-                 hb_codepoint_t unicode,
-                 hb_codepoint_t variation_selector,
-                 hb_codepoint_t *glyph,
-                 void *user_data HB_UNUSED)
-
+hb_ft_get_nominal_glyph (hb_font_t *font HB_UNUSED,
+                         void *font_data,
+                         hb_codepoint_t unicode,
+                         hb_codepoint_t *glyph,
+                         void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
-  unsigned int g;
+  unsigned int g = FT_Get_Char_Index (ft_font->ft_face, unicode);
 
-  if (likely (!variation_selector))
-    g = FT_Get_Char_Index (ft_font->ft_face, unicode);
-  else
-    g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, variation_selector);
+  if (unlikely (!g))
+  {
+    if (unlikely (ft_font->symbol) && unicode <= 0x00FFu)
+    {
+      /* For symbol-encoded OpenType fonts, we duplicate the
+       * U+F000..F0FF range at U+0000..U+00FF.  That's what
+       * Windows seems to do, and that's hinted about at:
+       * http://www.microsoft.com/typography/otspec/recom.htm
+       * under "Non-Standard (Symbol) Fonts". */
+      g = FT_Get_Char_Index (ft_font->ft_face, 0xF000u + unicode);
+      if (!g)
+        return false;
+    }
+    else
+      return false;
+  }
+
+  *glyph = g;
+  return true;
+}
+
+static hb_bool_t
+hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED,
+                           void *font_data,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t variation_selector,
+                           hb_codepoint_t *glyph,
+                           void *user_data HB_UNUSED)
+{
+  const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  unsigned int g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, variation_selector);
 
   if (unlikely (!g))
     return false;
@@ -217,18 +250,6 @@
 }
 
 static hb_bool_t
-hb_ft_get_glyph_h_origin (hb_font_t *font HB_UNUSED,
-                          void *font_data HB_UNUSED,
-                          hb_codepoint_t glyph HB_UNUSED,
-                          hb_position_t *x HB_UNUSED,
-                          hb_position_t *y HB_UNUSED,
-                          void *user_data HB_UNUSED)
-{
-  /* We always work in the horizontal coordinates. */
-  return true;
-}
-
-static hb_bool_t
 hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
                           void *font_data,
                           hb_codepoint_t glyph,
@@ -272,17 +293,6 @@
   return kerningv.x;
 }
 
-static hb_position_t
-hb_ft_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
-                           void *font_data HB_UNUSED,
-                           hb_codepoint_t top_glyph HB_UNUSED,
-                           hb_codepoint_t bottom_glyph HB_UNUSED,
-                           void *user_data HB_UNUSED)
-{
-  /* FreeType API doesn't support vertical kerning */
-  return 0;
-}
-
 static hb_bool_t
 hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
                          void *font_data,
@@ -300,6 +310,16 @@
   extents->y_bearing = ft_face->glyph->metrics.horiBearingY;
   extents->width = ft_face->glyph->metrics.width;
   extents->height = -ft_face->glyph->metrics.height;
+  if (font->x_scale < 0)
+  {
+    extents->x_bearing = -extents->x_bearing;
+    extents->width = -extents->width;
+  }
+  if (font->y_scale < 0)
+  {
+    extents->y_bearing = -extents->y_bearing;
+    extents->height = -extents->height;
+  }
   return true;
 }
 
@@ -379,25 +399,78 @@
   return *glyph != 0;
 }
 
+static hb_bool_t
+hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_font_extents_t *metrics,
+                          void *user_data HB_UNUSED)
+{
+  const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  FT_Face ft_face = ft_font->ft_face;
+  metrics->ascender = ft_face->size->metrics.ascender;
+  metrics->descender = ft_face->size->metrics.descender;
+  metrics->line_gap = ft_face->size->metrics.height - (ft_face->size->metrics.ascender - ft_face->size->metrics.descender);
+  if (font->y_scale < 0)
+  {
+    metrics->ascender = -metrics->ascender;
+    metrics->descender = -metrics->descender;
+    metrics->line_gap = -metrics->line_gap;
+  }
+  return true;
+}
+
+static hb_font_funcs_t *static_ft_funcs = NULL;
+
+#ifdef HB_USE_ATEXIT
+static
+void free_static_ft_funcs (void)
+{
+  hb_font_funcs_destroy (static_ft_funcs);
+}
+#endif
 
 static void
 _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
 {
-  static const hb_font_funcs_t ft_ffuncs = {
-    HB_OBJECT_HEADER_STATIC,
+retry:
+  hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_funcs);
 
-    true, /* immutable */
+  if (unlikely (!funcs))
+  {
+    funcs = hb_font_funcs_create ();
 
-    {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_ft_get_##name,
-      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
+    hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, NULL, NULL);
+    //hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, NULL, NULL);
+    hb_font_funcs_set_nominal_glyph_func (funcs, hb_ft_get_nominal_glyph, NULL, NULL);
+    hb_font_funcs_set_variation_glyph_func (funcs, hb_ft_get_variation_glyph, NULL, NULL);
+    hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NULL, NULL);
+    hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NULL, NULL);
+    //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NULL, NULL);
+    hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL, NULL);
+    hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NULL, NULL);
+    //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, NULL, NULL);
+    hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL, NULL);
+    hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_point, NULL, NULL);
+    hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL);
+    hb_font_funcs_set_glyph_from_name_func (funcs, hb_ft_get_glyph_from_name, NULL, NULL);
+
+    hb_font_funcs_make_immutable (funcs);
+
+    if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, NULL, funcs)) {
+      hb_font_funcs_destroy (funcs);
+      goto retry;
     }
+
+#ifdef HB_USE_ATEXIT
+    atexit (free_static_ft_funcs); /* First person registers atexit() callback. */
+#endif
   };
 
+  bool symbol = ft_face->charmap && ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL;
+
   hb_font_set_funcs (font,
-                     const_cast<hb_font_funcs_t *> (&ft_ffuncs),
-                     _hb_ft_font_create (ft_face, unref),
+                     funcs,
+                     _hb_ft_font_create (ft_face, symbol, unref),
                      (hb_destroy_func_t) _hb_ft_font_destroy);
 }
 
@@ -477,7 +550,7 @@
 hb_ft_face_create_referenced (FT_Face ft_face)
 {
   FT_Reference_Face (ft_face);
-  return hb_ft_face_create (ft_face, (hb_destroy_func_t) FT_Done_Face);
+  return hb_ft_face_create (ft_face, (hb_destroy_func_t) _hb_ft_face_destroy);
 }
 
 static void
@@ -557,7 +630,7 @@
 hb_ft_font_create_referenced (FT_Face ft_face)
 {
   FT_Reference_Face (ft_face);
-  return hb_ft_font_create (ft_face, (hb_destroy_func_t) FT_Done_Face);
+  return hb_ft_font_create (ft_face, (hb_destroy_func_t) _hb_ft_face_destroy);
 }
 
 
@@ -626,7 +699,8 @@
     return;
   }
 
-  FT_Select_Charmap (ft_face, FT_ENCODING_UNICODE);
+  if (FT_Select_Charmap (ft_face, FT_ENCODING_UNICODE))
+    FT_Select_Charmap (ft_face, FT_ENCODING_MS_SYMBOL);
 
   FT_Set_Char_Size (ft_face,
                     abs (font->x_scale), abs (font->y_scale),
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.h	Tue Aug 09 16:20:02 2016 -0700
@@ -59,7 +59,7 @@
  * probably should use (the more recent) hb_ft_face_create_referenced()
  * instead.
  */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_ft_face_create (FT_Face           ft_face,
                    hb_destroy_func_t destroy);
 
@@ -71,7 +71,7 @@
  * Client is still responsible for making sure that ft-face is destroyed
  * after hb-face is.
  */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_ft_face_create_cached (FT_Face ft_face);
 
 /* This version is like hb_ft_face_create(), except that it calls
@@ -81,7 +81,7 @@
  * This is the most convenient version to use.  Use it unless you have
  * very good reasons not to.
  */
-hb_face_t *
+HB_EXTERN hb_face_t *
 hb_ft_face_create_referenced (FT_Face ft_face);
 
 
@@ -98,26 +98,26 @@
 
 /* See notes on hb_ft_face_create().  Same issues re lifecycle-management
  * apply here.  Use hb_ft_font_create_referenced() if you can. */
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_ft_font_create (FT_Face           ft_face,
                    hb_destroy_func_t destroy);
 
 /* See notes on hb_ft_face_create_referenced() re lifecycle-management
  * issues. */
-hb_font_t *
+HB_EXTERN hb_font_t *
 hb_ft_font_create_referenced (FT_Face ft_face);
 
-FT_Face
+HB_EXTERN FT_Face
 hb_ft_font_get_face (hb_font_t *font);
 
-void
+HB_EXTERN void
 hb_ft_font_set_load_flags (hb_font_t *font, int load_flags);
 
-int
+HB_EXTERN int
 hb_ft_font_get_load_flags (hb_font_t *font);
 
 /* Makes an hb_font_t use FreeType internally to implement font functions. */
-void
+HB_EXTERN void
 hb_ft_font_set_funcs (hb_font_t *font);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-file-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-file-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -140,7 +140,7 @@
 
   protected:
   Tag           ttcTag;         /* TrueType Collection ID string: 'ttcf' */
-  FixedVersion  version;        /* Version of the TTC Header (1.0),
+  FixedVersion<>version;        /* Version of the TTC Header (1.0),
                                  * 0x00010000u */
   ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
                 table;          /* Array of offsets to the OffsetTable for each font
@@ -187,7 +187,7 @@
   union {
   struct {
   Tag           ttcTag;         /* TrueType Collection ID string: 'ttcf' */
-  FixedVersion  version;        /* Version of the TTC Header (1.0 or 2.0),
+  FixedVersion<>version;        /* Version of the TTC Header (1.0 or 2.0),
                                  * 0x00010000u or 0x00020000u */
   }                     header;
   TTCHeaderVersion1     version1;
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -101,10 +101,8 @@
 #define DEFINE_SIZE_STATIC(size) \
   DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
   static const unsigned int static_size = (size); \
-  static const unsigned int min_size = (size)
-
-/* Size signifying variable-sized array */
-#define VAR 1
+  static const unsigned int min_size = (size); \
+  inline unsigned int get_size (void) const { return (size); }
 
 #define DEFINE_SIZE_UNION(size, _member) \
   DEFINE_INSTANCE_ASSERTION (this->u._member.static_size == (size)); \
@@ -185,7 +183,7 @@
 
 /* This limits sanitizing time on really broken fonts. */
 #ifndef HB_SANITIZE_MAX_EDITS
-#define HB_SANITIZE_MAX_EDITS 100
+#define HB_SANITIZE_MAX_EDITS 32
 #endif
 
 struct hb_sanitize_context_t :
@@ -399,9 +397,9 @@
 
 struct hb_serialize_context_t
 {
-  inline hb_serialize_context_t (void *start, unsigned int size)
+  inline hb_serialize_context_t (void *start_, unsigned int size)
   {
-    this->start = (char *) start;
+    this->start = (char *) start_;
     this->end = this->start + size;
 
     this->ran_out_of_room = false;
@@ -495,10 +493,10 @@
     return reinterpret_cast<Type *> (&obj);
   }
 
-  inline void truncate (void *head)
+  inline void truncate (void *new_head)
   {
-    assert (this->start < head && head <= this->head);
-    this->head = (char *) head;
+    assert (this->start < new_head && new_head <= this->head);
+    this->head = (char *) new_head;
   }
 
   unsigned int debug_depth;
@@ -665,6 +663,24 @@
 /* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
 typedef USHORT UFWORD;
 
+/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
+struct F2DOT14 : SHORT
+{
+  //inline float to_float (void) const { return ???; }
+  //inline void set_float (float f) { v.set (f * ???); }
+  public:
+  DEFINE_SIZE_STATIC (2);
+};
+
+/* 32-bit signed fixed-point number (16.16). */
+struct Fixed: LONG
+{
+  //inline float to_float (void) const { return ???; }
+  //inline void set_float (float f) { v.set (f * ???); }
+  public:
+  DEFINE_SIZE_STATIC (4);
+};
+
 /* Date represented in number of seconds since 12:00 midnight, January 1,
  * 1904. The value is represented as a signed 64-bit integer. */
 struct LONGDATETIME
@@ -742,9 +758,10 @@
  * Version Numbers
  */
 
+template <typename FixedType=USHORT>
 struct FixedVersion
 {
-  inline uint32_t to_int (void) const { return (major << 16) + minor; }
+  inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -752,10 +769,10 @@
     return_trace (c->check_struct (this));
   }
 
-  USHORT major;
-  USHORT minor;
+  FixedType major;
+  FixedType minor;
   public:
-  DEFINE_SIZE_STATIC (4);
+  DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
 };
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cmap-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cmap-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -69,61 +69,78 @@
 
 struct CmapSubtableFormat4
 {
-  inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+  struct accelerator_t
   {
-    unsigned int segCount;
+    inline void init (const CmapSubtableFormat4 *subtable)
+    {
+      segCount = subtable->segCountX2 / 2;
+      endCount = subtable->values;
+      startCount = endCount + segCount + 1;
+      idDelta = startCount + segCount;
+      idRangeOffset = idDelta + segCount;
+      glyphIdArray = idRangeOffset + segCount;
+      glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
+    }
+
+    static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
+    {
+      const accelerator_t *thiz = (const accelerator_t *) obj;
+
+      /* Custom two-array bsearch. */
+      int min = 0, max = (int) thiz->segCount - 1;
+      const USHORT *startCount = thiz->startCount;
+      const USHORT *endCount = thiz->endCount;
+      unsigned int i;
+      while (min <= max)
+      {
+        int mid = (min + max) / 2;
+        if (codepoint < startCount[mid])
+          max = mid - 1;
+        else if (codepoint > endCount[mid])
+          min = mid + 1;
+        else
+        {
+          i = mid;
+          goto found;
+        }
+      }
+      return false;
+
+    found:
+      hb_codepoint_t gid;
+      unsigned int rangeOffset = thiz->idRangeOffset[i];
+      if (rangeOffset == 0)
+        gid = codepoint + thiz->idDelta[i];
+      else
+      {
+        /* Somebody has been smoking... */
+        unsigned int index = rangeOffset / 2 + (codepoint - thiz->startCount[i]) + i - thiz->segCount;
+        if (unlikely (index >= thiz->glyphIdArrayLength))
+          return false;
+        gid = thiz->glyphIdArray[index];
+        if (unlikely (!gid))
+          return false;
+        gid += thiz->idDelta[i];
+      }
+
+      *glyph = gid & 0xFFFFu;
+      return true;
+    }
+
     const USHORT *endCount;
     const USHORT *startCount;
     const USHORT *idDelta;
     const USHORT *idRangeOffset;
     const USHORT *glyphIdArray;
+    unsigned int segCount;
     unsigned int glyphIdArrayLength;
+  };
 
-    segCount = this->segCountX2 / 2;
-    endCount = this->values;
-    startCount = endCount + segCount + 1;
-    idDelta = startCount + segCount;
-    idRangeOffset = idDelta + segCount;
-    glyphIdArray = idRangeOffset + segCount;
-    glyphIdArrayLength = (this->length - 16 - 8 * segCount) / 2;
-
-    /* Custom two-array bsearch. */
-    int min = 0, max = (int) segCount - 1;
-    unsigned int i;
-    while (min <= max)
-    {
-      int mid = (min + max) / 2;
-      if (codepoint < startCount[mid])
-        max = mid - 1;
-      else if (codepoint > endCount[mid])
-        min = mid + 1;
-      else
-      {
-        i = mid;
-        goto found;
-      }
-    }
-    return false;
-
-  found:
-    hb_codepoint_t gid;
-    unsigned int rangeOffset = idRangeOffset[i];
-    if (rangeOffset == 0)
-      gid = codepoint + idDelta[i];
-    else
-    {
-      /* Somebody has been smoking... */
-      unsigned int index = rangeOffset / 2 + (codepoint - startCount[i]) + i - segCount;
-      if (unlikely (index >= glyphIdArrayLength))
-        return false;
-      gid = glyphIdArray[index];
-      if (unlikely (!gid))
-        return false;
-      gid += idDelta[i];
-    }
-
-    *glyph = gid & 0xFFFFu;
-    return true;
+  inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+  {
+    accelerator_t accel;
+    accel.init (this);
+    return accel.get_glyph_func (&accel, codepoint, glyph);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
@@ -388,7 +405,7 @@
   }
 
   protected:
-  USHORT        format;         /* Format number is set to 0. */
+  USHORT        format;         /* Format number is set to 14. */
   ULONG         lengthZ;        /* Byte length of this subtable. */
   SortedArrayOf<VariationSelectorRecord, ULONG>
                 record;         /* Variation selector records; sorted
@@ -416,16 +433,6 @@
     }
   }
 
-  inline glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
-                                            hb_codepoint_t variation_selector,
-                                            hb_codepoint_t *glyph) const
-  {
-    switch (u.format) {
-    case 14: return u.format14.get_glyph_variant(codepoint, variation_selector, glyph);
-    default: return GLYPH_VARIANT_NOT_FOUND;
-    }
-  }
-
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -442,7 +449,7 @@
     }
   }
 
-  protected:
+  public:
   union {
   USHORT                format;         /* Format identifier */
   CmapSubtableFormat0   format0;
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -35,6 +35,8 @@
 #include "hb-ot-head-table.hh"
 #include "hb-ot-hhea-table.hh"
 #include "hb-ot-hmtx-table.hh"
+#include "hb-ot-os2-table.hh"
+//#include "hb-ot-post-table.hh"
 
 
 struct hb_ot_face_metrics_accelerator_t
@@ -42,24 +44,58 @@
   unsigned int num_metrics;
   unsigned int num_advances;
   unsigned int default_advance;
+  unsigned short ascender;
+  unsigned short descender;
+  unsigned short line_gap;
+
   const OT::_mtx *table;
   hb_blob_t *blob;
 
   inline void init (hb_face_t *face,
-                    hb_tag_t _hea_tag, hb_tag_t _mtx_tag,
-                    unsigned int default_advance_)
+                    hb_tag_t _hea_tag,
+                    hb_tag_t _mtx_tag,
+                    hb_tag_t os2_tag)
   {
-    this->default_advance = default_advance_;
-    this->num_metrics = face->get_num_glyphs ();
+    this->default_advance = face->get_upem ();
+
+    bool got_font_extents = false;
+    if (os2_tag)
+    {
+      hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>::sanitize (face->reference_table (os2_tag));
+      const OT::os2 *os2 = OT::Sanitizer<OT::os2>::lock_instance (os2_blob);
+#define USE_TYPO_METRICS (1u<<7)
+      if (0 != (os2->fsSelection & USE_TYPO_METRICS))
+      {
+        this->ascender = os2->sTypoAscender;
+        this->descender = os2->sTypoDescender;
+        this->line_gap = os2->sTypoLineGap;
+        got_font_extents = (this->ascender | this->descender) != 0;
+      }
+      hb_blob_destroy (os2_blob);
+    }
 
     hb_blob_t *_hea_blob = OT::Sanitizer<OT::_hea>::sanitize (face->reference_table (_hea_tag));
     const OT::_hea *_hea = OT::Sanitizer<OT::_hea>::lock_instance (_hea_blob);
     this->num_advances = _hea->numberOfLongMetrics;
+    if (!got_font_extents)
+    {
+      this->ascender = _hea->ascender;
+      this->descender = _hea->descender;
+      this->line_gap = _hea->lineGap;
+    }
     hb_blob_destroy (_hea_blob);
 
     this->blob = OT::Sanitizer<OT::_mtx>::sanitize (face->reference_table (_mtx_tag));
-    if (unlikely (!this->num_advances ||
-                  2 * (this->num_advances + this->num_metrics) > hb_blob_get_length (this->blob)))
+
+    /* Cap num_metrics() and num_advances() based on table length. */
+    unsigned int len = hb_blob_get_length (this->blob);
+    if (unlikely (this->num_advances * 4 > len))
+      this->num_advances = len / 4;
+    this->num_metrics = this->num_advances + (len - 4 * this->num_advances) / 2;
+
+    /* We MUST set num_metrics to zero if num_advances is zero.
+     * Our get_advance() depends on that. */
+    if (unlikely (!this->num_advances))
     {
       this->num_metrics = this->num_advances = 0;
       hb_blob_destroy (this->blob);
@@ -166,10 +202,48 @@
   }
 };
 
+typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
+                                          hb_codepoint_t codepoint,
+                                          hb_codepoint_t *glyph);
+
+template <typename Type>
+static inline bool get_glyph_from (const void *obj,
+                                   hb_codepoint_t codepoint,
+                                   hb_codepoint_t *glyph)
+{
+  const Type *typed_obj = (const Type *) obj;
+  return typed_obj->get_glyph (codepoint, glyph);
+}
+
+template <typename Type>
+static inline bool get_glyph_from_symbol (const void *obj,
+                                          hb_codepoint_t codepoint,
+                                          hb_codepoint_t *glyph)
+{
+  const Type *typed_obj = (const Type *) obj;
+  if (likely (typed_obj->get_glyph (codepoint, glyph)))
+    return true;
+
+  if (codepoint <= 0x00FFu)
+  {
+    /* For symbol-encoded OpenType fonts, we duplicate the
+     * U+F000..F0FF range at U+0000..U+00FF.  That's what
+     * Windows seems to do, and that's hinted about at:
+     * http://www.microsoft.com/typography/otspec/recom.htm
+     * under "Non-Standard (Symbol) Fonts". */
+    return typed_obj->get_glyph (0xF000u + codepoint, glyph);
+  }
+
+  return false;
+}
+
 struct hb_ot_face_cmap_accelerator_t
 {
-  const OT::CmapSubtable *table;
-  const OT::CmapSubtable *uvs_table;
+  hb_cmap_get_glyph_func_t get_glyph_func;
+  const void *get_glyph_data;
+  OT::CmapSubtableFormat4::accelerator_t format4_accel;
+
+  const OT::CmapSubtableFormat14 *uvs_table;
   hb_blob_t *blob;
 
   inline void init (hb_face_t *face)
@@ -177,8 +251,9 @@
     this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
     const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
     const OT::CmapSubtable *subtable = NULL;
-    const OT::CmapSubtable *subtable_uvs = NULL;
+    const OT::CmapSubtableFormat14 *subtable_uvs = NULL;
 
+    bool symbol = false;
     /* 32-bit subtables. */
     if (!subtable) subtable = cmap->find_subtable (3, 10);
     if (!subtable) subtable = cmap->find_subtable (0, 6);
@@ -189,17 +264,38 @@
     if (!subtable) subtable = cmap->find_subtable (0, 2);
     if (!subtable) subtable = cmap->find_subtable (0, 1);
     if (!subtable) subtable = cmap->find_subtable (0, 0);
-    if (!subtable) subtable = cmap->find_subtable (3, 0);
+    if (!subtable)(subtable = cmap->find_subtable (3, 0)) && (symbol = true);
     /* Meh. */
     if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
 
     /* UVS subtable. */
-    if (!subtable_uvs) subtable_uvs = cmap->find_subtable (0, 5);
+    if (!subtable_uvs)
+    {
+      const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
+      if (st && st->u.format == 14)
+        subtable_uvs = &st->u.format14;
+    }
     /* Meh. */
-    if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtable);
+    if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
 
-    this->table = subtable;
     this->uvs_table = subtable_uvs;
+
+    this->get_glyph_data = subtable;
+    if (unlikely (symbol))
+      this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
+    else
+      switch (subtable->u.format) {
+      /* Accelerate format 4 and format 12. */
+      default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>;         break;
+      case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
+      case  4:
+        {
+          this->format4_accel.init (&subtable->u.format4);
+          this->get_glyph_data = &this->format4_accel;
+          this->get_glyph_func = this->format4_accel.get_glyph_func;
+        }
+        break;
+      }
   }
 
   inline void fini (void)
@@ -207,33 +303,77 @@
     hb_blob_destroy (this->blob);
   }
 
-  inline bool get_glyph (hb_codepoint_t  unicode,
-                         hb_codepoint_t  variation_selector,
-                         hb_codepoint_t *glyph) const
+  inline bool get_nominal_glyph (hb_codepoint_t  unicode,
+                                 hb_codepoint_t *glyph) const
   {
-    if (unlikely (variation_selector))
+    return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
+  }
+
+  inline bool get_variation_glyph (hb_codepoint_t  unicode,
+                                   hb_codepoint_t  variation_selector,
+                                   hb_codepoint_t *glyph) const
+  {
+    switch (this->uvs_table->get_glyph_variant (unicode,
+                                                variation_selector,
+                                                glyph))
     {
-      switch (this->uvs_table->get_glyph_variant (unicode,
-                                                  variation_selector,
-                                                  glyph))
-      {
-        case OT::GLYPH_VARIANT_NOT_FOUND:       return false;
-        case OT::GLYPH_VARIANT_FOUND:           return true;
-        case OT::GLYPH_VARIANT_USE_DEFAULT:     break;
-      }
+      case OT::GLYPH_VARIANT_NOT_FOUND:         return false;
+      case OT::GLYPH_VARIANT_FOUND:             return true;
+      case OT::GLYPH_VARIANT_USE_DEFAULT:       break;
     }
 
-    return this->table->get_glyph (unicode, glyph);
+    return get_nominal_glyph (unicode, glyph);
   }
 };
 
+template <typename T>
+struct hb_lazy_loader_t
+{
+  inline void init (hb_face_t *face_)
+  {
+    face = face_;
+    instance = NULL;
+  }
+
+  inline void fini (void)
+  {
+    if (instance && instance != &OT::Null(T))
+    {
+      instance->fini();
+      free (instance);
+    }
+  }
+
+  inline const T* operator-> (void) const
+  {
+  retry:
+    T *p = (T *) hb_atomic_ptr_get (&instance);
+    if (unlikely (!p))
+    {
+      p = (T *) calloc (1, sizeof (T));
+      if (unlikely (!p))
+        return &OT::Null(T);
+      p->init (face);
+      if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
+      {
+        p->fini ();
+        goto retry;
+      }
+    }
+    return p;
+  }
+
+  private:
+  hb_face_t *face;
+  T *instance;
+};
 
 struct hb_ot_font_t
 {
   hb_ot_face_cmap_accelerator_t cmap;
   hb_ot_face_metrics_accelerator_t h_metrics;
   hb_ot_face_metrics_accelerator_t v_metrics;
-  hb_ot_face_glyf_accelerator_t glyf;
+  hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf;
 };
 
 
@@ -245,11 +385,9 @@
   if (unlikely (!ot_font))
     return NULL;
 
-  unsigned int upem = face->get_upem ();
-
   ot_font->cmap.init (face);
-  ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, upem>>1);
-  ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, upem); /* TODO Can we do this lazily? */
+  ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_os2);
+  ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_TAG_NONE); /* TODO Can we do this lazily? */
   ot_font->glyf.init (face);
 
   return ot_font;
@@ -268,16 +406,27 @@
 
 
 static hb_bool_t
-hb_ot_get_glyph (hb_font_t *font HB_UNUSED,
-                 void *font_data,
-                 hb_codepoint_t unicode,
-                 hb_codepoint_t variation_selector,
-                 hb_codepoint_t *glyph,
-                 void *user_data HB_UNUSED)
+hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED,
+                         void *font_data,
+                         hb_codepoint_t unicode,
+                         hb_codepoint_t *glyph,
+                         void *user_data HB_UNUSED)
 
 {
   const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
-  return ot_font->cmap.get_glyph (unicode, variation_selector, glyph);
+  return ot_font->cmap.get_nominal_glyph (unicode, glyph);
+}
+
+static hb_bool_t
+hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
+                           void *font_data,
+                           hb_codepoint_t unicode,
+                           hb_codepoint_t variation_selector,
+                           hb_codepoint_t *glyph,
+                           void *user_data HB_UNUSED)
+{
+  const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+  return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph);
 }
 
 static hb_position_t
@@ -301,52 +450,6 @@
 }
 
 static hb_bool_t
-hb_ot_get_glyph_h_origin (hb_font_t *font HB_UNUSED,
-                          void *font_data HB_UNUSED,
-                          hb_codepoint_t glyph HB_UNUSED,
-                          hb_position_t *x HB_UNUSED,
-                          hb_position_t *y HB_UNUSED,
-                          void *user_data HB_UNUSED)
-{
-  /* We always work in the horizontal coordinates. */
-  return true;
-}
-
-static hb_bool_t
-hb_ot_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
-                          void *font_data,
-                          hb_codepoint_t glyph,
-                          hb_position_t *x,
-                          hb_position_t *y,
-                          void *user_data HB_UNUSED)
-{
-  /* TODO */
-  return false;
-}
-
-static hb_position_t
-hb_ot_get_glyph_h_kerning (hb_font_t *font,
-                           void *font_data,
-                           hb_codepoint_t left_glyph,
-                           hb_codepoint_t right_glyph,
-                           void *user_data HB_UNUSED)
-{
-  /* TODO */
-  return 0;
-}
-
-static hb_position_t
-hb_ot_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
-                           void *font_data HB_UNUSED,
-                           hb_codepoint_t top_glyph HB_UNUSED,
-                           hb_codepoint_t bottom_glyph HB_UNUSED,
-                           void *user_data HB_UNUSED)
-{
-  /* OpenType doesn't have vertical-kerning other than GPOS. */
-  return 0;
-}
-
-static hb_bool_t
 hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
                          void *font_data,
                          hb_codepoint_t glyph,
@@ -354,7 +457,7 @@
                          void *user_data HB_UNUSED)
 {
   const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
-  bool ret = ot_font->glyf.get_extents (glyph, extents);
+  bool ret = ot_font->glyf->get_extents (glyph, extents);
   extents->x_bearing = font->em_scale_x (extents->x_bearing);
   extents->y_bearing = font->em_scale_y (extents->y_bearing);
   extents->width     = font->em_scale_x (extents->width);
@@ -363,61 +466,85 @@
 }
 
 static hb_bool_t
-hb_ot_get_glyph_contour_point (hb_font_t *font HB_UNUSED,
-                               void *font_data,
-                               hb_codepoint_t glyph,
-                               unsigned int point_index,
-                               hb_position_t *x,
-                               hb_position_t *y,
-                               void *user_data HB_UNUSED)
+hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_font_extents_t *metrics,
+                          void *user_data HB_UNUSED)
 {
-  /* TODO */
-  return false;
+  const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+  metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender);
+  metrics->descender = font->em_scale_y (ot_font->h_metrics.descender);
+  metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap);
+  return true;
 }
 
 static hb_bool_t
-hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
-                      void *font_data,
-                      hb_codepoint_t glyph,
-                      char *name, unsigned int size,
-                      void *user_data HB_UNUSED)
+hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_font_extents_t *metrics,
+                          void *user_data HB_UNUSED)
 {
-  /* TODO */
-  return false;
+  const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+  metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender);
+  metrics->descender = font->em_scale_x (ot_font->v_metrics.descender);
+  metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap);
+  return true;
 }
 
-static hb_bool_t
-hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
-                           void *font_data,
-                           const char *name, int len, /* -1 means nul-terminated */
-                           hb_codepoint_t *glyph,
-                           void *user_data HB_UNUSED)
+static hb_font_funcs_t *static_ot_funcs = NULL;
+
+#ifdef HB_USE_ATEXIT
+static
+void free_static_ot_funcs (void)
 {
-  /* TODO */
-  return false;
+  hb_font_funcs_destroy (static_ot_funcs);
 }
-
+#endif
 
 static hb_font_funcs_t *
 _hb_ot_get_font_funcs (void)
 {
-  static const hb_font_funcs_t ot_ffuncs = {
-    HB_OBJECT_HEADER_STATIC,
+retry:
+  hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ot_funcs);
 
-    true, /* immutable */
+  if (unlikely (!funcs))
+  {
+    funcs = hb_font_funcs_create ();
 
-    {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_ot_get_##name,
-      HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
+    hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, NULL, NULL);
+    hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, NULL, NULL);
+    hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, NULL, NULL);
+    hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, NULL, NULL);
+    hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, NULL, NULL);
+    hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, NULL, NULL);
+    //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, NULL, NULL);
+    //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, NULL, NULL);
+    //hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, NULL, NULL); TODO
+    //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, NULL, NULL);
+    hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, NULL, NULL);
+    //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, NULL, NULL); TODO
+    //hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, NULL, NULL); TODO
+    //hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, NULL, NULL); TODO
+
+    hb_font_funcs_make_immutable (funcs);
+
+    if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, NULL, funcs)) {
+      hb_font_funcs_destroy (funcs);
+      goto retry;
     }
+
+#ifdef HB_USE_ATEXIT
+    atexit (free_static_ot_funcs); /* First person registers atexit() callback. */
+#endif
   };
 
-  return const_cast<hb_font_funcs_t *> (&ot_ffuncs);
+  return funcs;
 }
 
 
 /**
+ * hb_ot_font_set_funcs:
+ *
  * Since: 0.9.28
  **/
 void
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.h	Tue Aug 09 16:20:02 2016 -0700
@@ -36,7 +36,7 @@
 HB_BEGIN_DECLS
 
 
-void
+HB_EXTERN void
 hb_ot_font_set_funcs (hb_font_t *font);
 
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-glyf-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-glyf-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -90,10 +90,10 @@
                                          * greater than or equal to zero,
                                          * this is a simple glyph; if negative,
                                          * this is a composite glyph. */
-  SHORT         xMin;                   /* Minimum x for coordinate data. */
-  SHORT         yMin;                   /* Minimum y for coordinate data. */
-  SHORT         xMax;                   /* Maximum x for coordinate data. */
-  SHORT         yMax;                   /* Maximum y for coordinate data. */
+  FWORD         xMin;                   /* Minimum x for coordinate data. */
+  FWORD         yMin;                   /* Minimum y for coordinate data. */
+  FWORD         xMax;                   /* Maximum x for coordinate data. */
+  FWORD         yMax;                   /* Maximum y for coordinate data. */
 
   DEFINE_SIZE_STATIC (10);
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-head-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-head-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -55,13 +55,15 @@
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && likely (version.major == 1));
+    return_trace (c->check_struct (this) &&
+                  version.major == 1 &&
+                  magicNumber == 0x5F0F3CF5u);
   }
 
   protected:
-  FixedVersion  version;                /* Version of the head table--currently
+  FixedVersion<>version;                /* Version of the head table--currently
                                          * 0x00010000u for version 1.0. */
-  FixedVersion  fontRevision;           /* Set by font manufacturer. */
+  FixedVersion<>fontRevision;           /* Set by font manufacturer. */
   ULONG         checkSumAdjustment;     /* To compute: set it to 0, sum the
                                          * entire font as ULONG, then store
                                          * 0xB1B0AFBAu - sum. */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hhea-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hhea-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -56,7 +56,7 @@
   }
 
   public:
-  FixedVersion  version;                /* 0x00010000u for version 1.0. */
+  FixedVersion<>version;                /* 0x00010000u for version 1.0. */
   FWORD         ascender;               /* Typographic ascent. */
   FWORD         descender;              /* Typographic descent. */
   FWORD         lineGap;                /* Typographic line gap. */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hmtx-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hmtx-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -44,8 +44,8 @@
 
 struct LongMetric
 {
-  USHORT        advance; /* Advance width/height. */
-  SHORT         lsb; /* Leading (left/top) side bearing. */
+  UFWORD        advance; /* Advance width/height. */
+  FWORD         lsb; /* Leading (left/top) side bearing. */
   public:
   DEFINE_SIZE_STATIC (4);
 };
@@ -74,7 +74,7 @@
                                          * be in the array, but that entry is
                                          * required. The last entry applies to
                                          * all subsequent glyphs. */
-  SHORT         leadingBearingX[VAR];   /* Here the advance is assumed
+  FWORD         leadingBearingX[VAR];   /* Here the advance is assumed
                                          * to be the same as the advance
                                          * for the last entry above. The
                                          * number of entries in this array is
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -34,6 +34,14 @@
 #include "hb-set-private.hh"
 
 
+#ifndef HB_MAX_NESTING_LEVEL
+#define HB_MAX_NESTING_LEVEL    6
+#endif
+#ifndef HB_MAX_CONTEXT_LENGTH
+#define HB_MAX_CONTEXT_LENGTH   64
+#endif
+
+
 namespace OT {
 
 
@@ -44,8 +52,6 @@
 
 
 #define NOT_COVERED             ((unsigned int) -1)
-#define MAX_NESTING_LEVEL       6
-#define MAX_CONTEXT_LENGTH      64
 
 
 
@@ -539,6 +545,9 @@
           c->try_set (&featureParams, new_offset) &&
           !featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
         return_trace (false);
+
+      if (c->edit_count > 1)
+        c->edit_count--; /* This was a "legitimate" edit; don't contribute to error count. */
     }
 
     return_trace (true);
@@ -573,6 +582,11 @@
   DEFINE_SIZE_STATIC (2);
 };
 
+} /* namespace OT */
+/* This has to be outside the namespace. */
+HB_MARK_AS_FLAG_T (OT::LookupFlag::Flags);
+namespace OT {
+
 struct Lookup
 {
   inline unsigned int get_subtable_count (void) const { return subTable.len; }
@@ -756,7 +770,11 @@
     TRACE_SERIALIZE (this);
     if (unlikely (!c->extend_min (*this))) return_trace (false);
 
-    if (unlikely (!num_glyphs)) return_trace (true);
+    if (unlikely (!num_glyphs))
+    {
+      rangeRecord.len.set (0);
+      return_trace (true);
+    }
 
     unsigned int num_ranges = 1;
     for (unsigned int i = 1; i < num_glyphs; i++)
@@ -1156,6 +1174,21 @@
   inline hb_position_t get_y_delta (hb_font_t *font) const
   { return get_delta (font->y_ppem, font->y_scale); }
 
+  inline unsigned int get_size (void) const
+  {
+    unsigned int f = deltaFormat;
+    if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
+    return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
+  }
+
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
+  }
+
+  private:
+
   inline int get_delta (unsigned int ppem, int scale) const
   {
     if (!ppem) return 0;
@@ -1166,8 +1199,6 @@
 
     return (int) (pixels * (int64_t) scale / ppem);
   }
-
-
   inline int get_delta_pixels (unsigned int ppem_size) const
   {
     unsigned int f = deltaFormat;
@@ -1191,19 +1222,6 @@
     return delta;
   }
 
-  inline unsigned int get_size (void) const
-  {
-    unsigned int f = deltaFormat;
-    if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
-    return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
-  }
-
-  inline bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
-  }
-
   protected:
   USHORT        startSize;              /* Smallest size to correct--in ppem */
   USHORT        endSize;                /* Largest size to correct--in ppem */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -409,7 +409,7 @@
 
 
   protected:
-  FixedVersion  version;                /* Version of the GDEF table--currently
+  FixedVersion<>version;                /* Version of the GDEF table--currently
                                          * 0x00010002u */
   OffsetTo<ClassDef>
                 glyphClassDef;          /* Offset to class definition table
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -36,8 +36,17 @@
 
 
 /* buffer **position** var allocations */
-#define attach_lookback() var.u16[0] /* number of glyphs to go back to attach this glyph to its base */
-#define cursive_chain() var.i16[1] /* character to which this connects, may be positive or negative */
+#define attach_chain() var.i16[0] /* glyph to which this attaches to, relative to current glyphs; negative for going back, positive for forward. */
+#define attach_type() var.u8[2] /* attachment type */
+/* Note! if attach_chain() is zero, the value of attach_type() is irrelevant. */
+
+enum attach_type_t {
+  ATTACH_TYPE_NONE      = 0X00,
+
+  /* Each attachment should be either a mark or a cursive; can't be both. */
+  ATTACH_TYPE_MARK      = 0X01,
+  ATTACH_TYPE_CURSIVE   = 0X02,
+};
 
 
 /* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
@@ -425,7 +434,9 @@
     hb_glyph_position_t &o = buffer->cur_pos();
     o.x_offset = base_x - mark_x;
     o.y_offset = base_y - mark_y;
-    o.attach_lookback() = buffer->idx - glyph_pos;
+    o.attach_type() = ATTACH_TYPE_MARK;
+    o.attach_chain() = (int) glyph_pos - (int) buffer->idx;
+    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
 
     buffer->idx++;
     return_trace (true);
@@ -741,7 +752,7 @@
   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
-    /* (this+coverage).add_coverage (c->input); // Don't need this. */
+    (this+coverage).add_coverage (c->input);
 
     unsigned int count1 = class1Count;
     const ClassDef &klass1 = this+classDef1;
@@ -906,9 +917,6 @@
     TRACE_APPLY (this);
     hb_buffer_t *buffer = c->buffer;
 
-    /* We don't handle mark glyphs here. */
-    if (unlikely (_hb_glyph_info_is_mark (&buffer->cur()))) return_trace (false);
-
     const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage  (buffer->cur().codepoint)];
     if (!this_record.exitAnchor) return_trace (false);
 
@@ -992,7 +1000,9 @@
      */
     reverse_cursive_minor_offset (pos, child, c->direction, parent);
 
-    pos[child].cursive_chain() = parent - child;
+    pos[child].attach_type() = ATTACH_TYPE_CURSIVE;
+    pos[child].attach_chain() = (int) parent - (int) child;
+    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
     if (likely (HB_DIRECTION_IS_HORIZONTAL (c->direction)))
       pos[child].y_offset = y_offset;
     else
@@ -1067,7 +1077,7 @@
     unsigned int mark_index = (this+markCoverage).get_coverage  (buffer->cur().codepoint);
     if (likely (mark_index == NOT_COVERED)) return_trace (false);
 
-    /* now we search backwards for a non-mark glyph */
+    /* Now we search backwards for a non-mark glyph */
     hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset (buffer->idx, 1);
     skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
@@ -1079,7 +1089,7 @@
     } while (1);
 
     /* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
-    if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { /*return_trace (false);*/ }
+    //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
 
     unsigned int base_index = (this+baseCoverage).get_coverage  (buffer->info[skippy_iter.idx].codepoint);
     if (base_index == NOT_COVERED) return_trace (false);
@@ -1168,14 +1178,14 @@
     unsigned int mark_index = (this+markCoverage).get_coverage  (buffer->cur().codepoint);
     if (likely (mark_index == NOT_COVERED)) return_trace (false);
 
-    /* now we search backwards for a non-mark glyph */
+    /* Now we search backwards for a non-mark glyph */
     hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset (buffer->idx, 1);
     skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
     if (!skippy_iter.prev ()) return_trace (false);
 
     /* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
-    if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { /*return_trace (false);*/ }
+    //if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { return_trace (false); }
 
     unsigned int j = skippy_iter.idx;
     unsigned int lig_index = (this+ligatureCoverage).get_coverage  (buffer->info[j].codepoint);
@@ -1499,7 +1509,8 @@
   { return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
 
   static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
-  static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
+  static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer);
+  static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer);
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -1516,13 +1527,13 @@
 static void
 reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, unsigned int new_parent)
 {
-  unsigned int j = pos[i].cursive_chain();
-  if (likely (!j))
+  int chain = pos[i].attach_chain(), type = pos[i].attach_type();
+  if (likely (!chain || 0 == (type & ATTACH_TYPE_CURSIVE)))
     return;
 
-  j += i;
+  pos[i].attach_chain() = 0;
 
-  pos[i].cursive_chain() = 0;
+  unsigned int j = (int) i + chain;
 
   /* Stop if we see new parent in the chain. */
   if (j == new_parent)
@@ -1535,62 +1546,68 @@
   else
     pos[j].x_offset = -pos[i].x_offset;
 
-  pos[j].cursive_chain() = i - j;
+  pos[j].attach_chain() = -chain;
+  pos[j].attach_type() = type;
 }
 static void
-fix_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
+propagate_attachment_offsets (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
 {
-  unsigned int j = pos[i].cursive_chain();
-  if (likely (!j))
+  /* Adjusts offsets of attached glyphs (both cursive and mark) to accumulate
+   * offset of glyph they are attached to. */
+  int chain = pos[i].attach_chain(), type = pos[i].attach_type();
+  if (likely (!chain))
     return;
 
-  j += i;
+  unsigned int j = (int) i + chain;
 
-  pos[i].cursive_chain() = 0;
+  pos[i].attach_chain() = 0;
 
-  fix_cursive_minor_offset (pos, j, direction);
+  propagate_attachment_offsets (pos, j, direction);
 
-  if (HB_DIRECTION_IS_HORIZONTAL (direction))
+  assert (!!(type & ATTACH_TYPE_MARK) ^ !!(type & ATTACH_TYPE_CURSIVE));
+
+  if (type & ATTACH_TYPE_CURSIVE)
+  {
+    if (HB_DIRECTION_IS_HORIZONTAL (direction))
+      pos[i].y_offset += pos[j].y_offset;
+    else
+      pos[i].x_offset += pos[j].x_offset;
+  }
+  else /*if (type & ATTACH_TYPE_MARK)*/
+  {
+    pos[i].x_offset += pos[j].x_offset;
     pos[i].y_offset += pos[j].y_offset;
-  else
-    pos[i].x_offset += pos[j].x_offset;
-}
 
-static void
-fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
-{
-  if (likely (!(pos[i].attach_lookback())))
-    return;
-
-  unsigned int j = i - pos[i].attach_lookback();
-
-  pos[i].x_offset += pos[j].x_offset;
-  pos[i].y_offset += pos[j].y_offset;
-
-  if (HB_DIRECTION_IS_FORWARD (direction))
-    for (unsigned int k = j; k < i; k++) {
-      pos[i].x_offset -= pos[k].x_advance;
-      pos[i].y_offset -= pos[k].y_advance;
-    }
-  else
-    for (unsigned int k = j + 1; k < i + 1; k++) {
-      pos[i].x_offset += pos[k].x_advance;
-      pos[i].y_offset += pos[k].y_advance;
-    }
+    assert (j < i);
+    if (HB_DIRECTION_IS_FORWARD (direction))
+      for (unsigned int k = j; k < i; k++) {
+        pos[i].x_offset -= pos[k].x_advance;
+        pos[i].y_offset -= pos[k].y_advance;
+      }
+    else
+      for (unsigned int k = j + 1; k < i + 1; k++) {
+        pos[i].x_offset += pos[k].x_advance;
+        pos[i].y_offset += pos[k].y_advance;
+      }
+  }
 }
 
 void
 GPOS::position_start (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
 {
-  buffer->clear_positions ();
-
   unsigned int count = buffer->len;
   for (unsigned int i = 0; i < count; i++)
-    buffer->pos[i].attach_lookback() = buffer->pos[i].cursive_chain() = 0;
+    buffer->pos[i].attach_chain() = buffer->pos[i].attach_type() = 0;
 }
 
 void
-GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+GPOS::position_finish_advances (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+{
+  //_hb_buffer_assert_gsubgpos_vars (buffer);
+}
+
+void
+GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
 {
   _hb_buffer_assert_gsubgpos_vars (buffer);
 
@@ -1598,13 +1615,10 @@
   hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len);
   hb_direction_t direction = buffer->props.direction;
 
-  /* Handle cursive connections */
-  for (unsigned int i = 0; i < len; i++)
-    fix_cursive_minor_offset (pos, i, direction);
-
   /* Handle attachments */
-  for (unsigned int i = 0; i < len; i++)
-    fix_mark_attachment (pos, i, direction);
+  if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT)
+    for (unsigned int i = 0; i < len; i++)
+      propagate_attachment_offsets (pos, i, direction);
 }
 
 
@@ -1633,8 +1647,8 @@
 }
 
 
-#undef attach_lookback
-#undef cursive_chain
+#undef attach_chain
+#undef attach_type
 
 
 } /* namespace OT */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -265,16 +265,6 @@
     TRACE_APPLY (this);
     unsigned int count = substitute.len;
 
-    /* TODO:
-     * Testing shows that Uniscribe actually allows zero-len susbstitute,
-     * which essentially deletes a glyph.  We don't allow for now.  It
-     * can be confusing to the client since the cluster from the deleted
-     * glyph won't be merged with any output cluster...  Also, currently
-     * buffer->move_to() makes assumptions about this too.  Perhaps fix
-     * in the future after figuring out what to do with the clusters.
-     */
-    if (unlikely (!count)) return_trace (false);
-
     /* Special-case to make it in-place and not consider this
      * as a "multiplied" substitution. */
     if (unlikely (count == 1))
@@ -282,6 +272,13 @@
       c->replace_glyph (substitute.array[0]);
       return_trace (true);
     }
+    /* Spec disallows this, but Uniscribe allows it.
+     * https://github.com/behdad/harfbuzz/issues/253 */
+    else if (unlikely (count == 0))
+    {
+      c->buffer->delete_glyph ();
+      return_trace (true);
+    }
 
     unsigned int klass = _hb_glyph_info_is_ligature (&c->buffer->cur()) ?
                          HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0;
@@ -630,7 +627,7 @@
     unsigned int total_component_count = 0;
 
     unsigned int match_length = 0;
-    unsigned int match_positions[MAX_CONTEXT_LENGTH];
+    unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
 
     if (likely (!match_input (c, count,
                               &component[1],
@@ -970,7 +967,7 @@
   inline bool apply (hb_apply_context_t *c) const
   {
     TRACE_APPLY (this);
-    if (unlikely (c->nesting_level_left != MAX_NESTING_LEVEL))
+    if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL))
       return_trace (false); /* No chaining to this type */
 
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
@@ -1268,7 +1265,6 @@
   { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
 
   static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
-  static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer);
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -1289,19 +1285,32 @@
 
   const GDEF &gdef = *hb_ot_layout_from_face (font->face)->gdef;
   unsigned int count = buffer->len;
+  hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 0; i < count; i++)
   {
-    _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint));
-    _hb_glyph_info_clear_lig_props (&buffer->info[i]);
+    unsigned int props = gdef.get_glyph_props (info[i].codepoint);
+    if (!props)
+    {
+      /* Never mark default-ignorables as marks.
+       * They won't get in the way of lookups anyway,
+       * but having them as mark will cause them to be skipped
+       * over if the lookup-flag says so, but at least for the
+       * Mongolian variation selectors, looks like Uniscribe
+       * marks them as non-mark.  Some Mongolian fonts without
+       * GDEF rely on this.  Another notable character that
+       * this applies to is COMBINING GRAPHEME JOINER. */
+      props = (_hb_glyph_info_get_general_category (&info[i]) !=
+               HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ||
+               _hb_glyph_info_is_default_ignorable (&info[i])) ?
+              HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH :
+              HB_OT_LAYOUT_GLYPH_PROPS_MARK;
+    }
+    _hb_glyph_info_set_glyph_props (&info[i], props);
+    _hb_glyph_info_clear_lig_props (&info[i]);
     buffer->info[i].syllable() = 0;
   }
 }
 
-void
-GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSED)
-{
-}
-
 
 /* Out-of-class implementation for methods recursing */
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -74,7 +74,7 @@
 
   hb_closure_context_t (hb_face_t *face_,
                         hb_set_t *glyphs_,
-                        unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
+                        unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
                           face (face_),
                           glyphs (glyphs_),
                           recurse_func (NULL),
@@ -196,7 +196,7 @@
                                hb_set_t  *glyphs_input,  /* OUT. May be NULL */
                                hb_set_t  *glyphs_after,  /* OUT. May be NULL */
                                hb_set_t  *glyphs_output, /* OUT. May be NULL */
-                               unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
+                               unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
                               face (face_),
                               before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
                               input  (glyphs_input  ? glyphs_input  : hb_set_get_empty ()),
@@ -319,7 +319,7 @@
       if (!c->check_glyph_property (&info, lookup_props))
         return SKIP_YES;
 
-      if (unlikely (_hb_glyph_info_is_default_ignorable (&info) &&
+      if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_fvs (&info) &&
                     (ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
                     (ignore_zwj || !_hb_glyph_info_is_zwj (&info))))
         return SKIP_MAYBE;
@@ -355,11 +355,11 @@
     {
       matcher.set_lookup_props (lookup_props);
     }
-    inline void set_match_func (matcher_t::match_func_t match_func,
-                                const void *match_data,
+    inline void set_match_func (matcher_t::match_func_t match_func_,
+                                const void *match_data_,
                                 const USHORT glyph_data[])
     {
-      matcher.set_match_func (match_func, match_data);
+      matcher.set_match_func (match_func_, match_data_);
       match_glyph_data = glyph_data;
     }
 
@@ -483,7 +483,7 @@
                         lookup_mask (1),
                         auto_zwj (true),
                         recurse_func (NULL),
-                        nesting_level_left (MAX_NESTING_LEVEL),
+                        nesting_level_left (HB_MAX_NESTING_LEVEL),
                         lookup_props (0),
                         gdef (*hb_ot_layout_from_face (face)->gdef),
                         has_glyph_classes (gdef.has_glyph_classes ()),
@@ -704,13 +704,13 @@
                                 match_func_t match_func,
                                 const void *match_data,
                                 unsigned int *end_offset,
-                                unsigned int match_positions[MAX_CONTEXT_LENGTH],
+                                unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
                                 bool *p_is_mark_ligature = NULL,
                                 unsigned int *p_total_component_count = NULL)
 {
   TRACE_APPLY (NULL);
 
-  if (unlikely (count > MAX_CONTEXT_LENGTH)) return_trace (false);
+  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
 
   hb_buffer_t *buffer = c->buffer;
 
@@ -784,7 +784,7 @@
 }
 static inline bool ligate_input (hb_apply_context_t *c,
                                  unsigned int count, /* Including the first glyph */
-                                 unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */
+                                 unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
                                  unsigned int match_length,
                                  hb_codepoint_t lig_glyph,
                                  bool is_mark_ligature,
@@ -836,19 +836,21 @@
     if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
     {
       _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
-      _hb_glyph_info_set_modified_combining_class (&buffer->cur(), 0);
     }
   }
   c->replace_glyph_with_ligature (lig_glyph, klass);
 
   for (unsigned int i = 1; i < count; i++)
   {
-    while (buffer->idx < match_positions[i])
+    while (buffer->idx < match_positions[i] && !buffer->in_error)
     {
       if (!is_mark_ligature) {
+        unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
+        if (this_comp == 0)
+          this_comp = last_num_components;
         unsigned int new_lig_comp = components_so_far - last_num_components +
-                                    MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->cur()), 1u), last_num_components);
-        _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
+                                    MIN (this_comp, last_num_components);
+          _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
       }
       buffer->next_glyph ();
     }
@@ -865,8 +867,11 @@
     /* Re-adjust components for any marks following. */
     for (unsigned int i = buffer->idx; i < buffer->len; i++) {
       if (last_lig_id == _hb_glyph_info_get_lig_id (&buffer->info[i])) {
+        unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
+        if (!this_comp)
+          break;
         unsigned int new_lig_comp = components_so_far - last_num_components +
-                                    MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->info[i]), 1u), last_num_components);
+                                    MIN (this_comp, last_num_components);
         _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
       } else
         break;
@@ -944,7 +949,7 @@
 
 static inline bool apply_lookup (hb_apply_context_t *c,
                                  unsigned int count, /* Including the first glyph */
-                                 unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */
+                                 unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
                                  unsigned int lookupCount,
                                  const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
                                  unsigned int match_length)
@@ -966,12 +971,17 @@
       match_positions[j] += delta;
   }
 
-  for (unsigned int i = 0; i < lookupCount; i++)
+  for (unsigned int i = 0; i < lookupCount && !buffer->in_error; i++)
   {
     unsigned int idx = lookupRecord[i].sequenceIndex;
     if (idx >= count)
       continue;
 
+    /* Don't recurse to ourself at same position.
+     * Note that this test is too naive, it doesn't catch longer loops. */
+    if (idx == 0 && lookupRecord[i].lookupListIndex == c->lookup_index)
+      continue;
+
     buffer->move_to (match_positions[idx]);
 
     unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
@@ -986,16 +996,19 @@
 
     /* Recursed lookup changed buffer len.  Adjust. */
 
-    /* end can't go back past the current match position.
-     * Note: this is only true because we do NOT allow MultipleSubst
-     * with zero sequence len. */
-    end = MAX ((int) match_positions[idx] + 1, int (end) + delta);
+    end = int (end) + delta;
+    if (end <= match_positions[idx])
+    {
+      /* There can't be any further changes. */
+      assert (end == match_positions[idx]);
+      break;
+    }
 
     unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
 
     if (delta > 0)
     {
-      if (unlikely (delta + count > MAX_CONTEXT_LENGTH))
+      if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
         break;
     }
     else
@@ -1094,7 +1107,7 @@
                                          ContextApplyLookupContext &lookup_context)
 {
   unsigned int match_length = 0;
-  unsigned int match_positions[MAX_CONTEXT_LENGTH];
+  unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
   return match_input (c,
                       inputCount, input,
                       lookup_context.funcs.match, lookup_context.match_data,
@@ -1621,7 +1634,7 @@
                                                ChainContextApplyLookupContext &lookup_context)
 {
   unsigned int match_length = 0;
-  unsigned int match_positions[MAX_CONTEXT_LENGTH];
+  unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
   return match_input (c,
                       inputCount, input,
                       lookup_context.funcs.match, lookup_context.match_data[1],
@@ -2267,7 +2280,7 @@
   }
 
   protected:
-  FixedVersion  version;        /* Version of the GSUB/GPOS table--initially set
+  FixedVersion<>version;        /* Version of the GSUB/GPOS table--initially set
                                  * to 0x00010000u */
   OffsetTo<ScriptList>
                 scriptList;     /* ScriptList table */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-jstf-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-jstf-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -218,7 +218,7 @@
   }
 
   protected:
-  FixedVersion  version;        /* Version of the JSTF table--initially set
+  FixedVersion<>version;        /* Version of the JSTF table--initially set
                                  * to 0x00010000u */
   RecordArrayOf<JstfScript>
                 scriptList;     /* Array of JstfScripts--listed
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -49,7 +49,7 @@
  * GDEF
  */
 
-typedef enum
+enum hb_ot_layout_glyph_props_flags_t
 {
   /* The following three match LookupFlags::Ignore* numbers. */
   HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH   = 0x02u,
@@ -64,7 +64,8 @@
   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_ot_layout_glyph_class_mask_t;
+};
+HB_MARK_AS_FLAG_T (hb_ot_layout_glyph_props_flags_t);
 
 
 /*
@@ -98,21 +99,20 @@
                                 const hb_ot_layout_lookup_accelerator_t &accel);
 
 
-/* Should be called after all the substitute_lookup's are done */
-HB_INTERNAL void
-hb_ot_layout_substitute_finish (hb_font_t    *font,
-                                hb_buffer_t  *buffer);
-
-
-/* Should be called before all the position_lookup's are done.  Resets positions to zero. */
+/* Should be called before all the position_lookup's are done. */
 HB_INTERNAL void
 hb_ot_layout_position_start (hb_font_t    *font,
                              hb_buffer_t  *buffer);
 
-/* Should be called after all the position_lookup's are done */
+/* Should be called after all the position_lookup's are done, to finish advances. */
 HB_INTERNAL void
-hb_ot_layout_position_finish (hb_font_t    *font,
-                              hb_buffer_t  *buffer);
+hb_ot_layout_position_finish_advances (hb_font_t    *font,
+                                       hb_buffer_t  *buffer);
+
+/* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */
+HB_INTERNAL void
+hb_ot_layout_position_finish_offsets (hb_font_t    *font,
+                                      hb_buffer_t  *buffer);
 
 
 
@@ -180,8 +180,7 @@
  */
 
 /* buffer var allocations, used during the entire shaping process */
-#define unicode_props0()        var2.u8[0]
-#define unicode_props1()        var2.u8[1]
+#define unicode_props()         var2.u16[0]
 
 /* buffer var allocations, used during the GSUB/GPOS processing */
 #define glyph_props()           var1.u16[0] /* GDEF glyph properties */
@@ -214,48 +213,146 @@
 
 /* unicode_props */
 
-enum {
-  MASK0_ZWJ       = 0x20u,
-  MASK0_ZWNJ      = 0x40u,
-  MASK0_IGNORABLE = 0x80u,
-  MASK0_GEN_CAT   = 0x1Fu
+/* Design:
+ * unicode_props() is a two-byte number.  The low byte includes:
+ * - General_Category: 5 bits.
+ * - A bit each for:
+ *   * Is it Default_Ignorable(); we have a modified Default_Ignorable().
+ *   * Whether it's one of the three Mongolian Free Variation Selectors.
+ *   * One free bit right now.
+ *
+ * The high-byte has different meanings, switched by the Gen-Cat:
+ * - For Mn,Mc,Me: the modified Combining_Class.
+ * - For Cf: whether it's ZWJ, ZWNJ, or something else.
+ * - For Ws: index of which space character this is, if space fallback
+ *   is needed, ie. we don't set this by default, only if asked to.
+ */
+
+enum hb_unicode_props_flags_t {
+  UPROPS_MASK_GEN_CAT   = 0x001Fu,
+  UPROPS_MASK_IGNORABLE = 0x0020u,
+  UPROPS_MASK_FVS       = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3 */
+
+  /* If GEN_CAT=FORMAT, top byte masks: */
+  UPROPS_MASK_Cf_ZWJ    = 0x0100u,
+  UPROPS_MASK_Cf_ZWNJ   = 0x0200u
 };
+HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
 
 static inline void
-_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
+_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
 {
-  /* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
-  info->unicode_props0() = ((unsigned int) unicode->general_category (info->codepoint)) |
-                           (unicode->is_default_ignorable (info->codepoint) ? MASK0_IGNORABLE : 0) |
-                           (info->codepoint == 0x200Cu ? MASK0_ZWNJ : 0) |
-                           (info->codepoint == 0x200Du ? MASK0_ZWJ : 0);
-  info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
+  hb_unicode_funcs_t *unicode = buffer->unicode;
+  unsigned int u = info->codepoint;
+  unsigned int gen_cat = (unsigned int) unicode->general_category (u);
+  unsigned int props = gen_cat;
+
+  if (u >= 0x80)
+  {
+    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII;
+    if (unlikely (unicode->is_default_ignorable (u)))
+    {
+      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
+      props |=  UPROPS_MASK_IGNORABLE;
+      if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
+      if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
+      /* Mongolian Free Variation Selectors need to be remembered
+       * because although we need to hide them like default-ignorables,
+       * they need to non-ignorable during shaping.  This is similar to
+       * what we do for joiners in Indic-like shapers, but since the
+       * FVSes are GC=Mn, we have use a separate bit to remember them.
+       * Fixes:
+       * https://github.com/behdad/harfbuzz/issues/234
+       */
+      if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_FVS;
+    }
+    else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
+    {
+      /* The above check is just an optimization to let in only things we need further
+       * processing on. */
+
+      /* Only Mn and Mc can have non-zero ccc:
+       * http://www.unicode.org/policies/stability_policy.html#Property_Value
+       * """
+       * Canonical_Combining_Class, General_Category
+       * All characters other than those with General_Category property values
+       * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining_Class
+       * property value 0.
+       * 1.1.5+
+       * """
+       *
+       * Also, all Mn's that are Default_Ignorable, have ccc=0, hence
+       * the "else if".
+       */
+      props |= unicode->modified_combining_class (info->codepoint)<<8;
+
+      /* Recategorize emoji skin-tone modifiers as Unicode mark, so they
+       * behave correctly in non-native directionality.  They originally
+       * are MODIFIER_SYMBOL.  Fixes:
+       * https://github.com/behdad/harfbuzz/issues/169
+       */
+      if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
+      {
+        props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK;
+      }
+    }
+  }
+
+  info->unicode_props() = props;
 }
 
 static inline void
 _hb_glyph_info_set_general_category (hb_glyph_info_t *info,
                                      hb_unicode_general_category_t gen_cat)
 {
-  info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT);
+  /* Clears top-byte. */
+  info->unicode_props() = (unsigned int) gen_cat | (info->unicode_props() & (0xFF & ~UPROPS_MASK_GEN_CAT));
 }
 
 static inline hb_unicode_general_category_t
 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
 {
-  return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT);
+  return (hb_unicode_general_category_t) (info->unicode_props() & UPROPS_MASK_GEN_CAT);
 }
 
+static inline bool
+_hb_glyph_info_is_unicode_mark (const hb_glyph_info_t *info)
+{
+  return HB_UNICODE_GENERAL_CATEGORY_IS_MARK (info->unicode_props() & UPROPS_MASK_GEN_CAT);
+}
 static inline void
 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
                                              unsigned int modified_class)
 {
-  info->unicode_props1() = modified_class;
+  if (unlikely (!_hb_glyph_info_is_unicode_mark (info)))
+    return;
+  info->unicode_props() = (modified_class<<8) | (info->unicode_props() & 0xFF);
 }
-
 static inline unsigned int
 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
 {
-  return info->unicode_props1();
+  return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
+}
+
+static inline bool
+_hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_get_general_category (info) ==
+         HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR;
+}
+static inline void
+_hb_glyph_info_set_unicode_space_fallback_type (hb_glyph_info_t *info, hb_unicode_funcs_t::space_t s)
+{
+  if (unlikely (!_hb_glyph_info_is_unicode_space (info)))
+    return;
+  info->unicode_props() = (((unsigned int) s)<<8) | (info->unicode_props() & 0xFF);
+}
+static inline hb_unicode_funcs_t::space_t
+_hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_is_unicode_space (info) ?
+         (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
+         hb_unicode_funcs_t::NOT_SPACE;
 }
 
 static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
@@ -263,25 +360,44 @@
 static inline hb_bool_t
 _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
 {
-  return (info->unicode_props0() & MASK0_IGNORABLE) && !_hb_glyph_info_ligated (info);
+  return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
+         !_hb_glyph_info_ligated (info);
+}
+static inline hb_bool_t
+_hb_glyph_info_is_default_ignorable_and_not_fvs (const hb_glyph_info_t *info)
+{
+  return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_FVS))
+          == UPROPS_MASK_IGNORABLE) &&
+         !_hb_glyph_info_ligated (info);
 }
 
+static inline bool
+_hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_get_general_category (info) ==
+         HB_UNICODE_GENERAL_CATEGORY_FORMAT;
+}
 static inline hb_bool_t
 _hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
 {
-  return !!(info->unicode_props0() & MASK0_ZWNJ);
+  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWNJ);
 }
-
 static inline hb_bool_t
 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
 {
-  return !!(info->unicode_props0() & MASK0_ZWJ);
+  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWJ);
 }
-
+static inline hb_bool_t
+_hb_glyph_info_is_joiner (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & (UPROPS_MASK_Cf_ZWNJ|UPROPS_MASK_Cf_ZWJ));
+}
 static inline void
 _hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
 {
-  info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ;
+  if (!_hb_glyph_info_is_unicode_format (info))
+    return;
+  info->unicode_props() ^= UPROPS_MASK_Cf_ZWNJ | UPROPS_MASK_Cf_ZWJ;
 }
 
 /* lig_props: aka lig_id / lig_comp
@@ -442,11 +558,9 @@
 }
 
 static inline void
-_hb_glyph_info_clear_substituted_and_ligated_and_multiplied (hb_glyph_info_t *info)
+_hb_glyph_info_clear_substituted (hb_glyph_info_t *info)
 {
-  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
-                           HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
-                           HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
+  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
 }
 
 
@@ -455,22 +569,19 @@
 static inline void
 _hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
 {
-  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0);
-  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1);
+  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props);
 }
 
 static inline void
 _hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
 {
-  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0);
-  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1);
+  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props);
 }
 
 static inline void
 _hb_buffer_assert_unicode_vars (hb_buffer_t *buffer)
 {
-  HB_BUFFER_ASSERT_VAR (buffer, unicode_props0);
-  HB_BUFFER_ASSERT_VAR (buffer, unicode_props1);
+  HB_BUFFER_ASSERT_VAR (buffer, unicode_props);
 }
 
 static inline void
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -60,6 +60,80 @@
   layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table (HB_OT_TAG_GPOS));
   layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
 
+  {
+    /*
+     * The ugly business of blacklisting individual fonts' tables happen here!
+     * See this thread for why we finally had to bend in and do this:
+     * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
+     */
+    unsigned int gdef_len = hb_blob_get_length (layout->gdef_blob);
+    unsigned int gsub_len = hb_blob_get_length (layout->gsub_blob);
+    unsigned int gpos_len = hb_blob_get_length (layout->gpos_blob);
+    if (0
+      /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */
+      || (442 == gdef_len && 42038 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */
+      || (430 == gdef_len && 40662 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */
+      || (442 == gdef_len && 39116 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */
+      || (430 == gdef_len && 39374 == gpos_len && 2874 == gsub_len)
+      /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */
+      || (490 == gdef_len && 41638 == gpos_len && 3046 == gsub_len)
+      /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */
+      || (478 == gdef_len && 41902 == gpos_len && 3046 == gsub_len)
+    )
+    {
+      /* In certain versions of Times New Roman Italic and Bold Italic,
+       * ASCII double quotation mark U+0022, mapped to glyph 5, has wrong
+       * glyph class 3 (mark) in GDEF.  Nuke the GDEF to avoid zero-width
+       * double-quote.  See:
+       * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
+       */
+     if (3 == layout->gdef->get_glyph_class (5))
+       layout->gdef = &OT::Null(OT::GDEF);
+    }
+    else if (0
+      /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c  tahoma.ttf from Windows 8 */
+      || (898 == gdef_len && 46470 == gpos_len && 12554 == gsub_len)
+      /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc  tahomabd.ttf from Windows 8 */
+      || (910 == gdef_len && 47732 == gpos_len && 12566 == gsub_len)
+      /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e  tahoma.ttf from Windows 8.1 */
+      || (928 == gdef_len && 59332 == gpos_len && 23298 == gsub_len)
+      /* sha1sum:6d400781948517c3c0441ba42acb309584b73033  tahomabd.ttf from Windows 8.1 */
+      || (940 == gdef_len && 60732 == gpos_len && 23310 == gsub_len)
+      /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846  tahoma.ttf from Windows 10 */
+      || (994 == gdef_len && 60336 == gpos_len && 24474 == gsub_len)
+      /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343  tahomabd.ttf from Windows 10 */
+      || (1006 == gdef_len && 61740 == gpos_len && 24470 == gsub_len)
+      /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7  Tahoma.ttf from Mac OS X 10.9 */
+      || (832 == gdef_len && 47162 == gpos_len && 7324 == gsub_len)
+      /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba  Tahoma Bold.ttf from Mac OS X 10.9 */
+      || (844 == gdef_len && 45474 == gpos_len && 7302 == gsub_len)
+      /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0  himalaya.ttf from Windows 8 */
+      || (192 == gdef_len && 7254 == gpos_len && 12638 == gsub_len)
+      /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427  himalaya.ttf from Windows 8.1 */
+      || (192 == gdef_len && 7254 == gpos_len && 12690 == gsub_len)
+      /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44  cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */
+      /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371  cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */
+      || (188 == gdef_len && 3852 == gpos_len && 248 == gsub_len)
+      /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f  cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */
+      /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b  cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */
+      || (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len)
+    )
+    {
+      /* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks
+       * such as certain IPA symbols as glyph class 3. So do older versions of Microsoft Himalaya,
+       * and the version of Cantarell shipped by Ubuntu 16.04.
+       * Nuke the GDEF tables of these fonts to avoid unwanted width-zeroing.
+       * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925
+       *     https://bugzilla.mozilla.org/show_bug.cgi?id=1279693
+       *     https://bugzilla.mozilla.org/show_bug.cgi?id=1279875
+       */
+      layout->gdef = &OT::Null(OT::GDEF);
+    }
+  }
+
   layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
   layout->gpos_lookup_count = layout->gpos->get_lookup_count ();
 
@@ -130,6 +204,8 @@
 }
 
 /**
+ * hb_ot_layout_get_glyph_class:
+ *
  * Since: 0.9.7
  **/
 hb_ot_layout_glyph_class_t
@@ -140,6 +216,8 @@
 }
 
 /**
+ * hb_ot_layout_get_glyphs_in_class:
+ *
  * Since: 0.9.7
  **/
 void
@@ -365,6 +443,8 @@
 }
 
 /**
+ * hb_ot_layout_language_get_required_feature:
+ *
  * Since: 0.9.30
  **/
 hb_bool_t
@@ -452,6 +532,8 @@
 }
 
 /**
+ * hb_ot_layout_feature_get_lookups:
+ *
  * Since: 0.9.7
  **/
 unsigned int
@@ -469,6 +551,8 @@
 }
 
 /**
+ * hb_ot_layout_table_get_lookup_count:
+ *
  * Since: 0.9.22
  **/
 unsigned int
@@ -629,6 +713,8 @@
 }
 
 /**
+ * hb_ot_layout_collect_lookups:
+ *
  * Since: 0.9.8
  **/
 void
@@ -673,6 +759,8 @@
 }
 
 /**
+ * hb_ot_layout_lookup_collect_glyphs:
+ *
  * Since: 0.9.7
  **/
 void
@@ -721,6 +809,8 @@
 }
 
 /**
+ * hb_ot_layout_lookup_would_substitute:
+ *
  * Since: 0.9.7
  **/
 hb_bool_t
@@ -742,7 +832,7 @@
                                            hb_bool_t             zero_context)
 {
   if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
-  OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context);
+  OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context);
 
   const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lookup_index);
 
@@ -755,13 +845,9 @@
   OT::GSUB::substitute_start (font, buffer);
 }
 
-void
-hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer)
-{
-  OT::GSUB::substitute_finish (font, buffer);
-}
-
 /**
+ * hb_ot_layout_lookup_substitute_closure:
+ *
  * Since: 0.9.7
  **/
 void
@@ -793,12 +879,20 @@
 }
 
 void
-hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer)
+hb_ot_layout_position_finish_advances (hb_font_t *font, hb_buffer_t *buffer)
 {
-  OT::GPOS::position_finish (font, buffer);
+  OT::GPOS::position_finish_advances (font, buffer);
+}
+
+void
+hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
+{
+  OT::GPOS::position_finish_offsets (font, buffer);
 }
 
 /**
+ * hb_ot_layout_get_size_params:
+ *
  * Since: 0.9.10
  **/
 hb_bool_t
@@ -882,20 +976,79 @@
 };
 
 
-template <typename Obj>
+struct hb_get_subtables_context_t :
+       OT::hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
+{
+  template <typename Type>
+  static inline bool apply_to (const void *obj, OT::hb_apply_context_t *c)
+  {
+    const Type *typed_obj = (const Type *) obj;
+    return typed_obj->apply (c);
+  }
+
+  typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_apply_context_t *c);
+
+  struct hb_applicable_t
+  {
+    inline void init (const void *obj_, hb_apply_func_t apply_func_)
+    {
+      obj = obj_;
+      apply_func = apply_func_;
+    }
+
+    inline bool apply (OT::hb_apply_context_t *c) const { return apply_func (obj, c); }
+
+    private:
+    const void *obj;
+    hb_apply_func_t apply_func;
+  };
+
+  typedef hb_auto_array_t<hb_applicable_t> array_t;
+
+  /* Dispatch interface. */
+  inline const char *get_name (void) { return "GET_SUBTABLES"; }
+  template <typename T>
+  inline return_t dispatch (const T &obj)
+  {
+    hb_applicable_t *entry = array.push();
+    if (likely (entry))
+      entry->init (&obj, apply_to<T>);
+    return HB_VOID;
+  }
+  static return_t default_return_value (void) { return HB_VOID; }
+  bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
+
+  hb_get_subtables_context_t (array_t &array_) :
+                              array (array_),
+                              debug_depth (0) {}
+
+  array_t &array;
+  unsigned int debug_depth;
+};
+
 static inline bool
 apply_forward (OT::hb_apply_context_t *c,
-               const Obj &obj,
-               const hb_ot_layout_lookup_accelerator_t &accel)
+               const hb_ot_layout_lookup_accelerator_t &accel,
+               const hb_get_subtables_context_t::array_t &subtables)
 {
   bool ret = false;
   hb_buffer_t *buffer = c->buffer;
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
   {
+    bool applied = false;
     if (accel.may_have (buffer->cur().codepoint) &&
         (buffer->cur().mask & c->lookup_mask) &&
-        c->check_glyph_property (&buffer->cur(), c->lookup_props) &&
-        obj.apply (c))
+        c->check_glyph_property (&buffer->cur(), c->lookup_props))
+     {
+       for (unsigned int i = 0; i < subtables.len; i++)
+         if (subtables[i].apply (c))
+         {
+           applied = true;
+           break;
+         }
+     }
+
+    if (applied)
       ret = true;
     else
       buffer->next_glyph ();
@@ -903,11 +1056,10 @@
   return ret;
 }
 
-template <typename Obj>
 static inline bool
 apply_backward (OT::hb_apply_context_t *c,
-                const Obj &obj,
-                const hb_ot_layout_lookup_accelerator_t &accel)
+               const hb_ot_layout_lookup_accelerator_t &accel,
+               const hb_get_subtables_context_t::array_t &subtables)
 {
   bool ret = false;
   hb_buffer_t *buffer = c->buffer;
@@ -915,9 +1067,15 @@
   {
     if (accel.may_have (buffer->cur().codepoint) &&
         (buffer->cur().mask & c->lookup_mask) &&
-        c->check_glyph_property (&buffer->cur(), c->lookup_props) &&
-        obj.apply (c))
-      ret = true;
+        c->check_glyph_property (&buffer->cur(), c->lookup_props))
+    {
+     for (unsigned int i = 0; i < subtables.len; i++)
+       if (subtables[i].apply (c))
+       {
+         ret = true;
+         break;
+       }
+    }
     /* The reverse lookup doesn't "advance" cursor (for good reason). */
     buffer->idx--;
 
@@ -926,26 +1084,6 @@
   return ret;
 }
 
-struct hb_apply_forward_context_t :
-       OT::hb_dispatch_context_t<hb_apply_forward_context_t, bool, HB_DEBUG_APPLY>
-{
-  inline const char *get_name (void) { return "APPLY_FWD"; }
-  template <typename T>
-  inline return_t dispatch (const T &obj) { return apply_forward (c, obj, accel); }
-  static return_t default_return_value (void) { return false; }
-  bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return true; }
-
-  hb_apply_forward_context_t (OT::hb_apply_context_t *c_,
-                              const hb_ot_layout_lookup_accelerator_t &accel_) :
-                                c (c_),
-                                accel (accel_),
-                                debug_depth (0) {}
-
-  OT::hb_apply_context_t *c;
-  const hb_ot_layout_lookup_accelerator_t &accel;
-  unsigned int debug_depth;
-};
-
 template <typename Proxy>
 static inline void
 apply_string (OT::hb_apply_context_t *c,
@@ -959,6 +1097,10 @@
 
   c->set_lookup_props (lookup.get_props ());
 
+  hb_get_subtables_context_t::array_t subtables;
+  hb_get_subtables_context_t c_get_subtables (subtables);
+  lookup.dispatch (&c_get_subtables);
+
   if (likely (!lookup.is_reverse ()))
   {
     /* in/out forward substitution/positioning */
@@ -967,13 +1109,7 @@
     buffer->idx = 0;
 
     bool ret;
-    if (lookup.get_subtable_count () == 1)
-    {
-      hb_apply_forward_context_t c_forward (c, accel);
-      ret = lookup.dispatch (&c_forward);
-    }
-    else
-      ret = apply_forward (c, lookup, accel);
+    ret = apply_forward (c, accel, subtables);
     if (ret)
     {
       if (!Proxy::inplace)
@@ -989,7 +1125,7 @@
       buffer->remove_output ();
     buffer->idx = buffer->len - 1;
 
-    apply_backward (c, lookup, accel);
+    apply_backward (c, accel, subtables);
   }
 }
 
@@ -1008,25 +1144,15 @@
     const stage_map_t *stage = &stages[table_index][stage_index];
     for (; i < stage->last_lookup; i++)
     {
-#if 0
-      char buf[4096];
-      hb_buffer_serialize_glyphs (buffer, 0, buffer->len,
-                                  buf, sizeof (buf), NULL,
-                                  font,
-                                  HB_BUFFER_SERIALIZE_FORMAT_TEXT,
-                                  Proxy::table_index == 0 ?
-                                  HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS :
-                                  HB_BUFFER_SERIALIZE_FLAG_DEFAULT);
-      printf ("buf: [%s]\n", buf);
-#endif
-
       unsigned int lookup_index = lookups[table_index][i].index;
+      if (!buffer->message (font, "start lookup %d", lookup_index)) continue;
       c.set_lookup_index (lookup_index);
       c.set_lookup_mask (lookups[table_index][i].mask);
       c.set_auto_zwj (lookups[table_index][i].auto_zwj);
       apply_string<Proxy> (&c,
                            proxy.table.get_lookup (lookup_index),
                            proxy.accels[lookup_index]);
+      (void) buffer->message (font, "end lookup %d", lookup_index);
     }
 
     if (stage->pause_func)
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h	Tue Aug 09 16:20:02 2016 -0700
@@ -48,7 +48,7 @@
  * GDEF
  */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_has_glyph_classes (hb_face_t *face);
 
 typedef enum {
@@ -59,11 +59,11 @@
   HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT    = 4
 } hb_ot_layout_glyph_class_t;
 
-hb_ot_layout_glyph_class_t
+HB_EXTERN hb_ot_layout_glyph_class_t
 hb_ot_layout_get_glyph_class (hb_face_t      *face,
                               hb_codepoint_t  glyph);
 
-void
+HB_EXTERN void
 hb_ot_layout_get_glyphs_in_class (hb_face_t                  *face,
                                   hb_ot_layout_glyph_class_t  klass,
                                   hb_set_t                   *glyphs /* OUT */);
@@ -71,7 +71,7 @@
 
 /* Not that useful.  Provides list of attach points for a glyph that a
  * client may want to cache */
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_get_attach_points (hb_face_t      *face,
                                 hb_codepoint_t  glyph,
                                 unsigned int    start_offset,
@@ -79,7 +79,7 @@
                                 unsigned int   *point_array /* OUT */);
 
 /* Ligature caret positions */
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_get_ligature_carets (hb_font_t      *font,
                                   hb_direction_t  direction,
                                   hb_codepoint_t  glyph,
@@ -96,35 +96,35 @@
 #define HB_OT_LAYOUT_NO_FEATURE_INDEX           0xFFFFu
 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX     0xFFFFu
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
                                     hb_tag_t      table_tag,
                                     unsigned int  start_offset,
                                     unsigned int *script_count /* IN/OUT */,
                                     hb_tag_t     *script_tags /* OUT */);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_table_find_script (hb_face_t    *face,
                                 hb_tag_t      table_tag,
                                 hb_tag_t      script_tag,
                                 unsigned int *script_index);
 
 /* Like find_script, but takes zero-terminated array of scripts to test */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_table_choose_script (hb_face_t      *face,
                                   hb_tag_t        table_tag,
                                   const hb_tag_t *script_tags,
                                   unsigned int   *script_index,
                                   hb_tag_t       *chosen_script);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
                                      hb_tag_t      table_tag,
                                      unsigned int  start_offset,
                                      unsigned int *feature_count /* IN/OUT */,
                                      hb_tag_t     *feature_tags /* OUT */);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_script_get_language_tags (hb_face_t    *face,
                                        hb_tag_t      table_tag,
                                        unsigned int  script_index,
@@ -132,21 +132,21 @@
                                        unsigned int *language_count /* IN/OUT */,
                                        hb_tag_t     *language_tags /* OUT */);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_script_find_language (hb_face_t    *face,
                                    hb_tag_t      table_tag,
                                    unsigned int  script_index,
                                    hb_tag_t      language_tag,
                                    unsigned int *language_index);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
                                                   hb_tag_t      table_tag,
                                                   unsigned int  script_index,
                                                   unsigned int  language_index,
                                                   unsigned int *feature_index);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_language_get_required_feature (hb_face_t    *face,
                                             hb_tag_t      table_tag,
                                             unsigned int  script_index,
@@ -154,7 +154,7 @@
                                             unsigned int *feature_index,
                                             hb_tag_t     *feature_tag);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
                                            hb_tag_t      table_tag,
                                            unsigned int  script_index,
@@ -163,7 +163,7 @@
                                            unsigned int *feature_count /* IN/OUT */,
                                            unsigned int *feature_indexes /* OUT */);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
                                         hb_tag_t      table_tag,
                                         unsigned int  script_index,
@@ -172,7 +172,7 @@
                                         unsigned int *feature_count /* IN/OUT */,
                                         hb_tag_t     *feature_tags /* OUT */);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_language_find_feature (hb_face_t    *face,
                                     hb_tag_t      table_tag,
                                     unsigned int  script_index,
@@ -180,7 +180,7 @@
                                     hb_tag_t      feature_tag,
                                     unsigned int *feature_index);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_feature_get_lookups (hb_face_t    *face,
                                   hb_tag_t      table_tag,
                                   unsigned int  feature_index,
@@ -188,12 +188,12 @@
                                   unsigned int *lookup_count /* IN/OUT */,
                                   unsigned int *lookup_indexes /* OUT */);
 
-unsigned int
+HB_EXTERN unsigned int
 hb_ot_layout_table_get_lookup_count (hb_face_t    *face,
                                      hb_tag_t      table_tag);
 
 
-void
+HB_EXTERN void
 hb_ot_layout_collect_lookups (hb_face_t      *face,
                               hb_tag_t        table_tag,
                               const hb_tag_t *scripts,
@@ -201,7 +201,7 @@
                               const hb_tag_t *features,
                               hb_set_t       *lookup_indexes /* OUT */);
 
-void
+HB_EXTERN void
 hb_ot_layout_lookup_collect_glyphs (hb_face_t    *face,
                                     hb_tag_t      table_tag,
                                     unsigned int  lookup_index,
@@ -228,7 +228,7 @@
                                        const hb_ot_layout_glyph_sequence_t *sequence,
                                        void         *user_data);
 
-void
+HB_EXTERN void
 Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t    *face,
                                          hb_tag_t      table_tag,
                                          unsigned int  lookup_index,
@@ -241,17 +241,17 @@
  * GSUB
  */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_has_substitution (hb_face_t *face);
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_lookup_would_substitute (hb_face_t            *face,
                                       unsigned int          lookup_index,
                                       const hb_codepoint_t *glyphs,
                                       unsigned int          glyphs_length,
                                       hb_bool_t             zero_context);
 
-void
+HB_EXTERN void
 hb_ot_layout_lookup_substitute_closure (hb_face_t    *face,
                                         unsigned int  lookup_index,
                                         hb_set_t     *glyphs
@@ -259,7 +259,7 @@
 
 #ifdef HB_NOT_IMPLEMENTED
 /* Note: You better have GDEF when using this API, or marks won't do much. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 Xhb_ot_layout_lookup_substitute (hb_font_t            *font,
                                 unsigned int          lookup_index,
                                 const hb_ot_layout_glyph_sequence_t *sequence,
@@ -274,12 +274,12 @@
  * GPOS
  */
 
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_has_positioning (hb_face_t *face);
 
 #ifdef HB_NOT_IMPLEMENTED
 /* Note: You better have GDEF when using this API, or marks won't do much. */
-hb_bool_t
+HB_EXTERN hb_bool_t
 Xhb_ot_layout_lookup_position (hb_font_t            *font,
                               unsigned int          lookup_index,
                               const hb_ot_layout_glyph_sequence_t *sequence,
@@ -288,7 +288,7 @@
 
 /* Optical 'size' feature info.  Returns true if found.
  * http://www.microsoft.com/typography/otspec/features_pt.htm#size */
-hb_bool_t
+HB_EXTERN hb_bool_t
 hb_ot_layout_get_size_params (hb_face_t    *face,
                               unsigned int *design_size,       /* OUT.  May be NULL */
                               unsigned int *subfamily_id,      /* OUT.  May be NULL */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -159,23 +159,9 @@
   F_MANUAL_ZWJ          = 0x0004u, /* Don't skip over ZWJ when matching. */
   F_GLOBAL_SEARCH       = 0x0008u  /* If feature not found in LangSys, look for it in global feature list and pick one. */
 };
+HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t);
 /* Macro version for where const is desired. */
 #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
-static inline hb_ot_map_feature_flags_t
-operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator ~ (hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t (~(unsigned int) r); }
-static inline hb_ot_map_feature_flags_t&
-operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
-{ l = l | r; return l; }
-static inline hb_ot_map_feature_flags_t&
-operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
-{ l = l & r; return l; }
 
 
 struct hb_ot_map_builder_t
@@ -217,7 +203,8 @@
     unsigned int stage[2]; /* GSUB/GPOS */
 
     static int cmp (const feature_info_t *a, const feature_info_t *b)
-    { return (a->tag != b->tag) ?  (a->tag < b->tag ? -1 : 1) : (a->seq < b->seq ? -1 : 1); }
+    { return (a->tag != b->tag) ?  (a->tag < b->tag ? -1 : 1) :
+             (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); }
   };
 
   struct stage_info_t {
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -89,7 +89,7 @@
 
   for (unsigned int table_index = 0; table_index < 2; table_index++) {
     hb_tag_t table_tag = table_tags[table_index];
-    found_script[table_index] = hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
+    found_script[table_index] = (bool) hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
     hb_ot_layout_script_find_language (face, table_tag, script_index[table_index], language_tag, &language_index[table_index]);
   }
 }
@@ -204,11 +204,8 @@
     for (unsigned int table_index = 0; table_index < 2; table_index++)
     {
       if (required_feature_tag[table_index] == info->tag)
-      {
         required_feature_stage[table_index] = info->stage[table_index];
-        found = true;
-        continue;
-      }
+
       found |= hb_ot_layout_language_find_feature (face,
                                                    table_tags[table_index],
                                                    script_index[table_index],
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-maxp-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-maxp-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -58,7 +58,7 @@
 
   /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
   protected:
-  FixedVersion  version;                /* Version of the maxp table (0.5 or 1.0),
+  FixedVersion<>version;                /* Version of the maxp table (0.5 or 1.0),
                                          * 0x00005000u or 0x00010000u. */
   USHORT        numGlyphs;              /* The number of glyphs in the font. */
   public:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-os2-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2011,2012  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_OS2_TABLE_HH
+#define HB_OT_OS2_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+
+namespace OT {
+
+/*
+ * OS/2 and Windows Metrics
+ * http://www.microsoft.com/typography/otspec/os2.htm
+ */
+
+#define HB_OT_TAG_os2 HB_TAG('O','S','/','2')
+
+struct os2
+{
+  static const hb_tag_t tableTag = HB_OT_TAG_os2;
+
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this));
+  }
+
+  public:
+  USHORT        version;
+
+  /* Version 0 */
+  SHORT         xAvgCharWidth;
+  USHORT        usWeightClass;
+  USHORT        usWidthClass;
+  USHORT        fsType;
+  SHORT         ySubscriptXSize;
+  SHORT         ySubscriptYSize;
+  SHORT         ySubscriptXOffset;
+  SHORT         ySubscriptYOffset;
+  SHORT         ySuperscriptXSize;
+  SHORT         ySuperscriptYSize;
+  SHORT         ySuperscriptXOffset;
+  SHORT         ySuperscriptYOffset;
+  SHORT         yStrikeoutSize;
+  SHORT         yStrikeoutPosition;
+  SHORT         sFamilyClass;
+  BYTE          panose[10];
+  ULONG         ulUnicodeRange[4];
+  Tag           achVendID;
+  USHORT        fsSelection;
+  USHORT        usFirstCharIndex;
+  USHORT        usLastCharIndex;
+  SHORT         sTypoAscender;
+  SHORT         sTypoDescender;
+  SHORT         sTypoLineGap;
+  USHORT        usWinAscent;
+  USHORT        usWinDescent;
+
+  /* Version 1 */
+  //ULONG ulCodePageRange1;
+  //ULONG ulCodePageRange2;
+
+  /* Version 2 */
+  //SHORT sxHeight;
+  //SHORT sCapHeight;
+  //USHORT  usDefaultChar;
+  //USHORT  usBreakChar;
+  //USHORT  usMaxContext;
+
+  /* Version 5 */
+  //USHORT  usLowerOpticalPointSize;
+  //USHORT  usUpperOpticalPointSize;
+
+  public:
+  DEFINE_SIZE_STATIC (78);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_OS2_TABLE_HH */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-table.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-table.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -6,10 +6,10 @@
  *
  * on files with these headers:
  *
- * # ArabicShaping-8.0.0.txt
- * # Date: 2015-02-17, 23:33:00 GMT [RP]
- * # Blocks-8.0.0.txt
- * # Date: 2014-11-10, 23:04:00 GMT [KW]
+ * # ArabicShaping-9.0.0.txt
+ * # Date: 2016-02-24, 22:25:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
  * UnicodeData.txt does not have a header.
  */
 
@@ -19,6 +19,7 @@
 
 #define X       JOINING_TYPE_X
 #define R       JOINING_TYPE_R
+#define T       JOINING_TYPE_T
 #define U       JOINING_TYPE_U
 #define A       JOINING_GROUP_ALAPH
 #define DR      JOINING_GROUP_DALATH_RISH
@@ -76,9 +77,11 @@
 
   /* Arabic Extended-A */
 
-  /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,
+  /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,X,D,D,D,R,D,D,D,D,X,X,
+  /* 08C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 08E0 */ X,X,U,
 
-#define joining_offset_0x1806u 693
+#define joining_offset_0x1806u 739
 
   /* Mongolian */
 
@@ -86,43 +89,48 @@
   /* 1820 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 1840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 1860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,X,
-  /* 1880 */ U,U,U,U,U,U,U,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+  /* 1880 */ U,U,U,U,U,T,T,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 18A0 */ D,D,D,D,D,D,D,D,D,X,D,
 
-#define joining_offset_0x200cu 858
+#define joining_offset_0x200cu 904
 
   /* General Punctuation */
 
-  /* 2000 */                         U,C,
+  /* 2000 */                         U,C,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 2020 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 2040 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+  /* 2060 */ X,X,X,X,X,X,U,U,U,U,
 
-#define joining_offset_0x2066u 860
-
-  /* General Punctuation */
-
-  /* 2060 */             U,U,U,U,
-
-#define joining_offset_0xa840u 864
+#define joining_offset_0xa840u 998
 
   /* Phags-pa */
 
   /* A840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* A860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,L,U,
 
-#define joining_offset_0x10ac0u 916
+#define joining_offset_0x10ac0u 1050
 
   /* Manichaean */
 
   /* 10AC0 */ D,D,D,D,D,R,U,R,U,R,R,U,U,L,R,R,R,R,R,D,D,D,D,L,D,D,D,D,D,R,D,D,
   /* 10AE0 */ D,R,U,U,R,X,X,X,X,X,X,D,D,D,D,R,
 
-#define joining_offset_0x10b80u 964
+#define joining_offset_0x10b80u 1098
 
   /* Psalter Pahlavi */
 
   /* 10B80 */ D,R,D,R,R,R,D,D,D,R,D,D,R,D,R,R,D,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
   /* 10BA0 */ X,X,X,X,X,X,X,X,X,R,R,R,R,D,D,U,
 
-}; /* Table items: 1012; occupancy: 57% */
+#define joining_offset_0x1e900u 1146
+
+  /* Adlam */
+
+  /* 1E900 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+  /* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+  /* 1E940 */ D,D,D,D,
+
+}; /* Table items: 1214; occupancy: 54% */
 
 
 static unsigned int
@@ -131,7 +139,7 @@
   switch (u >> 12)
   {
     case 0x0u:
-      if (hb_in_range (u, 0x0600u, 0x08B4u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
+      if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
       break;
 
     case 0x1u:
@@ -139,8 +147,7 @@
       break;
 
     case 0x2u:
-      if (hb_in_range (u, 0x200Cu, 0x200Du)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
-      if (hb_in_range (u, 0x2066u, 0x2069u)) return joining_table[u - 0x2066u + joining_offset_0x2066u];
+      if (hb_in_range (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
       break;
 
     case 0xAu:
@@ -152,6 +159,10 @@
       if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
       break;
 
+    case 0x1Eu:
+      if (hb_in_range (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
+      break;
+
     default:
       break;
   }
@@ -160,6 +171,7 @@
 
 #undef X
 #undef R
+#undef T
 #undef U
 #undef A
 #undef DR
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -28,9 +28,38 @@
 #include "hb-ot-shape-private.hh"
 
 
+#ifndef HB_DEBUG_ARABIC
+#define HB_DEBUG_ARABIC (HB_DEBUG+0)
+#endif
+
+
 /* buffer var allocations */
 #define arabic_shaping_action() complex_var_u8_0() /* arabic shaping action */
 
+#define HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH HB_BUFFER_SCRATCH_FLAG_COMPLEX0
+
+/* See:
+ * https://github.com/behdad/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
+#define HB_ARABIC_GENERAL_CATEGORY_IS_WORD(gen_cat) \
+        (FLAG_SAFE (gen_cat) & \
+         (FLAG (HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE) | \
+          /*FLAG (HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER) |*/ \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER) | \
+          /*FLAG (HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER) |*/ \
+          /*FLAG (HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER) |*/ \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL) | \
+          FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL)))
+
 
 /*
  * Joining types:
@@ -84,7 +113,7 @@
 
 
 /* Same order as the feature array */
-enum {
+enum arabic_action_t {
   ISOL,
   FINA,
   FIN2,
@@ -95,7 +124,11 @@
 
   NONE,
 
-  ARABIC_NUM_FEATURES = NONE
+  ARABIC_NUM_FEATURES = NONE,
+
+  /* We abuse the same byte for other things... */
+  STCH_FIXED,
+  STCH_REPEATING,
 };
 
 static const struct arabic_state_table_entry {
@@ -140,6 +173,11 @@
                        hb_buffer_t *buffer);
 
 static void
+record_stch (const hb_ot_shape_plan_t *plan,
+             hb_font_t *font,
+             hb_buffer_t *buffer);
+
+static void
 collect_features_arabic (hb_ot_shape_planner_t *plan)
 {
   hb_ot_map_builder_t *map = &plan->map;
@@ -165,6 +203,9 @@
 
   map->add_gsub_pause (nuke_joiners);
 
+  map->add_global_bool_feature (HB_TAG('s','t','c','h'));
+  map->add_gsub_pause (record_stch);
+
   map->add_global_bool_feature (HB_TAG('c','c','m','p'));
   map->add_global_bool_feature (HB_TAG('l','o','c','l'));
 
@@ -182,7 +223,6 @@
     map->add_gsub_pause (arabic_fallback_shape);
 
   map->add_global_bool_feature (HB_TAG('c','a','l','t'));
-  map->add_gsub_pause (NULL);
 
   /* The spec includes 'cswh'.  Earlier versions of Windows
    * used to enable this by default, but testing suggests
@@ -192,6 +232,7 @@
    * Note that IranNastaliq uses this feature extensively
    * to fixup broken glyph sequences.  Oh well...
    * Test case: U+0643,U+0640,U+0631. */
+  //map->add_gsub_pause (NULL);
   //map->add_global_bool_feature (HB_TAG('c','s','w','h'));
   map->add_global_bool_feature (HB_TAG('m','s','e','t'));
 }
@@ -208,8 +249,10 @@
    * mask_array[NONE] == 0. */
   hb_mask_t mask_array[ARABIC_NUM_FEATURES + 1];
 
-  bool do_fallback;
   arabic_fallback_plan_t *fallback_plan;
+
+  unsigned int do_fallback : 1;
+  unsigned int has_stch : 1;
 };
 
 void *
@@ -220,6 +263,7 @@
     return NULL;
 
   arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
+  arabic_plan->has_stch = !!plan->map.get_1_mask (HB_TAG ('s','t','c','h'));
   for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) {
     arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]);
     arabic_plan->do_fallback = arabic_plan->do_fallback &&
@@ -320,8 +364,6 @@
   hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 0; i < count; i++)
     info[i].mask |= arabic_plan->mask_array[info[i].arabic_shaping_action()];
-
-  HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
 }
 
 static void
@@ -371,6 +413,197 @@
   arabic_fallback_plan_shape (fallback_plan, font, buffer);
 }
 
+/*
+ * Stretch feature: "stch".
+ * See example here:
+ * https://www.microsoft.com/typography/OpenTypeDev/syriac/intro.htm
+ * We implement this in a generic way, such that the Arabic subtending
+ * marks can use it as well.
+ */
+
+static void
+record_stch (const hb_ot_shape_plan_t *plan,
+             hb_font_t *font,
+             hb_buffer_t *buffer)
+{
+  const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) plan->data;
+  if (!arabic_plan->has_stch)
+    return;
+
+  /* 'stch' feature was just applied.  Look for anything that multiplied,
+   * and record it for stch treatment later.  Note that rtlm, frac, etc
+   * are applied before stch, but we assume that they didn't result in
+   * anything multiplying into 5 pieces, so it's safe-ish... */
+
+  unsigned int count = buffer->len;
+  hb_glyph_info_t *info = buffer->info;
+  for (unsigned int i = 0; i < count; i++)
+    if (unlikely (_hb_glyph_info_multiplied (&info[i])))
+    {
+      unsigned int comp = _hb_glyph_info_get_lig_comp (&info[i]);
+      info[i].arabic_shaping_action() = comp % 2 ? STCH_REPEATING : STCH_FIXED;
+      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH;
+    }
+}
+
+static void
+apply_stch (const hb_ot_shape_plan_t *plan,
+            hb_buffer_t              *buffer,
+            hb_font_t                *font)
+{
+  if (likely (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH)))
+    return;
+
+  /* The Arabic shaper currently always processes in RTL mode, so we should
+   * stretch / position the stretched pieces to the left / preceding glyphs. */
+
+  /* We do a two pass implementation:
+   * First pass calculates the exact number of extra glyphs we need,
+   * We then enlarge buffer to have that much room,
+   * Second pass applies the stretch, copying things to the end of buffer.
+   */
+
+  int sign = font->x_scale < 0 ? -1 : +1;
+  unsigned int extra_glyphs_needed = 0; // Set during MEASURE, used during CUT
+  typedef enum { MEASURE, CUT } step_t;
+
+  for (step_t step = MEASURE; step <= CUT; step = (step_t) (step + 1))
+  {
+    unsigned int count = buffer->len;
+    hb_glyph_info_t *info = buffer->info;
+    hb_glyph_position_t *pos = buffer->pos;
+    unsigned int new_len = count + extra_glyphs_needed; // write head during CUT
+    unsigned int j = new_len;
+    for (unsigned int i = count; i; i--)
+    {
+      if (!hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
+      {
+        if (step == CUT)
+        {
+          --j;
+          info[j] = info[i - 1];
+          pos[j] = pos[i - 1];
+        }
+        continue;
+      }
+
+      /* Yay, justification! */
+
+      hb_position_t w_total = 0; // Total to be filled
+      hb_position_t w_fixed = 0; // Sum of fixed tiles
+      hb_position_t w_repeating = 0; // Sum of repeating tiles
+      int n_fixed = 0;
+      int n_repeating = 0;
+
+      unsigned int end = i;
+      while (i &&
+             hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
+      {
+        i--;
+        hb_position_t width = font->get_glyph_h_advance (info[i].codepoint);
+        if (info[i].arabic_shaping_action() == STCH_FIXED)
+        {
+          w_fixed += width;
+          n_fixed++;
+        }
+        else
+        {
+          w_repeating += width;
+          n_repeating++;
+        }
+      }
+      unsigned int start = i;
+      unsigned int context = i;
+      while (context &&
+             !hb_in_range<unsigned> (info[context - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING) &&
+             (_hb_glyph_info_is_default_ignorable (&info[context - 1]) ||
+              HB_ARABIC_GENERAL_CATEGORY_IS_WORD (_hb_glyph_info_get_general_category (&info[context - 1]))))
+      {
+        context--;
+        w_total += pos[context].x_advance;
+      }
+      i++; // Don't touch i again.
+
+      DEBUG_MSG (ARABIC, NULL, "%s stretch at (%d,%d,%d)",
+                 step == MEASURE ? "measuring" : "cutting", context, start, end);
+      DEBUG_MSG (ARABIC, NULL, "rest of word:    count=%d width %d", start - context, w_total);
+      DEBUG_MSG (ARABIC, NULL, "fixed tiles:     count=%d width=%d", n_fixed, w_fixed);
+      DEBUG_MSG (ARABIC, NULL, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
+
+      /* Number of additional times to repeat each repeating tile. */
+      int n_copies = 0;
+
+      hb_position_t w_remaining = w_total - w_fixed;
+      if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0)
+        n_copies = (sign * w_remaining) / (sign * w_repeating) - 1;
+
+      /* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */
+      hb_position_t extra_repeat_overlap = 0;
+      hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
+      if (shortfall > 0)
+      {
+        ++n_copies;
+        hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
+        if (excess > 0)
+          extra_repeat_overlap = excess / (n_copies * n_repeating);
+      }
+
+      if (step == MEASURE)
+      {
+        extra_glyphs_needed += n_copies * n_repeating;
+        DEBUG_MSG (ARABIC, NULL, "will add extra %d copies of repeating tiles", n_copies);
+      }
+      else
+      {
+        hb_position_t x_offset = 0;
+        for (unsigned int k = end; k > start; k--)
+        {
+          hb_position_t width = font->get_glyph_h_advance (info[k - 1].codepoint);
+
+          unsigned int repeat = 1;
+          if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
+            repeat += n_copies;
+
+          DEBUG_MSG (ARABIC, NULL, "appending %d copies of glyph %d; j=%d",
+                     repeat, info[k - 1].codepoint, j);
+          for (unsigned int n = 0; n < repeat; n++)
+          {
+            x_offset -= width;
+            if (n > 0)
+              x_offset += extra_repeat_overlap;
+            pos[k - 1].x_offset = x_offset;
+            /* Append copy. */
+            --j;
+            info[j] = info[k - 1];
+            pos[j] = pos[k - 1];
+          }
+        }
+      }
+    }
+
+    if (step == MEASURE)
+    {
+      if (unlikely (!buffer->ensure (count + extra_glyphs_needed)))
+        break;
+    }
+    else
+    {
+      assert (j == 0);
+      buffer->len = new_len;
+    }
+  }
+}
+
+
+static void
+postprocess_glyphs_arabic (const hb_ot_shape_plan_t *plan,
+                           hb_buffer_t              *buffer,
+                           hb_font_t                *font)
+{
+  apply_stch (plan, buffer, font);
+
+  HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
+}
 
 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
 {
@@ -379,7 +612,8 @@
   NULL, /* override_features */
   data_create_arabic,
   data_destroy_arabic,
-  NULL, /* preprocess_text_arabic */
+  NULL, /* preprocess_text */
+  postprocess_glyphs_arabic,
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -35,10 +35,11 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   NULL, /* compose */
   NULL, /* setup_masks */
-  HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
   true, /* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -188,7 +188,7 @@
                                     */
   unsigned int count = buffer->len;
 
-  for (buffer->idx = 0; buffer->idx < count;)
+  for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
   {
     hb_codepoint_t u = buffer->cur().codepoint;
 
@@ -411,13 +411,14 @@
   "hangul",
   collect_features_hangul,
   override_features_hangul,
-  data_create_hangul, /* data_create */
-  data_destroy_hangul, /* data_destroy */
+  data_create_hangul,
+  data_destroy_hangul,
   preprocess_text_hangul,
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
   NULL, /* decompose */
   NULL, /* compose */
-  setup_masks_hangul, /* setup_masks */
+  setup_masks_hangul,
   HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
   false, /* fallback_position */
 };
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -68,7 +68,7 @@
     0xFB4Au /* TAV */
   };
 
-  bool found = c->unicode->compose (a, b, ab);
+  bool found = (bool) c->unicode->compose (a, b, ab);
 
   if (!found && !c->plan->has_mark)
   {
@@ -163,6 +163,7 @@
   NULL, /* data_create */
   NULL, /* data_destroy */
   NULL, /* preprocess_text */
+  NULL, /* postprocess_glyphs */
   HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
   NULL, /* decompose */
   compose_hebrew,
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -56,52 +56,52 @@
         5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u,
         5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u,
         4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u,
-        16u, 16u, 8u, 8u, 1u, 31u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
+        16u, 16u, 8u, 8u, 1u, 18u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+        3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+        3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u,
         5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
         3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
         3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
-        5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 3u, 31u, 3u, 31u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
-        5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
-        3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
-        3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
-        5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        4u, 14u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u,
-        4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u,
-        4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u, 5u, 10u,
+        5u, 14u, 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u,
+        1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u,
+        4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u,
+        4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u,
         9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u,
         5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u,
         4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
-        3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        4u, 14u, 3u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
-        3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
-        5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
-        3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+        3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u,
+        9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+        3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+        3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u,
+        4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u,
+        3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u,
+        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 3u, 17u, 4u, 14u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+        3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u,
+        9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+        3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+        3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u,
+        4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+        3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u,
+        3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u,
+        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u,
+        1u, 17u, 4u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u,
+        5u, 10u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 3u, 17u, 3u, 17u, 1u, 16u,
         3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
-        5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
-        1u, 16u, 3u, 31u, 1u, 31u, 3u, 31u, 1u, 31u, 4u, 14u, 5u, 10u, 9u, 10u,
-        9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 1u, 16u, 3u, 31u, 3u, 31u,
-        4u, 31u, 3u, 31u, 3u, 31u, 1u, 16u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u,
-        4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
-        3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u,
-        5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 0
+        5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+        3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u,
+        9u, 10u, 9u, 9u, 5u, 10u, 0
 };
 
 static const char _indic_syllable_machine_key_spans[] = {
@@ -127,52 +127,52 @@
         3, 4, 3, 1, 4, 3, 1, 4,
         3, 1, 1, 16, 6, 5, 1, 1,
         5, 1, 1, 5, 1, 1, 5, 1,
-        1, 1, 31, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 10, 10,
+        1, 1, 18, 15, 15, 14, 16, 15,
+        15, 14, 16, 15, 15, 14, 16, 15,
+        15, 14, 16, 15, 15, 14, 10, 10,
         6, 2, 1, 2, 2, 1, 6, 11,
         8, 6, 8, 11, 12, 12, 11, 10,
         12, 11, 10, 12, 11, 10, 12, 11,
-        10, 12, 16, 28, 11, 29, 29, 16,
-        16, 16, 16, 16, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        16, 29, 29, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 10, 10,
-        6, 2, 1, 2, 2, 1, 6, 11,
-        8, 6, 8, 11, 12, 12, 11, 10,
-        12, 11, 10, 12, 11, 10, 12, 11,
-        10, 12, 16, 28, 11, 29, 29, 16,
-        16, 16, 16, 16, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        11, 16, 29, 29, 28, 16, 29, 29,
-        28, 16, 29, 29, 28, 16, 29, 29,
-        28, 16, 29, 29, 28, 10, 10, 6,
+        10, 12, 16, 11, 15, 15, 16, 16,
+        16, 16, 16, 15, 15, 16, 16, 16,
+        16, 16, 15, 15, 16, 16, 16, 16,
+        16, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 15, 15, 14, 16, 15, 15,
+        14, 16, 15, 15, 14, 16, 15, 15,
+        14, 16, 15, 15, 14, 10, 10, 6,
         2, 1, 2, 2, 1, 6, 11, 8,
         6, 8, 11, 12, 12, 11, 10, 12,
         11, 10, 12, 11, 10, 12, 11, 10,
-        12, 16, 28, 11, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        16, 29, 29, 16, 16, 16, 16, 16,
-        11, 29, 11, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 16, 29,
-        29, 28, 16, 29, 29, 28, 10, 10,
-        6, 2, 1, 2, 2, 1, 6, 11,
-        8, 6, 8, 11, 12, 12, 11, 10,
+        12, 16, 11, 15, 15, 16, 16, 16,
+        16, 16, 15, 15, 16, 16, 16, 16,
+        16, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 16, 16, 16, 16, 11, 16,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 10, 10, 6, 2, 1,
+        2, 2, 1, 6, 11, 8, 6, 8,
+        11, 12, 12, 11, 10, 12, 11, 10,
+        12, 11, 10, 12, 11, 10, 12, 16,
+        11, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 16, 16, 16, 16, 16, 15,
+        15, 16, 16, 16, 16, 16, 15, 15,
+        16, 16, 16, 16, 16, 11, 15, 11,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 16, 15, 15, 14, 16,
+        15, 15, 14, 10, 10, 6, 2, 1,
+        2, 2, 1, 6, 11, 8, 6, 8,
+        11, 12, 12, 11, 10, 12, 11, 10,
+        12, 11, 10, 12, 11, 10, 12, 16,
+        11, 15, 15, 16, 16, 16, 16, 16,
+        15, 15, 16, 16, 16, 16, 16, 15,
+        15, 16, 16, 16, 16, 16, 15, 15,
+        16, 16, 16, 16, 16, 15, 17, 15,
+        17, 11, 6, 2, 1, 2, 2, 1,
+        6, 16, 15, 15, 14, 15, 15, 16,
         12, 11, 10, 12, 11, 10, 12, 11,
-        10, 12, 16, 28, 11, 29, 29, 16,
-        16, 16, 16, 16, 29, 29, 16, 16,
-        16, 16, 16, 29, 29, 16, 16, 16,
-        16, 16, 29, 29, 16, 16, 16, 16,
-        16, 29, 31, 29, 31, 11, 6, 2,
-        1, 2, 2, 1, 6, 16, 29, 29,
-        28, 29, 29, 16, 12, 11, 10, 12,
-        11, 10, 12, 11, 10, 12, 11, 10,
-        11, 8, 6, 8, 11, 16, 8, 6,
-        6, 2, 1, 2, 2, 1, 6
+        10, 12, 11, 10, 11, 8, 6, 8,
+        11, 16, 8, 6, 6, 2, 1, 2,
+        2, 1, 6
 };
 
 static const short _indic_syllable_machine_index_offsets[] = {
@@ -198,52 +198,52 @@
         954, 958, 963, 967, 969, 974, 978, 980,
         985, 989, 991, 993, 1010, 1017, 1023, 1025,
         1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053,
-        1055, 1057, 1059, 1091, 1121, 1151, 1180, 1197,
-        1227, 1257, 1286, 1303, 1333, 1363, 1392, 1409,
-        1439, 1469, 1498, 1515, 1545, 1575, 1604, 1615,
-        1626, 1633, 1636, 1638, 1641, 1644, 1646, 1653,
-        1665, 1674, 1681, 1690, 1702, 1715, 1728, 1740,
-        1751, 1764, 1776, 1787, 1800, 1812, 1823, 1836,
-        1848, 1859, 1872, 1889, 1918, 1930, 1960, 1990,
-        2007, 2024, 2041, 2058, 2075, 2105, 2135, 2152,
-        2169, 2186, 2203, 2220, 2250, 2280, 2297, 2314,
-        2331, 2348, 2365, 2395, 2425, 2442, 2459, 2476,
-        2493, 2510, 2540, 2570, 2600, 2630, 2659, 2676,
-        2706, 2736, 2765, 2782, 2812, 2842, 2871, 2888,
-        2918, 2948, 2977, 2994, 3024, 3054, 3083, 3094,
-        3105, 3112, 3115, 3117, 3120, 3123, 3125, 3132,
-        3144, 3153, 3160, 3169, 3181, 3194, 3207, 3219,
-        3230, 3243, 3255, 3266, 3279, 3291, 3302, 3315,
-        3327, 3338, 3351, 3368, 3397, 3409, 3439, 3469,
-        3486, 3503, 3520, 3537, 3554, 3584, 3614, 3631,
-        3648, 3665, 3682, 3699, 3729, 3759, 3776, 3793,
-        3810, 3827, 3844, 3874, 3904, 3921, 3938, 3955,
-        3972, 3984, 4001, 4031, 4061, 4090, 4107, 4137,
-        4167, 4196, 4213, 4243, 4273, 4302, 4319, 4349,
-        4379, 4408, 4425, 4455, 4485, 4514, 4525, 4536,
-        4543, 4546, 4548, 4551, 4554, 4556, 4563, 4575,
-        4584, 4591, 4600, 4612, 4625, 4638, 4650, 4661,
-        4674, 4686, 4697, 4710, 4722, 4733, 4746, 4758,
-        4769, 4782, 4799, 4828, 4840, 4870, 4900, 4917,
-        4934, 4951, 4968, 4985, 5015, 5045, 5062, 5079,
-        5096, 5113, 5130, 5160, 5190, 5207, 5224, 5241,
-        5258, 5275, 5305, 5335, 5352, 5369, 5386, 5403,
-        5420, 5432, 5462, 5474, 5504, 5534, 5563, 5580,
-        5610, 5640, 5669, 5686, 5716, 5746, 5775, 5792,
-        5822, 5852, 5881, 5898, 5928, 5958, 5987, 5998,
-        6009, 6016, 6019, 6021, 6024, 6027, 6029, 6036,
-        6048, 6057, 6064, 6073, 6085, 6098, 6111, 6123,
-        6134, 6147, 6159, 6170, 6183, 6195, 6206, 6219,
-        6231, 6242, 6255, 6272, 6301, 6313, 6343, 6373,
-        6390, 6407, 6424, 6441, 6458, 6488, 6518, 6535,
-        6552, 6569, 6586, 6603, 6633, 6663, 6680, 6697,
-        6714, 6731, 6748, 6778, 6808, 6825, 6842, 6859,
-        6876, 6893, 6923, 6955, 6985, 7017, 7029, 7036,
-        7039, 7041, 7044, 7047, 7049, 7056, 7073, 7103,
-        7133, 7162, 7192, 7222, 7239, 7252, 7264, 7275,
-        7288, 7300, 7311, 7324, 7336, 7347, 7360, 7372,
-        7383, 7395, 7404, 7411, 7420, 7432, 7449, 7458,
-        7465, 7472, 7475, 7477, 7480, 7483, 7485
+        1055, 1057, 1059, 1078, 1094, 1110, 1125, 1142,
+        1158, 1174, 1189, 1206, 1222, 1238, 1253, 1270,
+        1286, 1302, 1317, 1334, 1350, 1366, 1381, 1392,
+        1403, 1410, 1413, 1415, 1418, 1421, 1423, 1430,
+        1442, 1451, 1458, 1467, 1479, 1492, 1505, 1517,
+        1528, 1541, 1553, 1564, 1577, 1589, 1600, 1613,
+        1625, 1636, 1649, 1666, 1678, 1694, 1710, 1727,
+        1744, 1761, 1778, 1795, 1811, 1827, 1844, 1861,
+        1878, 1895, 1912, 1928, 1944, 1961, 1978, 1995,
+        2012, 2029, 2045, 2061, 2078, 2095, 2112, 2129,
+        2146, 2162, 2178, 2194, 2210, 2225, 2242, 2258,
+        2274, 2289, 2306, 2322, 2338, 2353, 2370, 2386,
+        2402, 2417, 2434, 2450, 2466, 2481, 2492, 2503,
+        2510, 2513, 2515, 2518, 2521, 2523, 2530, 2542,
+        2551, 2558, 2567, 2579, 2592, 2605, 2617, 2628,
+        2641, 2653, 2664, 2677, 2689, 2700, 2713, 2725,
+        2736, 2749, 2766, 2778, 2794, 2810, 2827, 2844,
+        2861, 2878, 2895, 2911, 2927, 2944, 2961, 2978,
+        2995, 3012, 3028, 3044, 3061, 3078, 3095, 3112,
+        3129, 3145, 3161, 3178, 3195, 3212, 3229, 3241,
+        3258, 3274, 3290, 3305, 3322, 3338, 3354, 3369,
+        3386, 3402, 3418, 3433, 3450, 3466, 3482, 3497,
+        3514, 3530, 3546, 3561, 3572, 3583, 3590, 3593,
+        3595, 3598, 3601, 3603, 3610, 3622, 3631, 3638,
+        3647, 3659, 3672, 3685, 3697, 3708, 3721, 3733,
+        3744, 3757, 3769, 3780, 3793, 3805, 3816, 3829,
+        3846, 3858, 3874, 3890, 3907, 3924, 3941, 3958,
+        3975, 3991, 4007, 4024, 4041, 4058, 4075, 4092,
+        4108, 4124, 4141, 4158, 4175, 4192, 4209, 4225,
+        4241, 4258, 4275, 4292, 4309, 4326, 4338, 4354,
+        4366, 4382, 4398, 4413, 4430, 4446, 4462, 4477,
+        4494, 4510, 4526, 4541, 4558, 4574, 4590, 4605,
+        4622, 4638, 4654, 4669, 4680, 4691, 4698, 4701,
+        4703, 4706, 4709, 4711, 4718, 4730, 4739, 4746,
+        4755, 4767, 4780, 4793, 4805, 4816, 4829, 4841,
+        4852, 4865, 4877, 4888, 4901, 4913, 4924, 4937,
+        4954, 4966, 4982, 4998, 5015, 5032, 5049, 5066,
+        5083, 5099, 5115, 5132, 5149, 5166, 5183, 5200,
+        5216, 5232, 5249, 5266, 5283, 5300, 5317, 5333,
+        5349, 5366, 5383, 5400, 5417, 5434, 5450, 5468,
+        5484, 5502, 5514, 5521, 5524, 5526, 5529, 5532,
+        5534, 5541, 5558, 5574, 5590, 5605, 5621, 5637,
+        5654, 5667, 5679, 5690, 5703, 5715, 5726, 5739,
+        5751, 5762, 5775, 5787, 5798, 5810, 5819, 5826,
+        5835, 5847, 5864, 5873, 5880, 5887, 5890, 5892,
+        5895, 5898, 5900
 };
 
 static const short _indic_syllable_machine_indicies[] = {
@@ -381,882 +381,684 @@
         161, 161, 162, 157, 0, 183, 0, 184,
         0, 186, 185, 188, 189, 190, 191, 192,
         193, 84, 79, 194, 195, 196, 196, 156,
-        197, 198, 199, 200, 201, 187, 187, 187,
-        187, 187, 187, 187, 187, 187, 187, 187,
-        187, 202, 187, 204, 205, 206, 207, 6,
-        1, 208, 209, 203, 203, 38, 210, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 213, 205, 214, 214, 6, 1, 208,
-        209, 203, 203, 203, 210, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 205,
-        214, 214, 6, 1, 208, 209, 203, 203,
-        203, 210, 203, 203, 211, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 212, 203, 215, 203, 203, 203,
-        19, 216, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 215, 203, 218, 219, 220,
-        221, 6, 1, 208, 209, 203, 203, 36,
-        222, 203, 203, 211, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 212, 203, 223, 219, 224, 224, 6,
-        1, 208, 209, 203, 203, 203, 222, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 219, 224, 224, 6, 1, 208, 209,
-        203, 203, 203, 222, 203, 203, 211, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 212, 203, 225, 203,
-        203, 203, 19, 226, 203, 1, 208, 209,
-        203, 203, 203, 217, 203, 225, 203, 227,
-        228, 229, 230, 6, 1, 208, 209, 203,
-        203, 34, 231, 203, 203, 211, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 212, 203, 232, 228, 233,
-        233, 6, 1, 208, 209, 203, 203, 203,
-        231, 203, 203, 211, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 212, 203, 228, 233, 233, 6, 1,
-        208, 209, 203, 203, 203, 231, 203, 203,
-        211, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 212, 203,
-        234, 203, 203, 203, 19, 235, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 234,
-        203, 236, 237, 238, 239, 6, 1, 208,
-        209, 203, 203, 32, 240, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 241,
-        237, 242, 242, 6, 1, 208, 209, 203,
-        203, 203, 240, 203, 203, 211, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 212, 203, 237, 242, 242,
-        6, 1, 208, 209, 203, 203, 203, 240,
-        203, 203, 211, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        212, 203, 243, 203, 203, 203, 19, 244,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 243, 203, 245, 246, 247, 248, 6,
-        1, 208, 209, 203, 203, 30, 249, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 250, 246, 251, 251, 6, 1, 208,
-        209, 203, 203, 203, 249, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 246,
-        251, 251, 6, 1, 208, 209, 203, 203,
-        203, 249, 203, 203, 211, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 212, 203, 19, 252, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 253,
-        253, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 254, 203, 203, 255, 208, 209,
-        203, 208, 209, 203, 256, 203, 208, 257,
-        203, 208, 258, 203, 208, 203, 254, 203,
-        203, 203, 208, 209, 203, 259, 203, 260,
-        261, 203, 1, 208, 209, 203, 203, 4,
-        203, 3, 203, 253, 253, 203, 1, 208,
-        209, 203, 253, 253, 203, 1, 208, 209,
-        203, 259, 203, 253, 253, 203, 1, 208,
-        209, 203, 259, 203, 260, 253, 203, 1,
-        208, 209, 203, 203, 4, 203, 19, 203,
-        262, 262, 6, 1, 208, 209, 203, 203,
-        203, 217, 203, 263, 28, 264, 265, 9,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        28, 264, 265, 9, 1, 208, 209, 203,
-        203, 203, 217, 203, 264, 264, 9, 1,
-        208, 209, 203, 203, 203, 217, 203, 266,
-        25, 267, 268, 12, 1, 208, 209, 203,
-        203, 203, 217, 203, 25, 267, 268, 12,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        267, 267, 12, 1, 208, 209, 203, 203,
-        203, 217, 203, 269, 22, 270, 271, 15,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        22, 270, 271, 15, 1, 208, 209, 203,
-        203, 203, 217, 203, 270, 270, 15, 1,
-        208, 209, 203, 203, 203, 217, 203, 272,
-        19, 253, 273, 203, 1, 208, 209, 203,
-        203, 203, 217, 203, 19, 253, 273, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        253, 274, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 19, 203, 253, 253, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        2, 3, 203, 203, 19, 252, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 2,
-        203, 246, 251, 251, 6, 1, 208, 209,
-        203, 203, 203, 249, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 212, 203, 246, 251,
-        251, 6, 1, 208, 209, 203, 203, 203,
-        249, 203, 245, 246, 251, 251, 6, 1,
-        208, 209, 203, 203, 203, 249, 203, 203,
-        211, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 212, 203,
-        245, 246, 247, 251, 6, 1, 208, 209,
-        203, 203, 30, 249, 203, 203, 211, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 212, 203, 243, 203,
-        275, 203, 262, 262, 6, 1, 208, 209,
-        203, 203, 203, 217, 203, 243, 203, 243,
-        203, 203, 203, 253, 253, 203, 1, 208,
-        209, 203, 203, 203, 217, 203, 243, 203,
-        243, 203, 203, 203, 253, 276, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 243,
-        203, 243, 203, 275, 203, 253, 253, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        243, 203, 243, 3, 203, 203, 19, 244,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 243, 203, 236, 237, 242, 242, 6,
-        1, 208, 209, 203, 203, 203, 240, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 236, 237, 238, 242, 6, 1, 208,
-        209, 203, 203, 32, 240, 203, 203, 211,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 212, 203, 234,
-        203, 277, 203, 262, 262, 6, 1, 208,
-        209, 203, 203, 203, 217, 203, 234, 203,
-        234, 203, 203, 203, 253, 253, 203, 1,
-        208, 209, 203, 203, 203, 217, 203, 234,
-        203, 234, 203, 203, 203, 253, 278, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        234, 203, 234, 203, 277, 203, 253, 253,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 234, 203, 234, 3, 203, 203, 19,
-        235, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 234, 203, 227, 228, 233, 233,
-        6, 1, 208, 209, 203, 203, 203, 231,
-        203, 203, 211, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        212, 203, 227, 228, 229, 233, 6, 1,
-        208, 209, 203, 203, 34, 231, 203, 203,
-        211, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 212, 203,
-        225, 203, 279, 203, 262, 262, 6, 1,
-        208, 209, 203, 203, 203, 217, 203, 225,
-        203, 225, 203, 203, 203, 253, 253, 203,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        225, 203, 225, 203, 203, 203, 253, 280,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 225, 203, 225, 203, 279, 203, 253,
-        253, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 225, 203, 225, 3, 203, 203,
-        19, 226, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 225, 203, 218, 219, 224,
-        224, 6, 1, 208, 209, 203, 203, 203,
-        222, 203, 203, 211, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 212, 203, 218, 219, 220, 224, 6,
-        1, 208, 209, 203, 203, 36, 222, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 215, 203, 281, 203, 262, 262, 6,
-        1, 208, 209, 203, 203, 203, 217, 203,
-        215, 203, 215, 203, 203, 203, 253, 253,
-        203, 1, 208, 209, 203, 203, 203, 217,
-        203, 215, 203, 215, 203, 203, 203, 253,
-        282, 203, 1, 208, 209, 203, 203, 203,
-        217, 203, 215, 203, 215, 203, 281, 203,
-        253, 253, 203, 1, 208, 209, 203, 203,
-        203, 217, 203, 215, 203, 215, 3, 203,
-        203, 19, 216, 203, 1, 208, 209, 203,
-        203, 203, 217, 203, 215, 203, 204, 205,
-        214, 214, 6, 1, 208, 209, 203, 203,
-        203, 210, 203, 203, 211, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 212, 203, 204, 205, 206, 214,
-        6, 1, 208, 209, 203, 203, 38, 210,
-        203, 203, 211, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        212, 203, 284, 285, 286, 287, 45, 40,
-        288, 289, 283, 283, 77, 290, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        293, 285, 294, 287, 45, 40, 288, 289,
-        283, 283, 283, 290, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 285, 294,
-        287, 45, 40, 288, 289, 283, 283, 283,
-        290, 283, 283, 291, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 292, 283, 295, 283, 283, 283, 58,
-        296, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 295, 283, 298, 299, 300, 301,
-        45, 40, 288, 289, 283, 283, 75, 302,
-        283, 283, 291, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        292, 283, 303, 299, 304, 304, 45, 40,
-        288, 289, 283, 283, 283, 302, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        299, 304, 304, 45, 40, 288, 289, 283,
-        283, 283, 302, 283, 283, 291, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 292, 283, 305, 283, 283,
-        283, 58, 306, 283, 40, 288, 289, 283,
-        283, 283, 297, 283, 305, 283, 307, 308,
-        309, 310, 45, 40, 288, 289, 283, 283,
-        73, 311, 283, 283, 291, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 292, 283, 312, 308, 313, 313,
-        45, 40, 288, 289, 283, 283, 283, 311,
-        283, 283, 291, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        292, 283, 308, 313, 313, 45, 40, 288,
-        289, 283, 283, 283, 311, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 314,
-        283, 283, 283, 58, 315, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 314, 283,
-        316, 317, 318, 319, 45, 40, 288, 289,
-        283, 283, 71, 320, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 321, 317,
-        322, 322, 45, 40, 288, 289, 283, 283,
-        283, 320, 283, 283, 291, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 292, 283, 317, 322, 322, 45,
-        40, 288, 289, 283, 283, 283, 320, 283,
-        283, 291, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 292,
-        283, 323, 283, 283, 283, 58, 324, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        323, 283, 325, 326, 327, 328, 45, 40,
-        288, 289, 283, 283, 69, 329, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        330, 326, 331, 331, 45, 40, 288, 289,
-        283, 283, 283, 329, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 326, 331,
-        331, 45, 40, 288, 289, 283, 283, 283,
-        329, 283, 283, 291, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 292, 283, 58, 332, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 333, 333,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 334, 283, 283, 335, 288, 289, 283,
-        288, 289, 283, 336, 283, 288, 337, 283,
-        288, 338, 283, 288, 283, 334, 283, 283,
-        283, 288, 289, 283, 339, 283, 340, 341,
-        283, 40, 288, 289, 283, 283, 43, 283,
-        42, 283, 333, 333, 283, 40, 288, 289,
-        283, 333, 333, 283, 40, 288, 289, 283,
-        339, 283, 333, 333, 283, 40, 288, 289,
-        283, 339, 283, 340, 333, 283, 40, 288,
-        289, 283, 283, 43, 283, 58, 283, 342,
-        342, 45, 40, 288, 289, 283, 283, 283,
-        297, 283, 343, 67, 344, 345, 48, 40,
-        288, 289, 283, 283, 283, 297, 283, 67,
-        344, 345, 48, 40, 288, 289, 283, 283,
-        283, 297, 283, 344, 344, 48, 40, 288,
-        289, 283, 283, 283, 297, 283, 346, 64,
-        347, 348, 51, 40, 288, 289, 283, 283,
-        283, 297, 283, 64, 347, 348, 51, 40,
-        288, 289, 283, 283, 283, 297, 283, 347,
-        347, 51, 40, 288, 289, 283, 283, 283,
-        297, 283, 349, 61, 350, 351, 54, 40,
-        288, 289, 283, 283, 283, 297, 283, 61,
-        350, 351, 54, 40, 288, 289, 283, 283,
-        283, 297, 283, 350, 350, 54, 40, 288,
-        289, 283, 283, 283, 297, 283, 352, 58,
-        333, 353, 283, 40, 288, 289, 283, 283,
-        283, 297, 283, 58, 333, 353, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 333,
-        354, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 58, 283, 333, 333, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 41,
-        42, 283, 283, 58, 332, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 41, 283,
-        326, 331, 331, 45, 40, 288, 289, 283,
-        283, 283, 329, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 292, 283, 326, 331, 331,
-        45, 40, 288, 289, 283, 283, 283, 329,
-        283, 325, 326, 331, 331, 45, 40, 288,
-        289, 283, 283, 283, 329, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 325,
-        326, 327, 331, 45, 40, 288, 289, 283,
-        283, 69, 329, 283, 283, 291, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 292, 283, 323, 283, 355,
-        283, 342, 342, 45, 40, 288, 289, 283,
-        283, 283, 297, 283, 323, 283, 323, 283,
-        283, 283, 333, 333, 283, 40, 288, 289,
-        283, 283, 283, 297, 283, 323, 283, 323,
-        283, 283, 283, 333, 356, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 323, 283,
-        323, 283, 355, 283, 333, 333, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 323,
-        283, 323, 42, 283, 283, 58, 324, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        323, 283, 316, 317, 322, 322, 45, 40,
-        288, 289, 283, 283, 283, 320, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        316, 317, 318, 322, 45, 40, 288, 289,
-        283, 283, 71, 320, 283, 283, 291, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 292, 283, 314, 283,
-        357, 283, 342, 342, 45, 40, 288, 289,
-        283, 283, 283, 297, 283, 314, 283, 314,
-        283, 283, 283, 333, 333, 283, 40, 288,
-        289, 283, 283, 283, 297, 283, 314, 283,
-        314, 283, 283, 283, 333, 358, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 314,
-        283, 314, 283, 357, 283, 333, 333, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        314, 283, 314, 42, 283, 283, 58, 315,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 314, 283, 307, 308, 313, 313, 45,
-        40, 288, 289, 283, 283, 283, 311, 283,
-        283, 291, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 292,
-        283, 307, 308, 309, 313, 45, 40, 288,
-        289, 283, 283, 73, 311, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 305,
-        283, 359, 283, 342, 342, 45, 40, 288,
-        289, 283, 283, 283, 297, 283, 305, 283,
-        305, 283, 283, 283, 333, 333, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 305,
-        283, 305, 283, 283, 283, 333, 360, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        305, 283, 305, 283, 359, 283, 333, 333,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 305, 283, 305, 42, 283, 283, 58,
-        306, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 305, 283, 298, 299, 304, 304,
-        45, 40, 288, 289, 283, 283, 283, 302,
-        283, 283, 291, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        292, 283, 298, 299, 300, 304, 45, 40,
-        288, 289, 283, 283, 75, 302, 283, 283,
-        291, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 283, 292, 283,
-        295, 283, 361, 283, 342, 342, 45, 40,
-        288, 289, 283, 283, 283, 297, 283, 295,
-        283, 295, 283, 283, 283, 333, 333, 283,
-        40, 288, 289, 283, 283, 283, 297, 283,
-        295, 283, 295, 283, 283, 283, 333, 362,
-        283, 40, 288, 289, 283, 283, 283, 297,
-        283, 295, 283, 295, 283, 361, 283, 333,
-        333, 283, 40, 288, 289, 283, 283, 283,
-        297, 283, 295, 283, 76, 44, 44, 45,
-        40, 283, 283, 283, 283, 283, 76, 283,
-        295, 42, 283, 283, 58, 296, 283, 40,
-        288, 289, 283, 283, 283, 297, 283, 295,
-        283, 284, 285, 294, 287, 45, 40, 288,
-        289, 283, 283, 283, 290, 283, 283, 291,
-        283, 283, 283, 283, 283, 283, 283, 283,
-        283, 283, 283, 283, 283, 292, 283, 364,
-        191, 365, 365, 84, 79, 194, 195, 363,
-        363, 363, 197, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 191, 365, 365,
-        84, 79, 194, 195, 363, 363, 363, 197,
-        363, 363, 200, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        202, 363, 366, 363, 363, 363, 98, 367,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 366, 363, 369, 370, 371, 372, 84,
-        79, 194, 195, 363, 363, 115, 373, 363,
-        363, 200, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 202,
-        363, 374, 370, 375, 375, 84, 79, 194,
-        195, 363, 363, 363, 373, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 370,
-        375, 375, 84, 79, 194, 195, 363, 363,
-        363, 373, 363, 363, 200, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 202, 363, 376, 363, 363, 363,
-        98, 377, 363, 79, 194, 195, 363, 363,
-        363, 368, 363, 376, 363, 378, 379, 380,
-        381, 84, 79, 194, 195, 363, 363, 113,
-        382, 363, 363, 200, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 202, 363, 383, 379, 384, 384, 84,
-        79, 194, 195, 363, 363, 363, 382, 363,
-        363, 200, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 202,
-        363, 379, 384, 384, 84, 79, 194, 195,
-        363, 363, 363, 382, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 385, 363,
-        363, 363, 98, 386, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 385, 363, 387,
-        388, 389, 390, 84, 79, 194, 195, 363,
-        363, 111, 391, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 392, 388, 393,
-        393, 84, 79, 194, 195, 363, 363, 363,
-        391, 363, 363, 200, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 202, 363, 388, 393, 393, 84, 79,
-        194, 195, 363, 363, 363, 391, 363, 363,
-        200, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 202, 363,
-        394, 363, 363, 363, 98, 395, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 394,
-        363, 396, 397, 398, 399, 84, 79, 194,
-        195, 363, 363, 109, 400, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 401,
-        397, 402, 402, 84, 79, 194, 195, 363,
-        363, 363, 400, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 397, 402, 402,
-        84, 79, 194, 195, 363, 363, 363, 400,
-        363, 363, 200, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        202, 363, 98, 403, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 404, 404, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        405, 363, 363, 406, 194, 195, 363, 194,
-        195, 363, 407, 363, 194, 408, 363, 194,
-        409, 363, 194, 363, 405, 363, 363, 363,
-        194, 195, 363, 410, 363, 411, 412, 363,
-        79, 194, 195, 363, 363, 82, 363, 81,
-        363, 404, 404, 363, 79, 194, 195, 363,
-        404, 404, 363, 79, 194, 195, 363, 410,
-        363, 404, 404, 363, 79, 194, 195, 363,
-        410, 363, 411, 404, 363, 79, 194, 195,
-        363, 363, 82, 363, 98, 363, 413, 413,
-        84, 79, 194, 195, 363, 363, 363, 368,
-        363, 414, 107, 415, 416, 88, 79, 194,
-        195, 363, 363, 363, 368, 363, 107, 415,
-        416, 88, 79, 194, 195, 363, 363, 363,
-        368, 363, 415, 415, 88, 79, 194, 195,
-        363, 363, 363, 368, 363, 417, 104, 418,
-        419, 91, 79, 194, 195, 363, 363, 363,
-        368, 363, 104, 418, 419, 91, 79, 194,
-        195, 363, 363, 363, 368, 363, 418, 418,
-        91, 79, 194, 195, 363, 363, 363, 368,
-        363, 420, 101, 421, 422, 94, 79, 194,
-        195, 363, 363, 363, 368, 363, 101, 421,
-        422, 94, 79, 194, 195, 363, 363, 363,
-        368, 363, 421, 421, 94, 79, 194, 195,
-        363, 363, 363, 368, 363, 423, 98, 404,
-        424, 363, 79, 194, 195, 363, 363, 363,
-        368, 363, 98, 404, 424, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 404, 425,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 98, 363, 404, 404, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 80, 81,
-        363, 363, 98, 403, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 80, 363, 397,
-        402, 402, 84, 79, 194, 195, 363, 363,
-        363, 400, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 202, 363, 397, 402, 402, 84,
-        79, 194, 195, 363, 363, 363, 400, 363,
-        396, 397, 402, 402, 84, 79, 194, 195,
-        363, 363, 363, 400, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 396, 397,
-        398, 402, 84, 79, 194, 195, 363, 363,
-        109, 400, 363, 363, 200, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 202, 363, 394, 363, 426, 363,
-        413, 413, 84, 79, 194, 195, 363, 363,
-        363, 368, 363, 394, 363, 394, 363, 363,
-        363, 404, 404, 363, 79, 194, 195, 363,
-        363, 363, 368, 363, 394, 363, 394, 363,
-        363, 363, 404, 427, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 394, 363, 394,
-        363, 426, 363, 404, 404, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 394, 363,
-        394, 81, 363, 363, 98, 395, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 394,
-        363, 387, 388, 393, 393, 84, 79, 194,
-        195, 363, 363, 363, 391, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 387,
-        388, 389, 393, 84, 79, 194, 195, 363,
-        363, 111, 391, 363, 363, 200, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 202, 363, 385, 363, 428,
-        363, 413, 413, 84, 79, 194, 195, 363,
-        363, 363, 368, 363, 385, 363, 385, 363,
-        363, 363, 404, 404, 363, 79, 194, 195,
-        363, 363, 363, 368, 363, 385, 363, 385,
-        363, 363, 363, 404, 429, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 385, 363,
-        385, 363, 428, 363, 404, 404, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 385,
-        363, 385, 81, 363, 363, 98, 386, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        385, 363, 378, 379, 384, 384, 84, 79,
-        194, 195, 363, 363, 363, 382, 363, 363,
-        200, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 202, 363,
-        378, 379, 380, 384, 84, 79, 194, 195,
-        363, 363, 113, 382, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 376, 363,
-        430, 363, 413, 413, 84, 79, 194, 195,
-        363, 363, 363, 368, 363, 376, 363, 376,
-        363, 363, 363, 404, 404, 363, 79, 194,
-        195, 363, 363, 363, 368, 363, 376, 363,
-        376, 363, 363, 363, 404, 431, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 376,
-        363, 376, 363, 430, 363, 404, 404, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        376, 363, 376, 81, 363, 363, 98, 377,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 376, 363, 369, 370, 375, 375, 84,
-        79, 194, 195, 363, 363, 363, 373, 363,
-        363, 200, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 202,
-        363, 369, 370, 371, 375, 84, 79, 194,
-        195, 363, 363, 115, 373, 363, 363, 200,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 202, 363, 366,
-        363, 432, 363, 413, 413, 84, 79, 194,
-        195, 363, 363, 363, 368, 363, 366, 363,
-        366, 363, 363, 363, 404, 404, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 366,
-        363, 366, 363, 363, 363, 404, 433, 363,
-        79, 194, 195, 363, 363, 363, 368, 363,
-        366, 363, 366, 363, 432, 363, 404, 404,
-        363, 79, 194, 195, 363, 363, 363, 368,
-        363, 366, 363, 366, 81, 363, 363, 98,
-        367, 363, 79, 194, 195, 363, 363, 363,
-        368, 363, 366, 363, 116, 83, 83, 84,
-        79, 434, 434, 434, 434, 156, 116, 434,
-        190, 191, 365, 365, 84, 79, 194, 195,
-        363, 363, 363, 197, 363, 363, 200, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 363, 363, 363, 202, 363, 116, 83,
-        83, 84, 79, 434, 434, 434, 434, 434,
-        116, 434, 436, 437, 438, 439, 123, 118,
-        440, 441, 435, 435, 155, 442, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        445, 437, 439, 439, 123, 118, 440, 441,
-        435, 435, 435, 442, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 437, 439,
-        439, 123, 118, 440, 441, 435, 435, 435,
-        442, 435, 435, 443, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 444, 435, 446, 435, 435, 435, 136,
-        447, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 446, 435, 449, 450, 451, 452,
-        123, 118, 440, 441, 435, 435, 153, 453,
-        435, 435, 443, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        444, 435, 454, 450, 455, 455, 123, 118,
-        440, 441, 435, 435, 435, 453, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        450, 455, 455, 123, 118, 440, 441, 435,
-        435, 435, 453, 435, 435, 443, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 444, 435, 456, 435, 435,
-        435, 136, 457, 435, 118, 440, 441, 435,
-        435, 435, 448, 435, 456, 435, 458, 459,
-        460, 461, 123, 118, 440, 441, 435, 435,
-        151, 462, 435, 435, 443, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 444, 435, 463, 459, 464, 464,
-        123, 118, 440, 441, 435, 435, 435, 462,
-        435, 435, 443, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        444, 435, 459, 464, 464, 123, 118, 440,
-        441, 435, 435, 435, 462, 435, 435, 443,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 444, 435, 465,
-        435, 435, 435, 136, 466, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 465, 435,
-        467, 468, 469, 470, 123, 118, 440, 441,
-        435, 435, 149, 471, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 472, 468,
-        473, 473, 123, 118, 440, 441, 435, 435,
-        435, 471, 435, 435, 443, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 444, 435, 468, 473, 473, 123,
-        118, 440, 441, 435, 435, 435, 471, 435,
-        435, 443, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 444,
-        435, 474, 435, 435, 435, 136, 475, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        474, 435, 476, 477, 478, 479, 123, 118,
-        440, 441, 435, 435, 147, 480, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        481, 477, 482, 482, 123, 118, 440, 441,
-        435, 435, 435, 480, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 477, 482,
-        482, 123, 118, 440, 441, 435, 435, 435,
-        480, 435, 435, 443, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 444, 435, 136, 483, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 484, 484,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 485, 435, 435, 486, 440, 441, 435,
-        440, 441, 435, 487, 435, 440, 488, 435,
-        440, 489, 435, 440, 435, 485, 435, 435,
-        435, 440, 441, 435, 490, 435, 491, 492,
-        435, 118, 440, 441, 435, 435, 121, 435,
-        120, 435, 484, 484, 435, 118, 440, 441,
-        435, 484, 484, 435, 118, 440, 441, 435,
-        490, 435, 484, 484, 435, 118, 440, 441,
-        435, 490, 435, 491, 484, 435, 118, 440,
-        441, 435, 435, 121, 435, 136, 435, 493,
-        493, 123, 118, 440, 441, 435, 435, 435,
-        448, 435, 494, 145, 495, 496, 126, 118,
-        440, 441, 435, 435, 435, 448, 435, 145,
-        495, 496, 126, 118, 440, 441, 435, 435,
-        435, 448, 435, 495, 495, 126, 118, 440,
-        441, 435, 435, 435, 448, 435, 497, 142,
-        498, 499, 129, 118, 440, 441, 435, 435,
-        435, 448, 435, 142, 498, 499, 129, 118,
-        440, 441, 435, 435, 435, 448, 435, 498,
-        498, 129, 118, 440, 441, 435, 435, 435,
-        448, 435, 500, 139, 501, 502, 132, 118,
-        440, 441, 435, 435, 435, 448, 435, 139,
-        501, 502, 132, 118, 440, 441, 435, 435,
-        435, 448, 435, 501, 501, 132, 118, 440,
-        441, 435, 435, 435, 448, 435, 503, 136,
-        484, 504, 435, 118, 440, 441, 435, 435,
-        435, 448, 435, 136, 484, 504, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 484,
-        505, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 136, 435, 484, 484, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 119,
-        120, 435, 435, 136, 483, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 119, 435,
-        477, 482, 482, 123, 118, 440, 441, 435,
-        435, 435, 480, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 444, 435, 477, 482, 482,
-        123, 118, 440, 441, 435, 435, 435, 480,
-        435, 476, 477, 482, 482, 123, 118, 440,
-        441, 435, 435, 435, 480, 435, 435, 443,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 444, 435, 476,
-        477, 478, 482, 123, 118, 440, 441, 435,
-        435, 147, 480, 435, 435, 443, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 444, 435, 474, 435, 506,
-        435, 493, 493, 123, 118, 440, 441, 435,
-        435, 435, 448, 435, 474, 435, 474, 435,
-        435, 435, 484, 484, 435, 118, 440, 441,
-        435, 435, 435, 448, 435, 474, 435, 474,
-        435, 435, 435, 484, 507, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 474, 435,
-        474, 435, 506, 435, 484, 484, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 474,
-        435, 474, 120, 435, 435, 136, 475, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        474, 435, 467, 468, 473, 473, 123, 118,
-        440, 441, 435, 435, 435, 471, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        467, 468, 469, 473, 123, 118, 440, 441,
-        435, 435, 149, 471, 435, 435, 443, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 444, 435, 465, 435,
-        508, 435, 493, 493, 123, 118, 440, 441,
-        435, 435, 435, 448, 435, 465, 435, 465,
-        435, 435, 435, 484, 484, 435, 118, 440,
-        441, 435, 435, 435, 448, 435, 465, 435,
-        465, 435, 435, 435, 484, 509, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 465,
-        435, 465, 435, 508, 435, 484, 484, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        465, 435, 465, 120, 435, 435, 136, 466,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 465, 435, 458, 459, 464, 464, 123,
-        118, 440, 441, 435, 435, 435, 462, 435,
-        435, 443, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 444,
-        435, 458, 459, 460, 464, 123, 118, 440,
-        441, 435, 435, 151, 462, 435, 435, 443,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 444, 435, 456,
-        435, 510, 435, 493, 493, 123, 118, 440,
-        441, 435, 435, 435, 448, 435, 456, 435,
-        456, 435, 435, 435, 484, 484, 435, 118,
-        440, 441, 435, 435, 435, 448, 435, 456,
-        435, 456, 435, 435, 435, 484, 511, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        456, 435, 456, 435, 510, 435, 484, 484,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 456, 435, 456, 120, 435, 435, 136,
-        457, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 456, 435, 449, 450, 455, 455,
-        123, 118, 440, 441, 435, 435, 435, 453,
-        435, 435, 443, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        444, 435, 449, 450, 451, 455, 123, 118,
-        440, 441, 435, 435, 153, 453, 435, 435,
-        443, 435, 435, 435, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 444, 435,
-        446, 435, 512, 435, 493, 493, 123, 118,
-        440, 441, 435, 435, 435, 448, 435, 446,
-        435, 446, 435, 435, 435, 484, 484, 435,
-        118, 440, 441, 435, 435, 435, 448, 435,
-        446, 435, 446, 435, 435, 435, 484, 513,
-        435, 118, 440, 441, 435, 435, 435, 448,
-        435, 446, 435, 446, 435, 512, 435, 484,
-        484, 435, 118, 440, 441, 435, 435, 435,
-        448, 435, 446, 435, 446, 120, 435, 435,
-        136, 447, 435, 118, 440, 441, 435, 435,
-        435, 448, 435, 446, 435, 436, 437, 439,
-        439, 123, 118, 440, 441, 435, 435, 435,
-        442, 435, 435, 443, 435, 435, 435, 435,
-        435, 435, 435, 435, 435, 435, 435, 435,
-        435, 444, 435, 188, 189, 190, 191, 514,
-        365, 84, 79, 194, 195, 196, 196, 156,
-        197, 363, 188, 200, 363, 363, 363, 363,
-        363, 363, 363, 363, 363, 363, 363, 363,
-        363, 202, 363, 204, 515, 206, 207, 6,
-        1, 208, 209, 203, 203, 38, 210, 203,
-        203, 211, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 212,
-        203, 215, 189, 190, 191, 516, 517, 84,
-        157, 518, 519, 203, 196, 156, 520, 203,
-        215, 200, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 202,
-        203, 116, 521, 521, 84, 157, 208, 209,
-        203, 203, 156, 522, 203, 523, 203, 203,
-        524, 518, 519, 203, 518, 519, 203, 256,
-        203, 518, 525, 203, 518, 526, 203, 518,
-        203, 523, 203, 203, 203, 518, 519, 203,
-        527, 3, 363, 363, 404, 433, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 527,
-        363, 528, 370, 529, 530, 84, 157, 518,
-        519, 203, 203, 158, 373, 203, 203, 200,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 202, 203, 531,
-        370, 532, 532, 84, 157, 518, 519, 203,
-        203, 203, 373, 203, 203, 200, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 202, 203, 370, 532, 532,
-        84, 157, 518, 519, 203, 203, 203, 373,
-        203, 203, 200, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        202, 203, 528, 370, 532, 532, 84, 157,
-        518, 519, 203, 203, 203, 373, 203, 203,
-        200, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 203, 203, 202, 203,
-        528, 370, 529, 532, 84, 157, 518, 519,
-        203, 203, 158, 373, 203, 203, 200, 203,
-        203, 203, 203, 203, 203, 203, 203, 203,
-        203, 203, 203, 203, 202, 203, 215, 203,
-        281, 116, 533, 533, 160, 157, 208, 209,
-        203, 203, 203, 522, 203, 215, 203, 534,
-        184, 535, 536, 162, 157, 518, 519, 203,
-        203, 203, 537, 203, 184, 535, 536, 162,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        535, 535, 162, 157, 518, 519, 203, 203,
-        203, 537, 203, 538, 181, 539, 540, 165,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        181, 539, 540, 165, 157, 518, 519, 203,
-        203, 203, 537, 203, 539, 539, 165, 157,
-        518, 519, 203, 203, 203, 537, 203, 541,
-        178, 542, 543, 168, 157, 518, 519, 203,
-        203, 203, 537, 203, 178, 542, 543, 168,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        542, 542, 168, 157, 518, 519, 203, 203,
-        203, 537, 203, 544, 175, 545, 546, 203,
-        157, 518, 519, 203, 203, 203, 537, 203,
-        175, 545, 546, 203, 157, 518, 519, 203,
-        203, 203, 537, 203, 545, 545, 203, 157,
-        518, 519, 203, 203, 203, 537, 203, 547,
-        203, 548, 549, 203, 157, 518, 519, 203,
-        203, 172, 203, 171, 203, 545, 545, 203,
-        157, 518, 519, 203, 545, 545, 203, 157,
-        518, 519, 203, 547, 203, 545, 545, 203,
-        157, 518, 519, 203, 547, 203, 548, 545,
-        203, 157, 518, 519, 203, 203, 172, 203,
-        527, 171, 363, 363, 98, 367, 363, 79,
-        194, 195, 363, 363, 363, 368, 363, 527,
-        363, 551, 550, 552, 552, 550, 186, 553,
-        554, 550, 552, 552, 550, 186, 553, 554,
-        550, 555, 550, 550, 556, 553, 554, 550,
-        553, 554, 550, 557, 550, 553, 558, 550,
-        553, 559, 550, 553, 550, 555, 550, 550,
-        550, 553, 554, 550, 0
+        197, 198, 199, 200, 201, 187, 203, 204,
+        205, 206, 6, 1, 207, 208, 202, 202,
+        38, 209, 202, 202, 210, 202, 211, 204,
+        212, 212, 6, 1, 207, 208, 202, 202,
+        202, 209, 202, 202, 210, 202, 204, 212,
+        212, 6, 1, 207, 208, 202, 202, 202,
+        209, 202, 202, 210, 202, 213, 202, 202,
+        202, 19, 214, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 213, 202, 216, 217,
+        218, 219, 6, 1, 207, 208, 202, 202,
+        36, 220, 202, 202, 210, 202, 221, 217,
+        222, 222, 6, 1, 207, 208, 202, 202,
+        202, 220, 202, 202, 210, 202, 217, 222,
+        222, 6, 1, 207, 208, 202, 202, 202,
+        220, 202, 202, 210, 202, 223, 202, 202,
+        202, 19, 224, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 223, 202, 225, 226,
+        227, 228, 6, 1, 207, 208, 202, 202,
+        34, 229, 202, 202, 210, 202, 230, 226,
+        231, 231, 6, 1, 207, 208, 202, 202,
+        202, 229, 202, 202, 210, 202, 226, 231,
+        231, 6, 1, 207, 208, 202, 202, 202,
+        229, 202, 202, 210, 202, 232, 202, 202,
+        202, 19, 233, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 232, 202, 234, 235,
+        236, 237, 6, 1, 207, 208, 202, 202,
+        32, 238, 202, 202, 210, 202, 239, 235,
+        240, 240, 6, 1, 207, 208, 202, 202,
+        202, 238, 202, 202, 210, 202, 235, 240,
+        240, 6, 1, 207, 208, 202, 202, 202,
+        238, 202, 202, 210, 202, 241, 202, 202,
+        202, 19, 242, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 241, 202, 243, 244,
+        245, 246, 6, 1, 207, 208, 202, 202,
+        30, 247, 202, 202, 210, 202, 248, 244,
+        249, 249, 6, 1, 207, 208, 202, 202,
+        202, 247, 202, 202, 210, 202, 244, 249,
+        249, 6, 1, 207, 208, 202, 202, 202,
+        247, 202, 202, 210, 202, 19, 250, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        251, 251, 202, 1, 207, 208, 202, 202,
+        202, 215, 202, 252, 202, 202, 253, 207,
+        208, 202, 207, 208, 202, 254, 202, 207,
+        255, 202, 207, 256, 202, 207, 202, 252,
+        202, 202, 202, 207, 208, 202, 257, 202,
+        258, 259, 202, 1, 207, 208, 202, 202,
+        4, 202, 3, 202, 251, 251, 202, 1,
+        207, 208, 202, 251, 251, 202, 1, 207,
+        208, 202, 257, 202, 251, 251, 202, 1,
+        207, 208, 202, 257, 202, 258, 251, 202,
+        1, 207, 208, 202, 202, 4, 202, 19,
+        202, 260, 260, 6, 1, 207, 208, 202,
+        202, 202, 215, 202, 261, 28, 262, 263,
+        9, 1, 207, 208, 202, 202, 202, 215,
+        202, 28, 262, 263, 9, 1, 207, 208,
+        202, 202, 202, 215, 202, 262, 262, 9,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        264, 25, 265, 266, 12, 1, 207, 208,
+        202, 202, 202, 215, 202, 25, 265, 266,
+        12, 1, 207, 208, 202, 202, 202, 215,
+        202, 265, 265, 12, 1, 207, 208, 202,
+        202, 202, 215, 202, 267, 22, 268, 269,
+        15, 1, 207, 208, 202, 202, 202, 215,
+        202, 22, 268, 269, 15, 1, 207, 208,
+        202, 202, 202, 215, 202, 268, 268, 15,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        270, 19, 251, 271, 202, 1, 207, 208,
+        202, 202, 202, 215, 202, 19, 251, 271,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 251, 272, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 19, 202, 251, 251,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 2, 3, 202, 202, 19, 250, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        2, 202, 244, 249, 249, 6, 1, 207,
+        208, 202, 202, 202, 247, 202, 243, 244,
+        249, 249, 6, 1, 207, 208, 202, 202,
+        202, 247, 202, 202, 210, 202, 243, 244,
+        245, 249, 6, 1, 207, 208, 202, 202,
+        30, 247, 202, 202, 210, 202, 241, 202,
+        273, 202, 260, 260, 6, 1, 207, 208,
+        202, 202, 202, 215, 202, 241, 202, 241,
+        202, 202, 202, 251, 251, 202, 1, 207,
+        208, 202, 202, 202, 215, 202, 241, 202,
+        241, 202, 202, 202, 251, 274, 202, 1,
+        207, 208, 202, 202, 202, 215, 202, 241,
+        202, 241, 202, 273, 202, 251, 251, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        241, 202, 241, 3, 202, 202, 19, 242,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 241, 202, 234, 235, 240, 240, 6,
+        1, 207, 208, 202, 202, 202, 238, 202,
+        202, 210, 202, 234, 235, 236, 240, 6,
+        1, 207, 208, 202, 202, 32, 238, 202,
+        202, 210, 202, 232, 202, 275, 202, 260,
+        260, 6, 1, 207, 208, 202, 202, 202,
+        215, 202, 232, 202, 232, 202, 202, 202,
+        251, 251, 202, 1, 207, 208, 202, 202,
+        202, 215, 202, 232, 202, 232, 202, 202,
+        202, 251, 276, 202, 1, 207, 208, 202,
+        202, 202, 215, 202, 232, 202, 232, 202,
+        275, 202, 251, 251, 202, 1, 207, 208,
+        202, 202, 202, 215, 202, 232, 202, 232,
+        3, 202, 202, 19, 233, 202, 1, 207,
+        208, 202, 202, 202, 215, 202, 232, 202,
+        225, 226, 231, 231, 6, 1, 207, 208,
+        202, 202, 202, 229, 202, 202, 210, 202,
+        225, 226, 227, 231, 6, 1, 207, 208,
+        202, 202, 34, 229, 202, 202, 210, 202,
+        223, 202, 277, 202, 260, 260, 6, 1,
+        207, 208, 202, 202, 202, 215, 202, 223,
+        202, 223, 202, 202, 202, 251, 251, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        223, 202, 223, 202, 202, 202, 251, 278,
+        202, 1, 207, 208, 202, 202, 202, 215,
+        202, 223, 202, 223, 202, 277, 202, 251,
+        251, 202, 1, 207, 208, 202, 202, 202,
+        215, 202, 223, 202, 223, 3, 202, 202,
+        19, 224, 202, 1, 207, 208, 202, 202,
+        202, 215, 202, 223, 202, 216, 217, 222,
+        222, 6, 1, 207, 208, 202, 202, 202,
+        220, 202, 202, 210, 202, 216, 217, 218,
+        222, 6, 1, 207, 208, 202, 202, 36,
+        220, 202, 202, 210, 202, 213, 202, 279,
+        202, 260, 260, 6, 1, 207, 208, 202,
+        202, 202, 215, 202, 213, 202, 213, 202,
+        202, 202, 251, 251, 202, 1, 207, 208,
+        202, 202, 202, 215, 202, 213, 202, 213,
+        202, 202, 202, 251, 280, 202, 1, 207,
+        208, 202, 202, 202, 215, 202, 213, 202,
+        213, 202, 279, 202, 251, 251, 202, 1,
+        207, 208, 202, 202, 202, 215, 202, 213,
+        202, 213, 3, 202, 202, 19, 214, 202,
+        1, 207, 208, 202, 202, 202, 215, 202,
+        213, 202, 203, 204, 212, 212, 6, 1,
+        207, 208, 202, 202, 202, 209, 202, 202,
+        210, 202, 203, 204, 205, 212, 6, 1,
+        207, 208, 202, 202, 38, 209, 202, 202,
+        210, 202, 282, 283, 284, 285, 45, 40,
+        286, 287, 281, 281, 77, 288, 281, 281,
+        289, 281, 290, 283, 291, 285, 45, 40,
+        286, 287, 281, 281, 281, 288, 281, 281,
+        289, 281, 283, 291, 285, 45, 40, 286,
+        287, 281, 281, 281, 288, 281, 281, 289,
+        281, 292, 281, 281, 281, 58, 293, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        292, 281, 295, 296, 297, 298, 45, 40,
+        286, 287, 281, 281, 75, 299, 281, 281,
+        289, 281, 300, 296, 301, 301, 45, 40,
+        286, 287, 281, 281, 281, 299, 281, 281,
+        289, 281, 296, 301, 301, 45, 40, 286,
+        287, 281, 281, 281, 299, 281, 281, 289,
+        281, 302, 281, 281, 281, 58, 303, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        302, 281, 304, 305, 306, 307, 45, 40,
+        286, 287, 281, 281, 73, 308, 281, 281,
+        289, 281, 309, 305, 310, 310, 45, 40,
+        286, 287, 281, 281, 281, 308, 281, 281,
+        289, 281, 305, 310, 310, 45, 40, 286,
+        287, 281, 281, 281, 308, 281, 281, 289,
+        281, 311, 281, 281, 281, 58, 312, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        311, 281, 313, 314, 315, 316, 45, 40,
+        286, 287, 281, 281, 71, 317, 281, 281,
+        289, 281, 318, 314, 319, 319, 45, 40,
+        286, 287, 281, 281, 281, 317, 281, 281,
+        289, 281, 314, 319, 319, 45, 40, 286,
+        287, 281, 281, 281, 317, 281, 281, 289,
+        281, 320, 281, 281, 281, 58, 321, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        320, 281, 322, 323, 324, 325, 45, 40,
+        286, 287, 281, 281, 69, 326, 281, 281,
+        289, 281, 327, 323, 328, 328, 45, 40,
+        286, 287, 281, 281, 281, 326, 281, 281,
+        289, 281, 323, 328, 328, 45, 40, 286,
+        287, 281, 281, 281, 326, 281, 281, 289,
+        281, 58, 329, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 330, 330, 281, 40,
+        286, 287, 281, 281, 281, 294, 281, 331,
+        281, 281, 332, 286, 287, 281, 286, 287,
+        281, 333, 281, 286, 334, 281, 286, 335,
+        281, 286, 281, 331, 281, 281, 281, 286,
+        287, 281, 336, 281, 337, 338, 281, 40,
+        286, 287, 281, 281, 43, 281, 42, 281,
+        330, 330, 281, 40, 286, 287, 281, 330,
+        330, 281, 40, 286, 287, 281, 336, 281,
+        330, 330, 281, 40, 286, 287, 281, 336,
+        281, 337, 330, 281, 40, 286, 287, 281,
+        281, 43, 281, 58, 281, 339, 339, 45,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        340, 67, 341, 342, 48, 40, 286, 287,
+        281, 281, 281, 294, 281, 67, 341, 342,
+        48, 40, 286, 287, 281, 281, 281, 294,
+        281, 341, 341, 48, 40, 286, 287, 281,
+        281, 281, 294, 281, 343, 64, 344, 345,
+        51, 40, 286, 287, 281, 281, 281, 294,
+        281, 64, 344, 345, 51, 40, 286, 287,
+        281, 281, 281, 294, 281, 344, 344, 51,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        346, 61, 347, 348, 54, 40, 286, 287,
+        281, 281, 281, 294, 281, 61, 347, 348,
+        54, 40, 286, 287, 281, 281, 281, 294,
+        281, 347, 347, 54, 40, 286, 287, 281,
+        281, 281, 294, 281, 349, 58, 330, 350,
+        281, 40, 286, 287, 281, 281, 281, 294,
+        281, 58, 330, 350, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 330, 351, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        58, 281, 330, 330, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 41, 42, 281,
+        281, 58, 329, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 41, 281, 323, 328,
+        328, 45, 40, 286, 287, 281, 281, 281,
+        326, 281, 322, 323, 328, 328, 45, 40,
+        286, 287, 281, 281, 281, 326, 281, 281,
+        289, 281, 322, 323, 324, 328, 45, 40,
+        286, 287, 281, 281, 69, 326, 281, 281,
+        289, 281, 320, 281, 352, 281, 339, 339,
+        45, 40, 286, 287, 281, 281, 281, 294,
+        281, 320, 281, 320, 281, 281, 281, 330,
+        330, 281, 40, 286, 287, 281, 281, 281,
+        294, 281, 320, 281, 320, 281, 281, 281,
+        330, 353, 281, 40, 286, 287, 281, 281,
+        281, 294, 281, 320, 281, 320, 281, 352,
+        281, 330, 330, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 320, 281, 320, 42,
+        281, 281, 58, 321, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 320, 281, 313,
+        314, 319, 319, 45, 40, 286, 287, 281,
+        281, 281, 317, 281, 281, 289, 281, 313,
+        314, 315, 319, 45, 40, 286, 287, 281,
+        281, 71, 317, 281, 281, 289, 281, 311,
+        281, 354, 281, 339, 339, 45, 40, 286,
+        287, 281, 281, 281, 294, 281, 311, 281,
+        311, 281, 281, 281, 330, 330, 281, 40,
+        286, 287, 281, 281, 281, 294, 281, 311,
+        281, 311, 281, 281, 281, 330, 355, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        311, 281, 311, 281, 354, 281, 330, 330,
+        281, 40, 286, 287, 281, 281, 281, 294,
+        281, 311, 281, 311, 42, 281, 281, 58,
+        312, 281, 40, 286, 287, 281, 281, 281,
+        294, 281, 311, 281, 304, 305, 310, 310,
+        45, 40, 286, 287, 281, 281, 281, 308,
+        281, 281, 289, 281, 304, 305, 306, 310,
+        45, 40, 286, 287, 281, 281, 73, 308,
+        281, 281, 289, 281, 302, 281, 356, 281,
+        339, 339, 45, 40, 286, 287, 281, 281,
+        281, 294, 281, 302, 281, 302, 281, 281,
+        281, 330, 330, 281, 40, 286, 287, 281,
+        281, 281, 294, 281, 302, 281, 302, 281,
+        281, 281, 330, 357, 281, 40, 286, 287,
+        281, 281, 281, 294, 281, 302, 281, 302,
+        281, 356, 281, 330, 330, 281, 40, 286,
+        287, 281, 281, 281, 294, 281, 302, 281,
+        302, 42, 281, 281, 58, 303, 281, 40,
+        286, 287, 281, 281, 281, 294, 281, 302,
+        281, 295, 296, 301, 301, 45, 40, 286,
+        287, 281, 281, 281, 299, 281, 281, 289,
+        281, 295, 296, 297, 301, 45, 40, 286,
+        287, 281, 281, 75, 299, 281, 281, 289,
+        281, 292, 281, 358, 281, 339, 339, 45,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        292, 281, 292, 281, 281, 281, 330, 330,
+        281, 40, 286, 287, 281, 281, 281, 294,
+        281, 292, 281, 292, 281, 281, 281, 330,
+        359, 281, 40, 286, 287, 281, 281, 281,
+        294, 281, 292, 281, 292, 281, 358, 281,
+        330, 330, 281, 40, 286, 287, 281, 281,
+        281, 294, 281, 292, 281, 76, 44, 44,
+        45, 40, 281, 281, 281, 281, 281, 76,
+        281, 292, 42, 281, 281, 58, 293, 281,
+        40, 286, 287, 281, 281, 281, 294, 281,
+        292, 281, 282, 283, 291, 285, 45, 40,
+        286, 287, 281, 281, 281, 288, 281, 281,
+        289, 281, 361, 191, 362, 362, 84, 79,
+        194, 195, 360, 360, 360, 197, 360, 360,
+        200, 360, 191, 362, 362, 84, 79, 194,
+        195, 360, 360, 360, 197, 360, 360, 200,
+        360, 363, 360, 360, 360, 98, 364, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        363, 360, 366, 367, 368, 369, 84, 79,
+        194, 195, 360, 360, 115, 370, 360, 360,
+        200, 360, 371, 367, 372, 372, 84, 79,
+        194, 195, 360, 360, 360, 370, 360, 360,
+        200, 360, 367, 372, 372, 84, 79, 194,
+        195, 360, 360, 360, 370, 360, 360, 200,
+        360, 373, 360, 360, 360, 98, 374, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        373, 360, 375, 376, 377, 378, 84, 79,
+        194, 195, 360, 360, 113, 379, 360, 360,
+        200, 360, 380, 376, 381, 381, 84, 79,
+        194, 195, 360, 360, 360, 379, 360, 360,
+        200, 360, 376, 381, 381, 84, 79, 194,
+        195, 360, 360, 360, 379, 360, 360, 200,
+        360, 382, 360, 360, 360, 98, 383, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        382, 360, 384, 385, 386, 387, 84, 79,
+        194, 195, 360, 360, 111, 388, 360, 360,
+        200, 360, 389, 385, 390, 390, 84, 79,
+        194, 195, 360, 360, 360, 388, 360, 360,
+        200, 360, 385, 390, 390, 84, 79, 194,
+        195, 360, 360, 360, 388, 360, 360, 200,
+        360, 391, 360, 360, 360, 98, 392, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        391, 360, 393, 394, 395, 396, 84, 79,
+        194, 195, 360, 360, 109, 397, 360, 360,
+        200, 360, 398, 394, 399, 399, 84, 79,
+        194, 195, 360, 360, 360, 397, 360, 360,
+        200, 360, 394, 399, 399, 84, 79, 194,
+        195, 360, 360, 360, 397, 360, 360, 200,
+        360, 98, 400, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 401, 401, 360, 79,
+        194, 195, 360, 360, 360, 365, 360, 402,
+        360, 360, 403, 194, 195, 360, 194, 195,
+        360, 404, 360, 194, 405, 360, 194, 406,
+        360, 194, 360, 402, 360, 360, 360, 194,
+        195, 360, 407, 360, 408, 409, 360, 79,
+        194, 195, 360, 360, 82, 360, 81, 360,
+        401, 401, 360, 79, 194, 195, 360, 401,
+        401, 360, 79, 194, 195, 360, 407, 360,
+        401, 401, 360, 79, 194, 195, 360, 407,
+        360, 408, 401, 360, 79, 194, 195, 360,
+        360, 82, 360, 98, 360, 410, 410, 84,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        411, 107, 412, 413, 88, 79, 194, 195,
+        360, 360, 360, 365, 360, 107, 412, 413,
+        88, 79, 194, 195, 360, 360, 360, 365,
+        360, 412, 412, 88, 79, 194, 195, 360,
+        360, 360, 365, 360, 414, 104, 415, 416,
+        91, 79, 194, 195, 360, 360, 360, 365,
+        360, 104, 415, 416, 91, 79, 194, 195,
+        360, 360, 360, 365, 360, 415, 415, 91,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        417, 101, 418, 419, 94, 79, 194, 195,
+        360, 360, 360, 365, 360, 101, 418, 419,
+        94, 79, 194, 195, 360, 360, 360, 365,
+        360, 418, 418, 94, 79, 194, 195, 360,
+        360, 360, 365, 360, 420, 98, 401, 421,
+        360, 79, 194, 195, 360, 360, 360, 365,
+        360, 98, 401, 421, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 401, 422, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        98, 360, 401, 401, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 80, 81, 360,
+        360, 98, 400, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 80, 360, 394, 399,
+        399, 84, 79, 194, 195, 360, 360, 360,
+        397, 360, 393, 394, 399, 399, 84, 79,
+        194, 195, 360, 360, 360, 397, 360, 360,
+        200, 360, 393, 394, 395, 399, 84, 79,
+        194, 195, 360, 360, 109, 397, 360, 360,
+        200, 360, 391, 360, 423, 360, 410, 410,
+        84, 79, 194, 195, 360, 360, 360, 365,
+        360, 391, 360, 391, 360, 360, 360, 401,
+        401, 360, 79, 194, 195, 360, 360, 360,
+        365, 360, 391, 360, 391, 360, 360, 360,
+        401, 424, 360, 79, 194, 195, 360, 360,
+        360, 365, 360, 391, 360, 391, 360, 423,
+        360, 401, 401, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 391, 360, 391, 81,
+        360, 360, 98, 392, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 391, 360, 384,
+        385, 390, 390, 84, 79, 194, 195, 360,
+        360, 360, 388, 360, 360, 200, 360, 384,
+        385, 386, 390, 84, 79, 194, 195, 360,
+        360, 111, 388, 360, 360, 200, 360, 382,
+        360, 425, 360, 410, 410, 84, 79, 194,
+        195, 360, 360, 360, 365, 360, 382, 360,
+        382, 360, 360, 360, 401, 401, 360, 79,
+        194, 195, 360, 360, 360, 365, 360, 382,
+        360, 382, 360, 360, 360, 401, 426, 360,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        382, 360, 382, 360, 425, 360, 401, 401,
+        360, 79, 194, 195, 360, 360, 360, 365,
+        360, 382, 360, 382, 81, 360, 360, 98,
+        383, 360, 79, 194, 195, 360, 360, 360,
+        365, 360, 382, 360, 375, 376, 381, 381,
+        84, 79, 194, 195, 360, 360, 360, 379,
+        360, 360, 200, 360, 375, 376, 377, 381,
+        84, 79, 194, 195, 360, 360, 113, 379,
+        360, 360, 200, 360, 373, 360, 427, 360,
+        410, 410, 84, 79, 194, 195, 360, 360,
+        360, 365, 360, 373, 360, 373, 360, 360,
+        360, 401, 401, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 373, 360, 373, 360,
+        360, 360, 401, 428, 360, 79, 194, 195,
+        360, 360, 360, 365, 360, 373, 360, 373,
+        360, 427, 360, 401, 401, 360, 79, 194,
+        195, 360, 360, 360, 365, 360, 373, 360,
+        373, 81, 360, 360, 98, 374, 360, 79,
+        194, 195, 360, 360, 360, 365, 360, 373,
+        360, 366, 367, 372, 372, 84, 79, 194,
+        195, 360, 360, 360, 370, 360, 360, 200,
+        360, 366, 367, 368, 372, 84, 79, 194,
+        195, 360, 360, 115, 370, 360, 360, 200,
+        360, 363, 360, 429, 360, 410, 410, 84,
+        79, 194, 195, 360, 360, 360, 365, 360,
+        363, 360, 363, 360, 360, 360, 401, 401,
+        360, 79, 194, 195, 360, 360, 360, 365,
+        360, 363, 360, 363, 360, 360, 360, 401,
+        430, 360, 79, 194, 195, 360, 360, 360,
+        365, 360, 363, 360, 363, 360, 429, 360,
+        401, 401, 360, 79, 194, 195, 360, 360,
+        360, 365, 360, 363, 360, 363, 81, 360,
+        360, 98, 364, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 363, 360, 116, 83,
+        83, 84, 79, 431, 431, 431, 431, 156,
+        116, 431, 190, 191, 362, 362, 84, 79,
+        194, 195, 360, 360, 360, 197, 360, 360,
+        200, 360, 116, 83, 83, 84, 79, 431,
+        431, 431, 431, 431, 116, 431, 433, 434,
+        435, 436, 123, 118, 437, 438, 432, 432,
+        155, 439, 432, 432, 440, 432, 441, 434,
+        436, 436, 123, 118, 437, 438, 432, 432,
+        432, 439, 432, 432, 440, 432, 434, 436,
+        436, 123, 118, 437, 438, 432, 432, 432,
+        439, 432, 432, 440, 432, 442, 432, 432,
+        432, 136, 443, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 442, 432, 445, 446,
+        447, 448, 123, 118, 437, 438, 432, 432,
+        153, 449, 432, 432, 440, 432, 450, 446,
+        451, 451, 123, 118, 437, 438, 432, 432,
+        432, 449, 432, 432, 440, 432, 446, 451,
+        451, 123, 118, 437, 438, 432, 432, 432,
+        449, 432, 432, 440, 432, 452, 432, 432,
+        432, 136, 453, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 452, 432, 454, 455,
+        456, 457, 123, 118, 437, 438, 432, 432,
+        151, 458, 432, 432, 440, 432, 459, 455,
+        460, 460, 123, 118, 437, 438, 432, 432,
+        432, 458, 432, 432, 440, 432, 455, 460,
+        460, 123, 118, 437, 438, 432, 432, 432,
+        458, 432, 432, 440, 432, 461, 432, 432,
+        432, 136, 462, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 461, 432, 463, 464,
+        465, 466, 123, 118, 437, 438, 432, 432,
+        149, 467, 432, 432, 440, 432, 468, 464,
+        469, 469, 123, 118, 437, 438, 432, 432,
+        432, 467, 432, 432, 440, 432, 464, 469,
+        469, 123, 118, 437, 438, 432, 432, 432,
+        467, 432, 432, 440, 432, 470, 432, 432,
+        432, 136, 471, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 470, 432, 472, 473,
+        474, 475, 123, 118, 437, 438, 432, 432,
+        147, 476, 432, 432, 440, 432, 477, 473,
+        478, 478, 123, 118, 437, 438, 432, 432,
+        432, 476, 432, 432, 440, 432, 473, 478,
+        478, 123, 118, 437, 438, 432, 432, 432,
+        476, 432, 432, 440, 432, 136, 479, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        480, 480, 432, 118, 437, 438, 432, 432,
+        432, 444, 432, 481, 432, 432, 482, 437,
+        438, 432, 437, 438, 432, 483, 432, 437,
+        484, 432, 437, 485, 432, 437, 432, 481,
+        432, 432, 432, 437, 438, 432, 486, 432,
+        487, 488, 432, 118, 437, 438, 432, 432,
+        121, 432, 120, 432, 480, 480, 432, 118,
+        437, 438, 432, 480, 480, 432, 118, 437,
+        438, 432, 486, 432, 480, 480, 432, 118,
+        437, 438, 432, 486, 432, 487, 480, 432,
+        118, 437, 438, 432, 432, 121, 432, 136,
+        432, 489, 489, 123, 118, 437, 438, 432,
+        432, 432, 444, 432, 490, 145, 491, 492,
+        126, 118, 437, 438, 432, 432, 432, 444,
+        432, 145, 491, 492, 126, 118, 437, 438,
+        432, 432, 432, 444, 432, 491, 491, 126,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        493, 142, 494, 495, 129, 118, 437, 438,
+        432, 432, 432, 444, 432, 142, 494, 495,
+        129, 118, 437, 438, 432, 432, 432, 444,
+        432, 494, 494, 129, 118, 437, 438, 432,
+        432, 432, 444, 432, 496, 139, 497, 498,
+        132, 118, 437, 438, 432, 432, 432, 444,
+        432, 139, 497, 498, 132, 118, 437, 438,
+        432, 432, 432, 444, 432, 497, 497, 132,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        499, 136, 480, 500, 432, 118, 437, 438,
+        432, 432, 432, 444, 432, 136, 480, 500,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 480, 501, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 136, 432, 480, 480,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 119, 120, 432, 432, 136, 479, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        119, 432, 473, 478, 478, 123, 118, 437,
+        438, 432, 432, 432, 476, 432, 472, 473,
+        478, 478, 123, 118, 437, 438, 432, 432,
+        432, 476, 432, 432, 440, 432, 472, 473,
+        474, 478, 123, 118, 437, 438, 432, 432,
+        147, 476, 432, 432, 440, 432, 470, 432,
+        502, 432, 489, 489, 123, 118, 437, 438,
+        432, 432, 432, 444, 432, 470, 432, 470,
+        432, 432, 432, 480, 480, 432, 118, 437,
+        438, 432, 432, 432, 444, 432, 470, 432,
+        470, 432, 432, 432, 480, 503, 432, 118,
+        437, 438, 432, 432, 432, 444, 432, 470,
+        432, 470, 432, 502, 432, 480, 480, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        470, 432, 470, 120, 432, 432, 136, 471,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 470, 432, 463, 464, 469, 469, 123,
+        118, 437, 438, 432, 432, 432, 467, 432,
+        432, 440, 432, 463, 464, 465, 469, 123,
+        118, 437, 438, 432, 432, 149, 467, 432,
+        432, 440, 432, 461, 432, 504, 432, 489,
+        489, 123, 118, 437, 438, 432, 432, 432,
+        444, 432, 461, 432, 461, 432, 432, 432,
+        480, 480, 432, 118, 437, 438, 432, 432,
+        432, 444, 432, 461, 432, 461, 432, 432,
+        432, 480, 505, 432, 118, 437, 438, 432,
+        432, 432, 444, 432, 461, 432, 461, 432,
+        504, 432, 480, 480, 432, 118, 437, 438,
+        432, 432, 432, 444, 432, 461, 432, 461,
+        120, 432, 432, 136, 462, 432, 118, 437,
+        438, 432, 432, 432, 444, 432, 461, 432,
+        454, 455, 460, 460, 123, 118, 437, 438,
+        432, 432, 432, 458, 432, 432, 440, 432,
+        454, 455, 456, 460, 123, 118, 437, 438,
+        432, 432, 151, 458, 432, 432, 440, 432,
+        452, 432, 506, 432, 489, 489, 123, 118,
+        437, 438, 432, 432, 432, 444, 432, 452,
+        432, 452, 432, 432, 432, 480, 480, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        452, 432, 452, 432, 432, 432, 480, 507,
+        432, 118, 437, 438, 432, 432, 432, 444,
+        432, 452, 432, 452, 432, 506, 432, 480,
+        480, 432, 118, 437, 438, 432, 432, 432,
+        444, 432, 452, 432, 452, 120, 432, 432,
+        136, 453, 432, 118, 437, 438, 432, 432,
+        432, 444, 432, 452, 432, 445, 446, 451,
+        451, 123, 118, 437, 438, 432, 432, 432,
+        449, 432, 432, 440, 432, 445, 446, 447,
+        451, 123, 118, 437, 438, 432, 432, 153,
+        449, 432, 432, 440, 432, 442, 432, 508,
+        432, 489, 489, 123, 118, 437, 438, 432,
+        432, 432, 444, 432, 442, 432, 442, 432,
+        432, 432, 480, 480, 432, 118, 437, 438,
+        432, 432, 432, 444, 432, 442, 432, 442,
+        432, 432, 432, 480, 509, 432, 118, 437,
+        438, 432, 432, 432, 444, 432, 442, 432,
+        442, 432, 508, 432, 480, 480, 432, 118,
+        437, 438, 432, 432, 432, 444, 432, 442,
+        432, 442, 120, 432, 432, 136, 443, 432,
+        118, 437, 438, 432, 432, 432, 444, 432,
+        442, 432, 433, 434, 436, 436, 123, 118,
+        437, 438, 432, 432, 432, 439, 432, 432,
+        440, 432, 188, 189, 190, 191, 510, 362,
+        84, 79, 194, 195, 196, 196, 156, 197,
+        360, 188, 200, 360, 203, 511, 205, 206,
+        6, 1, 207, 208, 202, 202, 38, 209,
+        202, 202, 210, 202, 213, 189, 190, 191,
+        512, 513, 84, 157, 514, 515, 202, 196,
+        156, 516, 202, 213, 200, 202, 116, 517,
+        517, 84, 157, 207, 208, 202, 202, 156,
+        518, 202, 519, 202, 202, 520, 514, 515,
+        202, 514, 515, 202, 254, 202, 514, 521,
+        202, 514, 522, 202, 514, 202, 519, 202,
+        202, 202, 514, 515, 202, 523, 3, 360,
+        360, 401, 430, 360, 79, 194, 195, 360,
+        360, 360, 365, 360, 523, 360, 524, 367,
+        525, 526, 84, 157, 514, 515, 202, 202,
+        158, 370, 202, 202, 200, 202, 527, 367,
+        528, 528, 84, 157, 514, 515, 202, 202,
+        202, 370, 202, 202, 200, 202, 367, 528,
+        528, 84, 157, 514, 515, 202, 202, 202,
+        370, 202, 202, 200, 202, 524, 367, 528,
+        528, 84, 157, 514, 515, 202, 202, 202,
+        370, 202, 202, 200, 202, 524, 367, 525,
+        528, 84, 157, 514, 515, 202, 202, 158,
+        370, 202, 202, 200, 202, 213, 202, 279,
+        116, 529, 529, 160, 157, 207, 208, 202,
+        202, 202, 518, 202, 213, 202, 530, 184,
+        531, 532, 162, 157, 514, 515, 202, 202,
+        202, 533, 202, 184, 531, 532, 162, 157,
+        514, 515, 202, 202, 202, 533, 202, 531,
+        531, 162, 157, 514, 515, 202, 202, 202,
+        533, 202, 534, 181, 535, 536, 165, 157,
+        514, 515, 202, 202, 202, 533, 202, 181,
+        535, 536, 165, 157, 514, 515, 202, 202,
+        202, 533, 202, 535, 535, 165, 157, 514,
+        515, 202, 202, 202, 533, 202, 537, 178,
+        538, 539, 168, 157, 514, 515, 202, 202,
+        202, 533, 202, 178, 538, 539, 168, 157,
+        514, 515, 202, 202, 202, 533, 202, 538,
+        538, 168, 157, 514, 515, 202, 202, 202,
+        533, 202, 540, 175, 541, 542, 202, 157,
+        514, 515, 202, 202, 202, 533, 202, 175,
+        541, 542, 202, 157, 514, 515, 202, 202,
+        202, 533, 202, 541, 541, 202, 157, 514,
+        515, 202, 202, 202, 533, 202, 543, 202,
+        544, 545, 202, 157, 514, 515, 202, 202,
+        172, 202, 171, 202, 541, 541, 202, 157,
+        514, 515, 202, 541, 541, 202, 157, 514,
+        515, 202, 543, 202, 541, 541, 202, 157,
+        514, 515, 202, 543, 202, 544, 541, 202,
+        157, 514, 515, 202, 202, 172, 202, 523,
+        171, 360, 360, 98, 364, 360, 79, 194,
+        195, 360, 360, 360, 365, 360, 523, 360,
+        547, 546, 548, 548, 546, 186, 549, 550,
+        546, 548, 548, 546, 186, 549, 550, 546,
+        551, 546, 546, 552, 549, 550, 546, 549,
+        550, 546, 553, 546, 549, 554, 546, 549,
+        555, 546, 549, 546, 551, 546, 546, 546,
+        549, 550, 546, 0
 };
 
 static const short _indic_syllable_machine_trans_targs[] = {
         178, 200, 207, 209, 210, 4, 213, 5,
         7, 216, 8, 10, 219, 11, 13, 222,
         14, 16, 17, 199, 19, 20, 221, 22,
-        23, 218, 25, 26, 215, 224, 229, 233,
-        236, 240, 243, 247, 250, 254, 257, 178,
-        280, 287, 289, 290, 41, 293, 42, 44,
-        296, 45, 47, 299, 48, 50, 302, 51,
-        53, 54, 279, 56, 57, 301, 59, 60,
-        298, 62, 63, 295, 304, 309, 313, 316,
-        320, 323, 327, 330, 334, 338, 178, 359,
-        366, 368, 369, 78, 372, 178, 79, 81,
-        375, 82, 84, 378, 85, 87, 381, 88,
-        90, 91, 358, 93, 94, 380, 96, 97,
-        377, 99, 100, 374, 383, 388, 392, 395,
-        399, 402, 406, 409, 413, 178, 440, 447,
-        449, 450, 114, 453, 115, 117, 456, 118,
-        120, 459, 121, 123, 462, 124, 126, 127,
-        439, 129, 130, 461, 132, 133, 458, 135,
-        136, 455, 464, 469, 473, 476, 480, 483,
-        487, 490, 494, 497, 417, 502, 513, 152,
-        516, 154, 519, 155, 157, 522, 158, 160,
-        525, 161, 528, 530, 531, 166, 167, 527,
-        169, 170, 524, 172, 173, 521, 175, 176,
-        518, 178, 536, 178, 179, 259, 339, 341,
-        416, 418, 361, 362, 419, 415, 498, 499,
-        386, 534, 387, 178, 180, 182, 36, 258,
-        202, 203, 256, 227, 228, 181, 35, 183,
-        252, 1, 184, 186, 34, 251, 249, 185,
-        33, 187, 245, 188, 190, 32, 244, 242,
-        189, 31, 191, 238, 192, 194, 30, 237,
-        235, 193, 29, 195, 231, 196, 198, 28,
-        230, 226, 197, 27, 212, 0, 201, 206,
-        178, 204, 205, 208, 2, 211, 3, 214,
-        6, 24, 217, 9, 21, 220, 12, 18,
-        223, 15, 225, 232, 234, 239, 241, 246,
-        248, 253, 255, 178, 260, 262, 73, 336,
-        282, 283, 337, 307, 308, 261, 72, 263,
-        332, 38, 264, 266, 71, 331, 329, 265,
-        70, 267, 325, 268, 270, 69, 324, 322,
-        269, 68, 271, 318, 272, 274, 67, 317,
-        315, 273, 66, 275, 311, 276, 278, 65,
-        310, 306, 277, 64, 292, 37, 281, 286,
-        178, 284, 285, 288, 39, 291, 40, 294,
-        43, 61, 297, 46, 58, 300, 49, 55,
-        303, 52, 305, 312, 314, 319, 321, 326,
-        328, 333, 335, 178, 340, 109, 342, 411,
-        75, 343, 345, 108, 410, 408, 344, 107,
-        346, 404, 347, 349, 106, 403, 401, 348,
-        105, 350, 397, 351, 353, 104, 396, 394,
-        352, 103, 354, 390, 355, 357, 102, 389,
-        385, 356, 101, 371, 74, 360, 365, 178,
-        363, 364, 367, 76, 370, 77, 373, 80,
-        98, 376, 83, 95, 379, 86, 92, 382,
-        89, 384, 391, 393, 398, 400, 405, 407,
-        412, 414, 178, 178, 420, 422, 146, 145,
-        442, 443, 496, 467, 468, 421, 423, 492,
-        111, 424, 426, 144, 491, 489, 425, 143,
-        427, 485, 428, 430, 142, 484, 482, 429,
-        141, 431, 478, 432, 434, 140, 477, 475,
-        433, 139, 435, 471, 436, 438, 138, 470,
-        466, 437, 137, 452, 110, 441, 446, 178,
-        444, 445, 448, 112, 451, 113, 454, 116,
-        134, 457, 119, 131, 460, 122, 128, 463,
-        125, 465, 472, 474, 479, 481, 486, 488,
-        493, 495, 147, 500, 501, 515, 504, 505,
-        533, 148, 509, 503, 508, 506, 507, 510,
-        511, 150, 514, 512, 149, 151, 517, 153,
-        174, 163, 520, 156, 171, 523, 159, 168,
-        526, 162, 165, 529, 164, 532, 178, 535,
-        177, 538, 539, 537, 542, 178, 540, 541
+        23, 218, 25, 26, 215, 224, 228, 232,
+        235, 239, 242, 246, 249, 253, 256, 178,
+        279, 286, 288, 289, 41, 292, 42, 44,
+        295, 45, 47, 298, 48, 50, 301, 51,
+        53, 54, 278, 56, 57, 300, 59, 60,
+        297, 62, 63, 294, 303, 307, 311, 314,
+        318, 321, 325, 328, 332, 336, 178, 357,
+        364, 366, 367, 78, 370, 178, 79, 81,
+        373, 82, 84, 376, 85, 87, 379, 88,
+        90, 91, 356, 93, 94, 378, 96, 97,
+        375, 99, 100, 372, 381, 385, 389, 392,
+        396, 399, 403, 406, 410, 178, 437, 444,
+        446, 447, 114, 450, 115, 117, 453, 118,
+        120, 456, 121, 123, 459, 124, 126, 127,
+        436, 129, 130, 458, 132, 133, 455, 135,
+        136, 452, 461, 465, 469, 472, 476, 479,
+        483, 486, 490, 493, 414, 498, 509, 152,
+        512, 154, 515, 155, 157, 518, 158, 160,
+        521, 161, 524, 526, 527, 166, 167, 523,
+        169, 170, 520, 172, 173, 517, 175, 176,
+        514, 178, 532, 178, 179, 258, 337, 339,
+        413, 415, 359, 360, 416, 412, 494, 495,
+        384, 530, 178, 180, 182, 36, 257, 202,
+        203, 255, 227, 181, 35, 183, 251, 1,
+        184, 186, 34, 250, 248, 185, 33, 187,
+        244, 188, 190, 32, 243, 241, 189, 31,
+        191, 237, 192, 194, 30, 236, 234, 193,
+        29, 195, 230, 196, 198, 28, 229, 226,
+        197, 27, 212, 0, 201, 206, 178, 204,
+        205, 208, 2, 211, 3, 214, 6, 24,
+        217, 9, 21, 220, 12, 18, 223, 15,
+        225, 231, 233, 238, 240, 245, 247, 252,
+        254, 178, 259, 261, 73, 334, 281, 282,
+        335, 306, 260, 72, 262, 330, 38, 263,
+        265, 71, 329, 327, 264, 70, 266, 323,
+        267, 269, 69, 322, 320, 268, 68, 270,
+        316, 271, 273, 67, 315, 313, 272, 66,
+        274, 309, 275, 277, 65, 308, 305, 276,
+        64, 291, 37, 280, 285, 178, 283, 284,
+        287, 39, 290, 40, 293, 43, 61, 296,
+        46, 58, 299, 49, 55, 302, 52, 304,
+        310, 312, 317, 319, 324, 326, 331, 333,
+        178, 338, 109, 340, 408, 75, 341, 343,
+        108, 407, 405, 342, 107, 344, 401, 345,
+        347, 106, 400, 398, 346, 105, 348, 394,
+        349, 351, 104, 393, 391, 350, 103, 352,
+        387, 353, 355, 102, 386, 383, 354, 101,
+        369, 74, 358, 363, 178, 361, 362, 365,
+        76, 368, 77, 371, 80, 98, 374, 83,
+        95, 377, 86, 92, 380, 89, 382, 388,
+        390, 395, 397, 402, 404, 409, 411, 178,
+        178, 417, 419, 146, 145, 439, 440, 492,
+        464, 418, 420, 488, 111, 421, 423, 144,
+        487, 485, 422, 143, 424, 481, 425, 427,
+        142, 480, 478, 426, 141, 428, 474, 429,
+        431, 140, 473, 471, 430, 139, 432, 467,
+        433, 435, 138, 466, 463, 434, 137, 449,
+        110, 438, 443, 178, 441, 442, 445, 112,
+        448, 113, 451, 116, 134, 454, 119, 131,
+        457, 122, 128, 460, 125, 462, 468, 470,
+        475, 477, 482, 484, 489, 491, 147, 496,
+        497, 511, 500, 501, 529, 148, 505, 499,
+        504, 502, 503, 506, 507, 150, 510, 508,
+        149, 151, 513, 153, 174, 163, 516, 156,
+        171, 519, 159, 168, 522, 162, 165, 525,
+        164, 528, 178, 531, 177, 534, 535, 533,
+        538, 178, 536, 537
 };
 
 static const char _indic_syllable_machine_trans_actions[] = {
@@ -1285,51 +1087,51 @@
         0, 0, 2, 0, 0, 2, 0, 0,
         2, 9, 0, 12, 2, 2, 6, 2,
         13, 13, 0, 0, 2, 2, 6, 2,
-        6, 2, 6, 14, 2, 2, 0, 2,
-        0, 0, 2, 2, 2, 2, 0, 2,
-        2, 0, 2, 2, 0, 2, 2, 2,
-        0, 2, 2, 2, 2, 0, 2, 2,
-        2, 0, 2, 2, 2, 2, 0, 2,
-        2, 2, 0, 2, 2, 2, 2, 0,
-        2, 2, 2, 0, 2, 0, 0, 0,
-        15, 0, 0, 2, 0, 2, 0, 2,
-        0, 0, 2, 0, 0, 2, 0, 0,
-        2, 0, 2, 2, 2, 2, 2, 2,
-        2, 2, 2, 16, 2, 2, 0, 2,
-        0, 0, 2, 2, 2, 2, 0, 2,
-        2, 0, 2, 2, 0, 2, 2, 2,
-        0, 2, 2, 2, 2, 0, 2, 2,
-        2, 0, 2, 2, 2, 2, 0, 2,
-        2, 2, 0, 2, 2, 2, 2, 0,
-        2, 2, 2, 0, 2, 0, 0, 0,
-        17, 0, 0, 2, 0, 2, 0, 2,
-        0, 0, 2, 0, 0, 2, 0, 0,
-        2, 0, 2, 2, 2, 2, 2, 2,
-        2, 2, 2, 18, 6, 0, 6, 6,
-        0, 6, 2, 0, 6, 2, 6, 0,
-        6, 6, 6, 2, 0, 6, 2, 6,
-        0, 6, 6, 6, 2, 0, 6, 2,
-        6, 0, 6, 6, 6, 2, 0, 6,
-        2, 6, 0, 6, 0, 0, 0, 19,
-        0, 0, 2, 0, 2, 0, 2, 0,
-        0, 2, 0, 0, 2, 0, 0, 2,
-        0, 2, 2, 2, 2, 2, 2, 2,
-        2, 2, 20, 21, 2, 2, 0, 0,
-        0, 0, 2, 2, 2, 2, 2, 2,
-        0, 2, 2, 0, 2, 2, 2, 0,
+        6, 2, 14, 2, 2, 0, 2, 0,
+        0, 2, 2, 2, 0, 2, 2, 0,
+        2, 2, 0, 2, 2, 2, 0, 2,
+        2, 2, 2, 0, 2, 2, 2, 0,
         2, 2, 2, 2, 0, 2, 2, 2,
         0, 2, 2, 2, 2, 0, 2, 2,
-        2, 0, 2, 2, 2, 2, 0, 2,
-        2, 2, 0, 2, 0, 0, 0, 22,
-        0, 0, 2, 0, 2, 0, 2, 0,
+        2, 0, 2, 0, 0, 0, 15, 0,
+        0, 2, 0, 2, 0, 2, 0, 0,
+        2, 0, 0, 2, 0, 0, 2, 0,
+        2, 2, 2, 2, 2, 2, 2, 2,
+        2, 16, 2, 2, 0, 2, 0, 0,
+        2, 2, 2, 0, 2, 2, 0, 2,
+        2, 0, 2, 2, 2, 0, 2, 2,
+        2, 2, 0, 2, 2, 2, 0, 2,
+        2, 2, 2, 0, 2, 2, 2, 0,
+        2, 2, 2, 2, 0, 2, 2, 2,
+        0, 2, 0, 0, 0, 17, 0, 0,
+        2, 0, 2, 0, 2, 0, 0, 2,
+        0, 0, 2, 0, 0, 2, 0, 2,
+        2, 2, 2, 2, 2, 2, 2, 2,
+        18, 6, 0, 6, 6, 0, 6, 2,
+        0, 6, 2, 6, 0, 6, 6, 6,
+        2, 0, 6, 2, 6, 0, 6, 6,
+        6, 2, 0, 6, 2, 6, 0, 6,
+        6, 6, 2, 0, 6, 2, 6, 0,
+        6, 0, 0, 0, 19, 0, 0, 2,
+        0, 2, 0, 2, 0, 0, 2, 0,
+        0, 2, 0, 0, 2, 0, 2, 2,
+        2, 2, 2, 2, 2, 2, 2, 20,
+        21, 2, 2, 0, 0, 0, 0, 2,
+        2, 2, 2, 2, 0, 2, 2, 0,
+        2, 2, 2, 0, 2, 2, 2, 2,
+        0, 2, 2, 2, 0, 2, 2, 2,
+        2, 0, 2, 2, 2, 0, 2, 2,
+        2, 2, 0, 2, 2, 2, 0, 2,
+        0, 0, 0, 22, 0, 0, 2, 0,
+        2, 0, 2, 0, 0, 2, 0, 0,
+        2, 0, 0, 2, 0, 2, 2, 2,
+        2, 2, 2, 2, 2, 2, 0, 0,
+        8, 2, 0, 0, 2, 0, 2, 0,
+        0, 0, 0, 8, 8, 0, 8, 8,
+        0, 0, 2, 0, 0, 0, 2, 0,
         0, 2, 0, 0, 2, 0, 0, 2,
-        0, 2, 2, 2, 2, 2, 2, 2,
-        2, 2, 0, 0, 8, 2, 0, 0,
-        2, 0, 2, 0, 0, 0, 0, 8,
-        8, 0, 8, 8, 0, 0, 2, 0,
-        0, 0, 2, 0, 0, 2, 0, 0,
-        2, 0, 0, 2, 0, 2, 23, 2,
-        0, 0, 0, 0, 0, 24, 0, 0
+        0, 2, 23, 2, 0, 0, 0, 0,
+        0, 24, 0, 0
 };
 
 static const char _indic_syllable_machine_to_state_actions[] = {
@@ -1400,7 +1202,7 @@
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0
 };
 
 static const char _indic_syllable_machine_from_state_actions[] = {
@@ -1471,7 +1273,7 @@
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0
 };
 
 static const short _indic_syllable_machine_eof_trans[] = {
@@ -1497,52 +1299,52 @@
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 186, 0, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 284, 284, 284, 284, 284,
-        284, 284, 284, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        364, 364, 364, 364, 364, 364, 364, 364,
-        435, 364, 435, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 436, 436, 436, 436, 436, 436,
-        436, 436, 364, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 364, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 204, 204, 204,
-        204, 204, 204, 204, 204, 364, 551, 551,
-        551, 551, 551, 551, 551, 551, 551
+        1, 186, 0, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 282, 282, 282, 282, 282, 282, 282,
+        282, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 361, 361, 361,
+        361, 361, 361, 361, 361, 432, 361, 432,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 433, 433,
+        433, 433, 433, 433, 433, 433, 361, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 361, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 203, 203, 203, 203, 203, 203, 203,
+        203, 361, 547, 547, 547, 547, 547, 547,
+        547, 547, 547
 };
 
 static const int indic_syllable_machine_start = 178;
@@ -1556,7 +1358,7 @@
 
 
 
-#line 97 "hb-ot-shape-complex-indic-machine.rl"
+#line 96 "hb-ot-shape-complex-indic-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -1576,7 +1378,7 @@
   int cs;
   hb_glyph_info_t *info = buffer->info;
 
-#line 1580 "hb-ot-shape-complex-indic-machine.hh"
+#line 1382 "hb-ot-shape-complex-indic-machine.hh"
         {
         cs = indic_syllable_machine_start;
         ts = 0;
@@ -1584,7 +1386,7 @@
         act = 0;
         }
 
-#line 118 "hb-ot-shape-complex-indic-machine.rl"
+#line 117 "hb-ot-shape-complex-indic-machine.rl"
 
 
   p = 0;
@@ -1593,7 +1395,7 @@
   unsigned int last = 0;
   unsigned int syllable_serial = 1;
 
-#line 1597 "hb-ot-shape-complex-indic-machine.hh"
+#line 1399 "hb-ot-shape-complex-indic-machine.hh"
         {
         int _slen;
         int _trans;
@@ -1607,7 +1409,7 @@
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 1611 "hb-ot-shape-complex-indic-machine.hh"
+#line 1413 "hb-ot-shape-complex-indic-machine.hh"
         }
 
         _keys = _indic_syllable_machine_trans_keys + (cs<<1);
@@ -1630,71 +1432,71 @@
         {te = p+1;}
         break;
         case 15:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (consonant_syllable); }}
         break;
         case 17:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (vowel_syllable); }}
         break;
         case 22:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (standalone_cluster); }}
         break;
         case 24:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (symbol_cluster); }}
         break;
         case 19:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (broken_cluster); }}
         break;
         case 12:
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
         {te = p+1;{ found_syllable (non_indic_cluster); }}
         break;
         case 14:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (consonant_syllable); }}
         break;
         case 16:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (vowel_syllable); }}
         break;
         case 21:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (standalone_cluster); }}
         break;
         case 23:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (symbol_cluster); }}
         break;
         case 18:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (broken_cluster); }}
         break;
         case 20:
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
         {te = p;p--;{ found_syllable (non_indic_cluster); }}
         break;
         case 1:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (consonant_syllable); }}
         break;
         case 3:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (vowel_syllable); }}
         break;
         case 7:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (standalone_cluster); }}
         break;
         case 9:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (symbol_cluster); }}
         break;
         case 4:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (broken_cluster); }}
         break;
         case 5:
@@ -1715,22 +1517,22 @@
         case 8:
 #line 1 "NONE"
         {te = p+1;}
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
         {act = 1;}
         break;
         case 6:
 #line 1 "NONE"
         {te = p+1;}
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
         {act = 5;}
         break;
         case 13:
 #line 1 "NONE"
         {te = p+1;}
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
         {act = 6;}
         break;
-#line 1734 "hb-ot-shape-complex-indic-machine.hh"
+#line 1536 "hb-ot-shape-complex-indic-machine.hh"
         }
 
 _again:
@@ -1739,7 +1541,7 @@
 #line 1 "NONE"
         {ts = 0;}
         break;
-#line 1743 "hb-ot-shape-complex-indic-machine.hh"
+#line 1545 "hb-ot-shape-complex-indic-machine.hh"
         }
 
         if ( ++p != pe )
@@ -1755,7 +1557,7 @@
 
         }
 
-#line 127 "hb-ot-shape-complex-indic-machine.rl"
+#line 126 "hb-ot-shape-complex-indic-machine.rl"
 
 }
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-private.hh	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-private.hh	Tue Aug 09 16:20:02 2016 -0700
@@ -60,11 +60,10 @@
   OT_Repha = 15, /* Atomically-encoded logical or visual repha. */
   OT_Ra = 16,
   OT_CM = 17,  /* Consonant-Medial. */
-  OT_Symbol = 18, /* Avagraha, etc that take marks (SM,A,VD). */
-  OT_CM2 = 31 /* Consonant-Medial, second slot. */
+  OT_Symbol = 18 /* Avagraha, etc that take marks (SM,A,VD). */
 };
 
-#define MEDIAL_FLAGS (FLAG (OT_CM) | FLAG (OT_CM2))
+#define MEDIAL_FLAGS (FLAG (OT_CM))
 
 /* Note:
  *
@@ -109,27 +108,31 @@
 
   INDIC_SYLLABIC_CATEGORY_AVAGRAHA                      = OT_Symbol,
   INDIC_SYLLABIC_CATEGORY_BINDU                         = OT_SM,
-  INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER         = OT_PLACEHOLDER, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER         = OT_PLACEHOLDER, /* Don't care. */
   INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK             = OT_A,
   INDIC_SYLLABIC_CATEGORY_CONSONANT                     = OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD                = OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL               = OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER         = OT_C,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER              = OT_M, /* U+17CD only. */
   INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL              = OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER         = OT_PLACEHOLDER,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA     = OT_Repha,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED            = OT_X, /* Don't care. */
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED           = OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA    = OT_N,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER        = OT_Repha, /* TODO */
   INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK               = OT_SM,
-  INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER             = OT_H, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER             = OT_Coeng,
   INDIC_SYLLABIC_CATEGORY_JOINER                        = OT_ZWJ,
   INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER              = OT_X,
   INDIC_SYLLABIC_CATEGORY_NON_JOINER                    = OT_ZWNJ,
   INDIC_SYLLABIC_CATEGORY_NUKTA                         = OT_N,
   INDIC_SYLLABIC_CATEGORY_NUMBER                        = OT_PLACEHOLDER,
-  INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER                 = OT_PLACEHOLDER, /* TODO */
-  INDIC_SYLLABIC_CATEGORY_PURE_KILLER                   = OT_H, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER                 = OT_PLACEHOLDER, /* Don't care. */
+  INDIC_SYLLABIC_CATEGORY_PURE_KILLER                   = OT_M, /* Is like a vowel matra. */
   INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER              = OT_RS,
+  INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER             = OT_M, /* Misc Khmer signs. */
   INDIC_SYLLABIC_CATEGORY_TONE_LETTER                   = OT_X,
   INDIC_SYLLABIC_CATEGORY_TONE_MARK                     = OT_N,
   INDIC_SYLLABIC_CATEGORY_VIRAMA                        = OT_H,
@@ -162,17 +165,23 @@
 };
 
 #define INDIC_COMBINE_CATEGORIES(S,M) \
-  (ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || \
-                            ( \
-                             S == INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL || \
-                             S == INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK || \
-                             S == INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER || \
-                             S == INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA || \
-                             S == INDIC_SYLLABIC_CATEGORY_VIRAMA || \
-                             S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT || \
-                             false)) + \
-   ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
-   ((M << 8) | S))
+  ( \
+    ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
+    ( S | \
+     ( \
+      ( \
+       S == INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL || \
+       S == INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK || \
+       S == INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER || \
+       S == INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA || \
+       S == INDIC_SYLLABIC_CATEGORY_VIRAMA || \
+       S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT || \
+       false \
+       ? M : INDIC_MATRA_CATEGORY_NOT_APPLICABLE \
+      ) << 8 \
+     ) \
+    ) \
+   )
 
 HB_INTERNAL INDIC_TABLE_ELEMENT_TYPE
 hb_indic_get_categories (hb_codepoint_t u);
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-table.cc	Tue Aug 09 12:08:51 2016 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-table.cc	Tue Aug 09 16:20:02 2016 -0700
@@ -2,67 +2,71 @@
 /*
  * The following table is generated by running:
  *
- *   ./gen-indic-table.py IndicSyllabicCategory.txt IndicMatraCategory.txt Blocks.txt
+ *   ./gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt
  *
  * on files with these headers:
  *
- * # IndicSyllabicCategory-7.0.0.txt
- * # Date: 2014-06-03, 07:00:00 GMT [KW, LI, AG, RP]
- * # IndicMatraCategory-7.0.0.txt
- * # Date: 2014-06-03, 07:00:00 GMT [KW, LI, AG, RP]
- * # Blocks-7.0.0.txt
- * # Date: 2014-04-03, 23:23:00 GMT [RP, KW]
+ * # IndicSyllabicCategory-9.0.0.txt
+ * # Date: 2016-05-21, 02:46:00 GMT [RP]
+ * # IndicPositionalCategory-9.0.0.txt
+ * # Date: 2016-02-25, 00:48:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
  */
 
 #include "hb-ot-shape-complex-indic-private.hh"
 
 
-#define ISC_A   INDIC_SYLLABIC_CATEGORY_AVAGRAHA                /*  13 chars; Avagraha */
-#define ISC_Bi  INDIC_SYLLABIC_CATEGORY_BINDU                   /*  59 chars; Bindu */
+#define ISC_A   INDIC_SYLLABIC_CATEGORY_AVAGRAHA                /*  15 chars; Avagraha */
+#define ISC_Bi  INDIC_SYLLABIC_CATEGORY_BINDU                   /*  67 chars; Bindu */
 #define ISC_BJN INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER   /*  20 chars; Brahmi_Joining_Number */
-#define ISC_Ca  INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK       /*  30 chars; Cantillation_Mark */
-#define ISC_C   INDIC_SYLLABIC_CATEGORY_CONSONANT               /* 1744 chars; Consonant */
-#define ISC_CD  INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD          /*   7 chars; Consonant_Dead */
-#define ISC_CF  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL         /*  61 chars; Consonant_Final */
+#define ISC_Ca  INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK       /*  53 chars; Cantillation_Mark */
+#define ISC_C   INDIC_SYLLABIC_CATEGORY_CONSONANT               /* 1907 chars; Consonant */
+#define ISC_CD  INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD          /*  10 chars; Consonant_Dead */
+#define ISC_CF  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL         /*  62 chars; Consonant_Final */
 #define ISC_CHL INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER   /*   5 chars; Consonant_Head_Letter */
-#define ISC_CM  INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL        /*  19 chars; Consonant_Medial */
-#define ISC_CP  INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER   /*  11 chars; Consonant_Placeholder */
+#define ISC_CK  INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER        /*   2 chars; Consonant_Killer */
+#define ISC_CM  INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL        /*  22 chars; Consonant_Medial */
+#define ISC_CP  INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER   /*  16 chars; Consonant_Placeholder */
 #define ISC_CPR INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA       /*   1 chars; Consonant_Preceding_Repha */
-#define ISC_CS  INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED     /*  61 chars; Consonant_Subjoined */
+#define ISC_CPrf        INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED      /*   2 chars; Consonant_Prefixed */
+#define ISC_CS  INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED     /*  90 chars; Consonant_Subjoined */
 #define ISC_CSR INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA      /*   4 chars; Consonant_Succeeding_Repha */
+#define ISC_CWS INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER  /*   4 chars; Consonant_With_Stacker */
 #define ISC_GM  INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK         /*   2 chars; Gemination_Mark */
 #define ISC_IS  INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER       /*   7 chars; Invisible_Stacker */
 #define ISC_ZWJ INDIC_SYLLABIC_CATEGORY_JOINER                  /*   1 chars; Joiner */
 #define ISC_ML  INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER        /*   1 chars; Modifying_Letter */
 #define ISC_ZWNJ        INDIC_SYLLABIC_CATEGORY_NON_JOINER              /*   1 chars; Non_Joiner */
-#define ISC_N   INDIC_SYLLABIC_CATEGORY_NUKTA                   /*  18 chars; Nukta */
-#define ISC_Nd  INDIC_SYLLABIC_CATEGORY_NUMBER                  /* 408 chars; Number */
+#define ISC_N   INDIC_SYLLABIC_CATEGORY_NUKTA                   /*  24 chars; Nukta */
+#define ISC_Nd  INDIC_SYLLABIC_CATEGORY_NUMBER                  /* 459 chars; Number */
 #define ISC_NJ  INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER           /*   1 chars; Number_Joiner */
 #define ISC_x   INDIC_SYLLABIC_CATEGORY_OTHER                   /*   1 chars; Other */
-#define ISC_PK  INDIC_SYLLABIC_CATEGORY_PURE_KILLER             /*  15 chars; Pure_Killer */
-#define ISC_RS  INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER        /*   3 chars; Register_Shifter */
+#define ISC_PK  INDIC_SYLLABIC_CATEGORY_PURE_KILLER             /*  16 chars; Pure_Killer */
+#define ISC_RS  INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER        /*   2 chars; Register_Shifter */
+#define ISC_SM  INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER       /*  22 chars; Syllable_Modifier */
 #define ISC_TL  INDIC_SYLLABIC_CATEGORY_TONE_LETTER             /*   7 chars; Tone_Letter */
-#define ISC_TM  INDIC_SYLLABIC_CATEGORY_TONE_MARK               /*  62 chars; Tone_Mark */
-#define ISC_V   INDIC_SYLLABIC_CATEGORY_VIRAMA                  /*  22 chars; Virama */
-#define ISC_Vs  INDIC_SYLLABIC_CATEGORY_VISARGA                 /*  29 chars; Visarga */
+#define ISC_TM  INDIC_SYLLABIC_CATEGORY_TONE_MARK               /*  42 chars; Tone_Mark */
+#define ISC_V   INDIC_SYLLABIC_CATEGORY_VIRAMA                  /*  24 chars; Virama */
+#define ISC_Vs  INDIC_SYLLABIC_CATEGORY_VISARGA                 /*  31 chars; Visarga */
 #define ISC_Vo  INDIC_SYLLABIC_CATEGORY_VOWEL                   /*  30 chars; Vowel */
-#define ISC_M   INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT         /* 553 chars; Vowel_Dependent */
-#define ISC_VI  INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT       /* 395 chars; Vowel_Independent */
+#define ISC_M   INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT         /* 602 chars; Vowel_Dependent */
+#define ISC_VI  INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT       /* 431 chars; Vowel_Independent */
 
-#define IMC_B   INDIC_MATRA_CATEGORY_BOTTOM                     /* 142 chars; Bottom */
+#define IMC_B   INDIC_MATRA_CATEGORY_BOTTOM                     /* 300 chars; Bottom */
 #define IMC_BR  INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT           /*   2 chars; Bottom_And_Right */
 #define IMC_L   INDIC_MATRA_CATEGORY_LEFT                       /*  57 chars; Left */
 #define IMC_LR  INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT             /*  21 chars; Left_And_Right */
 #define IMC_x   INDIC_MATRA_CATEGORY_NOT_APPLICABLE             /*   1 chars; Not_Applicable */
-#define IMC_O   INDIC_MATRA_CATEGORY_OVERSTRUCK                 /*   2 chars; Overstruck */
-#define IMC_R   IND