[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-12-07 Thread Behdad Esfahbod
 src/hb-aat-fdsc-table.hh|2 +-
 src/hb-cff-interp-common.hh |5 +
 src/hb-cff2-interp-cs.hh|   14 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 1abd4fcaec31053b442525d7f240af489c5974b1
Author: Ebrahim Byagowi 
Date:   Fri Dec 7 22:34:12 2018 +0330

[fdsc] minor

diff --git a/src/hb-aat-fdsc-table.hh b/src/hb-aat-fdsc-table.hh
index d432d7fc..136172c4 100644
--- a/src/hb-aat-fdsc-table.hh
+++ b/src/hb-aat-fdsc-table.hh
@@ -52,7 +52,7 @@ struct GXFontDescriptor
   DEFINE_SIZE_STATIC (8);
 };
 
-struct gasp
+struct fdsc
 {
   enum { tableTag = HB_AAT_TAG_fdsc };
 
commit 59345cdef38cf1f514a6a0eb6e8852350acb6166
Author: Michiharu Ariza 
Date:   Thu Dec 6 13:36:26 2018 -0800

[CFF] Refix oss-fuzz 11714: set_blends (PR #1458) (#1460)

* pass subarray of stack to set_blends

* get_subarray to return a value, not ref

* restored error check (with tweak)

diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh
index 9b595ff1..effc0812 100644
--- a/src/hb-cff-interp-common.hh
+++ b/src/hb-cff-interp-common.hh
@@ -576,6 +576,11 @@ struct ArgStack : Stack
 return true;
   }
 
+  inline hb_array_t get_subarray (unsigned int start) const
+  {
+return S::elements.sub_array (start);
+  }
+
   private:
   typedef Stack S;
 };
diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh
index 18e84680..8e296b6e 100644
--- a/src/hb-cff2-interp-cs.hh
+++ b/src/hb-cff2-interp-cs.hh
@@ -52,7 +52,7 @@ struct BlendArg : Number
   inline void set_real (double v) { reset_blends (); Number::set_real (v); }
 
   inline void set_blends (unsigned int numValues_, unsigned int valueIndex_,
- unsigned int numBlends, const BlendArg *blends_)
+ unsigned int numBlends, const hb_array_t &blends_)
   {
 numValues = numValues_;
 valueIndex = valueIndex_;
@@ -235,15 +235,19 @@ struct CFF2CSOpSet : CSOpSet
 env.process_blend ();
 k = env.get_region_count ();
 n = env.argStack.pop_uint ();
-if (unlikely (env.argStack.get_count () < ((k+1) * n)))
+/* copy the blend values into blend array of the default values */
+unsigned int start = env.argStack.get_count () - ((k+1) * n);
+/* let an obvious error case fail, but note CFF2 spec doesn't forbid n==0 
*/
+if (unlikely (start > env.argStack.get_count ()))
 {
   env.set_error ();
   return;
 }
-/* copy the blend values into blend array of the default values */
-unsigned int start = env.argStack.get_count () - ((k+1) * n);
 for (unsigned int i = 0; i < n; i++)
-  env.argStack[start + i].set_blends (n, i, k, &env.argStack[start + n + 
(i * k)]);
+{
+  const hb_array_t blends = env.argStack.get_subarray 
(start + n + (i * k));
+  env.argStack[start + i].set_blends (n, i, k, blends);
+}
 
 /* pop off blend values leaving default values now adorned with blend 
values */
 env.argStack.pop (k * n);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-12-05 Thread Behdad Esfahbod
 src/hb-cff-interp-common.hh
 |   18 --
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5768186323009536
 |binary
 2 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 81cfd3c775dbc470f57d7fe2775cc068ffa367b6
Merge: 8394a6cb 6708c559
Author: Behdad Esfahbod 
Date:   Wed Dec 5 15:37:15 2018 -0800

Merge pull request #1455 from harfbuzz/cff-strinc_assert

[CFF] fix oss-fuzz issue 11675 (ASSERT: count <= str.len)

commit 6708c5595fc6babdae0132f8a23cbe3558a58703
Author: Michiharu Ariza 
Date:   Wed Dec 5 12:51:18 2018 -0800

fix oss-fuzz issue 11675 (ASSERT: count <= str.len)

Also added an additional error check to avail ()

diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh
index f2ccc2bd..9b595ff1 100644
--- a/src/hb-cff-interp-common.hh
+++ b/src/hb-cff-interp-common.hh
@@ -391,8 +391,22 @@ struct SubByteStr
 
   inline operator ByteStr (void) const { return ByteStr (str, offset, str.len 
- offset); }
 
-  inline bool avail (unsigned int count=1) const { return str.check_limit 
(offset, count); }
-  inline void inc (unsigned int count=1) { offset += count; assert (count <= 
str.len); }
+  inline bool avail (unsigned int count=1) const
+  {
+return (!in_error () && str.check_limit (offset, count));
+  }
+  inline void inc (unsigned int count=1)
+  {
+if (likely (!in_error () && (offset <= str.len) && (offset + count <= 
str.len)))
+{
+  offset += count;
+}
+else
+{
+  offset = str.len;
+  set_error ();
+}
+  }
 
   inline void set_error (void) { error = true; }
   inline bool in_error (void) const { return error; }
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5768186323009536
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5768186323009536
new file mode 100644
index ..858604d7
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5768186323009536
 differ
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-12-03 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt  |7 ---
 src/hb-aat-layout.cc|9 -
 src/hb-aat-layout.h |8 
 src/hb-aat-layout.hh|3 ---
 test/api/fonts/aat-morx.ttf |binary
 test/api/fonts/aat-trak.ttf |binary
 test/api/test-aat-layout.c  |   13 +
 7 files changed, 33 insertions(+), 7 deletions(-)

New commits:
commit 8c05b955eb4aa088b2b5df9b6415863486eaf59c
Merge: d19b1680 01f628cf
Author: Behdad Esfahbod 
Date:   Mon Dec 3 14:30:51 2018 -0500

Merge pull request #1439 from ebraminio/tracking

[aat] Expose hb_aat_layout_has_tracking API

commit 01f628cf5571b8b58108ab66cfc3e929c9840e31
Author: Ebrahim Byagowi 
Date:   Mon Dec 3 22:04:48 2018 +0330

[aat] Expose hb_aat_layout_has_tracking API

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 63224317..fd7682ef 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -7,13 +7,14 @@ HB_OT_H_IN
 hb-aat-layout
 HB_AAT_LAYOUT_NO_SELECTOR_INDEX
 hb_aat_layout_feature_type_t
-hb_aat_layout_get_feature_types
-hb_aat_layout_feature_type_get_name_id
 hb_aat_layout_feature_selector_t
 hb_aat_layout_feature_selector_info_t
+hb_aat_layout_feature_type_get_name_id
 hb_aat_layout_feature_type_get_selector_infos
-hb_aat_layout_has_substitution
+hb_aat_layout_get_feature_types
 hb_aat_layout_has_positioning
+hb_aat_layout_has_substitution
+hb_aat_layout_has_tracking
 
 
 
diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index 837dcbae..e39df0e1 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -296,7 +296,14 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
 }
 
 
-bool
+/*
+ * hb_aat_layout_has_tracking:
+ * @face:
+ *
+ * Returns:
+ * Since: REPLACEME
+ */
+hb_bool_t
 hb_aat_layout_has_tracking (hb_face_t *face)
 {
   return face->table.trak->has_data ();
diff --git a/src/hb-aat-layout.h b/src/hb-aat-layout.h
index f5745096..760aaae4 100644
--- a/src/hb-aat-layout.h
+++ b/src/hb-aat-layout.h
@@ -473,6 +473,14 @@ HB_EXTERN hb_bool_t
 hb_aat_layout_has_positioning (hb_face_t *face);
 
 
+/*
+ * trak
+ */
+
+HB_EXTERN hb_bool_t
+hb_aat_layout_has_tracking (hb_face_t *face);
+
+
 HB_END_DECLS
 
 #endif /* HB_AAT_LAYOUT_H */
diff --git a/src/hb-aat-layout.hh b/src/hb-aat-layout.hh
index cbb94546..56a4818b 100644
--- a/src/hb-aat-layout.hh
+++ b/src/hb-aat-layout.hh
@@ -72,9 +72,6 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
 
-HB_INTERNAL bool
-hb_aat_layout_has_tracking (hb_face_t *face);
-
 HB_INTERNAL void
 hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
 hb_font_t *font,
diff --git a/test/api/fonts/aat-morx.ttf b/test/api/fonts/aat-morx.ttf
new file mode 100644
index ..5827ec5a
Binary files /dev/null and b/test/api/fonts/aat-morx.ttf differ
diff --git a/test/api/fonts/aat-trak.ttf b/test/api/fonts/aat-trak.ttf
new file mode 100644
index ..07ae3afd
Binary files /dev/null and b/test/api/fonts/aat-trak.ttf differ
diff --git a/test/api/test-aat-layout.c b/test/api/test-aat-layout.c
index 358fac87..8cfebb13 100644
--- a/test/api/test-aat-layout.c
+++ b/test/api/test-aat-layout.c
@@ -101,6 +101,18 @@ test_aat_get_feature_selectors (void)
   g_assert_cmpuint (0, ==, count);
 }
 
+static void
+test_aat_has (void)
+{
+  hb_face_t *morx = hb_test_open_font_file ("fonts/aat-morx.ttf");
+  g_assert (hb_aat_layout_has_substitution (morx));
+  hb_face_destroy (morx);
+
+  hb_face_t *trak = hb_test_open_font_file ("fonts/aat-trak.ttf");
+  g_assert (hb_aat_layout_has_tracking (trak));
+  hb_face_destroy (trak);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -108,6 +120,7 @@ main (int argc, char **argv)
 
   hb_test_add (test_aat_get_feature_types);
   hb_test_add (test_aat_get_feature_selectors);
+  hb_test_add (test_aat_has);
 
   face = hb_test_open_font_file ("fonts/aat-feat.ttf");
   sbix = hb_test_open_font_file ("fonts/chromacheck-sbix.ttf");
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-12-01 Thread Behdad Esfahbod
 CMakeLists.txt|   12 --
 src/Makefile.am   |6 -
 src/Makefile.sources  |  231 +-
 test/api/hb-subset-test.h |2 
 4 files changed, 112 insertions(+), 139 deletions(-)

New commits:
commit 58d4d19947794aded4e966290b01e1034f216a7d
Author: Behdad Esfahbod 
Date:   Sat Dec 1 19:34:18 2018 -0500

Simplify build source list

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 019e205b..2d6e77e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -168,10 +168,6 @@ extract_make_variable(HB_BASE_headers ${SRCSOURCES})
 add_prefix_to_list(HB_BASE_headers "${PROJECT_SOURCE_DIR}/src/")
 extract_make_variable(HB_FALLBACK_sources ${SRCSOURCES})
 add_prefix_to_list(HB_FALLBACK_sources "${PROJECT_SOURCE_DIR}/src/")
-extract_make_variable(HB_OT_sources ${SRCSOURCES})
-add_prefix_to_list(HB_OT_sources "${PROJECT_SOURCE_DIR}/src/")
-extract_make_variable(HB_OT_headers ${SRCSOURCES})
-add_prefix_to_list(HB_OT_headers "${PROJECT_SOURCE_DIR}/src/")
 
 extract_make_variable(HB_SUBSET_sources ${SRCSOURCES})
 add_prefix_to_list(HB_SUBSET_sources "${PROJECT_SOURCE_DIR}/src/")
@@ -180,13 +176,10 @@ extract_make_variable(HB_SUBSET_headers ${SRCSOURCES})
 add_prefix_to_list(HB_SUBSET_headers "${PROJECT_SOURCE_DIR}/src/")
 
 extract_make_variable(HB_BASE_RAGEL_GENERATED_sources ${SRCSOURCES})
-extract_make_variable(HB_OT_RAGEL_GENERATED_sources ${SRCSOURCES})
 #if (IN_HB_DIST)
   add_prefix_to_list(HB_BASE_RAGEL_GENERATED_sources 
"${PROJECT_SOURCE_DIR}/src/")
-  add_prefix_to_list(HB_OT_RAGEL_GENERATED_sources 
"${PROJECT_SOURCE_DIR}/src/")
 #else ()
 #  add_prefix_to_list(HB_BASE_RAGEL_GENERATED_sources 
"${PROJECT_BINARY_DIR}/src/")
-#  add_prefix_to_list(HB_OT_RAGEL_GENERATED_sources 
"${PROJECT_BINARY_DIR}/src/")
 #endif ()
 
 extract_make_variable(HB_VIEW_sources ${UTILSOURCES})
@@ -212,7 +205,7 @@ set (HB_VERSION_MICRO ${CMAKE_MATCH_4})
 
 ## Define ragel tasks
 # if (NOT IN_HB_DIST)
-#  foreach (ragel_output IN ITEMS ${HB_BASE_RAGEL_GENERATED_sources} 
${HB_OT_RAGEL_GENERATED_sources})
+#  foreach (ragel_output IN ITEMS ${HB_BASE_RAGEL_GENERATED_sources})
 #string(REGEX MATCH "([^/]+)\\.hh" temp ${ragel_output})
 #set (target_name ${CMAKE_MATCH_1})
 #add_custom_command(OUTPUT ${ragel_output}
@@ -246,8 +239,6 @@ set (project_sources
   ${HB_BASE_RAGEL_GENERATED_sources}
 
   ${HB_FALLBACK_sources}
-  ${HB_OT_sources}
-  ${HB_OT_RAGEL_GENERATED_sources}
 )
 
 set (subset_project_sources
@@ -260,7 +251,6 @@ set (project_headers
   #${HB_VERSION_H}
 
   ${HB_BASE_headers}
-  ${HB_OT_headers}
 )
 
 set (subset_project_headers
diff --git a/src/Makefile.am b/src/Makefile.am
index c726cf2a..3618d03a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,10 +28,6 @@ HBSOURCES =  $(HB_BASE_sources)
 HBSOURCES += $(HB_BASE_RAGEL_GENERATED_sources)
 HBHEADERS = $(HB_BASE_headers)
 
-HBSOURCES += $(HB_OT_sources)
-HBSOURCES += $(HB_OT_RAGEL_GENERATED_sources)
-HBHEADERS += $(HB_OT_headers)
-
 if HAVE_FALLBACK
 HBSOURCES += $(HB_FALLBACK_sources)
 endif
@@ -299,12 +295,10 @@ built-sources: $(BUILT_SOURCES)
 
 RAGEL_GENERATED = \
$(patsubst %,$(srcdir)/%,$(HB_BASE_RAGEL_GENERATED_sources)) \
-   $(patsubst %,$(srcdir)/%,$(HB_OT_RAGEL_GENERATED_sources)) \
$(NULL)
 BUILT_SOURCES += $(RAGEL_GENERATED)
 EXTRA_DIST += \
$(HB_BASE_RAGEL_sources) \
-   $(HB_OT_RAGEL_sources) \
$(NULL)
 # We decided to add ragel-generated files to git...
 #MAINTAINERCLEANFILES += $(RAGEL_GENERATED)
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 5484764c..e12d3b55 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -1,199 +1,177 @@
 # Base and default-included sources and headers
 
 HB_BASE_sources = \
+   hb-aat-layout-ankr-table.hh \
+   hb-aat-layout-bsln-table.hh \
+   hb-aat-layout-common.hh \
+   hb-aat-layout-feat-table.hh \
+   hb-aat-layout-just-table.hh \
+   hb-aat-layout-kerx-table.hh \
+   hb-aat-layout-lcar-table.hh \
+   hb-aat-layout-morx-table.hh \
+   hb-aat-layout-trak-table.hh \
+   hb-aat-layout.cc \
+   hb-aat-layout.hh \
+   hb-aat-ltag-table.hh \
+   hb-aat-map.cc \
+   hb-aat-map.hh \
hb-atomic.hh \
-   hb-blob.hh \
hb-blob.cc \
-   hb-buffer.hh \
+   hb-blob.hh \
hb-buffer-serialize.cc \
hb-buffer.cc \
+   hb-buffer.hh \
hb-cache.hh \
+   hb-cff-interp-common.hh \
+   hb-cff-interp-cs-common.hh \
+   hb-cff-interp-dict-common.hh \
+   hb-cff1-interp-cs.hh \
+   hb-cff2-interp-cs.hh \
hb-common.cc \
hb-debug.hh \
hb-dsalgs.hh \
-   hb-face.hh \
hb-face.cc \
-   hb-font.hh \
+   hb-face.hh \
hb-font.cc \
+   hb-font.hh \
hb-iter.hh \
hb-kern.hh \
-   hb-map.hh \
-   hb-map.cc \
hb-machinery.hh \
+   hb-map.cc \
+   hb-map.hh \
hb-mutex.hh \
hb-n

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-12-01 Thread Behdad Esfahbod
 src/hb-dsalgs.hh|   16 ++--
 src/hb-open-type.hh |   12 ++--
 2 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 11d2f49af8f53340134c844173f4d8655b00dea3
Author: Behdad Esfahbod 
Date:   Sat Dec 1 13:12:21 2018 -0500

New approach to change BigEndian casts to be int-sized

Fixes spurious warnings like:
Fixes https://github.com/harfbuzz/harfbuzz/issues/1436

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index ee76d7ed..0038ad8b 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -52,13 +52,19 @@ namespace OT {
  * Int types
  */
 
+template  struct hb_signedness_int;
+template <> struct hb_signedness_int { typedef unsigned int value; };
+template <> struct hb_signedness_int  { typedef   signed int value; };
+
 /* Integer types in big-endian order and no alignment requirement */
 template 
 struct IntType
 {
   typedef Type type;
-  inline void set (Type i) { v.set (i); }
-  inline operator Type (void) const { return v; }
+  typedef typename hb_signedness_int::value>::value 
wide_type;
+
+  inline void set (wide_type i) { v.set (i); }
+  inline operator wide_type (void) const { return v; }
   inline bool operator == (const IntType &o) const { return (Type) 
v == (Type) o.v; }
   inline bool operator != (const IntType &o) const { return !(*this 
== o); }
   static inline int cmp (const IntType *a, const IntType 
*b) { return b->cmp (*a); }
@@ -88,6 +94,8 @@ typedef IntType HBUINT16;/* 16-bit 
unsigned integer. */
 typedef IntType HBINT16;  /* 16-bit signed integer. */
 typedef IntType HBUINT32; /* 32-bit unsigned integer. */
 typedef IntType HBINT32;  /* 32-bit signed integer. */
+/* Note: we cannot defined a signed HBINT24 because there's no corresponding C 
type.
+ * Works for unsigned, but not signed, since we rely on compiler for 
sign-extension. */
 typedef IntType HBUINT24; /* 24-bit unsigned integer. */
 
 /* 16-bit signed integer (HBINT16) that describes a quantity in FUnits. */
commit 50e0273ab18acd2fbb21bcf18ad487092e890b4e
Author: Behdad Esfahbod 
Date:   Sat Dec 1 13:03:52 2018 -0500

Change hb_assert_unsigned_t<> to hb_is_signed<>

diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 9c920fc8..dccca3cf 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -287,11 +287,15 @@ hb_ceil_to_4 (unsigned int v)
   return ((v - 1) | 3) + 1;
 }
 
-template  class hb_assert_unsigned_t;
-template <> class hb_assert_unsigned_t {};
-template <> class hb_assert_unsigned_t {};
-template <> class hb_assert_unsigned_t {};
-template <> class hb_assert_unsigned_t {};
+template  struct hb_is_signed;
+template <> struct hb_is_signed { enum { value = true }; };
+template <> struct hb_is_signed { enum { value = true }; };
+template <> struct hb_is_signed { enum { value = true }; };
+template <> struct hb_is_signed { enum { value = true }; };
+template <> struct hb_is_signed { enum { value = false }; };
+template <> struct hb_is_signed { enum { value = false }; };
+template <> struct hb_is_signed { enum { value = false }; };
+template <> struct hb_is_signed { enum { value = false }; };
 
 template  static inline bool
 hb_in_range (T u, T lo, T hi)
@@ -301,7 +305,7 @@ hb_in_range (T u, T lo, T hi)
* one right now.  Declaring a variable won't work as HB_UNUSED
* is unusable on some platforms and unused types are less likely
* to generate a warning than unused variables. */
-  static_assert ((sizeof (hb_assert_unsigned_t) >= 0), "");
+  static_assert (!hb_is_signed::value, "");
 
   /* The casts below are important as if T is smaller than int,
* the subtract results will become a signed int! */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-30 Thread Behdad Esfahbod
 src/hb-machinery.hh |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 67fd94da98f950b5feb719ac805f2a45379fc935
Merge: abd81ed4 ae79fdaa
Author: Behdad Esfahbod 
Date:   Fri Nov 30 11:53:30 2018 -0500

Merge commit 'ae79fdaa7774d3f886a8f03926577c3bd2010b03'

commit abd81ed4f5cbc5a94171747909bc6b77551cb929
Author: Behdad Esfahbod 
Date:   Fri Nov 30 11:51:26 2018 -0500

Umm.  Cryptic, yes

In file included from hb-face.cc:35:
hb-ot-cmap-table.hh: In member function 'void 
OT::CmapSubtableFormat4::_compiles_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even 
though the worst conversion for the first is better than the worst conversion 
for the second:
hb-open-type.hh:354: note: candidate 1: const Type& 
OT::UnsizedArrayOf::operator[](unsigned int) const [with Type = 
OT::IntType]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) 

hb-ot-cmap-table.hh: In member function 'void 
OT::CmapSubtableFormat4::_instance_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even 
though the worst conversion for the first is better than the worst conversion 
for the second:
hb-open-type.hh:354: note: candidate 1: const Type& 
OT::UnsizedArrayOf::operator[](unsigned int) const [with Type = 
OT::IntType]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) 

hb-face.cc: In function 'hb_blob_t* 
_hb_face_builder_data_reference_blob(hb_face_builder_data_t*)':
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though 
the worst conversion for the first is better than the worst conversion for the 
second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t::operator[](unsigned int) [with Type = 
hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](T*, int) 
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though 
the worst conversion for the first is better than the worst conversion for the 
second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t::operator[](unsigned int) [with Type = 
hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](const T*, int) 
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though 
the worst conversion for the first is better than the worst conversion for the 
second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t::operator[](unsigned int) [with Type = 
hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](T*, int) 
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though 
the worst conversion for the first is better than the worst conversion for the 
second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t::operator[](unsigned int) [with Type = 
hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](const T*, int) 

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 724f54d5..a1ae1d77 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -647,8 +647,8 @@ _hb_face_builder_data_reference_blob 
(hb_face_builder_data_t *data)
   bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || 
data->tables.lsearch (HB_TAG ('C','F','F','2'));
   hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : 
OT::OpenTypeFontFile::TrueTypeTag;
 
-  Suppliertags_supplier  (&data->tables[0].tag, table_count, 
data->tables.item_size);
-  Supplier blobs_supplier (&data->tables[0].blob, table_count, 
data->tables.item_size);
+  Suppliertags_supplier  (&data->tables[0u].tag, table_count, 
data->tables.item_size);
+  Supplier blobs_supplier (&data->tables[0u].blob, table_count, 
data->tables.item_size);
   bool ret = f->serialize_single (&c,
  sfnt_tag,
  tags_supplier,
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 1732d297..19d2e17a 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -117,8 +117,8 @@ static inline Type& StructAfter(TObject &X)
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY(size, array) \
-  DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
((array)[0])) \
+  DEFINE_COMPILES_ASSERTION ((void) (array)[0u].static_size) \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
((array)[0u])) \
   enum { null_size = (size) }; \
   enum { min_size = (size) }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-29 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-khmer.cc |   15 +--
 src/hb-ot-shape.cc   |6 +++---
 2 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 000d4b128eba58677acdc3b361829ff2f9a257b1
Author: Behdad Esfahbod 
Date:   Thu Nov 29 12:32:47 2018 -0500

Make shaper's override_features() override user features as well

The override_features is used to override features that are normally
discretionary features, but in a specific shaper are for various
reasons desired to be bolted on or off, because they've been used
for inherent shaping.  As such, it makes sense that they also
override user features.  Ie. if user turned 'liga' on, we don't
want Khmer shaping to become broken...  Or turn 'clig' off...

Fixes https://github.com/harfbuzz/harfbuzz/issues/1310

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index ef974357..e0074d53 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -309,9 +309,6 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t 
 *planner,
 map->enable_feature (HB_TAG ('v','e','r','t'), F_GLOBAL_SEARCH);
   }
 
-  if (planner->shaper->override_features)
-planner->shaper->override_features (planner);
-
   for (unsigned int i = 0; i < num_user_features; i++)
   {
 const hb_feature_t *feature = &user_features[i];
@@ -330,6 +327,9 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t 
 *planner,
   aat_map->add_feature (feature->tag, feature->value);
 }
   }
+
+  if (planner->shaper->override_features)
+planner->shaper->override_features (planner);
 }
 
 
commit a95d9d8c8465ebc927bc2194dffe4ea95542e54c
Author: Behdad Esfahbod 
Date:   Thu Nov 29 12:30:14 2018 -0500

[khmer] Move 'clig' to overrides

Prerequisite for https://github.com/harfbuzz/harfbuzz/issues/1310

diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index 497891ea..8b6ec51d 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -127,22 +127,25 @@ collect_features_khmer (hb_ot_shape_planner_t *plan)
 
   for (; i < KHMER_NUM_FEATURES; i++)
 map->add_feature (khmer_features[i]);
-
-  map->enable_feature (HB_TAG('c','a','l','t'));
-  map->enable_feature (HB_TAG('c','l','i','g'));
-
 }
 
 static void
 override_features_khmer (hb_ot_shape_planner_t *plan)
 {
+  hb_ot_map_builder_t *map = &plan->map;
+
+  /* Khmer spec has 'clig' as part of required shaping features:
+   * "Apply feature 'clig' to form ligatures that are desired for
+   * typographical correctness.", hence in overrides... */
+  map->enable_feature (HB_TAG('c','l','i','g'));
+
   /* Uniscribe does not apply 'kern' in Khmer. */
   if (hb_options ().uniscribe_bug_compatible)
   {
-plan->map.disable_feature (HB_TAG('k','e','r','n'));
+map->disable_feature (HB_TAG('k','e','r','n'));
   }
 
-  plan->map.disable_feature (HB_TAG('l','i','g','a'));
+  map->disable_feature (HB_TAG('l','i','g','a'));
 }
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-29 Thread Behdad Esfahbod
 NEWS |   35 +++
 configure.ac |2 +-
 src/hb-aat-layout.cc |6 +++---
 src/hb-aat-layout.h  |4 ++--
 src/hb-deprecated.h  |4 ++--
 src/hb-icu.cc|4 ++--
 src/hb-ot-var.cc |8 
 src/hb-ot-var.h  |4 ++--
 src/hb-version.h |6 +++---
 9 files changed, 54 insertions(+), 19 deletions(-)

New commits:
commit dc41ecef85b094b30c612113606597b91c55351c
Author: Behdad Esfahbod 
Date:   Thu Nov 29 11:53:53 2018 -0500

2.2.0

diff --git a/NEWS b/NEWS
index 9bfe99a2..ff4f6e29 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,38 @@
+Overview of changes leading to 2.2.0
+Thursday, November 29, 2018
+
+- Misc shaping bug fixes.
+- Add font variations named-instance API.
+- Deprecate font variations axis enumeration API and add replacement.
+- AAT shaping improvements:
+  o Fixed 'kern' table Format 2 implementation.
+  o Implement 'feat' table API for feature detection.
+  o Blacklist 'GSUB' table of fonts from 'MUTF' foundry that also have 'morx'.
+
+New API:
++hb_aat_layout_feature_type_t
++hb_aat_layout_feature_selector_t
++hb_aat_layout_get_feature_types()
++hb_aat_layout_feature_type_get_name_id
++hb_aat_layout_feature_selector_info_t
++HB_AAT_LAYOUT_NO_SELECTOR_INDEX
++hb_aat_layout_feature_type_get_selector_infos()
++hb_ot_var_axis_flags_t
++hb_ot_var_axis_info_t
++hb_ot_var_get_axis_infos()
++hb_ot_var_find_axis_info()
++hb_ot_var_get_named_instance_count()
++hb_ot_var_named_instance_get_subfamily_name_id()
++hb_ot_var_named_instance_get_postscript_name_id()
++hb_ot_var_named_instance_get_design_coords()
+
+Deprecated API:
++HB_OT_VAR_NO_AXIS_INDEX
++hb_ot_var_axis_t
++hb_ot_var_get_axes()
++hb_ot_var_find_axis()
+
+
 Overview of changes leading to 2.1.3
 Friday, November 16, 2018
 
diff --git a/configure.ac b/configure.ac
index e9db42a7..06494643 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[2.1.3],
+[2.2.0],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index 727da42a..fae67800 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -318,7 +318,7 @@ _hb_aat_language_get (hb_face_t *face,
  *
  * Return value: Number of all available feature types.
  *
- * Since: REPLACEME
+ * Since: 2.2.0
  */
 unsigned int
 hb_aat_layout_get_feature_types (hb_face_t*face,
@@ -336,7 +336,7 @@ hb_aat_layout_get_feature_types (hb_face_t  
  *face,
  *
  * Return value: Name ID index
  *
- * Since: REPLACEME
+ * Since: 2.2.0
  */
 hb_ot_name_id_t
 hb_aat_layout_feature_type_get_name_id (hb_face_t*face,
@@ -358,7 +358,7 @@ hb_aat_layout_feature_type_get_name_id (hb_face_t   
 *face,
  *
  * Return value: Number of all available feature selectors.
  *
- * Since: REPLACEME
+ * Since: 2.2.0
  */
 unsigned int
 hb_aat_layout_feature_type_get_selector_infos (hb_face_t   
  *face,
diff --git a/src/hb-aat-layout.h b/src/hb-aat-layout.h
index 5912e012..696e9033 100644
--- a/src/hb-aat-layout.h
+++ b/src/hb-aat-layout.h
@@ -39,7 +39,7 @@ HB_BEGIN_DECLS
  * hb_aat_layout_feature_type_t:
  *
  *
- * Since: REPLACEME
+ * Since: 2.2.0
  */
 typedef enum
 {
@@ -92,7 +92,7 @@ typedef enum
  * hb_aat_layout_feature_selector_t:
  *
  *
- * Since: REPLACEME
+ * Since: 2.2.0
  */
 typedef enum
 {
diff --git a/src/hb-deprecated.h b/src/hb-deprecated.h
index a74431f0..9ceb2648 100644
--- a/src/hb-deprecated.h
+++ b/src/hb-deprecated.h
@@ -247,7 +247,7 @@ typedef unsigned int hb_ot_name_id_t; /* Since is in 
hb-ot.h */
  * HB_OT_VAR_NO_AXIS_INDEX:
  *
  * Since: 1.4.2
- * Deprecated: REPLACEME
+ * Deprecated: 2.2.0
  */
 #define HB_OT_VAR_NO_AXIS_INDEX0xu
 
@@ -255,7 +255,7 @@ typedef unsigned int hb_ot_name_id_t; /* Since is in 
hb-ot.h */
  * hb_ot_var_axis_t:
  *
  * Since: 1.4.2
- * Deprecated: REPLACEME
+ * Deprecated: 2.2.0
  */
 typedef struct hb_ot_var_axis_t
 {
diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc
index 56d24817..e327fb76 100644
--- a/src/hb-ot-var.cc
+++ b/src/hb-ot-var.cc
@@ -79,7 +79,7 @@ hb_ot_var_get_axis_count (hb_face_t *face)
  * hb_ot_var_get_axes:
  *
  * Since: 1.4.2
- * Deprecated: REPLACEME
+ * Deprecated: 2.2.0
  **/
 unsigned int
 hb_ot_var_get_axes (hb_face_t*face,
@@ -94,7 +94,7 @@ hb_ot_var_get_axes (hb_face_t*face,
  * hb_ot_var_find_axis:
  *
  * Since: 1.4.2
- * Deprecated: REPLACEME
+ * Deprecated: 2.2.0
  **/
 hb_bool_t
 hb_ot_var_find_axis (hb_face_t*face,
@@ -108,7 +108,7 @@ hb_ot_var_find_axis (hb_face_t*face,
 /**
  * hb_ot_var_get_axis_infos:
  *
- * Since: REPLACEME
+ * Since: 2.2.0
  **/
 HB_EXTERN unsigned int
 hb_ot_var_get_axis_infos (hb_face_t *face,
@@ -122,7 +12

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-28 Thread Behdad Esfahbod
 .circleci/config.yml |   15 ++-
 test/shaping/data/in-house/tests/macos.tests |   54 ++-
 2 files changed, 33 insertions(+), 36 deletions(-)

New commits:
commit 9e4f03b6ed80a81f8aee5ba93564f5eabab4299c
Merge: 19863c80 a3267cf8
Author: Behdad Esfahbod 
Date:   Wed Nov 28 15:08:01 2018 -0500

Merge remote-tracking branch 'fdo/master'

commit 19863c805982d5d1d059d4dd9376039d3fdaabcd
Author: Ebrahim Byagowi 
Date:   Wed Nov 28 20:28:42 2018 +0330

[test][aat] Add a test and make macOS runners faster (#1422)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index e546f89f..320813ad 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -7,8 +7,7 @@ jobs:
   xcode: "9.2.0"
 steps:
   - checkout
-  - run: brew update-reset
-  - run: brew install wget pkg-config libtool ragel freetype glib cairo
+  - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget pkg-config libtool 
ragel freetype glib cairo
   - run: ./autogen.sh --with-freetype --with-glib --with-gobject 
--with-cairo
   - run: make -j4
   - run: make check || .ci/fail.sh
@@ -18,8 +17,7 @@ jobs:
   xcode: "10.1.0"
 steps:
   - checkout
-  - run: brew update-reset
-  - run: brew install wget pkg-config libtool ragel freetype glib cairo
+  - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget pkg-config libtool 
ragel freetype glib cairo
   - run: ./autogen.sh --with-freetype --with-glib --with-gobject 
--with-cairo
   - run: make -j4
   - run: make check || .ci/fail.sh
@@ -29,8 +27,7 @@ jobs:
   # xcode: "8.3.3"
   #   steps:
   # - checkout
-  # - run: brew update-reset
-  # - run: brew install wget pkg-config libtool ragel freetype glib cairo
+  # - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget pkg-config libtool 
ragel freetype glib cairo
   # - run: wget 
https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
   # - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 
CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib 
--with-gobject --with-cairo
   # # Ignoring assembler complains, https://stackoverflow.com/a/39867021
@@ -42,8 +39,7 @@ jobs:
   # xcode: "8.3.3"
   #   steps:
   # - checkout
-  # - run: brew update-reset
-  # - run: brew install wget pkg-config libtool ragel
+  # - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget pkg-config libtool 
ragel
   # - run: wget 
https://packages.macports.org/apple-gcc42/apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
 && tar zxvf apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
   # - run: CPP=$PWD/opt/local/bin/i686-apple-darwin15-cpp-apple-4.2.1 
CC=$PWD/opt/local/bin/i686-apple-darwin15-gcc-apple-4.2.1 
CXX=$PWD/opt/local/bin/i686-apple-darwin15-g++-apple-4.2.1 ./autogen.sh
   # # Ignoring assembler complains, https://stackoverflow.com/a/39867021
@@ -54,8 +50,7 @@ jobs:
   xcode: "10.0.0"
 steps:
   - checkout
-  - run: brew update-reset
-  - run: brew install cmake
+  - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake
   # not needed to be a framework but we like to test that also
   # TODO: wrong way of targeting iOS as it doesn't point to iOS headers 
thus building
   # CoreText support is not possible, after the fix feel free HB_IOS from 
CMake altogether
diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 9f1f9fa1..f788a987 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,29 +1,31 @@
 # 10.12.6
-/System/Library/Fonts/Helvetica.dfont@c7bec2785a4c402b7809b5e35337c3d24c18e281::U+006D,U+0300:[m=0+1706|gravecmb=0@-284,10+0]
-/System/Library/Fonts/LucidaGrande.ttc@d89a9d7e57767bfe3b5a4cfd22bb1e9dbe03a062::U+006D,U+0300:[mgrave=0+1912]
-/System/Library/Fonts/Times.dfont@39c954614d3f3317b28564db06d5b7b7a6ff0e39::U+0066,U+0069:[fi=0+1139]
-/Library/Fonts/Khmer 
MN.ttc@5f5b1072df99b7355d3066ea85fe82969d13c94a::U+17A2,U+1780,U+17D2,U+179F,U+179A,U+1781,U+17D2,U+1798,U+17C2,U+179A:[km_qa=0+1025|km_ka=1+1025|km_sa.sub=1+517|km_ro=4+593|km_vs_ae=5+605|km_kha=5+1025|km_mo.sub=5+0|km_ro=9+593]
-/Library/Fonts/Tamil 
MN.ttc@37a2020c3f86ebcc45e02c1de5fdf81e2676989d::U+0BA4,U+0BCA,U+0B95,U+0BC1,U+0B95,U+0BCD,U+0B95,U+0BAA,U+0BCD,U+0BAA,U+0B9F,U+0BCD,U+0B9F,U+0BC1:[tgm_e=0+1702|tgc_ta=0+1598|tgm_aa=0+1149|tgc_ku=2+1962|tgc_k=4+1592|tgc_ka=6+1592|tgc_p=7+1370|tgc_pa=9+1370|tgc_tt=10+1596|tgc_ttu=12+1833]
-/System/Library/Fonts/Times.dfont@39c954614d3f3317b28564db06d5b7b7a6ff0e39::U+0041,U+0066,U+0300,U+0066,U+0069,U+005A:[A=0+1479|f=1+682|gravecmb=1@-480,588+0|fi=3+1139|Z=5+1251]
-/System/Library/Fonts/LucidaGrande.ttc@d89a9d7e57767bfe3b5a4cfd22bb1e9dbe03a062::U+05E1,U+05B0:[shevahebrew=0@-7,0+0|samekhhebrew

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-23 Thread Behdad Esfahbod
 src/hb-common.cc   |2 +-
 test/api/test-ot-tag.c |3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 992b7128656e72f935089dc2e12c2d2a25511886
Merge: c9cc96c0 018ba46e
Author: Behdad Esfahbod 
Date:   Fri Nov 23 13:49:34 2018 -0500

Merge pull request #1407 from harfbuzz/at-sign

Don't canonicalize '@' to '-' in language tags

commit 018ba46e4d003a5dd0f6d2d899226129c4ef0c60
Author: David Corbett 
Date:   Fri Nov 23 13:21:22 2018 -0500

Don't canonicalize '@' to '-' in language tags

Fixes #1406.

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 28b0c2b8..b7f9ad68 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -204,7 +204,7 @@ static const char canon_map[256] = {
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', '1', '2', '3', '4', '5', '6', '7',  '8', '9',  0,   0,   0,   0,   0,   
0,
-  '-', 'a', 'b', 'c', 'd', 'e', 'f', 'g',  'h', 'i', 'j', 'k', 'l', 'm', 'n', 
'o',
+   0,  'a', 'b', 'c', 'd', 'e', 'f', 'g',  'h', 'i', 'j', 'k', 'l', 'm', 'n', 
'o',
   'p', 'q', 'r', 's', 't', 'u', 'v', 'w',  'x', 'y', 'z',  0,   0,   0,   0,  
'-',
0,  'a', 'b', 'c', 'd', 'e', 'f', 'g',  'h', 'i', 'j', 'k', 'l', 'm', 'n', 
'o',
   'p', 'q', 'r', 's', 't', 'u', 'v', 'w',  'x', 'y', 'z',  0,   0,   0,   0,   0
diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c
index c0329bff..82a57dc0 100644
--- a/test/api/test-ot-tag.c
+++ b/test/api/test-ot-tag.c
@@ -449,6 +449,9 @@ test_ot_tag_language (void)
 
   /* A UN M.49 region code, not an extended language subtag */
   test_tag_from_language ("ARA", "ar-001");
+
+  /* An invalid tag */
+  test_tag_from_language ("TRK", "tr@foo=bar");
 }
 
 static void
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-23 Thread Behdad Esfahbod
 .circleci/config.yml   |   46 +
 src/hb.hh  |8 +--
 test/shaping/CMakeLists.txt|2 
 test/shaping/data/in-house/Makefile.sources|1 
 test/shaping/data/in-house/tests/macos-10.12.tests |   10 
 test/shaping/run-tests.py  |   38 ++---
 6 files changed, 77 insertions(+), 28 deletions(-)

New commits:
commit 3d2b98ef14af29acd74f01647bef60cd410825fb
Author: Behdad Esfahbod 
Date:   Fri Nov 23 10:45:44 2018 -0500

Minor

diff --git a/src/hb.hh b/src/hb.hh
index be8b2148..bc322a81 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -446,11 +446,11 @@ typedef uint64_t hb_vector_size_impl_t;
  * For example, for testing "x ∈ {x1, x2, x3}" use:
  * (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
  */
-#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (1U << 
(unsigned)(x)))
-#define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (1U << (unsigned)(x)) : 0)
+#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (((uint32_t) 
1U) << (unsigned)(x)))
+#define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (((uint32_t) 1U) << 
(unsigned)(x)) : 0)
 #define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - 
FLAG(x))
-#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (1ULL << 
(unsigned)(x)))
-#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (1ULL << (unsigned)(x)) : 0)
+#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (((uint64_t) 
1ULL) << (unsigned)(x)))
+#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (((uint64_t) 1ULL) << 
(unsigned)(x)) : 0)
 
 
 /* Size signifying variable-sized array */
commit 341851efe158599a34d241a97593058a4333852e
Author: Ebrahim Byagowi 
Date:   Fri Nov 23 15:40:05 2018 +0330

[aat] Add macOS specific tests (#1404)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 906f4ba8..e56aabb7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,30 +2,41 @@ version: 2
 
 jobs:
 
-  macos-llvm-gcc-4.2:
+  macos-10.12-aat-fonts:
 macos:
-  xcode: "8.3.3"
+  xcode: "9.2.0"
 steps:
   - checkout
   - run: brew update-reset
   - run: brew install wget pkg-config libtool ragel freetype glib cairo
-  - run: wget 
https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
-  - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 
CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib 
--with-gobject --with-cairo
-  # Ignoring assembler complains, https://stackoverflow.com/a/39867021
-  - run: make 2>&1 | grep -v -e '^/var/folders/*' -e 
'^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+  - run: ./autogen.sh --with-freetype --with-glib --with-gobject 
--with-cairo
+  - run: make -j4
   - run: make check || .ci/fail.sh
 
-  macos-notest-apple-gcc-i686-4.2:
-macos:
-  xcode: "8.3.3"
-steps:
-  - checkout
-  - run: brew update-reset
-  - run: brew install wget pkg-config libtool ragel
-  - run: wget 
https://packages.macports.org/apple-gcc42/apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
 && tar zxvf apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
-  - run: CPP=$PWD/opt/local/bin/i686-apple-darwin15-cpp-apple-4.2.1 
CC=$PWD/opt/local/bin/i686-apple-darwin15-gcc-apple-4.2.1 
CXX=$PWD/opt/local/bin/i686-apple-darwin15-g++-apple-4.2.1 ./autogen.sh
-  # Ignoring assembler complains, https://stackoverflow.com/a/39867021
-  - run: make 2>&1 | grep -v -e '^/var/folders/*' -e 
'^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+  # macos-llvm-gcc-4.2:
+  #   macos:
+  # xcode: "8.3.3"
+  #   steps:
+  # - checkout
+  # - run: brew update-reset
+  # - run: brew install wget pkg-config libtool ragel freetype glib cairo
+  # - run: wget 
https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
+  # - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 
CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib 
--with-gobject --with-cairo
+  # # Ignoring assembler complains, https://stackoverflow.com/a/39867021
+  # - run: make 2>&1 | grep -v -e '^/var/folders/*' -e 
'^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+  # - run: make check || .ci/fail.sh
+
+  # macos-notest-apple-gcc-i686-4.2:
+  #   macos:
+  # xcode: "8.3.3"
+  #   steps:
+  # - checkout
+  # - run: brew update-reset
+  # - run: brew install wget pkg-config libtool ragel
+  # - run: wget 
https://packages.macports.org/apple-gcc42/apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
 && tar zxvf apple-gcc42-5666.3_15+universal.darwin_15.i386-x86_64.tbz2
+  # - run: CPP=

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-21 Thread Behdad Esfahbod
 src/hb-open-type.hh |6 +++---
 src/hb-ot-kern-table.hh |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fffea5aff7a631eedd13c38c1fb7ea4f5f950930
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:25:34 2018 -0500

Minor

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index b1fcd687..c5d1aa84 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -231,13 +231,13 @@ struct FixedVersion
  * Use: (base+offset)
  */
 
-template  struct assert_has_min_size { 
static_assert (Type::min_size > 0, ""); };
-template  struct assert_has_min_size {};
+template  struct assert_has_null_size { 
static_assert (Type::null_size > 0, ""); };
+template  struct assert_has_null_size {};
 
 template 
 struct OffsetTo : Offset
 {
-  static_assert (sizeof (assert_has_min_size) || true, "");
+  static_assert (sizeof (assert_has_null_size) || true, "");
 
   inline const Type& operator () (const void *base) const
   {
commit 209b58ef731f102b92179ed76551e2fd6b5ed075
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:22:33 2018 -0500

Minor

diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index ebb231a1..b2d57140 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -154,7 +154,7 @@ struct KernSubTable
   KernSubTableFormat3  format3;
   } u;
   public:
-  DEFINE_SIZE_UNBOUNDED (KernSubTableHeader::static_size);
+  DEFINE_SIZE_MIN (KernSubTableHeader::static_size);
 };
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-21 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |2 +-
 src/hb-machinery.hh |4 
 src/hb-null.hh  |   17 +++--
 src/hb-ot-kern-table.hh |2 +-
 src/hb-ot-var-fvar-table.hh |   31 ---
 5 files changed, 37 insertions(+), 19 deletions(-)

New commits:
commit 3b9fd176e83bbebc4d0b5fc967c15b08fdef7015
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:18:55 2018 -0500

Disallow taking Null() of unbounded structs

Not sure I've marked all such structs.  To be done as we discover.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1300

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 6572b26d..7340996e 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -69,7 +69,7 @@ struct LookupFormat0
   UnsizedArrayOf
arrayZ; /* Array of lookup values, indexed by glyph 
index. */
   public:
-  DEFINE_SIZE_ARRAY (2, arrayZ);
+  DEFINE_SIZE_UNBOUNDED (2);
 };
 
 
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index a8d1ad53..cb30e990 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -112,6 +112,10 @@ static inline Type& StructAfter(TObject &X)
   enum { null_size = (size) }; \
   enum { min_size = (size) }
 
+#define DEFINE_SIZE_UNBOUNDED(size) \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)) \
+  enum { min_size = (size) }
+
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \
   DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
((array)[0])) \
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index 14e06568..ebb231a1 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -154,7 +154,7 @@ struct KernSubTable
   KernSubTableFormat3  format3;
   } u;
   public:
-  DEFINE_SIZE_MIN (0);
+  DEFINE_SIZE_UNBOUNDED (KernSubTableHeader::static_size);
 };
 
 
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 5c8832e1..fed334e8 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -65,7 +65,7 @@ struct InstanceRecord
   // * instance. */
 
   public:
-  DEFINE_SIZE_ARRAY (4, coordinatesZ);
+  DEFINE_SIZE_UNBOUNDED (4);
 };
 
 struct AxisRecord
@@ -109,7 +109,7 @@ struct fvar
  axisSize == 20 && /* Assumed in our code. */
  instanceSize >= axisCount * 4 + 4 &&
  get_axes ().sanitize (c) &&
- c->check_range (&get_instance (0), instanceCount, 
instanceSize));
+ c->check_range (get_instance (0), instanceCount, 
instanceSize));
   }
 
   inline unsigned int get_axis_count (void) const
@@ -240,15 +240,17 @@ struct fvar
 
   inline hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int 
instance_index) const
   {
-const InstanceRecord &instance = get_instance (instance_index);
-return instance.subfamilyNameID;
+const InstanceRecord *instance = get_instance (instance_index);
+if (unlikely (!instance)) return HB_OT_NAME_ID_INVALID;
+return instance->subfamilyNameID;
   }
 
   inline hb_ot_name_id_t get_instance_postscript_name_id (unsigned int 
instance_index) const
   {
-const InstanceRecord &instance = get_instance (instance_index);
+const InstanceRecord *instance = get_instance (instance_index);
+if (unlikely (!instance)) return HB_OT_NAME_ID_INVALID;
 if (instanceSize >= axisCount * 4 + 6)
-  return StructAfter (instance.get_coordinates (axisCount));
+  return StructAfter (instance->get_coordinates (axisCount));
 return HB_OT_NAME_ID_INVALID;
   }
 
@@ -256,7 +258,8 @@ struct fvar
   unsigned int *coords_length, /* 
IN/OUT */
   float*coords /* OUT 
*/) const
   {
-if (unlikely (instance_index >= instanceCount))
+const InstanceRecord *instance = get_instance (instance_index);
+if (unlikely (!instance))
 {
   if (coords_length)
 *coords_length = 0;
@@ -265,9 +268,8 @@ struct fvar
 
 if (coords_length && *coords_length)
 {
-  const InstanceRecord &instance = get_instance (instance_index);
-  hb_array_t instanceCoords = instance.get_coordinates 
(axisCount)
-  .sub_array (0, 
*coords_length);
+  hb_array_t instanceCoords = instance->get_coordinates 
(axisCount)
+.sub_array (0, 
*coords_length);
   for (unsigned int i = 0; i < instanceCoords.len; i++)
 coords[i] = instanceCoords.arrayZ[i].to_float ();
 }
@@ -278,12 +280,11 @@ struct fvar
   inline hb_array_t get_axes (void) const
   { return hb_array (&(this+firstAxis), axisCount); }
 
-  inline const InstanceRecord &get_instance (unsigned int i) const
+  inline const InstanceRecord *get_instance (unsigned int i) const
   {
-if (unlikely (i >

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-19 Thread Behdad Esfahbod
 .travis.yml |2 +-
 README  |   13 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 8f3ee17ae468950a34439785d2e6ac4182efb65c
Author: Behdad Esfahbod 
Date:   Tue Nov 20 01:38:23 2018 -0500

[travis] Update Coverity token

diff --git a/.travis.yml b/.travis.yml
index ef8b01d0..c2db4ff0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,7 @@ env:
 - CONFIGURE_OPTS="--with-freetype --with-glib --with-gobject --with-cairo 
--with-icu --with-graphite2"
 - NOCONFIGURE=1
 # COVERITY_SCAN_TOKEN
-- secure: 
"MRJtVu/fQoWNwMAamvIJBCX/1SMvEuEUk/ljAif/y2/3syyWgxFGp17UGnDILdoZYyCqTM+jQciY2P0nVqbjjOAUlML4QOAalqw8kPp8iTsnHUe+KOMVrOVP6p6qAQxk1im1O41cCMkmVKvk+NXe/on5euz6LGF2laHZaOAMoes="
+- secure: 
"k6l/18dpsoPAf0E5RQWCr+rgjbHns0H3k0WzSYovCoVg0B7RVlV8x8OjyEOBzEvXI4aaHRdH6MHCPDFnX4fa7ysImlT6LxxIG8YhDdLkJWyS0hHbcJiGxko9AhAGzOZcDl8fZi13d697wagMqqXpjN5v2T/AQm8t4X9z2otJosY="
 
 matrix:
   include:
commit f9552362986efd0973b2637d21b787edbc8479f2
Author: Behdad Esfahbod 
Date:   Tue Nov 20 01:21:36 2018 -0500

Add codecov.io badge

diff --git a/README b/README
index 55775c8b..e50f8f06 100644
--- a/README
+++ b/README
@@ -1,9 +1,10 @@
-[![Build 
Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz)
-[![Build 
status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz)
-[![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz)
-[![Coverity](https://img.shields.io/coverity/scan/5450.svg)](https://scan.coverity.com/projects/behdad-harfbuzz)
-[![Codacy 
Badge](https://api.codacy.com/project/badge/Grade/f17f1708783c447488bc8dd317150eaa)](https://app.codacy.com/app/behdad/harfbuzz)
-[![Coverage 
Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz)
+[![Travis Build 
Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz)
+[![AppVeyor Build 
Status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz)
+[![CircleCI Build 
Status](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz)
+[![Coverity Code 
Health](https://img.shields.io/coverity/scan/5450.svg)](https://scan.coverity.com/projects/behdad-harfbuzz)
+[![Codacy Code 
Health](https://api.codacy.com/project/badge/Grade/f17f1708783c447488bc8dd317150eaa)](https://app.codacy.com/app/behdad/harfbuzz)
+[![Codecov Code 
Coverage](https://codecov.io/gh/harfbuzz/harfbuzz/branch/master/graph/badge.svg)](https://codecov.io/gh/harfbuzz/harfbuzz)
+[![Coverals Code 
Coverage](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz)
 [ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/)
 
 This is HarfBuzz, a text shaping library.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-16 Thread Behdad Esfahbod
 NEWS|6 ++
 configure.ac|2 +-
 src/hb-open-type.hh |2 +-
 src/hb-version.h|4 ++--
 4 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit e3a1a8350a6a7933b0a100194985f4425ab9de19
Author: Behdad Esfahbod 
Date:   Fri Nov 16 16:53:25 2018 -0800

2.1.3

diff --git a/NEWS b/NEWS
index d72ea3db..9bfe99a2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Overview of changes leading to 2.1.3
+Friday, November 16, 2018
+
+- Fix AAT 'mort' shaping, which was broken in 2.1.2
+
+
 Overview of changes leading to 2.1.2
 Friday, November 16, 2018
 
diff --git a/configure.ac b/configure.ac
index 0db1fd0d..95ab48f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[2.1.2],
+[2.1.3],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-version.h b/src/hb-version.h
index a18c897c..fb9f8f30 100644
--- a/src/hb-version.h
+++ b/src/hb-version.h
@@ -38,9 +38,9 @@ HB_BEGIN_DECLS
 
 #define HB_VERSION_MAJOR 2
 #define HB_VERSION_MINOR 1
-#define HB_VERSION_MICRO 2
+#define HB_VERSION_MICRO 3
 
-#define HB_VERSION_STRING "2.1.2"
+#define HB_VERSION_STRING "2.1.3"
 
 #define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*1+(minor)*100+(micro) <= \
commit 9714e114b88893bd962b1bcf36382bdacbc4866c
Author: Behdad Esfahbod 
Date:   Fri Nov 16 16:52:42 2018 -0800

Fix recent commits

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index c77c25fa..b1fcd687 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -347,7 +347,7 @@ struct UnsizedArrayOf
   }
   inline Type& operator [] (unsigned int i)
   {
-const Type *p = &arrayZ[i];
+Type *p = &arrayZ[i];
 if (unlikely (p < arrayZ)) return Crap (Type); /* Overflowed. */
 return *p;
   }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-16 Thread Behdad Esfahbod
 src/hb-coretext.cc|   48 ++--
 src/hb-directwrite.cc |2 --
 src/hb-machinery.hh   |   15 +--
 src/hb-shaper.hh  |   44 
 4 files changed, 43 insertions(+), 66 deletions(-)

New commits:
commit 729aedf0da90cbf11235a35588cfdc06ba87a784
Author: Behdad Esfahbod 
Date:   Fri Nov 16 03:26:46 2018 -0500

[directwrite] Fix build

diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 4ae6e7f5..f9b2d261 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -235,8 +235,6 @@ struct hb_directwrite_font_data_t
 hb_directwrite_font_data_t *
 _hb_directwrite_shaper_font_data_create (hb_font_t *font)
 {
-  if (unlikely (!hb_directwrite_shaper_face_data_ensure (font->face))) return 
nullptr;
-
   hb_directwrite_font_data_t *data = new hb_directwrite_font_data_t;
   if (unlikely (!data))
 return nullptr;
commit cfb9771a3b096006cbae98438f1ba101d222e0e4
Author: Behdad Esfahbod 
Date:   Fri Nov 16 03:24:22 2018 -0500

[coretext] Try to fix

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 2830a426..73d226a8 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -99,11 +99,6 @@ _hb_cg_font_release (void *data)
 }
 
 
-/* XXX TODO */
-//HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
-// fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem 
(font->ptem)) <= .5
-//);
-
 static CTFontDescriptorRef
 get_last_resort_font_desc (void)
 {
@@ -318,7 +313,8 @@ hb_coretext_font_data_t *
 _hb_coretext_shaper_font_data_create (hb_font_t *font)
 {
   hb_face_t *face = font->face;
-  if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr;
+  const hb_coretext_face_data *face_data = face->data.coretext;
+  if (unlikely (!face_data)) return nullptr;
   CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext;
 
   CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size_from_ptem 
(font->ptem));
@@ -338,6 +334,38 @@ _hb_coretext_shaper_font_data_destroy 
(hb_coretext_font_data_t *data)
   CFRelease ((CTFontRef) data);
 }
 
+static const hb_coretext_font_data_t *
+hb_coretext_font_data_sync (hb_font_t *font)
+{
+retry:
+  const hb_coretext_shaper_font_data_t *data = font->data.font;
+  if (unlikely (!data)) return nullptr;
+
+  if (fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem 
(font->ptem)) > .5)
+  {
+/* XXX-MT-bug
+ * Note that evaluating condition above can be dangerous if another thread
+ * got here first and destructed data.  That's, as always, bad use pattern.
+ * If you modify the font (change font size), other threads must not be
+ * using it at the same time.  However, since this check is delayed to
+ * when one actually tries to shape something, this is a XXX race condition
+ * (and the only one we have that I know of) right now.  Ie. you modify the
+ * font size in one thread, then (supposedly safely) try to use it from two
+ * or more threads and BOOM!  I'm not sure how to fix this.  We want RCU.
+ */
+
+/* Drop and recreate. */
+/* If someone dropped it in the mean time, throw it away and don't touch 
it.
+ * Otherwise, destruct it. */
+if (likely (cmpexch (data, nullptr)))
+  _hb_coretext_shaper_font_data_destroy (data);
+else
+  goto retry;
+  }
+  return font->data.coretext;
+}
+
+
 /*
  * Since: 1.7.2
  */
@@ -364,8 +392,8 @@ hb_coretext_font_create (CTFontRef ct_font)
 CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font)
 {
-  if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
-  return (CTFontRef) (const void *) font->data.coretext;
+  const hb_coretext_font_data *data = hb_coretext_font_data_sync (font);
+  return data ? (CTFontRef) data : nullptr;
 }
 
 
@@ -425,7 +453,7 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan,
 {
   hb_face_t *face = font->face;
   CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext;
-  CTFontRef ct_font = (CTFontRef) (const void *) font->data.coretext;
+  CTFontRef ct_font = (CTFontRef) hb_coretext_font_data *data = 
hb_coretext_font_data_sync (font);
 
   CGFloat ct_font_size = CTFontGetSize (ct_font);
   CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
@@ -1169,7 +1197,7 @@ struct hb_coretext_aat_font_data_t {};
 hb_coretext_aat_font_data_t *
 _hb_coretext_aat_shaper_font_data_create (hb_font_t *font)
 {
-  return hb_coretext_shaper_font_data_ensure (font) ? 
(hb_coretext_aat_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr;
+  return font->data.coretext ? (hb_coretext_aat_font_data_t *) 
HB_SHAPER_DATA_SUCCEEDED : nullptr;
 }
 
 void
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 134aab64..3c11243f 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -790,7 +790,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t
   {
   retry:
 Stored *p = instance.get ();
-if (unlikely (p && !this->instance

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-15 Thread Behdad Esfahbod
 src/hb-ot-hdmx-table.hh |   25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

New commits:
commit cb4bf85b14afb3761a85e3da130f2844ac94a49d
Author: Behdad Esfahbod 
Date:   Fri Nov 16 02:02:24 2018 -0500

[hdmx] Fix bounds checking

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11351

diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh
index 2eed85c0..0fea24bc 100644
--- a/src/hb-ot-hdmx-table.hh
+++ b/src/hb-ot-hdmx-table.hh
@@ -66,12 +66,9 @@ struct DeviceRecord
   if (unlikely (i >= len ())) return nullptr;
   hb_codepoint_t gid = this->subset_plan->glyphs [i];
 
-  const HBUINT8* width = &(this->source_device_record->widthsZ[gid]);
-
-  if (width < ((const HBUINT8 *) this->source_device_record) + 
sizeDeviceRecord)
-   return width;
-  else
-   return nullptr;
+  if (gid >= sizeDeviceRecord - DeviceRecord::min_size)
+return nullptr;
+  return &(this->source_device_record->widthsZ[gid]);
 }
   };
 
@@ -135,6 +132,8 @@ struct hdmx
 
   inline const DeviceRecord& operator [] (unsigned int i) const
   {
+/* XXX Null(DeviceRecord) is NOT safe as it's num-glyphs lengthed.
+ * https://github.com/harfbuzz/harfbuzz/issues/1300 */
 if (unlikely (i >= numRecords)) return Null (DeviceRecord);
 return StructAtOffset (&this->firstDeviceRecord, i * 
sizeDeviceRecord);
   }
commit af727b4e629f8b07d7afb809be69d053827f6a51
Author: Behdad Esfahbod 
Date:   Fri Nov 16 01:55:39 2018 -0500

[hdmx] Minor

diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh
index 9cfce68a..2eed85c0 100644
--- a/src/hb-ot-hdmx-table.hh
+++ b/src/hb-ot-hdmx-table.hh
@@ -136,7 +136,7 @@ struct hdmx
   inline const DeviceRecord& operator [] (unsigned int i) const
   {
 if (unlikely (i >= numRecords)) return Null (DeviceRecord);
-return StructAtOffset (&this->dataZ, i * sizeDeviceRecord);
+return StructAtOffset (&this->firstDeviceRecord, i * 
sizeDeviceRecord);
   }
 
   inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, 
hb_subset_plan_t *plan)
@@ -200,19 +200,19 @@ struct hdmx
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
-return_trace (c->check_struct (this) && version == 0 &&
+return_trace (c->check_struct (this) &&
  !hb_unsigned_mul_overflows (numRecords, sizeDeviceRecord) &&
  sizeDeviceRecord >= DeviceRecord::min_size &&
  c->check_range (this, get_size ()));
   }
 
   protected:
-  HBUINT16 version;/* Table version number 
(0) */
-  HBUINT16 numRecords; /* Number of device 
records. */
-  HBUINT32 sizeDeviceRecord;   /* Size of a device 
record, 32-bit aligned. */
-  UnsizedArrayOf  dataZ;  /* Array of device 
records. */
+  HBUINT16 version;/* Table version number (0) */
+  HBUINT16 numRecords; /* Number of device records. */
+  HBUINT32 sizeDeviceRecord;   /* Size of a device record, 
32-bit aligned. */
+  DeviceRecord firstDeviceRecord;  /* Array of device records. */
   public:
-  DEFINE_SIZE_ARRAY (8, dataZ);
+  DEFINE_SIZE_MIN (8);
 };
 
 } /* namespace OT */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-13 Thread Behdad Esfahbod
 src/gen-use-table.py |3 ++-
 src/hb-ot-shape-complex-use-table.cc |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 086235f59310ed77542d4916d31a4285c68630ff
Merge: 2092f595 c565fc3f
Author: Behdad Esfahbod 
Date:   Tue Nov 13 19:50:25 2018 -0500

Merge pull request #1382 from punchcutter/master

Change USE Category for Grantha Virama

commit c565fc3fb3b14c02e30af28b9d4d4289b0d2e162
Author: punchcutter 
Date:   Tue Nov 13 12:51:10 2018 -0800

Change USE Category for Grantha Virama
https://github.com/harfbuzz/harfbuzz/issues/1379

diff --git a/src/gen-use-table.py b/src/gen-use-table.py
index ebfae6fa..a8a7a232 100755
--- a/src/gen-use-table.py
+++ b/src/gen-use-table.py
@@ -200,7 +200,8 @@ def is_HALANT(U, UISC, UGC):
return UISC in [Virama, Invisible_Stacker] and not 
is_HALANT_OR_VOWEL_MODIFIER(U, UISC, UGC)
 def is_HALANT_OR_VOWEL_MODIFIER(U, UISC, UGC):
# https://github.com/harfbuzz/harfbuzz/issues/1102
-   return U == 0x11046
+   # https://github.com/harfbuzz/harfbuzz/issues/1379
+   return U in [0x11046, 0x1134D]
 def is_HALANT_NUM(U, UISC, UGC):
return UISC == Number_Joiner
 def is_ZWNJ(U, UISC, UGC):
diff --git a/src/hb-ot-shape-complex-use-table.cc 
b/src/hb-ot-shape-complex-use-table.cc
index e9c88aec..bfc92d3b 100644
--- a/src/hb-ot-shape-complex-use-table.cc
+++ b/src/hb-ot-shape-complex-use-table.cc
@@ -582,7 +582,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
   /* 11310 */ B, O, O, B, B, B, B, B, B,   
  B, B, B, B, B, B, B,
   /* 11320 */ B, B, B, B, B, B, B, B, B,   
  O, B, B, B, B, B, B,
   /* 11330 */ B, O, B, B, O, B, B, B, B,   
  B, O, CMBlw, CMBlw, B,  VPst,  VPst,
-  /* 11340 */  VAbv,  VPst,  VPst,  VPst,  VPst, O, O,  VPre,  VPre,   
  O, O,  VPst,  VPst, H, O, O,
+  /* 11340 */  VAbv,  VPst,  VPst,  VPst,  VPst, O, O,  VPre,  VPre,   
  O, O,  VPst,  VPst,   HVM, O, O,
   /* 11350 */ O, O, O, O, O, O, O,  VPst, O,   
  O, O, O, O, O, B, B,
   /* 11360 */ B, B,  VPst,  VPst, O, O, VMAbv, VMAbv, VMAbv, 
VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
   /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-13 Thread Behdad Esfahbod
 src/hb-atomic.hh   |2 +-
 src/hb-blob.cc |   10 +-
 src/hb-mutex.hh|2 +-
 src/hb-ot-shape-complex-arabic-fallback.hh |2 +-
 src/hb.hh  |2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 2092f595c7a4c591cace41cb99d31620fa6d5fa4
Merge: 475be9d5 eee5b5ed
Author: Behdad Esfahbod 
Date:   Tue Nov 13 19:49:06 2018 -0500

Merge pull request #1380 from kbrow1i/cygwin

Don't use Win32 API on Cygwin

commit eee5b5ed04f588f618a2251397dd5b850c378627
Author: Ken Brown 
Date:   Mon Nov 12 21:05:39 2018 -0500

Don't use Win32 API on Cygwin

Cygwin is a Posix platform to the extent possible.  It should use the
Posix API except in special circumstances.

diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh
index 49c2809e..1f500d71 100644
--- a/src/hb-atomic.hh
+++ b/src/hb-atomic.hh
@@ -100,7 +100,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void 
*O_, const void *N)
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  _hb_atomic_ptr_impl_cmplexch 
((const void **) (P), (O), (N))
 
 
-#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
+#elif !defined(HB_NO_MT) && defined(_WIN32)
 
 #include 
 
diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 26c0d143..8ebedca7 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -481,7 +481,7 @@ hb_blob_t::try_make_writable (void)
 # include 
 #endif
 
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
 # include 
 #else
 # ifndef O_BINARY
@@ -497,19 +497,19 @@ struct hb_mapped_file_t
 {
   char *contents;
   unsigned long length;
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
   HANDLE mapping;
 #endif
 };
 
-#if (defined(HAVE_MMAP) || defined(_WIN32) || defined(__CYGWIN__)) && 
!defined(HB_NO_MMAP)
+#if (defined(HAVE_MMAP) || defined(_WIN32)) && !defined(HB_NO_MMAP)
 static void
 _hb_mapped_file_destroy (void *file_)
 {
   hb_mapped_file_t *file = (hb_mapped_file_t *) file_;
 #ifdef HAVE_MMAP
   munmap (file->contents, file->length);
-#elif defined(_WIN32) || defined(__CYGWIN__)
+#elif defined(_WIN32)
   UnmapViewOfFile (file->contents);
   CloseHandle (file->mapping);
 #else
@@ -560,7 +560,7 @@ fail:
 fail_without_close:
   free (file);
 
-#elif (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_MMAP)
+#elif defined(_WIN32) && !defined(HB_NO_MMAP)
   hb_mapped_file_t *file = (hb_mapped_file_t *) calloc (1, sizeof 
(hb_mapped_file_t));
   if (unlikely (!file)) return hb_blob_get_empty ();
 
diff --git a/src/hb-mutex.hh b/src/hb-mutex.hh
index 75b89add..b529091d 100644
--- a/src/hb-mutex.hh
+++ b/src/hb-mutex.hh
@@ -48,7 +48,7 @@
 /* Defined externally, i.e. in config.h; must have typedef'ed hb_mutex_impl_t 
as well. */
 
 
-#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
+#elif !defined(HB_NO_MT) && defined(_WIN32)
 
 #include 
 typedef CRITICAL_SECTION hb_mutex_impl_t;
diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh 
b/src/hb-ot-shape-complex-arabic-fallback.hh
index 0fb3793e..5be6f8d6 100644
--- a/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -202,7 +202,7 @@ struct arabic_fallback_plan_t
   OT::hb_ot_layout_lookup_accelerator_t 
accel_array[ARABIC_FALLBACK_MAX_LOOKUPS];
 };
 
-#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_WIN1256)
+#if defined(_WIN32) && !defined(HB_NO_WIN1256)
 #define HB_WITH_WIN1256
 #endif
 
diff --git a/src/hb.hh b/src/hb.hh
index e3faf17c..16ccf87c 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -246,7 +246,7 @@ struct _hb_alignof
 #endif
 
 
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
/* We need Windows Vista for both Uniscribe backend and for
 * MemoryBarrier.  We don't support compiling on Windows XP,
 * though we run on it fine. */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-11 Thread Behdad Esfahbod
 src/hb-shape-plan.cc |   33 +++--
 1 file changed, 15 insertions(+), 18 deletions(-)

New commits:
commit 77bd0a6458a9169df59f6be667a8eb79bd353dc9
Author: Behdad Esfahbod 
Date:   Sun Nov 11 22:08:48 2018 -0500

Add variation coords to shape_plan proposal

This is the root cause of bug worked around in 
19e77e01bc13f44138e1d50533327d314dd0a018.

Still no shape plan caching for variations though.

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index d4288046..2a2e0e39 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -481,6 +481,8 @@ hb_shape_plan_create_cached2 (hb_face_t 
*face,
 shaper_list,
 user_features,
 num_user_features,
+coords,
+num_coords,
 nullptr
   };
 
commit 9c767d075d0be85227b8dc146061de9bd24f3fec
Author: Behdad Esfahbod 
Date:   Sun Nov 11 22:03:15 2018 -0500

Minor

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 5579ded7..d4288046 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -146,27 +146,21 @@ hb_shape_plan_create2 (hb_face_t 
*face,
   hb_feature_t *features = nullptr;
   int *coords = nullptr;
 
-  if (unlikely (!face))
-face = hb_face_get_empty ();
   if (unlikely (!props))
-return hb_shape_plan_get_empty ();
+goto bail;
   if (num_user_features && !(features = (hb_feature_t *) calloc 
(num_user_features, sizeof (hb_feature_t
-return hb_shape_plan_get_empty ();
+goto bail;
   if (num_coords && !(coords = (int *) calloc (num_coords, sizeof (int
-  {
-free (features);
-return hb_shape_plan_get_empty ();
-  }
+goto bail;
   if (!(shape_plan = hb_object_create ()))
-  {
-free (coords);
-free (features);
-return hb_shape_plan_get_empty ();
-  }
+goto bail;
 
   assert (props->direction != HB_DIRECTION_INVALID);
 
+  if (unlikely (!face))
+face = hb_face_get_empty ();
   hb_face_make_immutable (face);
+
   shape_plan->custom_shaper_list = shaper_list;
   shape_plan->face_unsafe = face;
   shape_plan->props = *props;
@@ -189,13 +183,14 @@ hb_shape_plan_create2 (hb_face_t 
*face,
   num_user_features,
   coords,
   num_coords)))
-  {
-free (coords);
-free (features);
-return hb_shape_plan_get_empty ();
-  }
+goto bail;
 
   return shape_plan;
+
+bail:
+  free (coords);
+  free (features);
+  return hb_shape_plan_get_empty ();
 }
 
 /**
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-11 Thread Behdad Esfahbod
 src/hb-coretext.cc   |8 
 src/hb-directwrite.cc|4 ++--
 src/hb-face.cc   |2 +-
 src/hb-face.hh   |2 +-
 src/hb-fallback-shape.cc |4 ++--
 src/hb-graphite2.cc  |4 ++--
 src/hb-ot-shape.cc   |4 ++--
 src/hb-shaper.hh |3 ++-
 src/hb-uniscribe.cc  |4 ++--
 9 files changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 1beacdded9cd1e4467b52244cdfd8497516eb107
Author: Behdad Esfahbod 
Date:   Sun Nov 11 16:35:28 2018 -0500

Minor

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 893a8761..7509b8a3 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -101,10 +101,10 @@ _hb_cg_font_release (void *data)
 }
 
 
-HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
+HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face);
 HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem 
(font->ptem)) <= .5
-)
+);
 
 static CTFontDescriptorRef
 get_last_resort_font_desc (void)
@@ -1152,8 +1152,8 @@ fail:
  * AAT shaper
  */
 
-HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, face)
-HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, font)
+HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, face);
+HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, font);
 
 /*
  * shaper face data
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 35197c23..cc8f6cc0 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -31,8 +31,8 @@
 #include "hb-directwrite.h"
 
 
-HB_SHAPER_DATA_ENSURE_DEFINE (directwrite, face)
-HB_SHAPER_DATA_ENSURE_DEFINE (directwrite, font)
+HB_SHAPER_DATA_ENSURE_DEFINE (directwrite, face);
+HB_SHAPER_DATA_ENSURE_DEFINE (directwrite, font);
 
 
 /*
diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc
index dc8536c8..ccfeba4b 100644
--- a/src/hb-fallback-shape.cc
+++ b/src/hb-fallback-shape.cc
@@ -28,8 +28,8 @@
 #include "hb-shaper-impl.hh"
 
 
-HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face)
-HB_SHAPER_DATA_ENSURE_DEFINE(fallback, font)
+HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face);
+HB_SHAPER_DATA_ENSURE_DEFINE(fallback, font);
 
 
 /*
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 24ee3d50..38c2cd81 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -46,8 +46,8 @@
  **/
 
 
-HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, face)
-HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font)
+HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, face);
+HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font);
 
 
 /*
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 99d6b9d4..92a4b53a 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -255,7 +255,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t 
 *planner,
  * shaper face data
  */
 
-HB_SHAPER_DATA_ENSURE_DEFINE(ot, face)
+HB_SHAPER_DATA_ENSURE_DEFINE(ot, face);
 
 struct hb_ot_face_data_t {};
 
@@ -275,7 +275,7 @@ _hb_ot_shaper_face_data_destroy (hb_ot_face_data_t *data)
  * shaper font data
  */
 
-HB_SHAPER_DATA_ENSURE_DEFINE(ot, font)
+HB_SHAPER_DATA_ENSURE_DEFINE(ot, font);
 
 struct hb_ot_font_data_t {};
 
diff --git a/src/hb-shaper.hh b/src/hb-shaper.hh
index 361165e4..e3be4119 100644
--- a/src/hb-shaper.hh
+++ b/src/hb-shaper.hh
@@ -119,7 +119,8 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t 
*object) \
 } \
   } \
   return data != nullptr && (void *) data != HB_SHAPER_DATA_INVALID; \
-}
+} \
+static_assert (true, "") /* Require semicolon. */
 
 
 /* For embedding in face / font / ... */
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index e77825b3..76da20df 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -314,8 +314,8 @@ struct range_record_t {
   unsigned int index_last;  /* == end - 1 */
 };
 
-HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, face)
-HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, font)
+HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, face);
+HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, font);
 
 
 /*
commit e88d47b7f2f9aee5b0b3cdc0b8f708884175a71f
Author: Behdad Esfahbod 
Date:   Sun Nov 11 16:25:43 2018 -0500

Minor

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 952e6a6a..da73433c 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -96,7 +96,7 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
 #undef HB_SHAPER_IMPLEMENT
   },
 
-  HB_ATOMIC_PTR_INIT (nullptr), /* shape_plans */
+  /* Zero for the rest is fine. */
 };
 
 
diff --git a/src/hb-face.hh b/src/hb-face.hh
index 726f6883..5d22f4ad 100644
--- a/src/hb-face.hh
+++ b/src/hb-face.hh
@@ -54,7 +54,7 @@ struct hb_face_t
 
   struct hb_shaper_data_t shaper_data; /* Various shaper data. */
 
-  hb_ot_face_t table;
+  hb_ot_face_t table;  /* All the face's tables. */
 
   /* Cache */
   struct plan_node_t
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-11 Thread Behdad Esfahbod
 src/hb-face.cc |1 -
 src/hb-null.hh |2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 55c66c7c56c1ecd493f51fe66fd434b28addfb41
Author: Behdad Esfahbod 
Date:   Sun Nov 11 16:09:38 2018 -0500

Revert "Declare Null() constexpr"

This reverts commit 442a72d95ab1fb3a47b486d8d1eb68e909d0ffb8.

Doesn't make sense.  No idea how my local compilers where happy with it!

diff --git a/src/hb-null.hh b/src/hb-null.hh
index 5b9c7db7..25a24f05 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -43,7 +43,7 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + 
sizeof (hb_vector_
 
 /* Generic nul-content Null objects. */
 template 
-static inline constexpr Type const & Null (void) {
+static inline Type const & Null (void) {
   static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase 
HB_NULL_POOL_SIZE.");
   return *reinterpret_cast (_hb_NullPool);
 }
commit 98c6f03ccdd0630282ea0b166f66dcfb2a9c1f51
Author: Behdad Esfahbod 
Date:   Sun Nov 11 15:54:20 2018 -0500

Minor

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 8e731052..952e6a6a 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -129,7 +129,6 @@ hb_face_create_for_tables (hb_reference_table_func_t  
reference_table_func,
   face->user_data = user_data;
   face->destroy = destroy;
 
-  face->upem = 0;
   face->num_glyphs = (unsigned int) -1;
 
   face->table.init0 (face);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-10 Thread Behdad Esfahbod
 src/hb-blob.hh |   23 +++
 src/hb-ot-layout-gdef-table.hh |5 ++---
 src/hb-ot-layout-gsubgpos.hh   |8 +++-
 src/hb-ot-layout.cc|   19 ---
 src/hb-ot-name-table.hh|   12 +---
 5 files changed, 41 insertions(+), 26 deletions(-)

New commits:
commit 5d0078a48b246e713817e5bb6b4efada9618bea3
Author: Behdad Esfahbod 
Date:   Sat Nov 10 23:52:15 2018 -0500

Add hb_blob_ptr_t

Use in a couple of places.  Push to bots to see how many unhappy before
I convert the rest.

diff --git a/src/hb-blob.hh b/src/hb-blob.hh
index 1f7499fb..08afd562 100644
--- a/src/hb-blob.hh
+++ b/src/hb-blob.hh
@@ -80,4 +80,27 @@ struct hb_blob_t
 DECLARE_NULL_INSTANCE (hb_blob_t);
 
 
+/*
+ * hb_blob_ptr_t
+ */
+
+template 
+struct hb_blob_ptr_t
+{
+  typedef typename hb_remove_pointer::value T;
+
+  inline hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {}
+  inline hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; }
+  inline const T * operator -> (void) const { return get (); }
+  inline const T & operator * (void) const { return *get (); }
+  template  inline operator const C * (void) const { return get 
(); }
+  inline operator const char * (void) const { return (const char *) get (); }
+  inline const T * get (void) const { return b->as (); }
+  inline hb_blob_t * get_blob (void) const { return b.get_raw (); }
+  inline unsigned int get_length (void) const { return get_blob ()->length; }
+
+  hb_nonnull_ptr_t b;
+};
+
+
 #endif /* HB_BLOB_HH */
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index af7e5a83..aa6ffc88 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -412,11 +412,10 @@ struct GDEF
 
 inline void fini (void)
 {
-  hb_blob_destroy (this->blob);
+  hb_blob_destroy (this->table.get_blob ());
 }
 
-hb_blob_t *blob;
-hb_nonnull_ptr_t table;
+hb_blob_ptr_t table;
   };
 
   inline unsigned int get_size (void) const
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index eccbcf42..2a89d495 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -2752,8 +2752,7 @@ struct GSUBGPOS
   {
 inline void init (hb_face_t *face)
 {
-  this->blob = hb_sanitize_context_t().reference_table (face);
-  table = this->blob->template as ();
+  this->table = hb_sanitize_context_t().reference_table (face);
 
   this->lookup_count = table->get_lookup_count ();
 
@@ -2770,11 +2769,10 @@ struct GSUBGPOS
   for (unsigned int i = 0; i < this->lookup_count; i++)
this->accels[i].fini ();
   free (this->accels);
-  hb_blob_destroy (this->blob);
+  hb_blob_destroy (this->table.get_blob ());
 }
 
-hb_blob_t *blob;
-hb_nonnull_ptr_t table;
+hb_blob_ptr_t table;
 unsigned int lookup_count;
 hb_ot_layout_lookup_accelerator_t *accels;
   };
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 0353c1c5..ec2421e3 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -194,17 +194,15 @@ _hb_ot_blacklist_gdef (unsigned int gdef_len,
 void
 OT::GDEF::accelerator_t::init (hb_face_t *face)
 {
-  this->blob = hb_sanitize_context_t().reference_table (face);
+  this->table = hb_sanitize_context_t().reference_table (face);
 
-  if (unlikely (_hb_ot_blacklist_gdef (this->blob->length,
-  face->table.GSUB->blob->length,
-  face->table.GPOS->blob->length)))
+  if (unlikely (_hb_ot_blacklist_gdef (this->table.get_length (),
+  face->table.GSUB->table.get_length (),
+  face->table.GPOS->table.get_length (
   {
-hb_blob_destroy (this->blob);
-this->blob = hb_blob_get_empty ();
+hb_blob_destroy (this->table.get_blob ());
+this->table = hb_blob_get_empty ();
   }
-
-  table = this->blob->as ();
 }
 
 static void
diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh
index f1e785f1..5aa06813 100644
--- a/src/hb-ot-name-table.hh
+++ b/src/hb-ot-name-table.hh
@@ -179,11 +179,10 @@ struct name
   {
 inline void init (hb_face_t *face)
 {
-  this->blob = hb_sanitize_context_t().reference_table (face);
-  this->table = this->blob->as ();
-  assert (this->blob->length >= this->table->stringOffset);
+  this->table = hb_sanitize_context_t().reference_table (face);
+  assert (this->table.get_length () >= this->table->stringOffset);
   this->pool = (this->table+this->table->stringOffset).arrayZ;
-  this->pool_len = this->blob->length - this->table->stringOffset;
+  this->pool_len = this->table.get_length () - this->table->stringOffset;
   const hb_array_t all_names 
(this->table->nameRecordZ.arrayZ,
this->table->count);
 
@@ -221,7 +220,7 @@ struct name
 inline void fini (void)
 {

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-10 Thread Behdad Esfahbod
 src/Makefile.am
|2 -
 src/hb-aat-layout-kerx-table.hh
|6 ++---
 test/fuzzing/Makefile.am   
|   12 +-
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5629524117553152
 |binary
 4 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 752bd8a192af209f44dacaf1d3510d0bfc6354b8
Author: Behdad Esfahbod 
Date:   Sat Nov 10 21:13:13 2018 -0500

[kerx] Fix Format1 tupleKern sanitization

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11312
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11305

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 3cd80acf..6b61186a 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -262,10 +262,12 @@ struct KerxSubTableFormat1
 
   if (Format1EntryT::performAction (entry))
   {
+   unsigned int tuple_count = MAX (1u, table->header.tuple_count ());
+
unsigned int kern_idx = Format1EntryT::kernActionIndex (entry);
kern_idx = Types::offsetToIndex (kern_idx, &table->machine, 
kernAction.arrayZ);
const FWORD *actions = &kernAction[kern_idx];
-   if (!c->sanitizer.check_array (actions, depth))
+   if (!c->sanitizer.check_array (actions, depth * tuple_count))
{
  depth = 0;
  return false;
@@ -276,8 +278,6 @@ struct KerxSubTableFormat1
/* From Apple 'kern' spec:
 * "Each pops one glyph from the kerning stack and applies the kerning 
value to it.
 * The end of the list is marked by an odd value... */
-   unsigned int tuple_count = table->header.tuple_count ();
-   tuple_count = tuple_count ? tuple_count : 1;
bool last = false;
while (!last && depth--)
{
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5629524117553152
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5629524117553152
new file mode 100644
index ..01ca5173
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5629524117553152
 differ
commit f9e0552debc45afedd86c848484bcd169af62dc2
Author: Behdad Esfahbod 
Date:   Sat Nov 10 21:01:49 2018 -0500

[fuzzing] Make "make lib" faster and more usable

diff --git a/src/Makefile.am b/src/Makefile.am
index fbd8f602..9632b4df 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -195,7 +195,7 @@ libharfbuzz_subset_fuzzing_la_LINK = $(chosen_linker) 
$(libharfbuzz_subset_fuzzi
 libharfbuzz_subset_fuzzing_la_SOURCES = $(libharfbuzz_subset_la_SOURCES)
 libharfbuzz_subset_fuzzing_la_CPPFLAGS = $(HBCFLAGS) $(FUZZING_CPPFLAGS)
 libharfbuzz_subset_fuzzing_la_LDFLAGS = $(AM_LDFLAGS)
-libharfbuzz_subset_fuzzing_la_LIBADD = $(libharfbuzz_subset_la_LIBADD)
+libharfbuzz_subset_fuzzing_la_LIBADD = libharfbuzz-fuzzing.la
 EXTRA_libharfbuzz_subset_fuzzing_la_DEPENDENCIES = 
$(EXTRA_libharfbuzz_subset_la_DEPENDENCIES)
 CLEANFILES += libharfbuzz-subset-fuzzing.la
 
diff --git a/test/fuzzing/Makefile.am b/test/fuzzing/Makefile.am
index 54178ff4..ed67eee8 100644
--- a/test/fuzzing/Makefile.am
+++ b/test/fuzzing/Makefile.am
@@ -7,11 +7,13 @@ DISTCLEANFILES =
 MAINTAINERCLEANFILES =
 
 # Convenience targets:
-lib:
+lib-only:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src fuzzing
+lib: lib-only
+   @$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 
-$(top_builddir)/src/libharfbuzz-fuzzing.la: lib
-$(top_builddir)/src/libharfbuzz-subset-fuzzing.la: lib
+$(top_builddir)/src/libharfbuzz-fuzzing.la: lib-only
+$(top_builddir)/src/libharfbuzz-subset-fuzzing.la: lib-only
 
 EXTRA_DIST += \
README \
@@ -47,7 +49,7 @@ hb_shape_fuzzer_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(NULL)
 hb_shape_fuzzer_DEPENDENCIES = \
-   lib \
+   $(top_builddir)/src/libharfbuzz-fuzzing.la
$(NULL)
 
 hb_subset_fuzzer_SOURCES = \
@@ -62,7 +64,7 @@ hb_subset_fuzzer_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(NULL)
 hb_subset_fuzzer_DEPENDENCIES = \
-   lib \
+   $(top_builddir)/src/libharfbuzz-subset-fuzzing.la
$(NULL)
 
 check:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-10 Thread Behdad Esfahbod
 src/hb-machinery.hh|2 +-
 src/hb-ot-shape-complex-arabic-fallback.hh |3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4674655841bb810e7b68f03431d7b5a7c34c6f20
Author: Behdad Esfahbod 
Date:   Sat Nov 10 20:11:10 2018 -0500

Minor

diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh 
b/src/hb-ot-shape-complex-arabic-fallback.hh
index eeb2da85..0fb3793e 100644
--- a/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -212,8 +212,11 @@ struct arabic_fallback_plan_t
 
 struct ManifestLookup
 {
+  public:
   OT::Tag tag;
   OT::OffsetTo lookupOffset;
+  public:
+  DEFINE_SIZE_STATIC (6);
 };
 typedef OT::ArrayOf Manifest;
 
commit a953b647507fe2ae8f5187fbfb04e69d2a2952e4
Author: Behdad Esfahbod 
Date:   Sat Nov 10 20:10:03 2018 -0500

Revert parts of previous commit that made clang unhappy

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index f8f1a5b5..d0e1271c 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -110,7 +110,7 @@ static inline Type& StructAfter(TObject &X)
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_ARRAY(size, array) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * 
(array).item_size); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
((array)[0])); \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \
   enum { min_size = (size) }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-05 Thread Behdad Esfahbod
 src/hb-ot-cmap-table.hh |   55 ++--
 src/hb-ot-font.cc   |   13 ++-
 2 files changed, 38 insertions(+), 30 deletions(-)

New commits:
commit 56ba998cddbb2ba5d24fb0b02d2bf77a46c0f23f
Author: Behdad Esfahbod 
Date:   Mon Nov 5 19:49:54 2018 -0500

[cmap] Push get_nominal_glyphs down into cmap accelerator

diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 2013ae98..399c46bf 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -1060,6 +1060,27 @@ struct cmap
   if (unlikely (!this->get_glyph_funcZ)) return false;
   return this->get_glyph_funcZ (this->get_glyph_data, unicode, glyph);
 }
+inline unsigned int get_nominal_glyphs (unsigned int count,
+   const hb_codepoint_t *first_unicode,
+   unsigned int unicode_stride,
+   hb_codepoint_t *first_glyph,
+   unsigned int glyph_stride) const
+{
+  if (unlikely (!this->get_glyph_funcZ)) return 0;
+
+  hb_cmap_get_glyph_func_t get_glyph_funcZ = this->get_glyph_funcZ;
+  const void *get_glyph_data = this->get_glyph_data;
+
+  unsigned int done;
+  for (done = 0;
+  done < count && get_glyph_funcZ (get_glyph_data, *first_unicode, 
first_glyph);
+  done++)
+  {
+   first_unicode = &StructAtOffset (first_unicode, 
unicode_stride);
+   first_glyph = &StructAtOffset (first_glyph, 
glyph_stride);
+  }
+  return done;
+}
 
 inline bool get_variation_glyph (hb_codepoint_t  unicode,
 hb_codepoint_t  variation_selector,
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc
index 41bea140..3e2f1f65 100644
--- a/src/hb-ot-font.cc
+++ b/src/hb-ot-font.cc
@@ -76,16 +76,9 @@ hb_ot_get_nominal_glyphs (hb_font_t *font HB_UNUSED,
  void *user_data HB_UNUSED)
 {
   const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data;
-  const OT::cmap_accelerator_t &cmap = *ot_face->cmap;
-  unsigned int done;
-  for (done = 0;
-   done < count && cmap.get_nominal_glyph (*first_unicode, first_glyph);
-   done++)
-  {
-first_unicode = &StructAtOffset (first_unicode, 
unicode_stride);
-first_glyph = &StructAtOffset (first_glyph, glyph_stride);
-  }
-  return done;
+  return ot_face->cmap->get_nominal_glyphs (count,
+   first_unicode, unicode_stride,
+   first_glyph, glyph_stride);
 }
 
 static hb_bool_t
commit 36d85dce25abd079252d973f804220bf7b97e987
Author: Behdad Esfahbod 
Date:   Mon Nov 5 19:46:29 2018 -0500

[cmap] Use hb_nonnullptr_t

diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index bcb50790..2013ae98 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -1017,22 +1017,20 @@ struct cmap
   this->blob = hb_sanitize_context_t().reference_table (face);
   const cmap *table = this->blob->as ();
   bool symbol;
-  subtableZ = table->find_best_subtable (&symbol);
-
-  /* UVS subtable. */
-  subtable_uvsZ = &Null(CmapSubtableFormat14);
+  this->subtable = table->find_best_subtable (&symbol);
+  this->subtable_uvs = &Null(CmapSubtableFormat14);
   {
const CmapSubtable *st = table->find_subtable (0, 5);
if (st && st->u.format == 14)
- subtable_uvsZ = &st->u.format14;
+ subtable_uvs = &st->u.format14;
   }
 
-  this->get_glyph_data = subtableZ;
+  this->get_glyph_data = subtable;
   if (unlikely (symbol))
   {
this->get_glyph_funcZ = get_glyph_from_symbol;
   } else {
-   switch (subtableZ->u.format) {
+   switch (subtable->u.format) {
/* Accelerate format 4 and format 12. */
default:
  this->get_glyph_funcZ = get_glyph_from;
@@ -1042,7 +1040,7 @@ struct cmap
  break;
case  4:
  {
-   this->format4_accel.init (&subtableZ->u.format4);
+   this->format4_accel.init (&subtable->u.format4);
this->get_glyph_data = &this->format4_accel;
this->get_glyph_funcZ = this->format4_accel.get_glyph_func;
  }
@@ -1067,10 +1065,9 @@ struct cmap
 hb_codepoint_t  variation_selector,
 hb_codepoint_t *glyph) const
 {
-  if (unlikely (!this->subtable_uvsZ)) return false;
-  switch (this->subtable_uvsZ->get_glyph_variant (unicode,
- variation_selector,
- glyph))
+  switch (this->subtable_uvs->get_glyph_variant (unicode,
+variation_selector,
+glyph))
   {
case GLYPH_VARIANT_NOT_FOUND:  

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-11-03 Thread Behdad Esfahbod
 src/hb-ot-kern-table.hh |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 8d98c51d133b058a845ed7a84bfe8a43083bbb03
Author: Behdad Esfahbod 
Date:   Sat Nov 3 15:14:57 2018 -0400

[kern] Third try fix access violation in Format3

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11245

diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index b0ed4399..e361330b 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -441,7 +441,6 @@ struct KernSubTableFormat3
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
-return_trace (true); /* Disabled.  See above. */
 return_trace (c->check_struct (this) &&
  c->check_range (kernValueZ,
  kernValueCount * sizeof (FWORD) +
commit f074da8c2b6a7061c71d12213a6c494c119eb20e
Author: Behdad Esfahbod 
Date:   Sat Nov 3 15:06:45 2018 -0400

[kern] Really fix access violation in Format3

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11245

diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index 28ea9526..b0ed4399 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -444,7 +444,7 @@ struct KernSubTableFormat3
 return_trace (true); /* Disabled.  See above. */
 return_trace (c->check_struct (this) &&
  c->check_range (kernValueZ,
- kernValueCount +
+ kernValueCount * sizeof (FWORD) +
  glyphCount * 2 +
  leftClassCount * rightClassCount));
   }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-31 Thread Behdad Esfahbod
 src/hb-aat-layout.cc |1 +
 src/hb-aat-map.cc|8 
 2 files changed, 9 insertions(+)

New commits:
commit 52a00cd87f63c8ab32413a1a9ce792a3e2ec84e2
Author: Behdad Esfahbod 
Date:   Wed Oct 31 19:05:53 2018 -0700

[aat] Implement 'aalt' mapping

Fixes https://github.com/harfbuzz/harfbuzz/issues/1160

diff --git a/src/hb-aat-map.cc b/src/hb-aat-map.cc
index f2736bfd..1ce1b12b 100644
--- a/src/hb-aat-map.cc
+++ b/src/hb-aat-map.cc
@@ -34,6 +34,14 @@
 void hb_aat_map_builder_t::add_feature (hb_tag_t tag,
unsigned int value)
 {
+  if (tag == HB_TAG ('a','a','l','t'))
+  {
+feature_info_t *info = features.push();
+info->type = 17/*kCharacterAlternativesType*/;
+info->setting = value;
+return;
+  }
+
   const hb_aat_feature_mapping_t *mapping = hb_aat_layout_find_feature_mapping 
(tag);
   if (!mapping) return;
 
commit 6e3ea269fa1fe0a3de7a8a13c6e853c91231808e
Author: Behdad Esfahbod 
Date:   Wed Oct 31 19:00:11 2018 -0700

[aat] Add 'afrc' feature mapping

https://github.com/harfbuzz/harfbuzz/issues/1342#issuecomment-434829028

diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index b6bdb0be..d917c29c 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -41,6 +41,7 @@
  * when moving to this file. */
 static const hb_aat_feature_mapping_t feature_mappings[] =
 {
+  {HB_TAG ('a','f','r','c'),   11/*kFractionsType*/,   
1/*kVerticalFractionsSelector*/,0/*kNoFractionsSelector*/},
   {HB_TAG ('c','2','p','c'),   38/*kUpperCaseType*/,   
2/*kUpperCasePetiteCapsSelector*/,  0/*kDefaultUpperCaseSelector*/},
   {HB_TAG ('c','2','s','c'),   38/*kUpperCaseType*/,   
1/*kUpperCaseSmallCapsSelector*/,   0/*kDefaultUpperCaseSelector*/},
   {HB_TAG ('c','a','l','t'),   36/*kContextualAlternatesType*/,
0/*kContextualAlternatesOnSelector*/,   
1/*kContextualAlternatesOffSelector*/},
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-31 Thread Behdad Esfahbod
 src/hb-blob.hh|2 +-
 src/hb-ot-color-sbix-table.hh |6 --
 src/hb-ot-glyf-table.hh   |3 ++-
 3 files changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 995bf6c6f82d6b2dabcb81e1426910ee82b91b44
Author: Behdad Esfahbod 
Date:   Wed Oct 31 13:21:33 2018 -0700

[sbix] Rely on blob->as<> checking size against Type::min_size

diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh
index 4feb4e19..065c0dd1 100644
--- a/src/hb-ot-color-sbix-table.hh
+++ b/src/hb-ot-color-sbix-table.hh
@@ -243,12 +243,6 @@ struct sbix
   unsigned int strike_ppem = 0;
   hb_blob_t *blob = reference_png (font, glyph, &x_offset, &y_offset, 
&strike_ppem);
 
-  if (unlikely (blob->length < sizeof (PNGHeader)))
-  {
-hb_blob_destroy (blob);
-return false;
-  }
-
   const PNGHeader &png = *blob->as();
 
   extents->x_bearing = x_offset;
commit 4d4e526b5cc703111eb445b7e319a4cd1917489f
Author: Behdad Esfahbod 
Date:   Wed Oct 31 13:19:42 2018 -0700

Improve blob->as<>

It's true that blob->as<> should only be called on null or sanitized
data.  But this change is safe, so keep it.

diff --git a/src/hb-blob.hh b/src/hb-blob.hh
index 26e2dd70..0181e94a 100644
--- a/src/hb-blob.hh
+++ b/src/hb-blob.hh
@@ -60,7 +60,7 @@ struct hb_blob_t
   template 
   inline const Type* as (void) const
   {
-return unlikely (!data) ? &Null(Type) : reinterpret_cast 
(data);
+return length < Type::min_size ? &Null(Type) : reinterpret_cast (data);
   }
   inline hb_bytes_t as_bytes (void) const
   {
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 9437a83d..7bd175e3 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -55,6 +55,7 @@ struct loca
 
   protected:
   UnsizedArrayOf  dataZ;  /* Location data. */
+  public:
   DEFINE_SIZE_ARRAY (0, dataZ);
 };
 
@@ -484,7 +485,7 @@ struct glyf
 
   protected:
   UnsizedArrayOf  dataZ;  /* Glyphs data. */
-
+  public:
   DEFINE_SIZE_ARRAY (0, dataZ);
 };
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-30 Thread Behdad Esfahbod
 src/test-ot-color.cc|2 +-
 test/fuzzing/hb-shape-fuzzer.cc |4 
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 5cd544a621f10b307bb97aea27ea54e55aacb2e9
Author: Behdad Esfahbod 
Date:   Tue Oct 30 19:16:00 2018 -0700

Fix build

Fixes https://github.com/harfbuzz/harfbuzz/issues/1338

diff --git a/src/test-ot-color.cc b/src/test-ot-color.cc
index 2cb9b03b..cb369c0f 100644
--- a/src/test-ot-color.cc
+++ b/src/test-ot-color.cc
@@ -23,7 +23,7 @@
  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  */
 
-#include "hb.h"
+#include "hb.hh"
 #include "hb-ot.h"
 
 #include "hb-ft.h"
commit 69297bb21640677532b7030332f803c0768c6579
Author: Behdad Esfahbod 
Date:   Tue Oct 30 19:06:21 2018 -0700

[fuzzing] Call hb-ot-color API

diff --git a/test/fuzzing/hb-shape-fuzzer.cc b/test/fuzzing/hb-shape-fuzzer.cc
index b5a6c12e..e8bc186b 100644
--- a/test/fuzzing/hb-shape-fuzzer.cc
+++ b/test/fuzzing/hb-shape-fuzzer.cc
@@ -39,6 +39,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, 
size_t size)
 
   hb_glyph_extents_t extents;
   hb_font_get_glyph_extents (font, info.codepoint, &extents);
+
+  hb_ot_color_glyph_get_layers (face, info.codepoint, 0, nullptr, nullptr);
+  hb_blob_destroy (hb_ot_color_glyph_reference_svg (face, info.codepoint));
+  hb_blob_destroy (hb_ot_color_glyph_reference_png (font, info.codepoint));
 }
 
 hb_buffer_destroy (buffer);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-30 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt|3 -
 src/hb-debug.hh   |6 +-
 src/hb-ot-color-cpal-table.hh |   12 ++---
 src/hb-ot-color.cc|6 +-
 src/hb-ot-color.h |4 -
 src/hb-ot-layout.cc   |   44 +-
 src/hb-ot-layout.h|   28 ++--
 src/hb-ot-name-table.hh   |6 +-
 src/hb-ot-name.cc |   38 
 src/hb-ot-name.h  |   98 +-
 src/hb-set.hh |4 -
 test/api/test-ot-color.c  |   30 ++--
 test/api/test-ot-name.c   |8 +--
 13 files changed, 144 insertions(+), 143 deletions(-)

New commits:
commit a7aba99baab2d6e6105675ceedbe2fa0f166
Author: Behdad Esfahbod 
Date:   Tue Oct 30 14:04:09 2018 -0700

[name] Rename hb_name_id_t to hb_ot_name_id_t

https://github.com/harfbuzz/harfbuzz/pull/1254

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index c33a1c12..6a498e94 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -481,7 +481,8 @@ hb_ot_font_set_funcs
 
 
 hb-ot-name
-hb_name_id_t
+hb_ot_name_id_t
+HB_OT_NAME_ID_INVALID
 hb_ot_name_entry_t
 hb_ot_name_list_names
 hb_ot_name_get_utf16
diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 0b4bf377..df4d9b4e 100644
--- a/src/hb-ot-color-cpal-table.hh
+++ b/src/hb-ot-color-cpal-table.hh
@@ -58,21 +58,21 @@ struct CPALV1Tail
   hb_array (base+paletteFlagsZ, palette_count)[palette_index];
   }
 
-  inline hb_name_id_t
+  inline hb_ot_name_id_t
   get_palette_name_id (const void *base,
   unsigned int palette_index,
   unsigned int palette_count) const
   {
-if (!paletteLabelsZ) return HB_NAME_ID_INVALID;
+if (!paletteLabelsZ) return HB_OT_NAME_ID_INVALID;
 return hb_array (base+paletteLabelsZ, palette_count)[palette_index];
   }
 
-  inline hb_name_id_t
+  inline hb_ot_name_id_t
   get_color_name_id (const void *base,
 unsigned int color_index,
 unsigned int color_count) const
   {
-if (!colorLabelsZ) return HB_NAME_ID_INVALID;
+if (!colorLabelsZ) return HB_OT_NAME_ID_INVALID;
 return hb_array (base+colorLabelsZ, color_count)[color_index];
   }
 
@@ -123,10 +123,10 @@ struct CPAL
   inline hb_ot_color_palette_flags_t get_palette_flags (unsigned int 
palette_index) const
   { return v1 ().get_palette_flags (this, palette_index, numPalettes); }
 
-  inline hb_name_id_t get_palette_name_id (unsigned int palette_index) const
+  inline hb_ot_name_id_t get_palette_name_id (unsigned int palette_index) const
   { return v1 ().get_palette_name_id (this, palette_index, numPalettes); }
 
-  inline hb_name_id_t get_color_name_id (unsigned int color_index) const
+  inline hb_ot_name_id_t get_color_name_id (unsigned int color_index) const
   { return v1 ().get_color_name_id (this, color_index, numColors); }
 
   inline unsigned int get_palette_colors (unsigned int  palette_index,
diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc
index a3cd6190..11fc12af 100644
--- a/src/hb-ot-color.cc
+++ b/src/hb-ot-color.cc
@@ -129,11 +129,11 @@ hb_ot_color_palette_get_count (hb_face_t *face)
  * have themed palettes like "Spring", "Summer", "Fall", and "Winter".
  *
  * Returns: an identifier within @face's `name` table.
- * If the requested palette has no name the result is #HB_NAME_ID_INVALID.
+ * If the requested palette has no name the result is #HB_OT_NAME_ID_INVALID.
  *
  * Since: 2.1.0
  */
-hb_name_id_t
+hb_ot_name_id_t
 hb_ot_color_palette_get_name_id (hb_face_t *face,
 unsigned int palette_index)
 {
@@ -149,7 +149,7 @@ hb_ot_color_palette_get_name_id (hb_face_t *face,
  *
  * Since: 2.1.0
  */
-hb_name_id_t
+hb_ot_name_id_t
 hb_ot_color_palette_color_get_name_id (hb_face_t *face,
   unsigned int color_index)
 {
diff --git a/src/hb-ot-color.h b/src/hb-ot-color.h
index 1cc04d4f..e2d9a962 100644
--- a/src/hb-ot-color.h
+++ b/src/hb-ot-color.h
@@ -49,11 +49,11 @@ hb_ot_color_has_palettes (hb_face_t *face);
 HB_EXTERN unsigned int
 hb_ot_color_palette_get_count (hb_face_t *face);
 
-HB_EXTERN hb_name_id_t
+HB_EXTERN hb_ot_name_id_t
 hb_ot_color_palette_get_name_id (hb_face_t *face,
 unsigned int palette_index);
 
-HB_EXTERN hb_name_id_t
+HB_EXTERN hb_ot_name_id_t
 hb_ot_color_palette_color_get_name_id (hb_face_t *face,
   unsigned int color_index);
 
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index ea59b835..a8cfcf55 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1053,12 +1053,12 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, 
hb_buffer_t *buffer)
  * Since: 0.9.10
  **/
 hb_bool_t
-hb_ot_layout_get_size_params (hb_face_t*face,
- unsigned int *design_size,   /* OUT.  May be 
NULL */
- 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-30 Thread Behdad Esfahbod
 .circleci/config.yml |2 +-
 src/hb-machinery.hh  |   16 
 src/hb-ot-layout-common.hh   |6 +++---
 src/hb-ot-layout-gsubgpos.hh |2 +-
 src/hb.hh|2 +-
 test/shaping/run-tests.py|2 +-
 util/options.hh  |2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 64e41d2c89c533f554e49ffbd18e6653a70ab999
Author: Behdad Esfahbod 
Date:   Tue Oct 30 01:08:34 2018 -0700

[test] Fix Python3

diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index 99c0a59f..65e0e149 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -6,7 +6,7 @@ import sys, os, subprocess
 
 def cmd(command):
global process
-   process.stdin.write (' '.join (command) + '\n')
+   process.stdin.write ((' '.join (command) + '\n').encode ("utf-8"))
process.stdin.flush ()
return process.stdout.readline().decode ("utf-8").strip ()
 
commit f7a08cd41df1ff3e44aa838306218ae0565b7273
Author: Ebrahim Byagowi 
Date:   Tue Oct 30 11:29:09 2018 +0330

Fix extra semicolon issues and test that on CI (#1330)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8ed1c394..90c09405 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -120,7 +120,7 @@ jobs:
   - run: apt update || true
   - run: apt install -y clang lld binutils libtool autoconf automake make 
pkg-config gtk-doc-tools ragel libfreetype6-dev libfontconfig1-dev 
libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip
   - run: pip install fonttools
-  - run: CFLAGS="-Weverything -Wno-reserved-id-macro -Wno-conversion 
-Wno-padded -Wno-sign-conversion -Wno-cast-qual -Wno-documentation 
-Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast 
-Wno-documentation -Wno-documentation-unknown-command -Wno-c++98-compat 
-Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-sign-conversion -Wno-padded 
-Wno-shorten-64-to-32 -Wno-extra-semi -Wno-reserved-id-macro 
-Wno-float-conversion -Wno-format-pedantic -Wno-shadow -Wno-conversion 
-Wno-zero-as-null-pointer-constant -Wno-missing-field-initializers 
-Wno-used-but-marked-unused -Wno-unused-macros -Wno-comma -Wno-float-equal 
-Wno-disabled-macro-expansion -Wno-weak-vtables -Wno-unused-parameter 
-Wno-covered-switch-default -Wno-unreachable-code" CC=clang CXX=clang++ 
./autogen.sh --with-freetype --with-glib --with-cairo --with-icu 
--with-graphite2 --with-fontconfig
+  - run: CFLAGS="-Weverything -Wno-reserved-id-macro -Wno-conversion 
-Wno-padded -Wno-sign-conversion -Wno-cast-qual -Wno-documentation 
-Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast 
-Wno-documentation -Wno-documentation-unknown-command -Wno-c++98-compat 
-Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-sign-conversion -Wno-padded 
-Wno-shorten-64-to-32 -Wno-reserved-id-macro -Wno-float-conversion 
-Wno-format-pedantic -Wno-shadow -Wno-conversion 
-Wno-zero-as-null-pointer-constant -Wno-missing-field-initializers 
-Wno-used-but-marked-unused -Wno-unused-macros -Wno-comma -Wno-float-equal 
-Wno-disabled-macro-expansion -Wno-weak-vtables -Wno-unused-parameter 
-Wno-covered-switch-default -Wno-unreachable-code" CC=clang CXX=clang++ 
./autogen.sh --with-freetype --with-glib --with-cairo --with-icu 
--with-graphite2 --with-fontconfig
   - run: make -j32 CPPFLAGS="-Werror"
   - run: make check CPPFLAGS="-Werror" || .ci/fail.sh
 
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 0ff3a768..9e50bc02 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -95,30 +95,30 @@ static inline Type& StructAfter(TObject &X)
 
 
 #define DEFINE_SIZE_STATIC(size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \
+  inline unsigned int get_size (void) const { return (size); } \
   enum { static_size = (size) }; \
-  enum { min_size = (size) }; \
-  inline unsigned int get_size (void) const { return (size); }
+  enum { min_size = (size) }
 
 #define DEFINE_SIZE_UNION(size, _member) \
-  DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + 
sizeof(this->u._member) == (size)); \
+  DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + 
sizeof(this->u._member) == (size)) \
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_MIN(size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)) \
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_ARRAY(size, array) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
(array[0])); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
(array[0])) \
   DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \
-  enum { min_size = (size) } \
+  enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
inline unsi

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-29 Thread Behdad Esfahbod
 src/hb-open-type.hh |   10 +-
 src/hb-ot-shape.hh  |3 ---
 src/hb.hh   |   15 +--
 3 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit ea0e51d1b161245aaf5ad0f844bb5316b1cbcd5e
Author: Behdad Esfahbod 
Date:   Mon Oct 29 16:00:23 2018 -0700

Add HB_NO_CREATE_COPY_ASSIGN

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index ee452864..e9f99b10 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -335,7 +335,7 @@ static inline Type& operator + (Base &base, OffsetTo
 template 
 struct UnsizedArrayOf
 {
-  HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
+  HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
 
   inline const Type& operator [] (unsigned int i) const { return arrayZ[i]; }
   inline Type& operator [] (unsigned int i) { return arrayZ[i]; }
@@ -426,7 +426,7 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf
 template 
 struct ArrayOf
 {
-  HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
+  HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
 
   inline const Type *sub_array (unsigned int start_offset, unsigned int 
*pcount /* IN/OUT */) const
   {
@@ -593,7 +593,7 @@ struct OffsetListOf : OffsetArrayOf
 template 
 struct HeadlessArrayOf
 {
-  HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2 (HeadlessArrayOf, Type, LenType);
+  HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (HeadlessArrayOf, Type, LenType);
 
   inline const Type& operator [] (unsigned int i) const
   {
@@ -659,7 +659,7 @@ struct HeadlessArrayOf
 template 
 struct ArrayOfM1
 {
-  HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2 (ArrayOfM1, Type, LenType);
+  HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOfM1, Type, LenType);
 
   inline const Type& operator [] (unsigned int i) const
   {
@@ -791,7 +791,7 @@ struct VarSizedBinSearchHeader
 template 
 struct VarSizedBinSearchArrayOf
 {
-  HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type);
+  HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type);
 
   inline const Type& operator [] (unsigned int i) const
   {
diff --git a/src/hb.hh b/src/hb.hh
index d29baabf..74dd8ace 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -339,21 +339,24 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
 
 #if __cplusplus >= 201103L
 
-#define HB_DISALLOW_COPY_AND_ASSIGN(TypeName) \
+#define HB_NO_CREATE_COPY_ASSIGN(TypeName) \
+  TypeName(void); \
   TypeName(const TypeName&); \
   void operator=(const TypeName&)
-#define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE(TypeName, T) \
+#define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE(TypeName, T) \
+  TypeName(void); \
   TypeName(const TypeName&); \
   void operator=(const TypeName&)
-#define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2(TypeName, T1, T2) \
+#define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) \
+  TypeName(void); \
   TypeName(const TypeName&); \
   void operator=(const TypeName&);
 
 #else /* __cpluspplus >= 201103L */
 
-#define HB_DISALLOW_COPY_AND_ASSIGN(TypeName)
-#define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE(TypeName, T)
-#define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2(TypeName, T1, T2)
+#define HB_NO_CREATE_COPY_ASSIGN(TypeName)
+#define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE(TypeName, T)
+#define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2)
 
 #endif /* __cpluspplus >= 201103L */
 
commit 5b563640b2df5b100130c9901b666713b2e1767e
Author: Behdad Esfahbod 
Date:   Mon Oct 29 15:58:44 2018 -0700

Remove HB_DISALLOW_COPY_AND_ASSIGN from hb_ot_shape_planner_t

It was arbitrary that this struct had it and not dozens of others.

diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh
index e7d6204a..1cb9e24d 100644
--- a/src/hb-ot-shape.hh
+++ b/src/hb-ot-shape.hh
@@ -102,9 +102,6 @@ struct hb_ot_shape_planner_t
   HB_INTERNAL void compile (hb_ot_shape_plan_t &plan,
const int  *coords,
unsigned intnum_coords);
-
-  private:
-  HB_DISALLOW_COPY_AND_ASSIGN (hb_ot_shape_planner_t);
 };
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-29 Thread Behdad Esfahbod
 src/hb-ot-cmap-table.hh |   16 ++--
 src/hb.hh   |   13 -
 2 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit c7c5df9ffd4f7bcc84a9a02a565ccc1807cca529
Author: Behdad Esfahbod 
Date:   Mon Oct 29 15:16:52 2018 -0700

Try fixing older bots

Older C++ doesn't allow struct-with-constructor in union.

diff --git a/src/hb.hh b/src/hb.hh
index 18bccdbc..8198d396 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -337,6 +337,8 @@ static_assert ((sizeof (hb_mask_t) == 4), "");
 static_assert ((sizeof (hb_var_int_t) == 4), "");
 
 
+#if __cplusplus >= 201103L
+
 #define HB_DISALLOW_COPY_AND_ASSIGN(TypeName) \
   TypeName(const TypeName&); \
   void operator=(const TypeName&)
@@ -344,8 +346,17 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
   TypeName(const TypeName&); \
   void operator=(const TypeName&)
 #define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2(TypeName, T1, T2) \
+  inline TypeName() {} \
   TypeName(const TypeName&); \
-  void operator=(const TypeName&)
+  void operator=(const TypeName&);
+
+#else /* __cpluspplus >= 201103L */
+
+#define HB_DISALLOW_COPY_AND_ASSIGN(TypeName)
+#define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE(TypeName, T)
+#define HB_DISALLOW_COPY_AND_ASSIGN_TEMPLATE2(TypeName, T1, T2)
+
+#endif /* __cpluspplus >= 201103L */
 
 
 /*
commit be87959a67b8ccf2b21d3cfdb7d16202f18df670
Author: Behdad Esfahbod 
Date:   Mon Oct 29 15:16:38 2018 -0700

[cmap] Minor

diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index d5b4fde3..f0dbef69 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -851,18 +851,6 @@ struct cmap
 
   struct subset_plan
   {
-subset_plan(void)
-{
-  format4_segments.init();
-  format12_groups.init();
-}
-
-~subset_plan(void)
-{
-  format4_segments.fini();
-  format12_groups.fini();
-}
-
 inline size_t final_size() const
 {
   return 4 // header
@@ -872,9 +860,9 @@ struct cmap
 }
 
 // Format 4
-hb_vector_t format4_segments;
+hb_auto_t > 
format4_segments;
 // Format 12
-hb_vector_t format12_groups;
+hb_auto_t > format12_groups;
   };
 
   inline bool sanitize (hb_sanitize_context_t *c) const
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-28 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt|2 --
 src/hb-map.cc |2 +-
 src/hb-ot-color-cpal-table.hh |4 ++--
 src/hb-ot-layout.cc   |   12 ++--
 src/hb-ot-name-table.hh   |2 +-
 src/hb-ot-name.h  |6 +++---
 src/hb-set.cc |2 +-
 src/hb-shape-plan.cc  |2 +-
 src/test-size-params.cc   |2 +-
 9 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 6ce49a921a80f1238ddc537f77a1fceea5274a21
Author: Behdad Esfahbod 
Date:   Sun Oct 28 08:26:30 2018 -0700

[name] Change hb_name_id_t back to unsigned int


https://github.com/harfbuzz/harfbuzz/commit/d941f66c75fe26f909b1ba248535cc372bbde851#commitcomment-31076011

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 3ba5b8ce..9d4edc26 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -360,7 +360,6 @@ HB_GOBJECT_TYPE_FONT_FUNCS
 HB_GOBJECT_TYPE_GLYPH_FLAGS
 HB_GOBJECT_TYPE_MAP
 HB_GOBJECT_TYPE_MEMORY_MODE
-HB_GOBJECT_TYPE_NAME_ID
 HB_GOBJECT_TYPE_OT_COLOR_PALETTE_FLAGS
 HB_GOBJECT_TYPE_OT_LAYOUT_GLYPH_CLASS
 HB_GOBJECT_TYPE_OT_MATH_CONSTANT
@@ -394,7 +393,6 @@ hb_gobject_font_get_type
 hb_gobject_glyph_flags_get_type
 hb_gobject_map_get_type
 hb_gobject_memory_mode_get_type
-hb_gobject_name_id_get_type
 hb_gobject_ot_color_palette_flags_get_type
 hb_gobject_ot_layout_glyph_class_get_type
 hb_gobject_ot_math_constant_get_type
diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 0e13bece..0b4bf377 100644
--- a/src/hb-ot-color-cpal-table.hh
+++ b/src/hb-ot-color-cpal-table.hh
@@ -64,7 +64,7 @@ struct CPALV1Tail
   unsigned int palette_count) const
   {
 if (!paletteLabelsZ) return HB_NAME_ID_INVALID;
-return (hb_name_id_t) (unsigned) hb_array (base+paletteLabelsZ, 
palette_count)[palette_index];
+return hb_array (base+paletteLabelsZ, palette_count)[palette_index];
   }
 
   inline hb_name_id_t
@@ -73,7 +73,7 @@ struct CPALV1Tail
 unsigned int color_count) const
   {
 if (!colorLabelsZ) return HB_NAME_ID_INVALID;
-return (hb_name_id_t) (unsigned) hb_array (base+colorLabelsZ, 
color_count)[color_index];
+return hb_array (base+colorLabelsZ, color_count)[color_index];
   }
 
   public:
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 6c5f0d40..19f80040 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1075,7 +1075,7 @@ hb_ot_layout_get_size_params (hb_face_t*face,
   {
if (design_size) *design_size = params.designSize;
if (subfamily_id) *subfamily_id = params.subfamilyID;
-   if (subfamily_name_id) *subfamily_name_id = (hb_name_id_t) (unsigned) 
params.subfamilyNameID;
+   if (subfamily_name_id) *subfamily_name_id = params.subfamilyNameID;
if (range_start) *range_start = params.rangeStart;
if (range_end) *range_end = params.rangeEnd;
 
@@ -1139,7 +1139,7 @@ hb_ot_layout_feature_get_name_ids (hb_face_t*face,
   feature_params.get_stylistic_set_params (feature_tag);
 if (&ss_params != &Null (OT::FeatureParamsStylisticSet)) /* ssXX */
 {
-  if (label_id) *label_id = (hb_name_id_t) (unsigned) ss_params.uiNameID;
+  if (label_id) *label_id = ss_params.uiNameID;
   // ssXX features don't have the rest
   if (tooltip_id) *tooltip_id = HB_NAME_ID_INVALID;
   if (sample_id) *sample_id = HB_NAME_ID_INVALID;
@@ -1151,11 +1151,11 @@ hb_ot_layout_feature_get_name_ids (hb_face_t*face,
   feature_params.get_character_variants_params (feature_tag);
 if (&cv_params != &Null (OT::FeatureParamsCharacterVariants)) /* cvXX */
 {
-  if (label_id) *label_id = (hb_name_id_t) (unsigned) 
cv_params.featUILableNameID;
-  if (tooltip_id) *tooltip_id = (hb_name_id_t) (unsigned) 
cv_params.featUITooltipTextNameID;
-  if (sample_id) *sample_id = (hb_name_id_t) (unsigned) 
cv_params.sampleTextNameID;
+  if (label_id) *label_id = cv_params.featUILableNameID;
+  if (tooltip_id) *tooltip_id = cv_params.featUITooltipTextNameID;
+  if (sample_id) *sample_id = cv_params.sampleTextNameID;
   if (num_named_parameters) *num_named_parameters = 
cv_params.numNamedParameters;
-  if (first_param_id) *first_param_id = (hb_name_id_t) (unsigned) 
cv_params.firstParamUILabelNameID;
+  if (first_param_id) *first_param_id = cv_params.firstParamUILabelNameID;
   return true;
 }
   }
diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh
index daf78c89..b84edd18 100644
--- a/src/hb-ot-name-table.hh
+++ b/src/hb-ot-name-table.hh
@@ -194,7 +194,7 @@ struct name
   {
hb_ot_name_entry_t *entry = this->names.push ();
 
-   entry->name_id = (hb_name_id_t) (unsigned) all_names[i].nameID;
+   entry->name_id = all_names[i].nameID;
entry->language = all_names[i].language (face);
entry->entry_score =  all_names[i].score ();
entry->entry_index = i;
diff --git a/s

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-27 Thread Behdad Esfahbod
 docs/harfbuzz-docs.xml |  214 +
 src/hb-ot-var.cc   |   11 ++
 2 files changed, 68 insertions(+), 157 deletions(-)

New commits:
commit 4740a3593d6bbb97758593b7d5cd1b86eccbed78
Author: Behdad Esfahbod 
Date:   Sat Oct 27 05:07:54 2018 -0700

[docs] Divide reference API into three chapters

diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml
index 31aa4058..21c251d0 100644
--- a/docs/harfbuzz-docs.xml
+++ b/docs/harfbuzz-docs.xml
@@ -60,185 +60,84 @@
 
 Reference manual
   
-HarfBuzz API
-
+Core API
 
+
+
+
 
 
-
+
+
+
 
 
 
+  
 
+  
+OpenType API
+
 
 
-
-
 
+
 
 
+  
 
-
-
-
-
-
+  
+Integration API
+
 
-
 
 
-
 
+
 
-
-
-
-
   
-  
+
+  
+
+  API Index
+  Index of 
deprecated API
 
-  Index of new symbols in 
0.9.2
-
-  
-  
-Index of new symbols in 0.9.5
-
-  
-  
-Index of new symbols in 0.9.7
-
-  
-  
-Index of new symbols in 0.9.8
-
-  
-  
-Index of new symbols in 0.9.10
-
-  
-  
-Index of new symbols in 0.9.11
-
-  
-  
-Index of new symbols in 0.9.20
-
-  
-  
-Index of new symbols in 0.9.22
-
-  
-  
-Index of new symbols in 0.9.28
-
-  
-  
-Index of new symbols in 0.9.30
-
-  
-  
-Index of new symbols in 0.9.31
-
-  
-  
-Index of new symbols in 0.9.38
-
-  
-  
-Index of new symbols in 0.9.39
-
-  
-  
-Index of new symbols in 0.9.41
-
-  
-  
-Index of new symbols in 0.9.42
-
-  
-  
-Index of new symbols in 1.0.5
-
-  
-  
-Index of new symbols in 1.1.2
-
-  
-  
-Index of new symbols in 1.1.3
-
-  
-  
-Index of new symbols in 1.2.3
-
-  
-  
-Index of new symbols in 1.3.3
-
-  
-  
-Index of new symbols in 1.4.0
-
-  
-  
-Index of new symbols in 1.4.2
-
-  
-  
-Index of new symbols in 1.4.3
-
-  
-  
-Index of new symbols in 1.5.0
-
-  
-  
-Index of new symbols in 1.6.0
-
-  
-  
-Index of new symbols in 1.7.5
-
-  
-  
-Index of new symbols in 1.7.7
-
-  
-  
-Index of new symbols in 1.8.0
-
-  
-  
-Index of new symbols in 1.8.1
-
-  
-  
-Index of new symbols in 1.8.5
-
-  
-  
-Index of new symbols in 1.8.6
-
-  
-  
-Index of new symbols in 1.9.0
-
-  
-  
-Index of new symbols in 2.0.0
-
-  
+  Index of new symbols in 
2.0.0
+  Index of new symbols in 
1.9.0
+  Index of new symbols in 
1.8.6
+  Index of new symbols in 
1.8.5
+  Index of new symbols in 
1.8.1
+  Index of new symbols in 
1.8.0
+  Index of new symbols in 
1.7.7
+  Index of new symbols in 
1.7.5
+  Index of new symbols in 
1.6.0
+  Index of new symbols in 
1.5.0
+  Index of new symbols in 
1.4.3
+  Index of new symbols in 
1.4.2
+  Index of new symbols in 
1.4.0
+  Index of new symbols in 
1.3.3
+  Index of new symbols in 
1.2.3
+  Index of new symbols in 
1.1.3
+  Index of new symbols in 
1.1.2
+  Index of new symbols in 
1.0.5
+  Index of new symbols 
in 0.9.42
+  Index of new symbols 
in 0.9.41
+  Index of new symbols 
in 0.9.39
+  Index of new symbols 
in 0.9.38
+  Index of new symbols 
in 0.9.31
+  Index of new symbols 
in 0.9.30
+  Index of new symbols 
in 0.9.28
+  Index of new symbols 
in 0.9.22
+  Index of new symbols 
in 0.9.20
+  Index of new symbols 
in 0.9.11
+  Index of new symbols 
in 0.9.10
+  Index of new symbols in 
0.9.8
+  Index of new symbols in 
0.9.7
+  Index of new symbols in 
0.9.5
+  Index of new symbols in 
0.9.2
 
   
   
commit 1d40d72f291ed5e11850f8bd51a8562b57de1997
Author: Behdad Esfahbod 
Date:   Sat Oct 27 05:00:42 2018 -0700

[docs] Hook up hb-var

diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml
index 140184af..31aa4058 100644
--- a/docs/harfbuzz-docs.xml
+++ b/docs/harfbuzz-docs.xml
@@ -76,6 +76,7 @@
 
 
 
+
 
 
 
diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc
index 472ee845..64087be8 100644
-

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-26 Thread Behdad Esfahbod
 src/hb-aat-layout-morx-table.hh |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 6aa019c4af6b64bb732205e6051f3e73e1b70721
Author: Behdad Esfahbod 
Date:   Fri Oct 26 22:02:17 2018 -0700

[morx] Fix merge_cluster to end at last ligature component

Don't assume current position was a component in the ligature.

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 5b21358e..a5620910 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -443,6 +443,7 @@ struct LigatureSubtable
DEBUG_MSG (APPLY, nullptr, "Produced ligature %d", lig);
buffer->replace_glyph (lig);
 
+   unsigned int lig_end = match_positions[match_length - 1] + 1;
/* Now go and delete all subsequent components. */
while (match_length - 1 > cursor)
{
@@ -451,7 +452,7 @@ struct LigatureSubtable
  buffer->replace_glyph (DELETED_GLYPH);
}
 
-   buffer->move_to (end + 1);
+   buffer->move_to (lig_end);
buffer->merge_out_clusters (match_positions[cursor], 
buffer->out_len);
  }
 
commit 00ae4be6bf8b1d0800043167c5cf95187ac12515
Author: Behdad Esfahbod 
Date:   Fri Oct 26 21:59:20 2018 -0700

[morx] Fix bailing out ligation at end-of-text

Check was after a move_to, which wouldn't work.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11147

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 22a99443..5b21358e 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -399,6 +399,9 @@ struct LigatureSubtable
if (unlikely (!match_length))
  return true;
 
+   if (buffer->idx >= buffer->len)
+ return false; // TODO Work on previous instead?
+
unsigned int cursor = match_length;
 do
{
@@ -421,8 +424,6 @@ struct LigatureSubtable
  if (uoffset & 0x2000)
uoffset |= 0xC000; /* Sign-extend. */
  int32_t offset = (int32_t) uoffset;
- if (buffer->idx >= buffer->len)
-   return false; // TODO Work on previous instead?
  unsigned int component_idx = buffer->cur().codepoint + offset;
 
  const HBUINT16 &componentData = component[component_idx];
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-26 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic.cc   
|3 
 src/hb-ot-shape-complex-khmer.cc   
|4 -
 src/hb-ot-shape-complex-myanmar.cc 
|   40 --
 src/hb-ot-shape-complex-use.cc 
|   22 -
 test/api/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5658272078495744 
|binary
 5 files changed, 38 insertions(+), 31 deletions(-)

New commits:
commit 982c2f4a65d127e56e09e7ab583f84099b8136bb
Author: Behdad Esfahbod 
Date:   Fri Oct 26 15:40:12 2018 -0700

[indic/khmer/myanmar/use] Clarify clear_syllable

No logic change.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 3babbfec..f145a34c 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -116,7 +116,8 @@ indic_features[] =
   {HB_TAG('c','j','c','t'), F_GLOBAL_MANUAL_JOINERS},
   /*
* Other features.
-   * These features are applied all at once, after final_reordering.
+   * These features are applied all at once, after final_reordering
+   * but before clearing syllables.
* Default Bengali font in Windows for example has intermixed
* lookups for init,pres,abvs,blws features.
*/
diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index 88d16267..21db351f 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -46,7 +46,7 @@ khmer_features[] =
   {HB_TAG('c','f','a','r'), F_MANUAL_JOINERS},
   /*
* Other features.
-   * These features are applied all at once.
+   * These features are applied all at once after clearing syllables.
*/
   {HB_TAG('p','r','e','s'), F_GLOBAL_MANUAL_JOINERS},
   {HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS},
@@ -438,8 +438,6 @@ clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
 hb_font_t *font HB_UNUSED,
 hb_buffer_t *buffer)
 {
-  /* TODO: In USE, we clear syllables right after reorder.  Figure out
-   * what Uniscribe does. */
   hb_glyph_info_t *info = buffer->info;
   unsigned int count = buffer->len;
   for (unsigned int i = 0; i < count; i++)
diff --git a/src/hb-ot-shape-complex-myanmar.cc 
b/src/hb-ot-shape-complex-myanmar.cc
index e201a230..30fa8257 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -36,7 +36,7 @@ basic_features[] =
 {
   /*
* Basic features.
-   * These features are applied in order, one at a time, after 
initial_reordering.
+   * These features are applied in order, one at a time, after reordering.
*/
   HB_TAG('r','p','h','f'),
   HB_TAG('p','r','e','f'),
@@ -48,7 +48,7 @@ other_features[] =
 {
   /*
* Other features.
-   * These features are applied all at once, after final_reordering.
+   * These features are applied all at once, after clearing syllables.
*/
   HB_TAG('p','r','e','s'),
   HB_TAG('a','b','v','s'),
@@ -80,13 +80,13 @@ setup_syllables (const hb_ot_shape_plan_t *plan,
 hb_font_t *font,
 hb_buffer_t *buffer);
 static void
-initial_reordering (const hb_ot_shape_plan_t *plan,
-   hb_font_t *font,
-   hb_buffer_t *buffer);
+reorder (const hb_ot_shape_plan_t *plan,
+hb_font_t *font,
+hb_buffer_t *buffer);
 static void
-final_reordering (const hb_ot_shape_plan_t *plan,
- hb_font_t *font,
- hb_buffer_t *buffer);
+clear_syllables (const hb_ot_shape_plan_t *plan,
+hb_font_t *font,
+hb_buffer_t *buffer);
 
 static void
 collect_features_myanmar (hb_ot_shape_planner_t *plan)
@@ -102,7 +102,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
   map->enable_feature (HB_TAG('c','c','m','p'));
 
 
-  map->add_gsub_pause (initial_reordering);
+  map->add_gsub_pause (reorder);
 
   for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
   {
@@ -110,7 +110,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
 map->add_gsub_pause (nullptr);
   }
 
-  map->add_gsub_pause (final_reordering);
+  map->add_gsub_pause (clear_syllables);
 
   for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
 map->enable_feature (other_features[i], F_MANUAL_ZWJ);
@@ -348,30 +348,28 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan 
HB_UNUSED,
 }
 
 static void
-initial_reordering (const hb_ot_shape_plan_t *plan,
-   hb_font_t *font,
-   hb_buffer_t *buffer)
+reorder (const hb_ot_shape_plan_t *plan,
+hb_font_t *font,
+hb_buffer_t *buffer)
 {
   insert_dotted_circles (plan, font, buffer);
 
   foreach_syllable (buffer, start, end)
 initial_reordering_syllable (plan, font->face, buffer, start, end);
+
+  HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
+  HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
 }
 
 static void
-final_reor

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-25 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt   |   14 ++
 test/shaping/data/in-house/fonts/DFONT.dfont |binary
 2 files changed, 14 insertions(+)

New commits:
commit e3ceb2dde3525824de68914e12ad4e8a873ab90a
Author: Behdad Esfahbod 
Date:   Thu Oct 25 14:30:24 2018 -0700

Fix again

diff --git a/test/shaping/data/in-house/fonts/DFONT.dfont 
b/test/shaping/data/in-house/fonts/DFONT.dfont
new file mode 100644
index ..a6ea7009
Binary files /dev/null and b/test/shaping/data/in-house/fonts/DFONT.dfont differ
commit eceeb85666814023f57ee3517bbb304830a60c55
Author: Ebrahim Byagowi 
Date:   Fri Oct 26 00:23:45 2018 +0330

[docs] Add hb-ot-color section

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index fccfcb0e..7bca7ca2 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -458,6 +458,20 @@ HB_OT_H_IN
 
 
 
+hb-ot-color
+hb_ot_color_glyph_get_layers
+hb_ot_color_has_layers
+hb_ot_color_has_palettes
+hb_ot_color_layer_t
+hb_ot_color_palette_color_get_name_id
+hb_ot_color_palette_flags_t
+hb_ot_color_palette_get_colors
+hb_ot_color_palette_get_count
+hb_ot_color_palette_get_flags
+hb_ot_color_palette_get_name_id
+
+
+
 hb-ot-font
 hb_ot_font_set_funcs
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-24 Thread Behdad Esfahbod
 appveyor.yml |   13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

New commits:
commit 9a830a17318446dab86e1439f7167d8a698eb856
Author: Khaled Hosny 
Date:   Thu Oct 25 01:55:10 2018 +0200

[appveyor] Drop Cygwin builds again

They are so slow and we had only a couple of Cygwin build failure
reported in ~5 years.

diff --git a/appveyor.yml b/appveyor.yml
index 9f1baa7a..21d4ea79 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -28,14 +28,6 @@ environment:
   MINGW_CHOST: i686-w64-mingw32
   MSYS2_ARCH: i686
 
-- compiler: cygwin
-  CYGWIN_PREFIX: C:\Cygwin64
-  CYGWIN_ARCH: x86_64
-   # Lots of test failures here!
-   #- compiler: cygwin
-   #  CYGWIN_PREFIX: C:\Cygwin
-   #  CYGWIN_ARCH: x86
-
 
 install:
 # - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm 
--force -Sy && pacman --noconfirm --force -S pacman-mirrors && pacman --force 
-Syu --noconfirm"'
@@ -59,9 +51,6 @@ build_script:
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "curl 
https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h
 > %MINGW_PREFIX%/%MINGW_CHOST%/include/dwrite_1.h"'
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd 
$APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh 
--with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo 
--with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% 
--host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make -j3 check || .ci/fail.sh"'
 
-  - 'if "%compiler%"=="cygwin" curl 
https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h
 -o %CYGWIN_PREFIX%\usr\include\dwrite_1.h'
-  - 'if "%compiler%"=="cygwin" %CYGWIN_PREFIX%\bin\bash -lc "cd 
$APPVEYOR_BUILD_FOLDER; ./autogen.sh --with-uniscribe --with-freetype 
--with-glib --with-gobject --with-cairo --with-icu --with-graphite2 
--with-directwrite; make -j3 check || .ci/fail.sh"'
-
 cache:
   - c:\tools\vcpkg\installed\
   - '%CYGWIN_PREFIX%\var\cache\setup'
commit 00e51a10832965f4c1d65a6d71c9582782f02c2b
Author: Khaled Hosny 
Date:   Wed Oct 24 22:58:22 2018 +0200

[appveyor] Limit make to three jobs

https://github.com/harfbuzz/harfbuzz/pull/1309#issuecomment-432778270

diff --git a/appveyor.yml b/appveyor.yml
index 0bc1f310..9f1baa7a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -57,10 +57,10 @@ build_script:
   - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" ctest 
--output-on-failure -C %configuration%'
 
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "curl 
https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h
 > %MINGW_PREFIX%/%MINGW_CHOST%/include/dwrite_1.h"'
-  - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd 
$APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh 
--with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo 
--with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% 
--host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make -j check || .ci/fail.sh"'
+  - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd 
$APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh 
--with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo 
--with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% 
--host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make -j3 check || .ci/fail.sh"'
 
   - 'if "%compiler%"=="cygwin" curl 
https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h
 -o %CYGWIN_PREFIX%\usr\include\dwrite_1.h'
-  - 'if "%compiler%"=="cygwin" %CYGWIN_PREFIX%\bin\bash -lc "cd 
$APPVEYOR_BUILD_FOLDER; ./autogen.sh --with-uniscribe --with-freetype 
--with-glib --with-gobject --with-cairo --with-icu --with-graphite2 
--with-directwrite; make -j check || .ci/fail.sh"'
+  - 'if "%compiler%"=="cygwin" %CYGWIN_PREFIX%\bin\bash -lc "cd 
$APPVEYOR_BUILD_FOLDER; ./autogen.sh --with-uniscribe --with-freetype 
--with-glib --with-gobject --with-cairo --with-icu --with-graphite2 
--with-directwrite; make -j3 check || .ci/fail.sh"'
 
 cache:
   - c:\tools\vcpkg\installed\
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-23 Thread Behdad Esfahbod
 src/HBIndicVowelConstraints.txt   
|   97 ++
 src/Makefile.am   
|7 
 src/Makefile.sources  
|2 
 src/gen-vowel-constraints.py  
|  216 
 src/hb-ot-shape-complex-indic.cc  
|  278 --
 src/hb-ot-shape-complex-use.cc
|   12 
 src/hb-ot-shape-complex-vowel-constraints.cc  
|  433 ++
 src/hb-ot-shape-complex-vowel-constraints.hh  
|   39 
 test/shaping/README.md
|4 
 test/shaping/data/in-house/fonts/46669c8860cbfea13562a6ca0d83130ee571137b.ttf 
|binary
 test/shaping/data/in-house/tests/use-vowel-letter-spoofing.tests  
|   94 ++
 11 files changed, 909 insertions(+), 273 deletions(-)

New commits:
commit 6d40eb8372a2c74a6e1294b44a2b19c99d11e7da
Author: Behdad Esfahbod 
Date:   Tue Oct 23 02:51:42 2018 -0700

Touch up on previous commit

https://github.com/harfbuzz/harfbuzz/pull/1273

diff --git a/src/HBIndicVowelConstraints.txt b/src/HBIndicVowelConstraints.txt
new file mode 100644
index ..146ae1cb
--- /dev/null
+++ b/src/HBIndicVowelConstraints.txt
@@ -0,0 +1,97 @@
+# Copied from 
https://docs.microsoft.com/en-us/typography/script-development/use
+# On October 23, 2018; with documentd dated 02/07/2018.
+
+  0905 0946   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT E
+  0905 093E   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AA
+  0930 094D 0907  ; # DEVANAGARI LETTER RA, DEVANAGARI SIGN VIRAMA, DEVANAGARI 
LETTER I
+  0909 0941   ; # DEVANAGARI LETTER U, DEVANAGARI VOWEL SIGN U
+  090F 0945   ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN CANDRA E
+  090F 0946   ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN SHORT E
+  090F 0947   ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN E
+  0905 0949   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA O
+  0906 0945   ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN CANDRA E
+  0905 094A   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT O
+  0906 0946   ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN SHORT E
+  0905 094B   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN O
+  0906 0947   ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN E
+  0905 094C   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AU
+  0906 0948   ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN AI
+  0905 0945   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA E
+  0905 093A   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OE
+  0905 093B   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OOE
+  0906 093A   ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN OE
+  0905 094F   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AW
+  0905 0956   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UE
+  0905 0957   ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UUE
+  0985 09BE   ; # BENGALI LETTER A, BENGALI VOWEL SIGN AA
+  098B 09C3   ; # BENGALI LETTER VOCALIC R, BENGALI VOWEL SIGN VOCALIC R
+  098C 09E2   ; # BENGALI LETTER VOCALIC L, BENGALI VOWEL SIGN VOCALIC L
+  0A05 0A3E   ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AA
+  0A72 0A3F   ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN I
+  0A72 0A40   ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN II
+  0A73 0A41   ; # GURMUKHI URA, GURMUKHI VOWEL SIGN U
+  0A73 0A42   ; # GURMUKHI URA, GURMUKHI VOWEL SIGN UU
+  0A72 0A47   ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN EE
+  0A05 0A48   ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AI
+  0A73 0A4B   ; # GURMUKHI URA, GURMUKHI VOWEL SIGN OO
+  0A05 0A4C   ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AU
+  0A85 0ABE   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA
+  0A85 0AC5   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA E
+  0A85 0AC7   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN E
+  0A85 0AC8   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AI
+  0A85 0AC9   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA O
+  0A85 0ACB   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN O
+  0A85 0ABE 0AC5  ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI 
VOWEL SIGN CANDRA E
+  0A85 0ACC   ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AU
+  0A85 0ABE 0AC8  ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI 
VOWEL SIGN AI
+  0AC5 0ABE   ; # GUJARATI VOWEL SIGN CANDRA E, GUJARATI VOWEL SIGN AA
+  0B05 0B3E   ; # ORIYA LETTER A, ORIYA VOWEL SIGN AA
+  0B0F 0B57   ; # ORIYA LETTER E, ORIYA AU LENGTH MARK
+  0B13 0B57   ; # ORIYA LETTER O, ORIYA AU LENGTH MARK
+  0C12 0C55   ; # TELUGU LETTER O, TELUGU LENGTH MARK
+  0C12 0C4C   ; # TELUGU LETTER O, TELUGU VOWEL SIGN AU
+  0C3F 0C55

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-22 Thread Behdad Esfahbod
 src/hb-aat-layout-trak-table.hh |2 +-
 src/hb-dsalgs.hh|2 ++
 src/hb-open-file.hh |3 +--
 src/hb-open-type.hh |8 
 src/hb-ot-color-cpal-table.hh   |6 +++---
 5 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 8d689f8a7bccda861bcb286d52f1a90fca52df0f
Author: Behdad Esfahbod 
Date:   Mon Oct 22 21:33:18 2018 -0700

Add hb_array<>() specialization for UnsizedArrayOf

Related https://github.com/harfbuzz/harfbuzz/issues/1301

diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index 823991f2..8cfc8bc3 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -55,7 +55,7 @@ struct TrackTableEntry
unsigned int index,
unsigned int nSizes) const
   {
-return hb_array ((base+valuesZ).arrayZ, nSizes)[index];
+return hb_array (base+valuesZ, nSizes)[index];
   }
 
   public:
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index 3b742ea7..80dc5e61 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -330,7 +330,7 @@ struct ResourceTypeRecord
   inline const ResourceRecord& get_resource_record (unsigned int i,
const void *type_base) const
   {
-return hb_array ((type_base+resourcesZ).arrayZ, get_resource_count ())[i];
+return hb_array (type_base+resourcesZ, get_resource_count ())[i];
   }
 
   inline bool sanitize (hb_sanitize_context_t *c,
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 19081447..a76b111e 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -385,6 +385,14 @@ struct UnsizedArrayOf
   public:
   DEFINE_SIZE_ARRAY (0, arrayZ);
 };
+} /* namespace OT */
+template 
+hb_array_t hb_array (OT::UnsizedArrayOf &array, unsigned int len)
+{ return hb_array (array.arrayZ, len); }
+template 
+hb_array_t hb_array (const OT::UnsizedArrayOf &array, unsigned int 
len)
+{ return hb_array (array.arrayZ, len); }
+namespace OT {
 
 /* Unsized array of offset's */
 template 
diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 4b09d3a5..7d3733d3 100644
--- a/src/hb-ot-color-cpal-table.hh
+++ b/src/hb-ot-color-cpal-table.hh
@@ -55,7 +55,7 @@ struct CPALV1Tail
   {
 if (!paletteFlagsZ) return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
 return (hb_ot_color_palette_flags_t) (uint32_t)
-  hb_array ((base+paletteFlagsZ).arrayZ, palette_count)[palette_index];
+  hb_array (base+paletteFlagsZ, palette_count)[palette_index];
   }
 
   inline unsigned int
@@ -64,7 +64,7 @@ struct CPALV1Tail
   unsigned int palette_count) const
   {
 if (!paletteLabelsZ) return HB_NAME_ID_INVALID;
-return hb_array ((base+paletteLabelsZ).arrayZ, 
palette_count)[palette_index];
+return hb_array (base+paletteLabelsZ, palette_count)[palette_index];
   }
 
   inline unsigned int
@@ -73,7 +73,7 @@ struct CPALV1Tail
 unsigned int color_count) const
   {
 if (!colorLabelsZ) return HB_NAME_ID_INVALID;
-return hb_array ((base+colorLabelsZ).arrayZ, color_count)[color_index];
+return hb_array (base+colorLabelsZ, color_count)[color_index];
   }
 
   public:
commit abfbba191141c3e3cf2a391f365b5323f9dc37c0
Author: Behdad Esfahbod 
Date:   Mon Oct 22 21:27:45 2018 -0700

Add hb_array<>()

Simplifies transient object creation.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1301

diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index c2c50bbb..823991f2 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -55,7 +55,7 @@ struct TrackTableEntry
unsigned int index,
unsigned int nSizes) const
   {
-return hb_array_t ((base+valuesZ).arrayZ, nSizes)[index];
+return hb_array ((base+valuesZ).arrayZ, nSizes)[index];
   }
 
   public:
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 27c1a96e..11a05506 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -537,6 +537,8 @@ struct hb_array_t
   T *arrayZ;
   unsigned int len;
 };
+template 
+hb_array_t hb_array (T *array, unsigned int len) { return hb_array_t 
(array, len); }
 
 struct hb_bytes_t
 {
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index a973455d..3b742ea7 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -330,8 +330,7 @@ struct ResourceTypeRecord
   inline const ResourceRecord& get_resource_record (unsigned int i,
const void *type_base) const
   {
-return hb_array_t ((type_base+resourcesZ).arrayZ,
-get_resource_count ()) [i];
+return hb_array ((type_base+resourcesZ).arrayZ, get_resource_count ())[i];
   }
 
   inline bool sanitize (hb_sanitize_context_t *c,
diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 7dd0c

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-22 Thread Behdad Esfahbod
 src/hb-atomic.hh  |5 +
 src/hb-common.cc  |2 +-
 src/hb-ft.cc  |2 +-
 src/hb-null.hh|4 ++--
 src/hb-open-type.hh   |6 ++
 src/hb-ot-color-colr-table.hh |2 +-
 src/hb-ot-color-cpal-table.hh |8 ++--
 src/hb-static.cc  |1 -
 src/hb.hh |9 +
 9 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 17ffbc070ff4190d8ebaf88f8db62f19e6fa370d
Author: Behdad Esfahbod 
Date:   Mon Oct 22 21:22:25 2018 -0700

[color] Use Index for colorIdx

Doesn't matter, but matches the description.

diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh
index 7c5c35d8..b480af51 100644
--- a/src/hb-ot-color-colr-table.hh
+++ b/src/hb-ot-color-colr-table.hh
@@ -47,7 +47,7 @@ struct LayerRecord
 
   public:
   GlyphID  glyphId;/* Glyph ID of layer glyph */
-  HBUINT16 colorIdx;   /* Index value to use with a
+  IndexcolorIdx;   /* Index value to use with a
 * selected color palette.
 * An index value of 0x
 * is a special case indicating
commit 07386ea410af13e8fc844eb939a6c6e47c2adaf1
Author: Behdad Esfahbod 
Date:   Mon Oct 22 21:18:27 2018 -0700

Remove const and references when binding Null()

Fixes https://github.com/harfbuzz/harfbuzz/issues/1299

Removes anomaly I was seeing in cpal table trying to use implicit 
Null(NameID).

diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh
index 5cb7ca5d..697de19c 100644
--- a/src/hb-atomic.hh
+++ b/src/hb-atomic.hh
@@ -278,14 +278,11 @@ struct hb_atomic_int_t
 };
 
 
-template  struct hb_remove_ptr_t { typedef T value; };
-template  struct hb_remove_ptr_t { typedef T value; };
-
 #define HB_ATOMIC_PTR_INIT(V)  {V}
 template 
 struct hb_atomic_ptr_t
 {
-  typedef typename hb_remove_ptr_t::value T;
+  typedef typename hb_remove_pointer::value T;
 
   inline void init (T* v_ = nullptr) { set_relaxed (v_); }
   inline void set_relaxed (T* v_) const { hb_atomic_ptr_impl_set_relaxed (&v, 
v_); }
diff --git a/src/hb-common.cc b/src/hb-common.cc
index ba48dd56..ccdb4dd9 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -761,7 +761,7 @@ parse_uint32 (const char **pp, const char *end, uint32_t 
*pv)
 static void free_static_C_locale (void);
 #endif
 
-static struct hb_C_locale_lazy_loader_t : 
hb_lazy_loader_t::value,
+static struct hb_C_locale_lazy_loader_t : 
hb_lazy_loader_t::value,
  
hb_C_locale_lazy_loader_t>
 {
   static inline HB_LOCALE_T create (void)
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 18fb72a7..fbf36268 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -737,7 +737,7 @@ hb_ft_font_create_referenced (FT_Face ft_face)
 static void free_static_ft_library (void);
 #endif
 
-static struct hb_ft_library_lazy_loader_t : 
hb_lazy_loader_t::value,
+static struct hb_ft_library_lazy_loader_t : 
hb_lazy_loader_t::value,
 
hb_ft_library_lazy_loader_t>
 {
   static inline FT_Library create (void)
diff --git a/src/hb-null.hh b/src/hb-null.hh
index 87662265..3d8a1ae6 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -47,7 +47,7 @@ static inline Type const & Null (void) {
   static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase 
HB_NULL_POOL_SIZE.");
   return *reinterpret_cast (_hb_NullPool);
 }
-#define Null(Type) Null()
+#define Null(Type) Null::value>::value>()
 
 /* Specializations for arbitrary-content Null objects expressed in bytes. */
 #define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \
@@ -90,7 +90,7 @@ static inline Type& Crap (void) {
   *obj = Null(Type);
   return *obj;
 }
-#define Crap(Type) Crap()
+#define Crap(Type) Crap::value>::value>()
 
 template 
 struct CrapOrNull {
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index dc2f1f7c..19081447 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -149,16 +149,14 @@ struct Tag : HBUINT32
 /* Glyph index number, same as uint16 (length = 16 bits) */
 typedef HBUINT16 GlyphID;
 
-/* Name-table index, same as uint16 (length = 16 bits) */
-struct NameID : HBUINT16 {};
-DECLARE_NULL_NAMESPACE_BYTES (OT, NameID);
-
 /* Script/language-system/feature index */
 struct Index : HBUINT16 {
   enum { NOT_FOUND_INDEX = 0xu };
 };
 DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
 
+typedef Index NameID;
+
 /* Offset, Null offset = 0 */
 template 
 struct Offset : Type
diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 3f2165c4..7dd0c0f9 100644
--- a/src/hb-ot-color-cpal-table.hh
+++ b/src/hb-ot-color-cpal-table.hh
@@ -63,9 +63,7 @@ struct CPALV1Tail
   unsigned int palette_index,
   unsigned int palette_count) const
   {
-/* XXX the Null(NameID) returned by hb_array_t is 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-19 Thread Behdad Esfahbod
 test/api/test-map.c |2 +-
 test/api/test-ot-name.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f70f994112b2577271c20a929f7b980fa1d17428
Author: Behdad Esfahbod 
Date:   Fri Oct 19 20:00:36 2018 -0700

Minor

diff --git a/test/api/test-ot-name.c b/test/api/test-ot-name.c
index d5345bf1..2da504ac 100644
--- a/test/api/test-ot-name.c
+++ b/test/api/test-ot-name.c
@@ -31,7 +31,7 @@ static const char *font_path = "fonts/cv01.otf";
 static hb_face_t *face;
 
 static void
-test_ot_layout_feature_get_name_ids_and_characters ()
+test_ot_layout_feature_get_name_ids_and_characters (void)
 {
   hb_tag_t cv01 = HB_TAG ('c','v','0','1');
   unsigned int feature_index;
commit 4e09fb8f7a93ec0c8d7f71cd58772ba468b5523f
Author: Behdad Esfahbod 
Date:   Fri Oct 19 19:59:41 2018 -0700

Oops. Fix build

diff --git a/test/api/test-map.c b/test/api/test-map.c
index cc797fba..0d8be0bb 100644
--- a/test/api/test-map.c
+++ b/test/api/test-map.c
@@ -69,7 +69,7 @@ test_map_userdata (void)
   hb_user_data_key_t key[2];
   int *data = (int *) malloc (sizeof (int));
   *data = 3123;
-  hb_map_set_user_data (m, &key[0], data, free, true);
+  hb_map_set_user_data (m, &key[0], data, free, TRUE);
   g_assert_cmpint (*((int *) hb_map_get_user_data (m, &key[0])), ==, 3123);
 
   int *data2 = (int *) malloc (sizeof (int));
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-19 Thread Behdad Esfahbod
 src/hb-aat-layout-ankr-table.hh |6 ++--
 src/hb-aat-layout-common.hh |   55 +---
 src/hb-aat-layout-kerx-table.hh |   37 +-
 src/hb-machinery.hh |4 ++
 src/hb-open-type.hh |3 ++
 5 files changed, 92 insertions(+), 13 deletions(-)

New commits:
commit 29d877518fc2c29083cd7b955b422087966235f7
Author: Behdad Esfahbod 
Date:   Fri Oct 19 16:06:54 2018 -0700

[kerx] Implement variation-kerning tables (without the variation part)

SFSNDisplay uses these.  We just apply the default kern without
variations right now.  But at least makes the default kern work.

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 9727e396..64257809 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -45,6 +45,21 @@ namespace AAT {
 using namespace OT;
 
 
+static inline int
+kerxTupleKern (int value,
+  unsigned int tupleCount,
+  const void *base,
+  hb_aat_apply_context_t *c)
+{
+  if (likely (!tupleCount)) return value;
+
+  unsigned int offset = value;
+  const FWORD *pv = &StructAtOffset (base, offset);
+  if (unlikely (!pv->sanitize (&c->sanitizer))) return 0;
+  return *pv;
+}
+
+
 struct KerxSubTableHeader
 {
   inline bool sanitize (hb_sanitize_context_t *c) const
@@ -65,6 +80,7 @@ struct KerxSubTableFormat0
 {
   inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
   {
+if (header.tupleCount) return 0; /* TODO kerxTupleKern */
 hb_glyph_pair_t pair = {left, right};
 int i = pairs.bsearch (pair);
 return i == -1 ? 0 : pairs[i].get_kerning ();
@@ -201,6 +217,9 @@ struct KerxSubTableFormat1
 if (!c->plan->requested_kerning)
   return false;
 
+if (header.tupleCount)
+  return_trace (false); /* TODO kerxTupleKern */
+
 driver_context_t dc (this, c);
 
 StateTableDriver driver (machine, c->buffer, c->font->face);
@@ -236,7 +255,7 @@ struct KerxSubTableFormat2
 unsigned int offset = l + r;
 const FWORD *v = &StructAtOffset (&(this+array), offset);
 if (unlikely (!v->sanitize (&c->sanitizer))) return 0;
-return *v;
+return kerxTupleKern (*v, header.tupleCount, this, c);
   }
 
   inline bool apply (hb_aat_apply_context_t *c) const
@@ -482,7 +501,7 @@ struct KerxSubTableFormat6
   if (unlikely (hb_unsigned_mul_overflows (offset, sizeof (FWORD32 
return 0;
   const FWORD32 *v = &StructAtOffset (&(this+t.array), offset * 
sizeof (FWORD32));
   if (unlikely (!v->sanitize (&c->sanitizer))) return 0;
-  return *v;
+  return kerxTupleKern (*v, header.tupleCount, &(this+vector), c);
 }
 else
 {
@@ -492,7 +511,7 @@ struct KerxSubTableFormat6
   unsigned int offset = l + r;
   const FWORD *v = &StructAtOffset (&(this+t.array), offset * 
sizeof (FWORD));
   if (unlikely (!v->sanitize (&c->sanitizer))) return 0;
-  return *v;
+  return kerxTupleKern (*v, header.tupleCount, &(this+vector), c);
 }
   }
 
@@ -523,7 +542,9 @@ struct KerxSubTableFormat6
 u.s.rowIndexTable.sanitize (c, this) &&
 u.s.columnIndexTable.sanitize (c, this) &&
 c->check_range (this, u.s.array)
-  ;
+  )) &&
+ (header.tupleCount == 0 ||
+  c->check_range (this, vector;
   }
 
   struct accelerator_t
@@ -559,8 +580,9 @@ struct KerxSubTableFormat6
   LOffsetTo, false>  array;
 } s;
   } u;
+  LOffsetTo, false>  vector;
   public:
-  DEFINE_SIZE_STATIC (32);
+  DEFINE_SIZE_STATIC (36);
 };
 
 struct KerxTable
@@ -642,9 +664,8 @@ struct kerx
 {
   bool reverse;
 
-  if (table->u.header.coverage & (KerxTable::CrossStream | 
KerxTable::Variation) ||
- table->u.header.tupleCount)
-   goto skip; /* We do NOT handle cross-stream or variation kerning. */
+  if (table->u.header.coverage & (KerxTable::CrossStream))
+   goto skip; /* We do NOT handle cross-stream. */
 
   if (HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) !=
  bool (table->u.header.coverage & KerxTable::Vertical))
commit f7c0b4319c6f82f1e0020a0029469d8953a7a161
Author: Behdad Esfahbod 
Date:   Fri Oct 19 15:23:49 2018 -0700

[aat] Implement LookupFormat10

diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh
index 2e3ed275..5f7656d2 100644
--- a/src/hb-aat-layout-ankr-table.hh
+++ b/src/hb-aat-layout-ankr-table.hh
@@ -63,8 +63,10 @@ struct ankr
   unsigned int num_glyphs,
   const char *end) const
   {
-unsigned int offset = (this+lookupTable).get_value_or_null (glyph_id, 
num_glyphs);
-const GlyphAnchors &anchors = StructAtOffset 
(&(this+anchorData), offset);
+const Offset *offset = (this+lookupTable).get_value

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-19 Thread Behdad Esfahbod
 RELEASING.md|5 -
 test/shaping/data/in-house/tests/aat-trak.tests |2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 257ded1f9ec653d15e79d2ea0a83bd8c5c53d831
Author: Behdad Esfahbod 
Date:   Fri Oct 19 11:20:14 2018 -0700

[trak] Fix test for previous fix

diff --git a/test/shaping/data/in-house/tests/aat-trak.tests 
b/test/shaping/data/in-house/tests/aat-trak.tests
index 9e650558..48b224f3 100644
--- a/test/shaping/data/in-house/tests/aat-trak.tests
+++ b/test/shaping/data/in-house/tests/aat-trak.tests
@@ -5,4 +5,4 @@
 
../fonts/TestTRAK.ttf:--font-ptem=9:U+0041,U+0042,U+0043:[A.alt=0+1000|B=1+1000|C.alt=2+1000]
 
../fonts/TestTRAK.ttf:--font-ptem=24:U+0041,U+0042,U+0043:[A.alt=0@-12,0+976|B=1@-12,0+976|C.alt=2@-12,0+976]
 
../fonts/TestTRAK.ttf:--font-ptem=72:U+0041,U+0042,U+0043:[A.alt=0@-50,0+900|B=1@-50,0+900|C.alt=2@-50,0+900]
-../fonts/TestTRAK.ttf:--font-ptem=144:U+0041,U+0042,U+0043:[A.alt=0@-100,0+800|B=1@-100,0+800|C.alt=2@-100,0+800]
+../fonts/TestTRAK.ttf:--font-ptem=144:U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1@-107,0+786|C.alt=2@-107,0+786]
commit 72bb139b807c21f1569058fb5fb260dcdd81eba4
Author: Behdad Esfahbod 
Date:   Fri Oct 19 11:15:35 2018 -0700

[RELEASING] Post-mortem

Re https://github.com/harfbuzz/harfbuzz/issues/1271

diff --git a/RELEASING.md b/RELEASING.md
index d431871c..4f5705e5 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -27,7 +27,10 @@ HarfBuzz release walk-through checklist:
Otherwise, fix things and commit them separately before making release,
Note: Check src/hb-version.h and make sure the new version number is
there.  Sometimes, it does not get updated.  If that's the case,
-   "touch configure.ac" and rebuild.  TODO: debug.
+   "touch configure.ac" and rebuild.  Also check that there is no hb-version.h
+   in your build/src file. Typically it will fail the distcheck if there is.
+   That's what happened to 2.0.0 going out with 1.8.0 hb-version.h...  So, 
that's
+   a clue.
 
 7. "make release-files".  Enter your GPG password.  This creates a sha256 hash
and signs it.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-18 Thread Behdad Esfahbod
 NEWS   |   68 +
 configure.ac   |2 -
 src/hb-buffer.cc   |4 +-
 src/hb-common.h|4 +-
 src/hb-deprecated.h|   18 ++--
 src/hb-font.cc |6 ++--
 src/hb-font.h  |2 -
 src/hb-ot-layout.cc|8 ++---
 src/hb-ot-name.h   |4 +-
 src/hb-ot-tag.cc   |4 +-
 src/hb-ot-tag.h|4 +-
 src/hb-version.h   |6 ++--
 test/api/test-ot-tag.c |4 +-
 13 files changed, 101 insertions(+), 33 deletions(-)

New commits:
commit 3d9a0306ebb48706778fd2c487c3cacc7d508d6c
Author: Behdad Esfahbod 
Date:   Thu Oct 18 05:58:17 2018 -0700

2.0.0

diff --git a/NEWS b/NEWS
index c9af0f36..58e21a59 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,71 @@
+Overview of changes leading to 2.0.0
+Wednesday, October 17, 2018
+
+- Added AAT shaping support (morx/kerx/trak).
+  Automatically used if GSUB/GPOS are not available respectively.
+  Set HB_OPTIONS=aat env var to have morx/kerx preferred over
+  GSUB/GPOS.
+- Apply TrueType kern table internally, instead of relying on
+  hb_font_t callbacks.
+- Khmer shaper significantly rewritten to better match Uniscribe.
+- Indic3 tags ('dev3', etc) are passed to USE shaper.
+- .dfont Mac font containers implemented.
+- Script- and language-mapping revamped to better use BCP 47.
+- Misc USE and Indic fixes.
+- Misc everything fixes.
+- Too many things to list.  Biggest release since 0.9.1, with
+  over 500 commits in just over 5 weeks!  Didn't intend it to
+  be a big release.  Just happened to become.
+- hb-ft now locks underlying FT_Face during use.
+
+API changes:
+
+- Newly-created hb_font_t's now have our internal "hb-ot-font"
+  callbacks set on them, so they should work out of the box
+  without any callbacks set.  If callbacks are set, everything
+  is back to what it was before, the fallback callbacks are
+  null.  If you to get the internal implementation modified,
+  sub_font it.
+
+- New hb_font_funcs_set_nominal_glyphs_func() allows speeding
+  up character to glyph mapping.
+
+New API:
++HB_FEATURE_GLOBAL_START
++HB_FEATURE_GLOBAL_END
++hb_buffer_set_invisible_glyph()
++hb_buffer_get_invisible_glyph()
++hb_font_funcs_set_nominal_glyphs_func()
++hb_ot_layout_table_select_script()
++hb_ot_layout_script_select_language()
++hb_ot_layout_feature_get_name_ids()
++hb_ot_layout_feature_get_characters()
++hb_name_id_t
++HB_NAME_ID_INVALID
++HB_OT_MAX_TAGS_PER_SCRIPT
++hb_ot_tags_from_script_and_language()
++hb_ot_tags_to_script_and_language()
+
+Deprecated API:
+-hb_font_funcs_set_glyph_func()
+-hb_unicode_eastasian_width_func_t
+-hb_unicode_funcs_set_eastasian_width_func()
+-hb_unicode_eastasian_width()
+-hb_unicode_decompose_compatibility_func_t
+-HB_UNICODE_MAX_DECOMPOSITION_LEN
+-hb_unicode_funcs_set_decompose_compatibility_func()
+-hb_unicode_decompose_compatibility()
+-hb_font_funcs_set_glyph_h_kerning_func()
+-hb_font_funcs_set_glyph_v_kerning_func()
+-hb_font_get_glyph_h_kerning()
+-hb_font_get_glyph_v_kerning()
+-hb_font_get_glyph_kerning_for_direction()
+-hb_ot_layout_table_choose_script()
+-hb_ot_layout_script_find_language()
+-hb_ot_tags_from_script()
+-hb_ot_tag_from_language()
+
+
 Overview of changes leading to 1.9.0
 Monday, September 10, 2018
 
diff --git a/configure.ac b/configure.ac
index 1b9ddfe7..a3ce8c1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[1.9.0],
+[2.0.0],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 00e7e149..ce9b0530 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -1190,7 +1190,7 @@ hb_buffer_get_replacement_codepoint (hb_buffer_t
*buffer)
  * U+0020 SPACE character is used.  Otherwise, this value is used
  * verbatim.
  *
- * Since: REPLACEME
+ * Since: 2.0.0
  **/
 void
 hb_buffer_set_invisible_glyph (hb_buffer_t*buffer,
@@ -1211,7 +1211,7 @@ hb_buffer_set_invisible_glyph (hb_buffer_t*buffer,
  * Return value: 
  * The @buffer invisible #hb_codepoint_t.
  *
- * Since: REPLACEME
+ * Since: 2.0.0
  **/
 hb_codepoint_t
 hb_buffer_get_invisible_glyph (hb_buffer_t*buffer)
diff --git a/src/hb-common.h b/src/hb-common.h
index c601b1f6..2f09f431 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -401,13 +401,13 @@ typedef void (*hb_destroy_func_t) (void *user_data);
 /**
  * HB_FEATURE_GLOBAL_START
  *
- * Since: REPLACEME
+ * Since: 2.0.0
  */
 #define HB_FEATURE_GLOBAL_START0
 /**
  * HB_FEATURE_GLOBAL_END
  *
- * Since: REPLACEME
+ * Since: 2.0.0
  */
 #define HB_FEATURE_GLOBAL_END  ((unsigned int) -1)
 
diff --git a/src/hb-deprecated.h b/src/hb-deprecated.h
index 52ee49e2..5af9bdbd 100644
--- a/src/hb-deprecated.h
+++ b/src/hb-deprecated.h
@@ -61,7 +61,7 @@ hb_set_invert (hb_set_t *set);
 /**
  * hb_unico

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-17 Thread Behdad Esfahbod
 .circleci/config.yml   
|2 +-
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088   
|binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608
 |binary
 4 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b9478e28ac4361353e4920d749cc5d29e5bfef67
Author: Behdad Esfahbod 
Date:   Wed Oct 17 21:52:14 2018 -0700

Revert "[test] Remove not-fixed yet testcases (#1268)"

This reverts commit 191eef823fe95355425621f8e002dfe7fe632383.

diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056
new file mode 100644
index ..065080f3
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 
differ
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088
new file mode 100644
index ..1c62961e
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 
differ
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608
new file mode 100644
index ..28e72df7
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608
 differ
commit af99b20dfddbca75e68f84c5aa465a54728990a6
Author: Ebrahim Byagowi 
Date:   Thu Oct 18 08:35:20 2018 +0330

[ci/ubsan] Disable enum sanitization

Behdad apparently not interested on them

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 1cf4bc88..0eb35f87 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -168,7 +168,7 @@ jobs:
   - run: apt update || true
   - run: apt install -y clang lld binutils libtool autoconf automake make 
pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev 
libgraphite2-dev python python-pip
   - run: pip install fonttools
-  - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined -O1 
-g -fno-omit-frame-pointer" CFLAGS="-fsanitize=undefined -O1 -g 
-fno-omit-frame-pointer" CXXFLAGS="-fsanitize=undefined -O1 -g 
-fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh 
--with-freetype --with-glib --with-cairo --with-icu --with-graphite2
+  - run: CPPFLAGS="-fsanitize=undefined -fno-sanitize=enum" 
LDFLAGS="-fsanitize=undefined -fno-sanitize=enum -O1 -g 
-fno-omit-frame-pointer" CFLAGS="-fsanitize=undefined -fno-sanitize=enum -O1 -g 
-fno-omit-frame-pointer" CXXFLAGS="-fsanitize=undefined -O1 -g 
-fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh 
--with-freetype --with-glib --with-cairo --with-icu --with-graphite2
   - run: make -j32
   - run: make check || .ci/fail.sh | asan_symbolize | c++filt
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-16 Thread Behdad Esfahbod
 dev/null   |binary
 src/hb-ot-layout-gpos-table.hh |   14 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 49c041f7c5b135cbcbd1663e18047afd54fc948b
Author: Behdad Esfahbod 
Date:   Tue Oct 16 16:25:24 2018 -0700

Minor

diff --git a/test/fuzzing/clusterfuzz-testcase-6107935408390144 
b/test/fuzzing/clusterfuzz-testcase-6107935408390144
deleted file mode 100644
index 4c81a866..
Binary files a/test/fuzzing/clusterfuzz-testcase-6107935408390144 and /dev/null 
differ
commit 36f38ea7033b4e52c6cd94a8a0d686a95c0cc148
Author: Behdad Esfahbod 
Date:   Tue Oct 16 16:24:03 2018 -0700

[gpos] Protect mark attachment against out-of-bounds

Not sure how can happen, but does...

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 8b20c150..4f81b327 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1658,7 +1658,10 @@ reverse_cursive_minor_offset (hb_glyph_position_t *pos, 
unsigned int i, hb_direc
   pos[j].attach_type() = type;
 }
 static void
-propagate_attachment_offsets (hb_glyph_position_t *pos, unsigned int i, 
hb_direction_t direction)
+propagate_attachment_offsets (hb_glyph_position_t *pos,
+ unsigned int len,
+ unsigned int i,
+ hb_direction_t direction)
 {
   /* Adjusts offsets of attached glyphs (both cursive and mark) to accumulate
* offset of glyph they are attached to. */
@@ -1666,11 +1669,14 @@ propagate_attachment_offsets (hb_glyph_position_t *pos, 
unsigned int i, hb_direc
   if (likely (!chain))
 return;
 
+  pos[i].attach_chain() = 0;
+
   unsigned int j = (int) i + chain;
 
-  pos[i].attach_chain() = 0;
+  if (unlikely (j >= len))
+return;
 
-  propagate_attachment_offsets (pos, j, direction);
+  propagate_attachment_offsets (pos, len, j, direction);
 
   assert (!!(type & ATTACH_TYPE_MARK) ^ !!(type & ATTACH_TYPE_CURSIVE));
 
@@ -1726,7 +1732,7 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, 
hb_buffer_t *buffer)
   /* Handle attachments */
   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);
+  propagate_attachment_offsets (pos, len, i, direction);
 }
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-16 Thread Behdad Esfahbod
 src/hb-aat-layout-ankr-table.hh
|2 +-
 test/fuzzing/fonts/clusterfuzz-testcase-6107935408390144   
|binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5973566991106048
 |binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5633985665826816
 |binary
 4 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1147ce2392ac6b3d12fdabe69ac5da9bae97e30d
Author: Behdad Esfahbod 
Date:   Tue Oct 16 16:18:32 2018 -0700

[fuzzing] Add more tests

diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-6107935408390144 
b/test/fuzzing/fonts/clusterfuzz-testcase-6107935408390144
new file mode 100644
index ..4c81a866
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-6107935408390144 differ
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5973566991106048
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5973566991106048
new file mode 100644
index ..984bb4bd
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5973566991106048
 differ
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5633985665826816
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5633985665826816
new file mode 100644
index ..387d7fd4
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5633985665826816
 differ
commit 12cbe195ae65656dbc9e32b4d50696bc4223136b
Author: Behdad Esfahbod 
Date:   Tue Oct 16 16:13:53 2018 -0700

[aat] Another non-null offset

diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh
index f9bd30ff..2e3ed275 100644
--- a/src/hb-aat-layout-ankr-table.hh
+++ b/src/hb-aat-layout-ankr-table.hh
@@ -84,7 +84,7 @@ struct ankr
   HBUINT16 flags;  /* Flags (currently unused; set to zero) */
   LOffsetTo >, false>
lookupTable;/* Offset to the table's lookup table */
-  LOffsetTo
+  LOffsetTo
anchorData; /* Offset to the glyph data table */
 
   public:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-16 Thread Behdad Esfahbod
 test/fuzzing/clusterfuzz-testcase-6107935408390144 |binary
 test/shaping/data/in-house/tests/fuzzed.tests  |6 +++---
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 1aa353e4fc79dfa880559ff75113ed58fac8392b
Author: Behdad Esfahbod 
Date:   Tue Oct 16 15:26:51 2018 -0700

Fix tests

diff --git a/test/shaping/data/in-house/tests/fuzzed.tests 
b/test/shaping/data/in-house/tests/fuzzed.tests
index 614dd8d2..429172ca 100644
--- a/test/shaping/data/in-house/tests/fuzzed.tests
+++ b/test/shaping/data/in-house/tests/fuzzed.tests
@@ -6,7 +6,7 @@
 ../fonts/8240789f6d12d4cfc4b5e8e6f246c3701bcf861f.ttf:--font-funcs=ot:U+0041:*
 ../fonts/b9e2aaa0d75fcef6971ec3a96d806ba4a6b31fe2.ttf:--font-funcs=ot:U+0041:*
 ../fonts/43979b90b2dd929723cf4fe1715990bcb9c9a56b.ttf:--font-funcs=ot:U+0041:*
-../fonts/3511ff5c1647150595846ac414c595cccac34f18.ttf:--font-funcs=ot 
--no-positions --no-clusters --no-glyph-names:U+0041:*
+../fonts/3511ff5c1647150595846ac414c595cccac34f18.ttf:--font-funcs=ot:U+0041:*
 
../fonts/fab39d60d758cb586db5a504f218442cd1395725.ttf:--font-funcs=ot:U+0041,U+0041:*
 ../fonts/205edd09bd3d141cc9580f650109556cc28b22cb.ttf:--font-funcs=ot:U+0041:*
 
../fonts/217a934cfe15c548b572c203dceb2befdf026462.ttf:--font-funcs=ot:U+0061,U+0061,U+0061:*
@@ -16,7 +16,7 @@
 ../fonts/b6acef662e0beb8d5fcf5b61c6b0ca69537b7402.ttf:--font-funcs=ot:U+0041:*
 ../fonts/e88c339237f52d21e01c55f01b9c1b4cc14a0467.ttf:--font-funcs=ot:U+0041:*
 ../fonts/243798dd281c1c77c065958e1ff467420faa9bde.ttf:--font-funcs=ot:U+0041:*
-../fonts/dd9f0c7c7c36f75a18be0cab1cddf8f3ab0f366b.ttf:--font-funcs=ot 
--no-positions --no-clusters --no-glyph-names:U+0041:*
+../fonts/dd9f0c7c7c36f75a18be0cab1cddf8f3ab0f366b.ttf:--font-funcs=ot:U+0041:*
 ../fonts/ef2511f215aa3ca847cbfffbf861793b42170875.ttf:--font-funcs=ot:U+0041:*
 ../fonts/9d8a94a67932a3ab75a596fc8b5c6d0392ca9e49.ttf:--font-funcs=ot:U+0041:*
 ../fonts/bbf4a308c402f0678c3e82844892a4da2ebe598f.ttf:--font-funcs=ot:U+0041:*
@@ -66,7 +66,7 @@
 
../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5656511058018304:--font-funcs=ot:U+0041:*
 
../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5659641787187200:--font-funcs=ot:U+0041:*
 
../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5668791174823936:--font-funcs=ot:U+0041:*
-../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-56722614077358084:--font-funcs=ot:U+0041:*
+../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5672261407735808:--font-funcs=ot:U+0041:*
 
../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5674361600606208:--font-funcs=ot:U+0041:*
 
../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5677421274071040:--font-funcs=ot:U+0041:*
 
../../../../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5679244475105280:--font-funcs=ot:U+0041:*
commit 98d4ad02b97628e5a9a7bfe3187ccc3851c00b18
Author: Behdad Esfahbod 
Date:   Tue Oct 16 15:17:31 2018 -0700

[fuzzing] One more

diff --git a/test/fuzzing/clusterfuzz-testcase-6107935408390144 
b/test/fuzzing/clusterfuzz-testcase-6107935408390144
new file mode 100644
index ..4c81a866
Binary files /dev/null and b/test/fuzzing/clusterfuzz-testcase-6107935408390144 
differ
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-16 Thread Behdad Esfahbod
 test/fuzzing/Makefile.am   
|1 
 test/fuzzing/fonts/clusterfuzz-testcase-5517117891805184   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-fuzzer-4666056377368576 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-fuzzer-5662671558934528 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-fuzzer-6243458541944832 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-fuzzer-6303297511096320 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-fuzzer-6696647723581440 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5746142327865344   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5750379279548416   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-4884742786777088 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-5255344882188288 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-5720051798769664 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-5924299061854208 
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-6460279560863744 
|binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-blink_harfbuzz_shaper_fuzzer-5099655095123968
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4523479581851648   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4535496598355968   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4595692015190016   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4687441845813248   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4706238090706944   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4769173588672512   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4827735151083520   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4841745322868736   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4884742786777088   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5216838347653120   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5255344882188288   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5294584596791296   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5303930168803328   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5331901587914752   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5388906574905344   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5517117891805184   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5617496443846656   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5672141338968064   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5700697074958336   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5720051798769664   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5924299061854208   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6023178755244032   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6111685556305920   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6160439919509504   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6260579246276608   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6264625609834496   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6424351550210048   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6460279560863744   
|binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6576177596596224   

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-14 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |5 +++--
 src/hb-aat-layout-kerx-table.hh |   10 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 40f2b9355cf827c7b82ea5e55b112ce0032a9abf
Author: Behdad Esfahbod 
Date:   Sun Oct 14 14:56:32 2018 -0700

[kerx] Fix Format1 sanitize

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10948

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 52923a8d..ae11963a 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -212,7 +212,9 @@ struct KerxSubTableFormat1
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
-return_trace (likely (machine.sanitize (c)));
+/* The rest of array sanitizations are done at run-time. */
+return_trace (likely (c->check_struct (this) &&
+ machine.sanitize (c)));
   }
 
   protected:
@@ -444,11 +446,9 @@ struct KerxSubTableFormat4
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
-
 /* The rest of array sanitizations are done at run-time. */
-return_trace (c->check_struct (this) &&
- machine.sanitize (c) &&
- flags.sanitize (c));
+return_trace (likely (c->check_struct (this) &&
+ machine.sanitize (c)));
   }
 
   protected:
commit 44af1f93ee32e236a5c14085c72d3fa102a14f5e
Author: Behdad Esfahbod 
Date:   Sun Oct 14 14:52:17 2018 -0700

[aat] Whitespace

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 4e3e4d17..eda5151c 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -224,7 +224,8 @@ struct LookupFormat8
   private:
   inline const T* get_value (hb_codepoint_t glyph_id) const
   {
-return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ? 
&valueArrayZ[glyph_id - firstGlyph] : nullptr;
+return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ?
+  &valueArrayZ[glyph_id - firstGlyph] : nullptr;
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
@@ -234,7 +235,7 @@ struct LookupFormat8
   }
 
   protected:
-  HBUINT16 format; /* Format identifier--format = 6 */
+  HBUINT16 format; /* Format identifier--format = 8 */
   GlyphID  firstGlyph; /* First glyph index included in the trimmed 
array. */
   HBUINT16 glyphCount; /* Total number of glyphs (equivalent to the 
last
 * glyph minus the value of firstGlyph plus 1). 
*/
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-13 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |   56 
 1 file changed, 23 insertions(+), 33 deletions(-)

New commits:
commit 6d4b054234b4736ca9927268ee3e2d9a0f8f6ead
Author: Behdad Esfahbod 
Date:   Sat Oct 13 12:20:33 2018 -0400

[kerx] Use sanitizer instead of handcoded runtime sanitization

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 2004e579..d65f3093 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -232,11 +232,9 @@ struct KerxSubTableFormat2
 unsigned int l = (this+leftClassTable).get_value_or_null (left, 
num_glyphs);
 unsigned int r = (this+rightClassTable).get_value_or_null (right, 
num_glyphs);
 unsigned int offset = l + r;
-const FWORD *v = &StructAtOffset (&(this+array), offset);
-if (unlikely ((const char *) v < (const char *) &array ||
- (const char *) v - (const char *) this > header.length - 
v->static_size))
-  return 0;
-return *v;
+const FWORD v = StructAtOffset (&(this+array), offset);
+if (unlikely (!v.sanitize (&c->sanitizer))) return 0;
+return v;
   }
 
   inline bool apply (hb_aat_apply_context_t *c) const
@@ -481,11 +479,9 @@ struct KerxSubTableFormat6
   unsigned int offset = l + r;
   if (unlikely (offset < l)) return 0; /* Addition overflow. */
   if (unlikely (hb_unsigned_mul_overflows (offset, sizeof (FWORD32 
return 0;
-  const FWORD32 *v = &StructAtOffset (&(this+t.array), offset * 
sizeof (FWORD32));
-  if (unlikely ((const char *) v < (const char *) &t.array ||
-   (const char *) v - (const char *) this > header.length - 
v->static_size))
-   return 0;
-  return *v;
+  const FWORD32 &v = StructAtOffset (&(this+t.array), offset * 
sizeof (FWORD32));
+  if (unlikely (!v.sanitize (&c->sanitizer))) return 0;
+  return v;
 }
 else
 {
@@ -493,11 +489,9 @@ struct KerxSubTableFormat6
   unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, 
num_glyphs);
   unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, 
num_glyphs);
   unsigned int offset = l + r;
-  const FWORD *v = &StructAtOffset (&(this+t.array), offset * 
sizeof (FWORD));
-  if (unlikely ((const char *) v < (const char *) &t.array ||
-   (const char *) v - (const char *) this > header.length - 
v->static_size))
-   return 0;
-  return *v;
+  const FWORD &v = StructAtOffset (&(this+t.array), offset * sizeof 
(FWORD));
+  if (unlikely (!v.sanitize (&c->sanitizer))) return 0;
+  return v;
 }
   }
 
commit 5733113662e668a25187e0042935d955e44fb488
Author: Behdad Esfahbod 
Date:   Sat Oct 13 12:16:12 2018 -0400

[kerx] Wire up context down to get_kerning

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index d59d6374..2004e579 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -226,8 +226,9 @@ struct KerxSubTableFormat1
 struct KerxSubTableFormat2
 {
   inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
- unsigned int num_glyphs) const
+ hb_aat_apply_context_t *c) const
   {
+unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
 unsigned int l = (this+leftClassTable).get_value_or_null (left, 
num_glyphs);
 unsigned int r = (this+rightClassTable).get_value_or_null (right, 
num_glyphs);
 unsigned int offset = l + r;
@@ -245,8 +246,7 @@ struct KerxSubTableFormat2
 if (!c->plan->requested_kerning)
   return false;
 
-accelerator_t accel (*this,
-c->sanitizer.get_num_glyphs ());
+accelerator_t accel (*this, c);
 hb_kern_machine_t machine (accel);
 machine.kern (c->font, c->buffer, c->plan->kern_mask);
 
@@ -264,16 +264,14 @@ struct KerxSubTableFormat2
   struct accelerator_t
   {
 const KerxSubTableFormat2 &table;
-unsigned int num_glyphs;
+hb_aat_apply_context_t *c;
 
 inline accelerator_t (const KerxSubTableFormat2 &table_,
- unsigned int num_glyphs_)
- : table (table_), num_glyphs (num_glyphs_) {}
+ hb_aat_apply_context_t *c_) :
+   table (table_), c (c_) {}
 
 inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
-{
-  return table.get_kerning (left, right, num_glyphs);
-}
+{ return table.get_kerning (left, right, c); }
   };
 
   protected:
@@ -472,8 +470,9 @@ struct KerxSubTableFormat6
   inline bool is_long (void) const { return flags & ValuesAreLong; }
 
   inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
- unsigned int num_glyphs) const
+ hb_aat_apply_context_t *c) const
   {
+unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
 if (is_long ())
 {
   const U::Long &t =

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-11 Thread Behdad Esfahbod
 test/shaping/data/in-house/Makefile.sources   
|1 +
 test/shaping/data/in-house/fonts/3c96e7a303c58475a8c750bf4289bbe73784f37d.ttf 
|binary
 test/shaping/data/in-house/tests/use-indic3.tests 
|1 +
 test/shaping/record-test.sh   
|5 +++--
 4 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 788e1478557603d30966f12449eef0d0bd51c880
Author: Behdad Esfahbod 
Date:   Thu Oct 11 19:24:52 2018 -0400

[test] Add test for USE indic3

diff --git a/test/shaping/data/in-house/Makefile.sources 
b/test/shaping/data/in-house/Makefile.sources
index f2402740..e66f0a65 100644
--- a/test/shaping/data/in-house/Makefile.sources
+++ b/test/shaping/data/in-house/Makefile.sources
@@ -46,6 +46,7 @@ TESTS = \
tests/tibetan-contractions-2.tests \
tests/tibetan-vowels.tests \
tests/use.tests \
+   tests/use-indic3.tests \
tests/use-marchen.tests \
tests/use-syllable.tests \
tests/variations-rvrn.tests \
diff --git 
a/test/shaping/data/in-house/fonts/3c96e7a303c58475a8c750bf4289bbe73784f37d.ttf 
b/test/shaping/data/in-house/fonts/3c96e7a303c58475a8c750bf4289bbe73784f37d.ttf
new file mode 100644
index ..cebd3757
Binary files /dev/null and 
b/test/shaping/data/in-house/fonts/3c96e7a303c58475a8c750bf4289bbe73784f37d.ttf 
differ
diff --git a/test/shaping/data/in-house/tests/use-indic3.tests 
b/test/shaping/data/in-house/tests/use-indic3.tests
new file mode 100644
index ..8c3ae139
--- /dev/null
+++ b/test/shaping/data/in-house/tests/use-indic3.tests
@@ -0,0 +1 @@
+../fonts/3c96e7a303c58475a8c750bf4289bbe73784f37d.ttf::U+0C95,U+0CCD,U+0CB0:[uni0C95=0+1176|uni0CB0_uni0CCD.blwf=0+275]
commit a11972787a2a90b541f92cc56bb885859390a0c0
Author: Behdad Esfahbod 
Date:   Thu Oct 11 19:23:36 2018 -0400

Minor

diff --git a/test/shaping/record-test.sh b/test/shaping/record-test.sh
index 93ebcfc9..4ab74f0f 100755
--- a/test/shaping/record-test.sh
+++ b/test/shaping/record-test.sh
@@ -3,8 +3,9 @@
 dir=`mktemp -d`
 
 out=/dev/stdout
-if test "x${1:0:3}" == 'x-o='; then
-   out=${1:3}
+if test "x$1" == 'x-o'; then
+   shift
+   out=$1
shift
 fi
 hb_shape=$1
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-11 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |   11 ---
 test/api/hb-subset-test.h   |6 ++
 test/api/test-multithread.c |5 +
 test/fuzzing/main.cc|2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit e940530c9723c3a581a5d5b31e5f419865dd6cc7
Author: Behdad Esfahbod 
Date:   Thu Oct 11 15:56:17 2018 -0400

[aat] Fix mul overflow

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10897

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 78a27a74..5be3d372 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -386,6 +386,8 @@ struct StateTable
 const HBUINT16 *states = (this+stateArrayTable).arrayZ;
 const Entry *entries = (this+entryTable).arrayZ;
 
+unsigned int num_classes = nClasses;
+
 unsigned int num_states = 1;
 unsigned int num_entries = 0;
 
@@ -393,13 +395,16 @@ struct StateTable
 unsigned int entry = 0;
 while (state < num_states)
 {
+  if (unlikely (hb_unsigned_mul_overflows (num_classes, 
states[0].static_size)))
+   return_trace (false);
+
   if (unlikely (!c->check_array (states,
 num_states,
-states[0].static_size * nClasses)))
+num_classes * states[0].static_size)))
return_trace (false);
   { /* Sweep new states. */
-   const HBUINT16 *stop = &states[num_states * nClasses];
-   for (const HBUINT16 *p = &states[state * nClasses]; p < stop; p++)
+   const HBUINT16 *stop = &states[num_states * num_classes];
+   for (const HBUINT16 *p = &states[state * num_classes]; p < stop; p++)
  num_entries = MAX (num_entries, *p + 1);
state = num_states;
   }
commit 1d995a340b9e17fc8dca7a3e88e0918de2d8f02c
Author: Behdad Esfahbod 
Date:   Thu Oct 11 15:42:54 2018 -0400

Minor

diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h
index 8f32d3db..5f5cd8d0 100644
--- a/test/api/hb-subset-test.h
+++ b/test/api/hb-subset-test.h
@@ -58,10 +58,8 @@ hb_subset_test_open_font (const char *font_path)
 
   hb_blob_t *blob = hb_blob_create_from_file (path);
   if (hb_blob_get_length (blob) == 0)
-  {
-printf ("The test font is not found.");
-exit (1);
-  }
+g_error ("Font not found.");
+
   hb_face_t *face = hb_face_create (blob, 0);
   hb_blob_destroy (blob);
 
diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c
index 779b762d..b651b399 100644
--- a/test/api/test-multithread.c
+++ b/test/api/test-multithread.c
@@ -149,10 +149,7 @@ main (int argc, char **argv)
 
   hb_blob_t *blob = hb_blob_create_from_file (path);
   if (hb_blob_get_length (blob) == 0)
-  {
-printf ("The test font is not found.");
-return 1;
-  }
+g_error ("Font not found.");
 
   hb_face_t *face = hb_face_create (blob, 0);
   font = hb_font_create (face);
diff --git a/test/fuzzing/main.cc b/test/fuzzing/main.cc
index b42d60c1..f15247cd 100644
--- a/test/fuzzing/main.cc
+++ b/test/fuzzing/main.cc
@@ -10,7 +10,7 @@ int main(int argc, char **argv) {
   const char *font_data = hb_blob_get_data (blob, &len);
   if (len == 0)
   {
-printf ("The test font is not found.");
+printf ("Font not found.\n");
 exit (1);
   }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-11 Thread Behdad Esfahbod
 src/hb-ot-shape.cc |   24 +---
 src/hb-ot-shape.hh |5 +++--
 2 files changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 0b9d60e1a1c4b7867ac907bbd7c004191a14e697
Author: Behdad Esfahbod 
Date:   Thu Oct 11 13:26:58 2018 -0400

[aat] Apply kerx if GPOS kern was not applied

Ned tells me this is what Apple does.

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 2b147e34..a5538871 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -100,17 +100,15 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
   else if (hb_aat_layout_has_positioning (face))
 plan.apply_kerx = true;
 
-  if (plan.requested_kerning)
+  if (plan.requested_kerning && !plan.apply_kerx && !has_gpos_kern)
   {
-if (plan.apply_kerx)
-  ;/* kerx supercedes kern. */
-else if (!has_gpos_kern)
-{
-  if (hb_ot_layout_has_kerning (face))
-plan.apply_kern = true;
-  else
-   plan.fallback_kerning = true;
-}
+/* Apparently Apple applies kerx if GPOS kern was not applied. */
+if (hb_aat_layout_has_positioning (face))
+  plan.apply_kerx = true;
+if (hb_ot_layout_has_kerning (face))
+  plan.apply_kern = true;
+else
+  plan.fallback_kerning = true;
   }
 
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
commit b59a428af08d6451a47f40ed01e594815ebf6303
Author: Behdad Esfahbod 
Date:   Thu Oct 11 13:24:17 2018 -0400

Minor

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 3ca54ac8..2b147e34 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -116,6 +116,9 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
   if (!plan.apply_gpos && !plan.apply_kerx)
 plan.fallback_mark_positioning = true;
+
+  /* Currently we always apply trak. */
+  plan.apply_trak = hb_aat_layout_has_tracking (face);
 }
 
 
@@ -838,7 +841,8 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
   else if (c->plan->apply_kerx)
 hb_aat_layout_position (c->plan, c->font, c->buffer);
 
-  hb_aat_layout_track (c->plan, c->font, c->buffer);
+  if (c->plan->apply_trak)
+hb_aat_layout_track (c->plan, c->font, c->buffer);
 
   if (!c->plan->apply_kerx)
 switch (c->plan->shaper->zero_width_marks)
diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh
index 4943c515..c9c0d3e0 100644
--- a/src/hb-ot-shape.hh
+++ b/src/hb-ot-shape.hh
@@ -50,10 +50,11 @@ struct hb_ot_shape_plan_t
   bool fallback_kerning : 1;
   bool fallback_mark_positioning : 1;
 
-  bool apply_morx : 1;
+  bool apply_gpos : 1;
   bool apply_kerx : 1;
   bool apply_kern : 1;
-  bool apply_gpos : 1;
+  bool apply_morx : 1;
+  bool apply_trak : 1;
 
 
   inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-10 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |   85 ++--
 src/hb-ot-kern-table.hh |7 +++
 src/hb-ot-shape.cc  |4 -
 src/hb-ot-shape.hh  |1 
 4 files changed, 67 insertions(+), 30 deletions(-)

New commits:
commit 5d34164d98f04816aafaa0abfc44cd899c7d70b3
Author: Behdad Esfahbod 
Date:   Wed Oct 10 18:14:41 2018 -0400

[kern/kerx] Fix offset base

Disable kern Format2.

Fix kerx Format2.  Manually tested this with Tamil MN font and it works:

$ HB_OPTIONS=aat ./hb-shape Tamil\ MN.ttc -u 0B94,0B95
[tgv_au=0+3435|tgc_ka=1@-75,0+1517]

 HB_OPTIONS=aat ./hb-shape Tamil\ MN.ttc -u 0B94,0B95 --features=-kern
[tgv_au=0+3510|tgc_ka=1+1592]

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index f5540b6e..2214265b 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -44,6 +44,22 @@ namespace AAT {
 using namespace OT;
 
 
+struct KerxSubTableHeader
+{
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+TRACE_SANITIZE (this);
+return_trace (likely (c->check_struct (this)));
+  }
+
+  public:
+  HBUINT32 length;
+  HBUINT32 coverage;
+  HBUINT32 tupleCount;
+  public:
+  DEFINE_SIZE_STATIC (12);
+};
+
 struct KerxSubTableFormat0
 {
   inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
@@ -76,10 +92,11 @@ struct KerxSubTableFormat0
   }
 
   protected:
+  KerxSubTableHeader   header;
   BinSearchArrayOf
-   pairs;  /* Sorted kern records. */
+   pairs;  /* Sorted kern records. */
   public:
-  DEFINE_SIZE_ARRAY (16, pairs);
+  DEFINE_SIZE_ARRAY (28, pairs);
 };
 
 struct KerxSubTableFormat1
@@ -104,10 +121,11 @@ struct KerxSubTableFormat1
   }
 
   protected:
+  KerxSubTableHeader   header;
   StateTable stateHeader;
   LOffsetTo >valueTable;
   public:
-  DEFINE_SIZE_STATIC (20);
+  DEFINE_SIZE_STATIC (32);
 };
 
 struct KerxSubTableFormat2
@@ -168,18 +186,18 @@ struct KerxSubTableFormat2
   };
 
   protected:
-  HBUINT32 rowWidth;   /* The width, in bytes, of a row in the table. 
*/
+  KerxSubTableHeader   header;
+  HBUINT32 rowWidth;   /* The width, in bytes, of a row in the 
table. */
   LOffsetTo >
-   leftClassTable; /* Offset from beginning of this subtable to
-* left-hand class table. */
+   leftClassTable; /* Offset from beginning of this 
subtable to
+* left-hand class table. */
   LOffsetTo >
-   rightClassTable;/* Offset from beginning of this subtable to
-* right-hand class table. */
-  LOffsetTo
-   array;  /* Offset from beginning of this subtable to
-* the start of the kerning array. */
+   rightClassTable;/* Offset from beginning of this 
subtable to
+* right-hand class table. */
+  LOffsetTo array;  /* Offset from beginning of this 
subtable to
+* the start of the kerning array. */
   public:
-  DEFINE_SIZE_STATIC (16);
+  DEFINE_SIZE_STATIC (28);
 };
 
 struct KerxSubTableFormat4
@@ -202,8 +220,9 @@ struct KerxSubTableFormat4
   }
 
   protected:
+  KerxSubTableHeader   header;
   public:
-  DEFINE_SIZE_STATIC (1);
+  DEFINE_SIZE_STATIC (12);
 };
 
 struct KerxSubTableFormat6
@@ -231,23 +250,24 @@ struct KerxSubTableFormat6
   }
 
   protected:
-  HBUINT32 flags;
-  HBUINT16 rowCount;
-  HBUINT16 columnCount;
+  KerxSubTableHeader   header;
+  HBUINT32 flags;
+  HBUINT16 rowCount;
+  HBUINT16 columnCount;
   LOffsetTo > rowIndexTable;
   LOffsetTo > columnIndexTable;
   LOffsetTo > kerningArray;
   LOffsetTo > kerningVector;
   public:
-  DEFINE_SIZE_STATIC (24);
+  DEFINE_SIZE_STATIC (36);
 };
 
 struct KerxTable
 {
   friend struct kerx;
 
-  inline unsigned int get_size (void) const { return length; }
-  inline unsigned int get_type (void) const { return coverage & SubtableType; }
+  inline unsigned int get_size (void) const { return u.header.length; }
+  inline unsigned int get_type (void) const { return u.header.coverage & 
SubtableType; }
 
   enum Coverage
   {
@@ -281,19 +301,16 @@ struct KerxTable
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
-if (!length.sanitize (c) ||
-   length < min_size ||
-   !c->check_range (this, length))
+if (!u.header.sanitize (c) ||
+   !c->check_range (this, u.header.length))
   return_trace (false);
 
 return_trace (dispatch (c));
   }
 
 protected:
-  HBUINT32 length;
-  HBUINT32 coverage;
-  HBUINT32 tupleCount;
   union {
+  KerxSubTableHeader   header;
   KerxSubTableFormat0  format0;
   

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-09 Thread Behdad Esfahbod
 src/hb-ft.cc|   25 ++---
 src/hb-mutex.hh |8 
 test/api/test-multithread.c |7 ++-
 3 files changed, 28 insertions(+), 12 deletions(-)

New commits:
commit be2f148da474d6dd30132c22dd467ea33a942edf
Author: Behdad Esfahbod 
Date:   Tue Oct 9 16:24:50 2018 -0400

[ft] Use mutex to lock access to FT_Face

Makes our FT-backed hb_font_t safe to use from multiple threads.  Still,
the underlying FT_Face should NOT be used from other threads by client
or other libraries.

Maybe I add a lock()/unlock() public API ala PangoFT2 and cairo-ft.
Maybe not.

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 90e8073b..18fb72a7 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -60,6 +60,7 @@
 
 struct hb_ft_font_t
 {
+  mutable hb_mutex_t lock;
   FT_Face ft_face;
   int load_flags;
   bool symbol; /* Whether selected cmap is symbol cmap. */
@@ -77,6 +78,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
   if (unlikely (!ft_font))
 return nullptr;
 
+  ft_font->lock.init ();
   ft_font->ft_face = ft_face;
   ft_font->symbol = symbol;
   ft_font->unref = unref;
@@ -105,6 +107,8 @@ _hb_ft_font_destroy (void *data)
   if (ft_font->unref)
 _hb_ft_face_destroy (ft_font->ft_face);
 
+  ft_font->lock.fini ();
+
   free (ft_font);
 }
 
@@ -172,6 +176,7 @@ hb_ft_get_nominal_glyph (hb_font_t *font HB_UNUSED,
 void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   unsigned int g = FT_Get_Char_Index (ft_font->ft_face, unicode);
 
   if (unlikely (!g))
@@ -206,6 +211,7 @@ hb_ft_get_nominal_glyphs (hb_font_t *font HB_UNUSED,
  void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   unsigned int done;
   for (done = 0;
done < count && (*first_glyph = FT_Get_Char_Index (ft_font->ft_face, 
*first_unicode));
@@ -229,6 +235,7 @@ hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED,
   void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   unsigned int g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, 
variation_selector);
 
   if (unlikely (!g))
@@ -248,6 +255,7 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* 
font_data,
void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   FT_Face ft_face = ft_font->ft_face;
   int load_flags = ft_font->load_flags;
   int mult = font->x_scale < 0 ? -1 : +1;
@@ -285,6 +293,7 @@ hb_ft_get_glyph_v_advance (hb_font_t *font,
   void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   FT_Fixed v;
 
   if (unlikely (FT_Get_Advance (ft_font->ft_face, glyph, ft_font->load_flags | 
FT_LOAD_VERTICAL_LAYOUT, &v)))
@@ -307,6 +316,7 @@ hb_ft_get_glyph_v_origin (hb_font_t *font,
  void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   FT_Face ft_face = ft_font->ft_face;
 
   if (unlikely (FT_Load_Glyph (ft_face, glyph, ft_font->load_flags)))
@@ -333,6 +343,7 @@ hb_ft_get_glyph_extents (hb_font_t *font,
 void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   FT_Face ft_face = ft_font->ft_face;
 
   if (unlikely (FT_Load_Glyph (ft_face, glyph, ft_font->load_flags)))
@@ -365,6 +376,7 @@ hb_ft_get_glyph_contour_point (hb_font_t *font HB_UNUSED,
   void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   FT_Face ft_face = ft_font->ft_face;
 
   if (unlikely (FT_Load_Glyph (ft_face, glyph, ft_font->load_flags)))
@@ -390,8 +402,10 @@ hb_ft_get_glyph_name (hb_font_t *font HB_UNUSED,
  void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
+  FT_Face ft_face = ft_font->ft_face;
 
-  hb_bool_t ret = !FT_Get_Glyph_Name (ft_font->ft_face, glyph, name, size);
+  hb_bool_t ret = !FT_Get_Glyph_Name (ft_face, glyph, name, size);
   if (ret && (size && !*name))
 ret = false;
 
@@ -406,6 +420,7 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
   void *user_data HB_UNUSED)
 {
   const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
+  hb_lock_t lock (ft_font->lock);
   FT_Face ft_face = ft_font->ft_face;
 
   if (len < 0)
@@ -438,6 +453,7 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
  void *user_data HB_UNU

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-09 Thread Behdad Esfahbod
 src/hb-font.cc|   39 +-
 src/hb-ot-shape-complex-arabic.cc |2 -
 2 files changed, 27 insertions(+), 14 deletions(-)

New commits:
commit 7003b601afd02b0ba7e839510a7d0b886da09aaa
Author: Behdad Esfahbod 
Date:   Tue Oct 9 15:55:26 2018 -0400

Minor

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 2cdd7ba8..0e011e25 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -599,7 +599,7 @@ postprocess_glyphs_arabic (const hb_ot_shape_plan_t *plan,
   HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
 }
 
-/* https://unicode.org/reports/tr53/tr53-1.pdf */
+/* http://www.unicode.org/reports/tr53/ */
 
 static hb_codepoint_t
 modifier_combining_marks[] =
commit 07899435b8065d494e563f83e0a35300c828eefe
Author: Behdad Esfahbod 
Date:   Tue Oct 9 15:39:51 2018 -0400

Install ot-funcs on newly created funcs

**Finally**!  Casual users can stop caring about font-funcs completely now,
like they haven't been needing to care re unicode-funcs for a few years.

diff --git a/src/hb-font.cc b/src/hb-font.cc
index fcf86f07..fd0e097a 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -31,6 +31,8 @@
 #include "hb-font.hh"
 #include "hb-machinery.hh"
 
+#include "hb-ot.h"
+
 
 /*
  * hb_font_funcs_t
@@ -1304,18 +1306,8 @@ DEFINE_NULL_INSTANCE (hb_font_t) =
 };
 
 
-/**
- * hb_font_create: (Xconstructor)
- * @face: a face.
- *
- * 
- *
- * Return value: (transfer full): 
- *
- * Since: 0.9.2
- **/
-hb_font_t *
-hb_font_create (hb_face_t *face)
+static hb_font_t *
+_hb_font_create (hb_face_t *face)
 {
   hb_font_t *font;
 
@@ -1335,6 +1327,27 @@ hb_font_create (hb_face_t *face)
 }
 
 /**
+ * hb_font_create: (Xconstructor)
+ * @face: a face.
+ *
+ * 
+ *
+ * Return value: (transfer full): 
+ *
+ * Since: 0.9.2
+ **/
+hb_font_t *
+hb_font_create (hb_face_t *face)
+{
+  hb_font_t *font = _hb_font_create (face);
+
+  /* Install our in-house, very lightweight, funcs. */
+  hb_ot_font_set_funcs (font);
+
+  return font;
+}
+
+/**
  * hb_font_create_sub_font:
  * @parent: parent font.
  *
@@ -1350,7 +1363,7 @@ hb_font_create_sub_font (hb_font_t *parent)
   if (unlikely (!parent))
 parent = hb_font_get_empty ();
 
-  hb_font_t *font = hb_font_create (parent->face);
+  hb_font_t *font = _hb_font_create (parent->face);
 
   if (unlikely (hb_object_is_inert (font)))
 return font;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-09 Thread Behdad Esfahbod
 src/hb-font.cc  |   10 +-
 src/hb-font.h   |8 
 src/hb-font.hh  |6 +++---
 src/hb-ft.cc|2 +-
 src/hb-ot-font.cc   |4 ++--
 src/hb-ot-shape-fallback.cc |   42 +-
 6 files changed, 36 insertions(+), 36 deletions(-)

New commits:
commit e4f27f368f8f0509fa47f6a28f3984e90b40588f
Author: Behdad Esfahbod 
Date:   Tue Oct 9 08:20:10 2018 -0400

Try fixing older bots

diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index bf1fc8fb..556c3408 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -435,33 +435,33 @@ _hb_ot_shape_fallback_mark_position (const 
hb_ot_shape_plan_t *plan,
 }
 
 
+struct hb_ot_shape_fallback_kern_driver_t
+{
+  hb_ot_shape_fallback_kern_driver_t (hb_font_t   *font_,
+ hb_buffer_t *buffer) :
+font (font_), direction (buffer->props.direction) {}
+
+  hb_position_t get_kerning (hb_codepoint_t first, hb_codepoint_t second) const
+  {
+hb_position_t kern = 0;
+font->get_glyph_kerning_for_direction (first, second,
+  direction,
+  &kern, &kern);
+return kern;
+  }
+
+  hb_font_t *font;
+  hb_direction_t direction;
+};
+
 /* Performs font-assisted kerning. */
 void
 _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
 {
-  struct driver_t
-  {
-driver_t (hb_font_t   *font_,
- hb_buffer_t *buffer) :
-  font (font_), direction (buffer->props.direction) {}
-
-hb_position_t get_kerning (hb_codepoint_t first, hb_codepoint_t second) 
const
-{
-  hb_position_t kern = 0;
-  font->get_glyph_kerning_for_direction (first, second,
-direction,
-&kern, &kern);
-  return kern;
-}
-
-hb_font_t *font;
-hb_direction_t direction;
-  } driver (font, buffer);
-
-  hb_kern_machine_t machine (driver);
-
+  hb_ot_shape_fallback_kern_driver_t driver (font, buffer);
+  hb_kern_machine_t machine (driver);
   machine.kern (font, buffer, plan->kern_mask);
 }
 
commit bee93e269711a3eda4e7d762b730522564fe6e87
Author: Behdad Esfahbod 
Date:   Tue Oct 9 08:01:49 2018 -0400

Add const to get_*_advances API

Ouch!

diff --git a/src/hb-font.cc b/src/hb-font.cc
index f4f2df7c..fa5e6614 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -179,7 +179,7 @@ static void
 hb_font_get_glyph_h_advances_default (hb_font_t* font,
  void* font_data HB_UNUSED,
  unsigned int count,
- hb_codepoint_t *first_glyph,
+ const hb_codepoint_t *first_glyph,
  unsigned int glyph_stride,
  hb_position_t *first_advance,
  unsigned int advance_stride,
@@ -211,7 +211,7 @@ static void
 hb_font_get_glyph_v_advances_default (hb_font_t* font,
  void* font_data HB_UNUSED,
  unsigned int count,
- hb_codepoint_t *first_glyph,
+ const hb_codepoint_t *first_glyph,
  unsigned int glyph_stride,
  hb_position_t *first_advance,
  unsigned int advance_stride,
@@ -808,7 +808,7 @@ hb_font_get_glyph_v_advance (hb_font_t *font,
 void
 hb_font_get_glyph_h_advances (hb_font_t* font,
  unsigned count,
- hb_codepoint_t *first_glyph,
+ const hb_codepoint_t *first_glyph,
  unsigned glyph_stride,
  hb_position_t *first_advance,
  unsigned advance_stride)
@@ -826,7 +826,7 @@ hb_font_get_glyph_h_advances (hb_font_t* font,
 void
 hb_font_get_glyph_v_advances (hb_font_t* font,
  unsigned count,
- hb_codepoint_t *first_glyph,
+ const hb_codepoint_t *first_glyph,
  unsigned glyph_stride,
  hb_position_t *first_advance,
  unsigned advance_stride)
@@ -1053,7 +1053,7 @@ HB_EXTERN void
 hb_font_get_glyph_advances_for_direction (hb_font_t* font,
  hb_direction_t direction,
  unsigned count,
- hb_codepoint_t *first_glyph,
+ const hb_codepoint_t *first_glyph

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-08 Thread Behdad Esfahbod
 src/hb-icu.cc   |4 ++--
 test/api/test-set.c |4 
 2 files changed, 2 insertions(+), 6 deletions(-)

New commits:
commit b2fbe55b828ea5864bc0aed54db7109a2e189de2
Author: Behdad Esfahbod 
Date:   Tue Oct 9 01:07:36 2018 -0400

[icu] Unbreak

diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index 83a15e7f..e012314b 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -311,8 +311,8 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : 
hb_unicode_funcs_lazy_loader_
 hb_unicode_funcs_set_general_category_func (funcs, 
hb_icu_unicode_general_category, nullptr, nullptr);
 hb_unicode_funcs_set_mirroring_func (funcs, hb_icu_unicode_mirroring, 
nullptr, nullptr);
 hb_unicode_funcs_set_script_func (funcs, hb_icu_unicode_script, nullptr, 
nullptr);
-hb_unicode_funcs_set_compose_func (funcs, hb_icu_unicode_compose, nullptr, 
nullptr);
-hb_unicode_funcs_set_decompose_func (funcs, hb_icu_unicode_decompose, 
nullptr, nullptr);
+hb_unicode_funcs_set_compose_func (funcs, hb_icu_unicode_compose, 
user_data, nullptr);
+hb_unicode_funcs_set_decompose_func (funcs, hb_icu_unicode_decompose, 
user_data, nullptr);
 
 hb_unicode_funcs_make_immutable (funcs);
 
commit a353c1768dc1d7934b8ac293761620f561304bb2
Author: Behdad Esfahbod 
Date:   Tue Oct 9 01:05:28 2018 -0400

Remove test for deprecated hb_set_invert()

diff --git a/test/api/test-set.c b/test/api/test-set.c
index eb2f22ec..1382adaa 100644
--- a/test/api/test-set.c
+++ b/test/api/test-set.c
@@ -381,10 +381,6 @@ test_set_empty (void)
 
   test_empty (b);
 
-  hb_set_invert (b);
-
-  test_empty (b);
-
   g_assert (!hb_set_allocation_successful (b));
 
   hb_set_clear (b);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-03 Thread Behdad Esfahbod
 azure-pipelines.yml   
|   10 --
 test/shaping/data/in-house/Makefile.sources   
|2 +-
 test/shaping/data/in-house/fonts/3cf6f8ac6d647473a43a3100e7494b202b2cfafe.ttf 
|binary
 test/shaping/data/in-house/tests/emoji-flag-tags.tests
|2 --
 test/shaping/data/in-house/tests/emoji.tests  
|4 
 5 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 81f5eb09eca010337ffb3369000a3d5c1e8e2cda
Author: Behdad Esfahbod 
Date:   Wed Oct 3 21:30:48 2018 +0200

Add emoji test for recent work

diff --git a/test/shaping/data/in-house/Makefile.sources 
b/test/shaping/data/in-house/Makefile.sources
index 293bb14f..1f7eff20 100644
--- a/test/shaping/data/in-house/Makefile.sources
+++ b/test/shaping/data/in-house/Makefile.sources
@@ -12,7 +12,7 @@ TESTS = \
tests/context-matching.tests \
tests/cursive-positioning.tests \
tests/default-ignorables.tests \
-   tests/emoji-flag-tags.tests \
+   tests/emoji.tests \
tests/fallback-positioning.tests \
tests/fuzzed.tests \
tests/hangul-jamo.tests \
diff --git 
a/test/shaping/data/in-house/fonts/3cf6f8ac6d647473a43a3100e7494b202b2cfafe.ttf 
b/test/shaping/data/in-house/fonts/3cf6f8ac6d647473a43a3100e7494b202b2cfafe.ttf
new file mode 100644
index ..63c0c71b
Binary files /dev/null and 
b/test/shaping/data/in-house/fonts/3cf6f8ac6d647473a43a3100e7494b202b2cfafe.ttf 
differ
diff --git a/test/shaping/data/in-house/tests/emoji-flag-tags.tests 
b/test/shaping/data/in-house/tests/emoji-flag-tags.tests
deleted file mode 100644
index 189de55a..
--- a/test/shaping/data/in-house/tests/emoji-flag-tags.tests
+++ /dev/null
@@ -1,2 +0,0 @@
-../fonts/53374c7ca3657be37efde7ed02ae34229a56ae1f.ttf::U+1F3F4,U+E0055,U+E0053,U+E0064,U+E0065,U+E007F:[u1F3F4=0+2126|space=1+0|space=2+0|space=3+0|space=4+0|space=5+0]
-../fonts/53374c7ca3657be37efde7ed02ae34229a56ae1f.ttf::U+1F3F4,U+E0064,U+E0065,U+E007F:[de=0+3200]
diff --git a/test/shaping/data/in-house/tests/emoji.tests 
b/test/shaping/data/in-house/tests/emoji.tests
new file mode 100644
index ..8d9b2541
--- /dev/null
+++ b/test/shaping/data/in-house/tests/emoji.tests
@@ -0,0 +1,4 @@
+../fonts/53374c7ca3657be37efde7ed02ae34229a56ae1f.ttf::U+1F3F4,U+E0055,U+E0053,U+E0064,U+E0065,U+E007F:[u1F3F4=0+2126|space=1+0|space=2+0|space=3+0|space=4+0|space=5+0]
+../fonts/53374c7ca3657be37efde7ed02ae34229a56ae1f.ttf::U+1F3F4,U+E0064,U+E0065,U+E007F:[de=0+3200]
+../fonts/3cf6f8ac6d647473a43a3100e7494b202b2cfafe.ttf:--font-funcs=ot 
--direction=l:U+1F481,U+1F3FB,U+200D,U+2642,U+FE0F:[gid7=0+2550]
+../fonts/3cf6f8ac6d647473a43a3100e7494b202b2cfafe.ttf:--font-funcs=ot 
--direction=r:U+1F481,U+1F3FB,U+200D,U+2642,U+FE0F:[gid7=0+2550]
commit 9e2824cca0e42a53fafda7b2feb095986df40675
Author: Ebrahim Byagowi 
Date:   Wed Oct 3 22:49:02 2018 +0330

[ci] Delete azure-pipelines

End of experiment, we might get back to it later

diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 08f33ae7..
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-pool:
-  vmImage: 'Ubuntu 16.04'
-
-steps:
-- script: |
-sudo apt install -y gcc binutils libtool autoconf automake make pkg-config 
gtk-doc-tools ragel libfreetype6-dev libfontconfig1-dev libglib2.0-dev 
libcairo2-dev libicu-dev libgraphite2-dev python python-pip
-./autogen.sh --with-freetype --with-glib --with-cairo --with-icu 
--with-graphite2 --with-fontconfig
-make -j32
-make check
-  displayName: 'make'
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-03 Thread Behdad Esfahbod
 .circleci/config.yml  
|4 
 src/dump-emoji.cc 
|   19 
 src/gen-use-table.py  
|7 
 src/hb-ot-shape-complex-use-machine.hh
|  518 +-
 src/hb-ot-shape-complex-use-machine.rl
|9 
 src/hb-ot-shape-complex-use-table.cc  
|4 
 src/hb-ot-shape-complex-use.hh
|5 
 src/hb-ucdn.cc
|3 
 src/test-unicode-ranges.cc
|4 
 test/fuzzing/hb-subset-fuzzer.cc  
|   32 
 test/shaping/data/in-house/fonts/28f497629c04ceb15546c9a70e0730125ed6698d.ttf 
|binary
 test/shaping/data/in-house/tests/use-syllable.tests   
|3 
 util/ansi-print.cc
|4 
 13 files changed, 337 insertions(+), 275 deletions(-)

New commits:
commit 75114e01d29b90f72a9398ed5dbc4298aba5a6b8
Author: Behdad Esfahbod 
Date:   Wed Oct 3 12:29:56 2018 +0200

[use] Add Halant_Or_Vowel_Modifier category

Fixes https://github.com/harfbuzz/harfbuzz/issues/1102

diff --git a/src/gen-use-table.py b/src/gen-use-table.py
index 2afbc760..ebfae6fa 100755
--- a/src/gen-use-table.py
+++ b/src/gen-use-table.py
@@ -197,7 +197,10 @@ def is_CONS_SUB(U, UISC, UGC):
 def is_CONS_WITH_STACKER(U, UISC, UGC):
return UISC == Consonant_With_Stacker
 def is_HALANT(U, UISC, UGC):
-   return UISC in [Virama, Invisible_Stacker]
+   return UISC in [Virama, Invisible_Stacker] and not 
is_HALANT_OR_VOWEL_MODIFIER(U, UISC, UGC)
+def is_HALANT_OR_VOWEL_MODIFIER(U, UISC, UGC):
+   # https://github.com/harfbuzz/harfbuzz/issues/1102
+   return U == 0x11046
 def is_HALANT_NUM(U, UISC, UGC):
return UISC == Number_Joiner
 def is_ZWNJ(U, UISC, UGC):
@@ -248,6 +251,7 @@ use_mapping = {
'SUB':  is_CONS_SUB,
'CS':   is_CONS_WITH_STACKER,
'H':is_HALANT,
+   'HVM':  is_HALANT_OR_VOWEL_MODIFIER,
'HN':   is_HALANT_NUM,
'ZWNJ': is_ZWNJ,
'ZWJ':  is_ZWJ,
@@ -295,6 +299,7 @@ use_positions = {
'Blw': [Bottom],
},
'H': None,
+   'HVM': None,
'B': None,
'FM': None,
'SUB': None,
diff --git a/src/hb-ot-shape-complex-use-machine.hh 
b/src/hb-ot-shape-complex-use-machine.hh
index e7caca5a..c9410e4e 100644
--- a/src/hb-ot-shape-complex-use-machine.hh
+++ b/src/hb-ot-shape-complex-use-machine.hh
@@ -36,227 +36,266 @@
 
 #line 38 "hb-ot-shape-complex-use-machine.hh"
 static const unsigned char _use_syllable_machine_trans_keys[] = {
-   12u, 12u, 1u, 15u, 1u, 1u, 12u, 12u, 0u, 43u, 21u, 21u, 8u, 39u, 8u, 
39u, 
-   1u, 15u, 1u, 1u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 
-   8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 
-   8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u, 4u, 4u, 13u, 13u, 8u, 
39u, 
-   8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 
-   8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 
-   8u, 39u, 1u, 15u, 12u, 12u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u, 42u, 
42u, 
-   1u, 5u, 0
+   12u, 44u, 1u, 15u, 1u, 1u, 12u, 44u, 0u, 44u, 21u, 21u, 8u, 44u, 8u, 
44u,
+   1u, 15u, 1u, 1u, 8u, 44u, 8u, 44u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u,
+   8u, 39u, 8u, 39u, 8u, 39u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u,
+   8u, 44u, 8u, 44u, 8u, 44u, 1u, 39u, 8u, 44u, 13u, 21u, 4u, 4u, 13u, 13u,
+   8u, 44u, 8u, 44u, 8u, 44u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u,
+   8u, 39u, 8u, 39u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u,
+   8u, 44u, 8u, 44u, 1u, 39u, 1u, 15u, 12u, 44u, 1u, 44u, 8u, 44u, 21u, 
42u,
+   41u, 42u, 42u, 42u, 1u, 5u, 0
 };
 
 static const char _use_syllable_machine_key_spans[] = {
-   1, 15, 1, 1, 44, 1, 32, 32, 
-   15, 1, 32, 32, 32, 19, 19, 19, 
-   32, 32, 32, 32, 32, 32, 32, 32, 
-   32, 32, 32, 32, 9, 1, 1, 32, 
-   32, 32, 32, 19, 19, 19, 32, 32, 
-   32, 32, 32, 32, 32, 32, 32, 32, 
-   32, 15, 1, 39, 32, 22, 2, 1, 
-   5
+   33, 15, 1, 33, 45, 1, 37, 37,
+   15, 1, 37, 37, 32, 19, 19, 19,
+   32, 32, 32, 37, 37, 37, 37, 37,
+   37, 37, 37, 39, 37, 9, 1, 1,
+   37, 37, 37, 32, 19, 19, 19, 32,
+   32, 32, 37, 37, 37, 37, 37, 37,
+   37, 37, 39, 15, 33, 44, 37, 22,
+   2, 1, 5
 };
 
 static const short _use_syllable_machine_index_offsets[] = {
-   0, 2, 18, 20, 22, 67, 69, 102, 
-   135, 151, 153, 186, 219, 252, 272, 292, 
-   312, 345, 378, 411, 444, 477, 510, 543, 
-   576, 609, 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-02 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh |3 ---
 src/hb-ot-layout-gsubgpos.hh   |   38 +++---
 2 files changed, 23 insertions(+), 18 deletions(-)

New commits:
commit 9efddb9de821fc909a3ea8354f3dfd39c823e97b
Author: Behdad Esfahbod 
Date:   Tue Oct 2 16:05:26 2018 +0200

Treat a base+mark... ligature as base, not ligature

Fixes https://github.com/harfbuzz/harfbuzz/issues/746

diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index da023eab..bdaf35a9 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -856,7 +856,11 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
 
   buffer->merge_clusters (buffer->idx, buffer->idx + match_length);
 
-  /* - If all components of the ligature were marks, we call this a mark 
ligature.
+  /* - If a base and one or more marks ligate, consider that as a base, NOT
+   *   ligature, such that all following marks can still attach to it.
+   *   https://github.com/harfbuzz/harfbuzz/issues/1109
+   *
+   * - If all components of the ligature were marks, we call this a mark 
ligature.
*   If it *is* a mark ligature, we don't allocate a new ligature id, and 
leave
*   the ligature to keep its old ligature id.  This will allow it to attach 
to
*   a base ligature in GPOS.  Eg. if the sequence is: 
LAM,LAM,SHADDA,FATHA,HEH,
@@ -884,21 +888,24 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
*   https://bugzilla.gnome.org/show_bug.cgi?id=437633
*/
 
-  bool is_mark_ligature =  true;
-  for (unsigned int i = 0; i < count; i++)
+  bool is_base_ligature = _hb_glyph_info_is_base_glyph 
(&buffer->info[match_positions[0]]);
+  bool is_mark_ligature = _hb_glyph_info_is_mark 
(&buffer->info[match_positions[0]]);
+  for (unsigned int i = 1; i < count; i++)
 if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]]))
 {
+  is_base_ligature = false;
   is_mark_ligature = false;
   break;
 }
+  bool is_ligature = !is_base_ligature && !is_mark_ligature;
 
-  unsigned int klass = is_mark_ligature ? 0 : 
HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
-  unsigned int lig_id = is_mark_ligature ? 0 : _hb_allocate_lig_id (buffer);
+  unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0;
+  unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0;
   unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
   unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps 
(&buffer->cur());
   unsigned int components_so_far = last_num_components;
 
-  if (!is_mark_ligature)
+  if (is_ligature)
   {
 _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, 
total_component_count);
 if (_hb_glyph_info_get_general_category (&buffer->cur()) == 
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
@@ -912,7 +919,8 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
   {
 while (buffer->idx < match_positions[i] && buffer->successful)
 {
-  if (!is_mark_ligature) {
+  if (is_ligature)
+  {
 unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
if (this_comp == 0)
  this_comp = last_num_components;
commit 3cca978723db43233d25402254d297dfccf991a3
Author: Behdad Esfahbod 
Date:   Tue Oct 2 15:02:16 2018 +0200

Move code around

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 7e36e063..b664f15a 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -762,7 +762,6 @@ struct Ligature
   return_trace (true);
 }
 
-bool is_mark_ligature = false;
 unsigned int total_component_count = 0;
 
 unsigned int match_length = 0;
@@ -774,7 +773,6 @@ struct Ligature
  nullptr,
  &match_length,
  match_positions,
- &is_mark_ligature,
  &total_component_count)))
   return_trace (false);
 
@@ -783,7 +781,6 @@ struct Ligature
  match_positions,
  match_length,
  ligGlyph,
- is_mark_ligature,
  total_component_count);
 
 return_trace (true);
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 5dd4c3da..da023eab 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -731,7 +731,6 @@ static inline bool match_input (hb_ot_apply_context_t *c,
const void *match_data,
unsigned int *end_offset,
unsigned int 
match_positions[HB_MAX_CONTEXT_LENGTH],
-   bool *p_is_mark_ligature = nullptr,
unsigned int *p_total_component_count = nullptr)
 {
   TRACE_APPLY (nullptr);
@@ -768,8 +767,6 @@ static inline bool match_input (hb_ot_apply_context_t *c,
* 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-10-01 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-use.cc |2 +-
 test/shaping/hb_test_tools.py  |4 
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit eb1e60287732ede6040ce6f7498c10909448d248
Author: Behdad Esfahbod 
Date:   Mon Oct 1 15:31:50 2018 +0200

[test] Try import unicodedata2 as unicodedata

diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py
index 8348dc26..c9a44033 100644
--- a/test/shaping/hb_test_tools.py
+++ b/test/shaping/hb_test_tools.py
@@ -4,6 +4,10 @@ from __future__ import print_function, division, 
absolute_import
 
 import sys, os, re, difflib, unicodedata, errno, cgi
 from itertools import *
+try:
+   import unicodedata2 as unicodedata
+except Exception:
+   pass
 
 diff_symbols = "-+=*&^%$#@!~/"
 diff_colors = ['red', 'green', 'blue']
commit 81afdbe803ca949d915d03cab4a6ed6c6e6ff304
Author: Behdad Esfahbod 
Date:   Mon Oct 1 15:01:04 2018 +0200

[use] Disable automatic ZWJ for 'akhn' feature

Fixes https://github.com/harfbuzz/harfbuzz/issues/746

diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index 0ca088ba..929d60d9 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -132,7 +132,7 @@ collect_features_use (hb_ot_shape_planner_t *plan)
   map->enable_feature (HB_TAG('l','o','c','l'));
   map->enable_feature (HB_TAG('c','c','m','p'));
   map->enable_feature (HB_TAG('n','u','k','t'));
-  map->enable_feature (HB_TAG('a','k','h','n'));
+  map->add_feature (HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_ZWJ);
 
   /* "Reordering group" */
   map->add_gsub_pause (clear_substitution_flags);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-25 Thread Behdad Esfahbod
 .circleci/config.yml |   17 +
 src/hb-coretext.cc   |4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 824111d4842b9a7bbbdcd147325f8f372ed3d37c
Author: Behdad Esfahbod 
Date:   Tue Sep 25 12:47:37 2018 -0400

Fix iOS build

Fixes https://github.com/harfbuzz/harfbuzz/pull/1179

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index f921e3a0..8b120aac 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -210,7 +210,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
   }
 
   CFURLRef original_url = nullptr;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+#if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1060
   ATSFontRef atsFont;
   FSRef fsref;
   OSStatus status;
@@ -240,7 +240,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
* process in Blink. This can be detected by the new file URL location
* that the newly found font points to. */
   CFURLRef new_url = nullptr;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+#if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1060
   atsFont = CTFontGetPlatformFont (new_ct_font, NULL);
   status = ATSFontGetFileReference (atsFont, &fsref);
   if (status == noErr)
commit 4b4be7701f635f8378e7f868cfbe8d4571fc841f
Author: Ebrahim Byagowi 
Date:   Tue Sep 25 09:24:35 2018 +0330

[circle] Add an obsessive clang bot (#1178)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3bf1977a..ec8abd92 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -79,6 +79,22 @@ jobs:
   - run: make
   - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || 
.ci/fail.sh
 
+  clang-everything:
+docker:
+  - image: ubuntu:18.10
+steps:
+  - checkout
+  - run: apt update || true; apt install -y wget gnupg
+  - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key 
add -
+  - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" 
> /etc/apt/sources.list.d/llvmdev.list
+  - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic 
main" > /etc/apt/sources.list.d/llvmdevsrc.list
+  - run: apt update || true
+  - run: apt install -y clang lld binutils libtool autoconf automake make 
pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev 
libicu-dev libgraphite2-dev python python-pip
+  - run: pip install fonttools
+  - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual 
-Wno-sign-conversion -Wno-conversion" CXXFLAGS="-Weverything 
-Wno-old-style-cast -Wno-documentation -Wno-conversion -Wno-sign-conversion 
-Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic 
-Wno-documentation-unknown-command -Wno-padded -Wno-shift-sign-overflow 
-Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro 
-Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow 
-Wno-used-but-marked-unused -Wno-format-pedantic 
-Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion 
-Wno-covered-switch-default -Wno-conditional-uninitialized 
-Wno-unreachable-code -Wno-unused-macros -Wno-float-equal 
-Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype 
--with-glib --with-cairo --with-icu --with-graphite2
+  - run: make
+  - run: make check || .ci/fail.sh
+
   clang-asan:
 docker:
   - image: ubuntu:18.10
@@ -264,6 +280,7 @@ workflows:
   - alpine-O3-NOMMAP
   - archlinux-debug-O0-py3
   - clang-O3-O0
+  - clang-everything
   - clang-asan
   #- clang-msan # https://github.com/harfbuzz/harfbuzz/issues/1175
   - clang-tsan
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-24 Thread Behdad Esfahbod
 src/hb-ot-shape-normalize.cc |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 7f335390f3a498119319a0e6c3ce7656a3902066
Author: Behdad Esfahbod 
Date:   Mon Sep 24 09:56:18 2018 -0400

Revert change that would decompose text if GPOS mark feature is available

https://github.com/harfbuzz/harfbuzz/issues/653#issuecomment-423905920

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 90b76404..2f0cba18 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -297,7 +297,9 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
   if (mode == HB_OT_SHAPE_NORMALIZATION_MODE_AUTO)
   {
 if (plan->has_mark)
-  mode = HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED;
+  // https://github.com/harfbuzz/harfbuzz/issues/653#issuecomment-423905920
+  //mode = HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED;
+  mode = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 else
   mode = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
   }
commit a6f4b2f7cd088aeb44e1aac672434641f4f9e484
Author: Behdad Esfahbod 
Date:   Mon Sep 24 09:54:37 2018 -0400

Fix normalization


https://github.com/harfbuzz/harfbuzz/commit/62d1e0852a5549a1b510ad46a4b89f12730bb708#commitcomment-30613091

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 487fd96a..90b76404 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -385,7 +385,6 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
 
   if (mode == HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS ||
   mode == 
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT)
-return;
   {
 /* As noted in the comment earlier, we don't try to combine
  * ccc=0 chars with their previous Starter. */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-23 Thread Behdad Esfahbod
 src/hb-ot-layout-gsubgpos.hh   |   23 ---
 src/hb-ot-shape-complex-indic.cc   |   21 -
 src/hb-ot-shape-complex-khmer.cc   |   21 ++---
 src/hb-ot-shape-complex-myanmar.cc |   15 ++-
 src/hb-ot-shape-complex-use.cc |   15 +--
 5 files changed, 69 insertions(+), 26 deletions(-)

New commits:
commit 3583fb03b14a10ec5ab5f9c480e150934101fd0b
Author: Behdad Esfahbod 
Date:   Sun Sep 23 22:33:38 2018 -0400

Simplify ZWJ-skipping a bit

Towards disabling ZWJ-skipping in certain GPOS contexts.

Part of https://github.com/flutter/flutter/issues/16886

diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 6ff19e23..031b39b9 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -344,10 +344,10 @@ struct hb_ot_apply_context_t :
   match_glyph_data = nullptr;
   matcher.set_match_func (nullptr, nullptr);
   matcher.set_lookup_props (c->lookup_props);
-  /* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
+  /* Ignore ZWNJ if we are matching GPOS, or matching GSUB context and 
asked to. */
   matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && 
c->auto_zwnj));
-  /* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if 
asked to. */
-  matcher.set_ignore_zwj  (c->table_index == 1 || (context_match || 
c->auto_zwj));
+  /* Ignore ZWJ if we are matching context, or asked to. */
+  matcher.set_ignore_zwj  (context_match || c->auto_zwj);
   matcher.set_mask (context_match ? -1 : c->lookup_mask);
 }
 inline void set_lookup_props (unsigned int lookup_props)
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 369078cb..c1aa1d0f 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -95,7 +95,8 @@ static const indic_config_t indic_configs[] =
  * Indic shaper.
  */
 
-struct feature_list_t {
+struct feature_list_t
+{
   hb_tag_t tag;
   hb_ot_map_feature_flags_t flags;
 };
@@ -130,7 +131,10 @@ indic_features[] =
   {HB_TAG('b','l','w','s'), F_GLOBAL},
   {HB_TAG('p','s','t','s'), F_GLOBAL},
   {HB_TAG('h','a','l','n'), F_GLOBAL},
-  /* Positioning features, though we don't care about the types. */
+  /*
+   * Positioning features.
+   * We don't care about the types.
+   */
   {HB_TAG('d','i','s','t'), F_GLOBAL},
   {HB_TAG('a','b','v','m'), F_GLOBAL},
   {HB_TAG('b','l','w','m'), F_GLOBAL},
@@ -158,12 +162,14 @@ enum {
   _BLWS,
   _PSTS,
   _HALN,
+
   _DIST,
   _ABVM,
   _BLWM,
 
   INDIC_NUM_FEATURES,
-  INDIC_BASIC_FEATURES = INIT /* Don't forget to update this! */
+  INDIC_BASIC_FEATURES = INIT, /* Don't forget to update this! */
+  INDIC_SUBST_FEATURES = _DIST /* Don't forget to update this! */
 };
 
 static void
@@ -199,14 +205,19 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
 
   unsigned int i = 0;
   map->add_gsub_pause (initial_reordering);
+
   for (; i < INDIC_BASIC_FEATURES; i++) {
 map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
 map->add_gsub_pause (nullptr);
   }
+
   map->add_gsub_pause (final_reordering);
-  for (; i < INDIC_NUM_FEATURES; i++) {
+
+  for (; i < INDIC_SUBST_FEATURES; i++)
 map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
-  }
+
+  for (; i < INDIC_NUM_FEATURES; i++)
+map->add_feature (indic_features[i].tag, 1, indic_features[i].flags);
 
   map->add_global_bool_feature (HB_TAG('c','a','l','t'));
   map->add_global_bool_feature (HB_TAG('c','l','i','g'));
diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index 0b5b50a9..7a88aaa2 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -32,7 +32,8 @@
  * Khmer shaper.
  */
 
-struct feature_list_t {
+struct feature_list_t
+{
   hb_tag_t tag;
   hb_ot_map_feature_flags_t flags;
 };
@@ -57,7 +58,10 @@ khmer_features[] =
   {HB_TAG('a','b','v','s'), F_GLOBAL},
   {HB_TAG('b','l','w','s'), F_GLOBAL},
   {HB_TAG('p','s','t','s'), F_GLOBAL},
-  /* Positioning features, though we don't care about the types. */
+  /*
+   * Positioning features.
+   * We don't care about the types.
+   */
   {HB_TAG('d','i','s','t'), F_GLOBAL},
   {HB_TAG('a','b','v','m'), F_GLOBAL},
   {HB_TAG('b','l','w','m'), F_GLOBAL},
@@ -77,12 +81,14 @@ enum {
   _ABVS,
   _BLWS,
   _PSTS,
+
   _DIST,
   _ABVM,
   _BLWM,
 
   KHMER_NUM_FEATURES,
-  KHMER_BASIC_FEATURES = _PRES /* Don't forget to update this! */
+  KHMER_BASIC_FEATURES = _PRES, /* Don't forget to update this! */
+  KHMER_SUBST_FEATURES = _DIST, /* Don't forget to update this! */
 };
 
 static void
@@ -121,15 +127,16 @@ collect_features_khmer (hb_ot_shape_planner_t *plan)
   map->add_global_bool_feature (HB_TAG('c','c','m','p'));
 
   unsigned int i = 0;
-  for (; i < KHMER_BASIC_FEATURES; i++) {
+  for (; 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-19 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |3 ++-
 src/hb-aat-layout-morx-table.hh |4 +---
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 5fd8bce945e7efaa48d0c29eb8b2700027bd3c0b
Author: Behdad Esfahbod 
Date:   Wed Sep 19 22:34:09 2018 -0400

[morx] Fix mark_set check

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 0a2d62b5..a8b287fd 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -608,7 +608,7 @@ struct InsertionSubtable
   hb_buffer_t *buffer = driver->buffer;
   unsigned int flags = entry->flags;
 
-  if (entry->data.markedInsertIndex != 0x)
+  if (entry->data.markedInsertIndex != 0x && mark_set)
   {
unsigned int count = (flags & MarkedInsertCount);
unsigned int start = entry->data.markedInsertIndex;
@@ -617,8 +617,6 @@ struct InsertionSubtable
 
bool before = flags & MarkedInsertBefore;
 
-   if (unlikely (!mark_set)) return false;
-
unsigned int end = buffer->out_len;
buffer->move_to (mark);
 
commit 0739b28169eb63332b31420deb5bf58b5446f154
Author: Behdad Esfahbod 
Date:   Wed Sep 19 17:32:21 2018 -0400

[aat] Minor

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 57374b0b..052aad7f 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -569,7 +569,8 @@ struct StateTableDriver
/* If there's no action and we're just epsilon-transitioning to state 0,
 * safe to break. */
if (c->is_actionable (this, entry) ||
-   !(entry->newState == 0 && entry->flags == context_t::DontAdvance))
+   !(entry->newState == StateTable::STATE_START_OF_TEXT &&
+ entry->flags == context_t::DontAdvance))
  buffer->unsafe_to_break (buffer->idx - 1, buffer->idx + 1);
   }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-19 Thread Behdad Esfahbod
 src/hb-aat-layout-morx-table.hh |   64 +++-
 1 file changed, 63 insertions(+), 1 deletion(-)

New commits:
commit dc8ed45292ce4e522c3bda03fd83873da7b6591e
Author: Behdad Esfahbod 
Date:   Wed Sep 19 16:46:41 2018 -0400

[morx] Implement forward/backward processing

We reverse too many times. Can be optimized. But I doubt many fonts
use reverse lookups, so doesn't matter.

Other than not applying user features, this completes morx table
implementation.

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 03bb4d53..0a2d62b5 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -836,6 +836,8 @@ struct Chain
 unsigned int count = subtableCount;
 for (unsigned int i = 0; i < count; i++)
 {
+  bool reverse;
+
   if (!(subtable->subFeatureFlags & flags))
 goto skip;
 
@@ -844,11 +846,49 @@ struct Chain
  bool (subtable->coverage & ChainSubtable::Vertical))
 goto skip;
 
+  /* Buffer contents is always in logical direction.  Determine if
+   * we need to reverse before applying this subtable.  We reverse
+   * back after if we did reverse indeed.
+   *
+   * Quoting the spac:
+   * """
+   * Bits 28 and 30 of the coverage field control the order in which
+   * glyphs are processed when the subtable is run by the layout engine.
+   * Bit 28 is used to indicate if the glyph processing direction is
+   * the same as logical order or layout order. Bit 30 is used to
+   * indicate whether glyphs are processed forwards or backwards within
+   * that order.
+
+   Bit 30  Bit 28  Interpretation for Horizontal Text
+   0   0   The subtable is processed in layout order
+   (the same order as the glyphs, which is
+   always left-to-right).
+   1   0   The subtable is processed in reverse layout 
order
+   (the order opposite that of the glyphs, which is
+   always right-to-left).
+   0   1   The subtable is processed in logical order
+   (the same order as the characters, which may be
+   left-to-right or right-to-left).
+   1   1   The subtable is processed in reverse logical 
order
+   (the order opposite that of the characters, 
which
+   may be right-to-left or left-to-right).
+   */
+  reverse = subtable->coverage & ChainSubtable::Logical ?
+   bool (subtable->coverage & ChainSubtable::Descending) :
+   bool (subtable->coverage & ChainSubtable::Descending) !=
+   HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
+
   if (!c->buffer->message (c->font, "start chain subtable %d", 
c->lookup_index))
 goto skip;
 
+  if (reverse)
+c->buffer->reverse ();
+
   subtable->dispatch (c);
 
+  if (reverse)
+c->buffer->reverse ();
+
   (void) c->buffer->message (c->font, "end chain subtable %d", 
c->lookup_index);
 
 skip:
commit 3bccd62196b5dff70d446c3fe053b1b47bb9c19e
Author: Behdad Esfahbod 
Date:   Wed Sep 19 16:24:34 2018 -0400

[morx] Implement horiz-only/vert-only subtables

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 03f31024..03bb4d53 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -743,8 +743,25 @@ struct ChainSubtable
   friend struct Chain;
 
   inline unsigned int get_size (void) const { return length; }
-  inline unsigned int get_type (void) const { return coverage & 0xFF; }
+  inline unsigned int get_type (void) const { return coverage & SubtableType; }
 
+  enum Coverage
+  {
+Vertical   = 0x8000,   /* If set, this subtable will only be 
applied
+* to vertical text. If clear, this 
subtable
+* will only be applied to horizontal 
text. */
+Descending = 0x4000,   /* If set, this subtable will process 
glyphs
+* in descending order. If clear, it 
will
+* process the glyphs in ascending 
order. */
+AllDirections  = 0x2000,   /* If set, this subtable will be 
applied to
+* both horizontal and vertical text 
(i.e.
+* the state of bit 0x8000 is 
ignored). */
+Logical= 0x1000,   /* If set, this subtable will process 
glyphs
+* in logical order (or reverse logical 
order,
+* depending on the value of bit 
0x8000). */
+Reserved   

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-16 Thread Behdad Esfahbod
 src/hb-atomic.hh   |4 +--
 src/hb-buffer.cc   |2 -
 src/hb-buffer.hh   |4 +--
 src/hb-cache.hh|4 +--
 src/hb-coretext.cc |2 -
 src/hb-debug.hh|2 -
 src/hb-dsalgs.hh   |4 +--
 src/hb-machinery.hh|4 +--
 src/hb-null.hh |   21 +++--
 src/hb-open-type.hh|4 +--
 src/hb-ot-layout-common.hh |2 -
 src/hb-ot-layout-gdef-table.hh |6 ++---
 src/hb-ot-layout.cc|   14 +--
 src/hb-ot-map.cc   |2 -
 src/hb-ot-math-table.hh|2 -
 src/hb-ot-shape-complex-arabic-fallback.hh |2 -
 src/hb-ot-shape-complex-indic.hh   |2 -
 src/hb-ot-shape-complex-use.cc |2 -
 src/hb-set-digest.hh   |4 +--
 src/hb-set.hh  |6 ++---
 src/hb-uniscribe.cc|2 -
 src/hb.hh  |   34 -
 22 files changed, 60 insertions(+), 69 deletions(-)

New commits:
commit 4e62627831e7457ed60ff87712570065b14b200a
Author: Behdad Esfahbod 
Date:   Sun Sep 16 18:09:36 2018 +0200

Enforce single-param static_assert() only

So we don't accidentally break it again.

diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh
index 6e3672c1..65b1dc8f 100644
--- a/src/hb-atomic.hh
+++ b/src/hb-atomic.hh
@@ -107,7 +107,7 @@ static inline void _hb_memory_barrier (void)
 #define _hb_memory_barrier()   _hb_memory_barrier ()
 
 #define hb_atomic_int_impl_add(AI, V)  InterlockedExchangeAdd ((LONG 
*) (AI), (V))
-static_assert ((sizeof (LONG) == sizeof (int)), "");
+static_assert ((sizeof (LONG) == sizeof (int)));
 
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  
(InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) 
== (void *) (O))
 
@@ -198,7 +198,7 @@ static inline bool _hb_compare_and_swaplp (long *P, long O, 
long N)
 #define hb_atomic_int_impl_add(AI, V)   _hb_fetch_and_add ((AI), (V))
 
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)   _hb_compare_and_swaplp ((long 
*) (P), (long) (O), (long) (N))
-static_assert ((sizeof (long) == sizeof (void *)), "");
+static_assert ((sizeof (long) == sizeof (void *)));
 
 
 #elif !defined(HB_NO_MT)
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 536ab5d5..df6b5c9d 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -130,7 +130,7 @@ hb_buffer_t::enlarge (unsigned int size)
   while (size >= new_allocated)
 new_allocated += (new_allocated >> 1) + 32;
 
-  static_assert ((sizeof (info[0]) == sizeof (pos[0])), "");
+  static_assert ((sizeof (info[0]) == sizeof (pos[0])));
   if (unlikely (hb_unsigned_mul_overflows (new_allocated, sizeof (info[0]
 goto done;
 
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
index bcaf066c..c137af73 100644
--- a/src/hb-buffer.hh
+++ b/src/hb-buffer.hh
@@ -54,8 +54,8 @@
 #define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFF /* Shaping more than a billion 
operations? Let us know! */
 #endif
 
-static_assert ((sizeof (hb_glyph_info_t) == 20), "");
-static_assert ((sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)), "");
+static_assert ((sizeof (hb_glyph_info_t) == 20));
+static_assert ((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);
diff --git a/src/hb-cache.hh b/src/hb-cache.hh
index f8581b4d..40e397d5 100644
--- a/src/hb-cache.hh
+++ b/src/hb-cache.hh
@@ -35,8 +35,8 @@
 template 
 struct hb_cache_t
 {
-  static_assert ((key_bits >= cache_bits), "");
-  static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (unsigned 
int)), "");
+  static_assert ((key_bits >= cache_bits));
+  static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (unsigned 
int)));
 
   inline void init (void) { clear (); }
   inline void fini (void) {}
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index a7ba85f8..ee612f70 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -720,7 +720,7 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan,
  CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, 
&active_features[j].rec.feature),
  CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, 
&active_features[j].rec.setting)
};
-   static_assert ((ARRAY_LENGTH_CONST (keys) == ARRAY_LENGTH_CONST 
(values)), "");
+   static_assert ((ARRAY_LENGTH_CONST (keys) == ARRAY_LENGTH_CONST 
(values)));
CFDictionaryRef dict = CFDictionaryCreate (kCFAllocatorDefault,
   (const void **) keys,
   (co

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-14 Thread Behdad Esfahbod
 src/hb-ot-layout.hh |   14 ++
 src/hb-unicode.hh   |   36 +++-
 2 files changed, 29 insertions(+), 21 deletions(-)

New commits:
commit 01b9148d9ae7d18228538774243e49840cfd2499
Author: Behdad Esfahbod 
Date:   Fri Sep 14 14:23:09 2018 +0200

[unicode] Move Fitzpatrick hack from ot-layout into unicode.hh

diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh
index 94414d3f..7a787b77 100644
--- a/src/hb-ot-layout.hh
+++ b/src/hb-ot-layout.hh
@@ -245,7 +245,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, 
hb_buffer_t *buffer)
props |= UPROPS_MASK_HIDDEN;
   }
 }
-else if (unlikely 
(HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL 
(gen_cat)))
+else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK 
(gen_cat)))
 {
   /* The above check is just an optimization to let in only things we need 
further
* processing on. */
@@ -264,16 +264,6 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, 
hb_buffer_t *buffer)
* the "else if".
*/
   props |= unicode->modified_combining_class (u)<<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/harfbuzz/harfbuzz/issues/169
-   */
-  if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
-  {
-   props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK;
-  }
 }
   }
 
diff --git a/src/hb-unicode.hh b/src/hb-unicode.hh
index e6bca5f0..6ee4a3ae 100644
--- a/src/hb-unicode.hh
+++ b/src/hb-unicode.hh
@@ -102,23 +102,42 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
   }
 
 
+  inline hb_unicode_general_category_t
+  modified_general_category (hb_codepoint_t u)
+  {
+hb_unicode_general_category_t cat = general_category (u);
+
+if (unlikely (cat == HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL))
+{
+  /* 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/harfbuzz/harfbuzz/issues/169
+   */
+  if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
+   cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK;
+}
+
+return cat;
+  }
+
   inline unsigned int
-  modified_combining_class (hb_codepoint_t unicode)
+  modified_combining_class (hb_codepoint_t u)
   {
 /* XXX This hack belongs to the Myanmar shaper. */
-if (unlikely (unicode == 0x1037u)) unicode = 0x103Au;
+if (unlikely (u == 0x1037u)) u = 0x103Au;
 
 /* XXX This hack belongs to the USE shaper (for Tai Tham):
  * Reorder SAKOT to ensure it comes after any tone marks. */
-if (unlikely (unicode == 0x1A60u)) return 254;
+if (unlikely (u == 0x1A60u)) return 254;
 
 /* XXX This hack belongs to the Tibetan shaper:
  * Reorder PADMA to ensure it comes after any vowel marks. */
-if (unlikely (unicode == 0x0FC6u)) return 254;
+if (unlikely (u == 0x0FC6u)) return 254;
 /* Reorder TSA -PHRU to reorder before U+0F74 */
-if (unlikely (unicode == 0x0F39u)) return 127;
+if (unlikely (u == 0x0F39u)) return 127;
 
-return _hb_modified_combining_class[combining_class (unicode)];
+return _hb_modified_combining_class[combining_class (u)];
   }
 
   static inline hb_bool_t
@@ -360,10 +379,9 @@ DECLARE_NULL_INSTANCE (hb_unicode_funcs_t);
  FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
  FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
 
-#define 
HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL(gen_cat) \
+#define HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK(gen_cat) \
(FLAG_UNSAFE (gen_cat) & \
 (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
- FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
- FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)))
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
 
 #endif /* HB_UNICODE_HH */
commit 6ebbf514ac90712fe089b2b64f68d1cf681edd5d
Author: Behdad Esfahbod 
Date:   Fri Sep 14 12:15:53 2018 +0200

Minor

diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh
index 84981391..94414d3f 100644
--- a/src/hb-ot-layout.hh
+++ b/src/hb-ot-layout.hh
@@ -263,7 +263,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, 
hb_buffer_t *buffer)
* Also, all Mn's that are Default_Ignorable, have ccc=0, hence
* the "else if".
*/
-  props |= unicode->modified_combining_class (info->codepoint)<<8;
+  props |= unicode->modified_combining_class (u)<<8;
 
   /* Recategorize emoji skin-tone modifiers as Unicode mark, so they
* behave correctly in non-native directionality.  They originally
___
HarfBuzz mailing list
HarfBuzz@lists.free

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-13 Thread Behdad Esfahbod
 src/hb-open-file.hh|   30 -
 src/hb-open-type.hh|   58 -
 src/hb-ot-layout-gsub-table.hh |   10 +++
 src/hb-ot-layout-gsubgpos.hh   |   10 +++
 4 files changed, 73 insertions(+), 35 deletions(-)

New commits:
commit 3789c557ca06aef430726f4942cafecac6fe4eef
Author: Behdad Esfahbod 
Date:   Thu Sep 13 20:30:04 2018 +0200

[dfont] Solve the mystery +2 offset thing!

Previously, ResourceForkHeader was defined as 30 bytes, having the 
typeCountM1 as last member.
There was a mysterious offset-by-2 in the code, derived from FontTools and 
JDK code this was
ported from.

In testing, I observed that typeListZ offset is actually 28.  Suggesting 
that the typeCountM1
does NOT actually belong to ResourceForkHeader, but belongs to the array 
itself.  Adjusting for
that resolves the mystery +2 offset hack, so everything is clean and good 
now.

This, concludes my dfont hacking.  The code looks great now, and I'm happy 
to leave it.
Fuzzers might disagree though, we will see!

diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index 5c653fed..cd7d78a3 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -357,13 +357,6 @@ struct ResourceTypeRecord
 
 struct ResourceMap
 {
-  inline const ResourceTypeRecord& get_type_record (unsigned int i) const
-  {
-// Why offset from the third byte of the object? I'm not sure
-return hb_array_t (((2 + (const char *) this 
)+typeListZ).arrayZ,
-  get_type_count ()) [i];
-  }
-
   inline unsigned int get_face_count (void) const
   {
 unsigned int count = get_type_count ();
@@ -386,7 +379,7 @@ struct ResourceMap
   /* The check for idx < count is here because ResourceRecord is NOT 
null-safe.
* Because an offset of 0 there does NOT mean null. */
   if (type.is_sfnt () && idx < type.get_resource_count ())
-   return type.get_resource_record (idx, &(this+typeListZ)).get_face 
(data_base);
+   return type.get_resource_record (idx, &(this+typeList)).get_face 
(data_base);
 }
 return Null (OpenTypeFontFace);
   }
@@ -394,30 +387,31 @@ struct ResourceMap
   inline bool sanitize (hb_sanitize_context_t *c, const void *data_base) const
   {
 TRACE_SANITIZE (this);
-const void *type_base = &(this+typeListZ);
+const void *type_base = &(this+typeList);
 return_trace (c->check_struct (this) &&
- typeListZ.sanitize (c, 2 + (const char *) this,
- get_type_count (),
- type_base,
- data_base));
+ typeList.sanitize (c, this,
+type_base,
+data_base));
   }
 
   private:
-  inline unsigned int get_type_count (void) const { return typeCountM1 + 1; }
+  inline unsigned int get_type_count (void) const { return 
(this+typeList).lenM1 + 1; }
+
+  inline const ResourceTypeRecord& get_type_record (unsigned int i) const
+  { return (this+typeList)[i]; }
 
   protected:
   HBUINT8  reserved0[16];  /* Reserved for copy of resource header */
   HBUINT32 reserved1;  /* Reserved for handle to next resource map */
   HBUINT16 resreved2;  /* Reserved for file reference number */
   HBUINT16 attrs;  /* Resource fork attribute */
-  OffsetTo >
-   typeListZ;  /* Offset from beginning of map to
+  OffsetTo >
+   typeList;   /* Offset from beginning of map to
 * resource type list */
   Offset16 nameList;   /* Offset from beginning of map to
 * resource name list */
-  HBUINT16 typeCountM1;/* Number of types in the map minus 1 */
   public:
-  DEFINE_SIZE_STATIC (30);
+  DEFINE_SIZE_STATIC (28);
 };
 
 struct ResourceForkHeader
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 68079738..4f16c7d3 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -628,6 +628,50 @@ struct HeadlessArrayOf
   DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ);
 };
 
+/* An array storing length-1. */
+template 
+struct ArrayOfM1
+{
+  inline const Type& operator [] (unsigned int i) const
+  {
+if (unlikely (i > lenM1)) return Null(Type);
+return arrayZ[i];
+  }
+  inline Type& operator [] (unsigned int i)
+  {
+if (unlikely (i > lenM1)) return Crap(Type);
+return arrayZ[i];
+  }
+  inline unsigned int get_size (void) const
+  { return lenM1.static_size + (lenM1 + 1) * Type::static_size; }
+
+  template 
+  inline bool sanitize (hb_sanitize_context_t *c, const void *base, T 
user_data) const
+  {
+TRACE_SANITIZE (this);
+if (unlikely (!sanitize_shallow (c))) return_trace (false);
+unsigned int count = lenM1 + 1;
+for (unsigned int i = 0; i < count; i++)
+  if (unlikely (!arrayZ[i].sanitize (c, base, 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-11 Thread Behdad Esfahbod
 src/hb-open-file.hh|   18 ++
 test/shaping/data/in-house/Makefile.sources|1 +
 test/shaping/data/in-house/fonts/TestDFONT.dfont   |binary
 test/shaping/data/in-house/fonts/TestTTC.ttc   |binary
 test/shaping/data/in-house/tests/collections.tests |6 ++
 5 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit d5c509272f2fbd1b4c56e3b530da7e42e7f03901
Author: Behdad Esfahbod 
Date:   Tue Sep 11 17:18:21 2018 +0200

[dfont] Fix test expecatation and minor touch up

I have no way to authoritatively know, but looks like test font only has one
face.  So, adjust test expectation instead.

diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index 608de0a9..39c6aeb8 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -300,7 +300,7 @@ struct ResourceRefItem
 
   HBINT16  id; /* Resource ID, is really should be signed? */
   HBINT16  nameOffset; /* Offset from beginning of resource name list
-* to resource name, minus means there is no */
+* to resource name, minus means there is none. 
*/
   HBUINT8  attr;   /* Resource attributes */
   HBUINT24 dataOffset; /* Offset from beginning of resource data to
 * data for this resource */
@@ -318,15 +318,9 @@ struct ResourceTypeItem
 return_trace (likely (c->check_struct (this)));
   }
 
-  inline unsigned int get_resource_count () const
-  {
-return numRes + 1;
-  }
+  inline unsigned int get_resource_count () const { return numRes + 1; }
 
-  inline bool is_sfnt () const
-  {
-return type == HB_TAG ('s','f','n','t');
-  }
+  inline bool is_sfnt () const { return type == HB_TAG ('s','f','n','t'); }
 
   inline const ResourceRefItem& get_ref_item (const void *base,
  unsigned int i) const
@@ -335,11 +329,11 @@ struct ResourceTypeItem
   }
 
   protected:
-  Tag  type;   /* Resource type */
-  HBUINT16 numRes; /* Number of resource this type in map minus 1 
*/
+  Tag  type;   /* Resource type. */
+  HBUINT16 numRes; /* Number of resources minus 1. */
   OffsetTo >
refList;/* Offset from beginning of resource type list
-* to reference list for this type */
+* to reference item list for this type. */
   public:
   DEFINE_SIZE_STATIC (8);
 };
diff --git a/test/shaping/data/in-house/tests/collections.tests 
b/test/shaping/data/in-house/tests/collections.tests
index d9ecdabb..85653c54 100644
--- a/test/shaping/data/in-house/tests/collections.tests
+++ b/test/shaping/data/in-house/tests/collections.tests
@@ -1,5 +1,5 @@
 ../fonts/TestDFONT.dfont:--face-index=0 
--font-funcs=ot:U+2026,U+0020,U+002E:[ellipsis=0+723|space=1+250|period=2+241]
-../fonts/TestDFONT.dfont:--face-index=1 
--font-funcs=ot:U+2026,U+0020,U+002E:[ellipsis=0+723|space=1+250|period=2+241]
+../fonts/TestDFONT.dfont:--face-index=1 
--font-funcs=ot:U+2026,U+0020,U+002E:[gid0=0+1000|gid0=1+1000|gid0=2+1000]
 ../fonts/TestDFONT.dfont:--face-index=2 
--font-funcs=ot:U+2026,U+0020,U+002E:[gid0=0+1000|gid0=1+1000|gid0=2+1000]
 ../fonts/TestTTC.ttc:--face-index=0 
--font-funcs=ot:U+2026,U+0020,U+002E:[ellipsis=0+723|space=1+250|period=2+241]
 ../fonts/TestTTC.ttc:--face-index=1 
--font-funcs=ot:U+2026,U+0020,U+002E:[ellipsis=0+723|space=1+250|period=2+241]
commit 2b2ed1e536061cfd3a0f29522118f42b451678bd
Author: Ebrahim Byagowi 
Date:   Mon Jul 2 17:26:43 2018 +0430

[dfont] Add test

diff --git a/test/shaping/data/in-house/Makefile.sources 
b/test/shaping/data/in-house/Makefile.sources
index 1bb8604e..c0b85f2f 100644
--- a/test/shaping/data/in-house/Makefile.sources
+++ b/test/shaping/data/in-house/Makefile.sources
@@ -6,6 +6,7 @@ TESTS = \
tests/arabic-stch.tests \
tests/automatic-fractions.tests \
tests/cluster.tests \
+   tests/collections.tests \
tests/color-fonts.tests \
tests/context-matching.tests \
tests/cursive-positioning.tests \
diff --git a/test/shaping/data/in-house/fonts/TestDFONT.dfont 
b/test/shaping/data/in-house/fonts/TestDFONT.dfont
new file mode 100644
index ..a6ea7009
Binary files /dev/null and b/test/shaping/data/in-house/fonts/TestDFONT.dfont 
differ
diff --git a/test/shaping/data/in-house/fonts/TestTTC.ttc 
b/test/shaping/data/in-house/fonts/TestTTC.ttc
new file mode 100644
index ..a21fe89d
Binary files /dev/null and b/test/shaping/data/in-house/fonts/TestTTC.ttc differ
diff --git a/test/shaping/data/in-house/tests/collections.tests 
b/test/shaping/data/in-house/tests/collections.tests
new file mode 100644
index ..d9ecdabb
--- /dev/null
+++ b/test/shaping/data/in-house/tests/collections.tests
@@ -0,0 +1,6 @@
+../fonts/TestDFONT.dfont:--face-index=0 
--font-funcs=ot:U+2026,

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-11 Thread Behdad Esfahbod
 src/hb-face.cc  |5 +++--
 src/hb-open-file.hh |   21 ++---
 2 files changed, 17 insertions(+), 9 deletions(-)

New commits:
commit 9479ffefbfa3ea4ee39747e34177d26ab1ebbec9
Author: Behdad Esfahbod 
Date:   Tue Sep 11 16:41:26 2018 +0200

[dfont] Re-enable and fix offset handling

Fixes https://github.com/harfbuzz/harfbuzz/pull/1085

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 92c34152..922fd8fd 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -163,11 +163,12 @@ _hb_face_for_data_reference_table (hb_face_t *face 
HB_UNUSED, hb_tag_t tag, void
 return hb_blob_reference (data->blob);
 
   const OT::OpenTypeFontFile &ot_file = *data->blob->as 
();
-  const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index);
+  unsigned int base_offset;
+  const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index, 
&base_offset);
 
   const OT::OpenTypeTable &table = ot_face.get_table_by_tag (tag);
 
-  hb_blob_t *blob = hb_blob_create_sub_blob (data->blob, table.offset, 
table.length);
+  hb_blob_t *blob = hb_blob_create_sub_blob (data->blob, base_offset + 
table.offset, table.length);
 
   return blob;
 }
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index b1732057..608de0a9 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -428,14 +428,19 @@ struct ResourceForkHeader
 return StructAtOffset > (this, offset);
   }
 
-  inline const OpenTypeFontFace& get_face (unsigned int idx) const
+  inline const OpenTypeFontFace& get_face (unsigned int idx, unsigned int 
*base_offset = nullptr) const
   {
 const ResourceMap &resource_map = this+map;
 for (unsigned int i = 0; i < resource_map.get_types_count (); ++i)
 {
   const ResourceTypeItem& type = resource_map.get_type (i);
   if (type.is_sfnt () && idx < type.get_resource_count ())
-   return (OpenTypeFontFace&) get_data (type, idx).arrayZ;
+  {
+   const OpenTypeFontFace &face = (OpenTypeFontFace&) get_data (type, 
idx).arrayZ;
+   if (base_offset)
+ *base_offset = (const char *) &face - (const char *) this;
+   return face;
+  }
 }
 return Null (OpenTypeFontFace);
   }
@@ -502,12 +507,14 @@ struct OpenTypeFontFile
 case Typ1Tag:
 case TrueTypeTag:  return 1;
 case TTCTag:   return u.ttcHeader.get_face_count ();
-//case DFontTag:   return u.rfHeader.get_face_count ();
+case DFontTag: return u.rfHeader.get_face_count ();
 default:   return 0;
 }
   }
-  inline const OpenTypeFontFace& get_face (unsigned int i) const
+  inline const OpenTypeFontFace& get_face (unsigned int i, unsigned int 
*base_offset = nullptr) const
   {
+if (base_offset)
+  *base_offset = 0;
 switch (u.tag) {
 /* Note: for non-collection SFNT data we ignore index.  This is because
  * Apple dfont container is a container of SFNT's.  So each SFNT is a
@@ -517,7 +524,7 @@ struct OpenTypeFontFile
 case Typ1Tag:
 case TrueTypeTag:  return u.fontFace;
 case TTCTag:   return u.ttcHeader.get_face (i);
-//case DFontTag:   return u.rfHeader.get_face (i);
+case DFontTag: return u.rfHeader.get_face (i, base_offset);
 default:   return Null(OpenTypeFontFace);
 }
   }
@@ -544,7 +551,7 @@ struct OpenTypeFontFile
 case Typ1Tag:
 case TrueTypeTag:  return_trace (u.fontFace.sanitize (c));
 case TTCTag:   return_trace (u.ttcHeader.sanitize (c));
-//case DFontTag:   return_trace (u.rfHeader.sanitize (c));
+case DFontTag: return_trace (u.rfHeader.sanitize (c));
 default:   return_trace (true);
 }
   }
commit a1814e2bec3a43b9eeb4d50a67daae3fc52fd0a5
Author: Behdad Esfahbod 
Date:   Tue Sep 11 14:45:23 2018 +0200

Whitespace

diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index d3b74860..b1732057 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -485,7 +485,7 @@ struct OpenTypeFontFile
 {
   enum {
 CFFTag = HB_TAG ('O','T','T','O'), /* OpenType with Postscript 
outlines */
-TrueTypeTag= HB_TAG ( 0 , 1 , 0 , 0 ), /* OpenType with TrueType 
outlines */
+TrueTypeTag= HB_TAG ( 0 , 1 , 0 , 0 ), /* OpenType with 
TrueType outlines */
 TTCTag = HB_TAG ('t','t','c','f'), /* TrueType Collection */
 DFontTag   = HB_TAG ( 0 , 0 , 1 , 0 ), /* DFont Mac Resource Fork 
*/
 TrueTag= HB_TAG ('t','r','u','e'), /* Obsolete Apple TrueType 
*/
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-11 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh  |5 +
 src/hb-ot-layout-gsubgpos.hh|9 -
 test/shaping/data/in-house/tests/rand.tests |4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit cfdea884754ed40ffa5cc00cb1ecaa86cb46a394
Author: Behdad Esfahbod 
Date:   Tue Sep 11 10:57:48 2018 +0200

[random] Switch to 32bit RNG

diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index cb71759e..eae73ce3 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -484,7 +484,7 @@ struct hb_ot_apply_context_t :
   bool auto_zwj;
   bool random;
 
-  uint64_t random_state;
+  uint32_t random_state;
 
 
   hb_ot_apply_context_t (unsigned int table_index_,
@@ -523,8 +523,9 @@ struct hb_ot_apply_context_t :
 
   inline uint32_t random_number (void)
   {
-random_state = (0x5DEECE66Dull * random_state + 11) & (((uint64_t) 1 << 
48) - 1);
-return random_state >> 32;
+/* http://www.cplusplus.com/reference/random/minstd_rand/ */
+random_state = random_state * 48271 % 2147483647;
+return random_state;
   }
 
   inline bool
diff --git a/test/shaping/data/in-house/tests/rand.tests 
b/test/shaping/data/in-house/tests/rand.tests
index 5ea0fc04..df324b92 100644
--- a/test/shaping/data/in-house/tests/rand.tests
+++ b/test/shaping/data/in-house/tests/rand.tests
@@ -1,3 +1,3 @@
 ../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names 
--features=-rand:U+0054,U+0055,U+0056:[1=0+560|2=1+602|3=2+602]
-#../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names 
--features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602]
-../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[6=0+560|9=1+602|10=2+602|6=3+560|9=4+602|12=5+602|5=6+560|8=7+602|11=8+602|6=9+560|8=10+602|10=11+602]
+../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names 
--features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602]
+../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[5=0+560|7=1+602|10=2+602|4=3+560|7=4+602|10=5+602|6=6+560|9=7+602|10=8+602|5=9+560|8=10+602|12=11+602]
commit 08260c708ae6adc4efa9bde5e9ede01b7e4d42cc
Author: Behdad Esfahbod 
Date:   Tue Sep 11 10:51:19 2018 +0200

[random] Shuffle

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index dfa50979..4d5db6ae 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -543,10 +543,7 @@ struct AlternateSet
 
 /* If alt_index is MAX, randomize feature if it is the rand feature. */
 if (alt_index == HB_OT_MAP_MAX_VALUE && c->random)
-{
-  c->random_state = (0x5DEECE66Dull * c->random_state + 11) & (((uint64_t) 
1 << 48) - 1);
-  alt_index = (c->random_state >> 32) % count + 1;
-}
+  alt_index = c->random_number () % count + 1;
 
 if (unlikely (alt_index > count || alt_index == 0)) return_trace (false);
 
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index be1b449c..cb71759e 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -521,6 +521,12 @@ struct hb_ot_apply_context_t :
 iter_context.init (this, true);
   }
 
+  inline uint32_t random_number (void)
+  {
+random_state = (0x5DEECE66Dull * random_state + 11) & (((uint64_t) 1 << 
48) - 1);
+return random_state >> 32;
+  }
+
   inline bool
   match_properties_mark (hb_codepoint_t  glyph,
 unsigned intglyph_props,
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-10 Thread Behdad Esfahbod
 src/hb-ot-layout-gsubgpos.hh |2 +-
 src/hb-subset.cc |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5dfd6e07626a9022a995eb7fa16767eff66c6047
Author: Behdad Esfahbod 
Date:   Mon Sep 10 15:45:32 2018 +0200

Fix sanitize or Context Rule

Fixes https://github.com/harfbuzz/harfbuzz/issues/1110

diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 315951a3..bd4611d2 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -1267,7 +1267,7 @@ struct Rule
 return_trace (inputCount.sanitize (c) &&
  lookupCount.sanitize (c) &&
  c->check_range (inputZ,
- inputZ[0].static_size * inputCount +
+ inputZ[0].static_size * (inputCount ? 
inputCount - 1 : 0) +
  LookupRecord::static_size * lookupCount));
   }
 
commit 20a11a824d2a07a8544649477ad03e809bdd8e19
Author: Behdad Esfahbod 
Date:   Mon Sep 10 13:56:28 2018 +0200

Revert "[subset] Disable GSUB/GPOS subsetting for now"

This reverts commit 616fd34a69bb69bc35c7e4ea939e71c3ea2e92cb.

diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index b714f291..2bed3586 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -179,10 +179,10 @@ _subset_table (hb_subset_plan_t *plan,
   break;
 
 case HB_OT_TAG_GSUB:
-  //result = _subset2 (plan);
+  result = _subset2 (plan);
   break;
 case HB_OT_TAG_GPOS:
-  //result = _subset2 (plan);
+  result = _subset2 (plan);
   break;
 
 default:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-10 Thread Behdad Esfahbod
 NEWS |   19 +++
 configure.ac |2 +-
 src/hb-face.cc   |   10 +-
 src/hb-subset.cc |4 ++--
 src/hb-unicode.h |5 +
 src/hb-version.h |6 +++---
 6 files changed, 35 insertions(+), 11 deletions(-)

New commits:
commit 54d332dd9b0263821376161cdffb60ffb3c7847f
Author: Behdad Esfahbod 
Date:   Mon Sep 10 11:37:24 2018 +0200

1.9.0

diff --git a/NEWS b/NEWS
index 3ae857ef..c9af0f36 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,22 @@
+Overview of changes leading to 1.9.0
+Monday, September 10, 2018
+
+- Added 'cmap' API to hb_face_t.
+- Face-builder API.
+- hb-ot-font re-creation should be much leaner now, as the
+  font tables it uses are cached on hb_face_t now.
+- Internal source header file name changes:
+  hb-*-private.hh is renamed to hb-*.hh.
+
+New API:
++HB_UNICODE_MAX
++hb_face_collect_unicodes()
++hb_face_collect_variation_selectors()
++hb_face_collect_variation_unicodes()
++hb_face_builder_create()
++hb_face_builder_add_table()
+
+
 Overview of changes leading to 1.8.8
 Tuesday, August 14, 2018
 
diff --git a/configure.ac b/configure.ac
index 55cc12b3..1c698087 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[1.8.8],
+[1.9.0],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-face.cc b/src/hb-face.cc
index 2fb5a0a3..92c34152 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -526,7 +526,7 @@ hb_face_get_table_tags (const hb_face_t *face,
  * @face: font face.
  * @out: set to add Unicode characters covered by @face to.
  *
- * Since: REPLACEME
+ * Since: 1.9.0
  */
 void
 hb_face_collect_unicodes (hb_face_t *face,
@@ -543,7 +543,7 @@ hb_face_collect_unicodes (hb_face_t *face,
  *
  *
  *
- * Since: REPLACEME
+ * Since: 1.9.0
  */
 void
 hb_face_collect_variation_selectors (hb_face_t *face,
@@ -560,7 +560,7 @@ hb_face_collect_variation_selectors (hb_face_t *face,
  *
  *
  *
- * Since: REPLACEME
+ * Since: 1.9.0
  */
 void
 hb_face_collect_variation_unicodes (hb_face_t *face,
@@ -684,7 +684,7 @@ _hb_face_builder_reference_table (hb_face_t *face, hb_tag_t 
tag, void *user_data
  *
  * Return value: (transfer full) New face.
  *
- * Since: REPLACEME
+ * Since: 1.9.0
  **/
 hb_face_t *
 hb_face_builder_create (void)
@@ -703,7 +703,7 @@ hb_face_builder_create (void)
  * Add table for @tag with data provided by @blob to the face.  @face must
  * be created using hb_face_builder_create().
  *
- * Since: REPLACEME
+ * Since: 1.9.0
  **/
 hb_bool_t
 hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
diff --git a/src/hb-unicode.h b/src/hb-unicode.h
index 226c5d5c..c8d87e4d 100644
--- a/src/hb-unicode.h
+++ b/src/hb-unicode.h
@@ -40,6 +40,11 @@
 HB_BEGIN_DECLS
 
 
+/**
+ * HB_UNICODE_MAX
+ *
+ * Since: 1.9.0
+ */
 #define HB_UNICODE_MAX 0x10u
 
 
diff --git a/src/hb-version.h b/src/hb-version.h
index e0816d1e..34649510 100644
--- a/src/hb-version.h
+++ b/src/hb-version.h
@@ -37,10 +37,10 @@ HB_BEGIN_DECLS
 
 
 #define HB_VERSION_MAJOR 1
-#define HB_VERSION_MINOR 8
-#define HB_VERSION_MICRO 8
+#define HB_VERSION_MINOR 9
+#define HB_VERSION_MICRO 0
 
-#define HB_VERSION_STRING "1.8.8"
+#define HB_VERSION_STRING "1.9.0"
 
 #define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*1+(minor)*100+(micro) <= \
commit 616fd34a69bb69bc35c7e4ea939e71c3ea2e92cb
Author: Behdad Esfahbod 
Date:   Mon Sep 10 11:19:49 2018 +0200

[subset] Disable GSUB/GPOS subsetting for now

So I can get a release out.  I haven't debugged those yet, and they
are producing bad tables.

diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 2bed3586..b714f291 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -179,10 +179,10 @@ _subset_table (hb_subset_plan_t *plan,
   break;
 
 case HB_OT_TAG_GSUB:
-  result = _subset2 (plan);
+  //result = _subset2 (plan);
   break;
 case HB_OT_TAG_GPOS:
-  result = _subset2 (plan);
+  //result = _subset2 (plan);
   break;
 
 default:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-09-05 Thread Behdad Esfahbod
 src/hb-ot-hdmx-table.hh|3 +
 src/hb-ot-layout-gsub-table.hh |8 ++--
 src/hb-subset.cc   |   75 +
 3 files changed, 81 insertions(+), 5 deletions(-)

New commits:
commit 1e6599f59680c81356b2e9b61252490337a0
Author: Behdad Esfahbod 
Date:   Wed Sep 5 19:29:42 2018 -0700

Fix older compilers re '>>' at nested template declarations

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 57633610..76a0ea6d 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -110,8 +110,8 @@ struct SingleSubstFormat1
   inline bool subset (hb_subset_context_t *c) const
   {
 TRACE_SUBSET (this);
-hb_auto_t> from;
-hb_auto_t> to;
+hb_auto_t > from;
+hb_auto_t > to;
 hb_codepoint_t delta = deltaGlyphID;
 for (hb_auto_t iter (this+coverage); iter.more (); 
iter.next ())
 {
@@ -216,8 +216,8 @@ struct SingleSubstFormat2
   inline bool subset (hb_subset_context_t *c) const
   {
 TRACE_SUBSET (this);
-hb_auto_t> from;
-hb_auto_t> to;
+hb_auto_t > from;
+hb_auto_t > to;
 for (hb_auto_t iter (this+coverage); iter.more (); 
iter.next ())
 {
   if (!c->plan->glyphset->has (iter.get_glyph ()))
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index a67e416d..adc7c51d 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -65,7 +65,7 @@ _subset2 (hb_subset_plan_t *plan)
   hb_bool_t result = false;
   if (source_blob->data)
   {
-hb_auto_t> buf;
+hb_auto_t > buf;
 unsigned int buf_size = _plan_estimate_subset_table_size (plan, 
source_blob->length);
 DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c initial estimated table size: %u 
bytes.", HB_UNTAG(tag), buf_size);
 if (unlikely (!buf.alloc (buf_size)))
commit a1e5e07c735091e82d66ac56a4e27341f589369d
Author: Behdad Esfahbod 
Date:   Wed Sep 5 16:24:28 2018 -0700

[subset] Hook up GSUB/GPOS, but still disabled

They are still in the drop list.

diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh
index d684de0b..c523c420 100644
--- a/src/hb-ot-hdmx-table.hh
+++ b/src/hb-ot-hdmx-table.hh
@@ -177,7 +177,8 @@ struct hdmx
 
 hb_serialize_context_t c (dest, dest_size);
 hdmx *hdmx_prime = c.start_serialize ();
-if (!hdmx_prime || !hdmx_prime->serialize (&c, this, plan)) {
+if (!hdmx_prime || !hdmx_prime->serialize (&c, this, plan))
+{
   free (dest);
   return false;
 }
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index f6abdc43..a67e416d 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -40,8 +40,75 @@
 #include "hb-ot-maxp-table.hh"
 #include "hb-ot-os2-table.hh"
 #include "hb-ot-post-table.hh"
+#include "hb-ot-layout-gsub-table.hh"
+#include "hb-ot-layout-gpos-table.hh"
 
 
+static unsigned int
+_plan_estimate_subset_table_size (hb_subset_plan_t *plan,
+ unsigned int table_len)
+{
+  unsigned int src_glyphs = plan->source->get_num_glyphs ();
+  unsigned int dst_glyphs = plan->glyphset->get_population ();
+
+  return 512 + (unsigned int) (table_len * sqrt ((double) dst_glyphs / 
src_glyphs));
+}
+
+template
+static bool
+_subset2 (hb_subset_plan_t *plan)
+{
+  hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table 
(plan->source);
+  const TableType *table = source_blob->as ();
+
+  hb_tag_t tag = TableType::tableTag;
+  hb_bool_t result = false;
+  if (source_blob->data)
+  {
+hb_auto_t> buf;
+unsigned int buf_size = _plan_estimate_subset_table_size (plan, 
source_blob->length);
+DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c initial estimated table size: %u 
bytes.", HB_UNTAG(tag), buf_size);
+if (unlikely (!buf.alloc (buf_size)))
+{
+  DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", 
HB_UNTAG(tag), buf_size);
+  return false;
+}
+  retry:
+hb_serialize_context_t serializer (buf.arrayZ, buf_size);
+hb_subset_context_t c (plan, &serializer);
+result = table->subset (&c);
+if (serializer.ran_out_of_room)
+{
+  buf_size += (buf_size >> 1) + 32;
+  DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating 
to %u bytes.", HB_UNTAG(tag), buf_size);
+  if (unlikely (!buf.alloc (buf_size)))
+  {
+   DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u 
bytes.", HB_UNTAG(tag), buf_size);
+   return false;
+  }
+  goto retry;
+}
+if (result)
+{
+  hb_blob_t *dest_blob = serializer.copy_blob ();
+  DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c final subset table size: %u 
bytes.", HB_UNTAG(tag), dest_blob->length);
+  result = c.plan->add_table (tag, dest_blob);
+  hb_blob_destroy (dest_blob);
+}
+else
+{
+  DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to 
empty.", HB_UNTAG(tag));
+  result = true;
+}
+  }
+  else
+DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset sanitize failed on source 
table

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-29 Thread Behdad Esfahbod
 m4/pkg.m4   |  157 
 src/hb-ot-cmap-table.hh |   25 ---
 2 files changed, 15 insertions(+), 167 deletions(-)

New commits:
commit 2ccc322cf88a01248aa5df88a5073db3dfb40eea
Author: Behdad Esfahbod 
Date:   Wed Aug 29 16:38:04 2018 -0700

[ot-font] Clean up cmap with gid=0

Fixes https://github.com/harfbuzz/harfbuzz/issues/1145

diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index aca5de2e..faf0a2c6 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -48,7 +48,7 @@ struct CmapSubtableFormat0
 if (!gid)
   return false;
 *glyph = gid;
-return *glyph != 0;
+return true;
   }
   inline void collect_unicodes (hb_set_t *out) const
   {
@@ -279,9 +279,11 @@ struct CmapSubtableFormat4
  return false;
gid += this->idDelta[i];
   }
-
-  *glyph = gid & 0xu;
-  return *glyph != 0;
+  gid &= 0xu;
+  if (!gid)
+   return false;
+  *glyph = gid;
+  return true;
 }
 static inline bool get_glyph_func (const void *obj, hb_codepoint_t 
codepoint, hb_codepoint_t *glyph)
 {
@@ -423,7 +425,7 @@ struct CmapSubtableTrimmed
 if (!gid)
   return false;
 *glyph = gid;
-return *glyph != 0;
+return true;
   }
   inline void collect_unicodes (hb_set_t *out) const
   {
@@ -465,8 +467,11 @@ struct CmapSubtableLongSegmented
 int i = groups.bsearch (codepoint);
 if (i == -1)
   return false;
-*glyph = T::group_get_glyph (groups[i], codepoint);
-return *glyph != 0;
+hb_codepoint_t gid = T::group_get_glyph (groups[i], codepoint);
+if (!gid)
+  return false;
+*glyph = gid;
+return true;
   }
 
   inline void collect_unicodes (hb_set_t *out) const
@@ -674,7 +679,7 @@ struct VariationSelectorRecord
   return GLYPH_VARIANT_USE_DEFAULT;
 const NonDefaultUVS &nonDefaults = base+nonDefaultUVS;
 i = nonDefaults.bsearch (codepoint);
-if (i != -1)
+if (i != -1 && nonDefaults[i].glyphID)
 {
   *glyph = nonDefaults[i].glyphID;
return GLYPH_VARIANT_FOUND;
@@ -1076,8 +1081,8 @@ struct cmap
 hb_codepoint_t *glyph) const
 {
   switch (this->subtable_uvs->get_glyph_variant (unicode,
- variation_selector,
- glyph))
+variation_selector,
+glyph))
   {
case GLYPH_VARIANT_NOT_FOUND:   return false;
case GLYPH_VARIANT_FOUND:   return true;
commit 0c7b633f528bae4a0cf5ca816f75a0d84206b3fb
Author: Ross Burton 
Date:   Wed Aug 29 22:37:39 2018 +0100

Delete pkg.m4

pkg.m4 is provided by pkg-config, which is a requirement to build, and this 
copy is ancient.  Delete it to avoid it being used instead of the host copy.

diff --git a/m4/pkg.m4 b/m4/pkg.m4
deleted file mode 100644
index 0048a3fa..
--- a/m4/pkg.m4
+++ /dev/null
@@ -1,157 +0,0 @@
-# pkg.m4 - Macros to locate and utilise pkg-config.-*- Autoconf -*-
-# 
-# Copyright © 2004 Scott James Remnant .
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# --
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-   AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
-   _pkg_min_version=m4_default([$1], [0.9.0])
-   AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-   if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-   AC_MSG_RESULT([yes])
-   else
-   AC_MSG_RESULT([no])
-   PKG_CONFIG=""
-   fi
-   
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-28 Thread Behdad Esfahbod
 src/hb-dsalgs.hh|7 ---
 src/hb-ot-layout.cc |6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit fee0f41c6c1e50621d10b07802ca36a9b295b53d
Author: Behdad Esfahbod 
Date:   Tue Aug 28 18:27:41 2018 -0700

Don't declare extern symbols as inline

clang -O3 was completely removing _get_gdef(), causing link
failure when needed from another compilation unit.  Surprisingly,
"extern inline" didn't fix it.

diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 8b247704..34507891 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -56,7 +56,7 @@
 //   return *(data->base.get ());
 // }
 
-inline const OT::GDEF& _get_gdef (hb_face_t *face)
+const OT::GDEF& _get_gdef (hb_face_t *face)
 {
   if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF);
   return *hb_ot_face_data (face)->GDEF->table;
@@ -71,7 +71,7 @@ static inline const OT::GSUB& _get_gsub (hb_face_t *face)
   if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB);
   return *hb_ot_face_data (face)->GSUB->table;
 }
-inline const OT::GSUB& _get_gsub_relaxed (hb_face_t *face)
+const OT::GSUB& _get_gsub_relaxed (hb_face_t *face)
 {
   return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table;
 }
@@ -85,7 +85,7 @@ static inline const OT::GPOS& _get_gpos (hb_face_t *face)
   if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS);
   return *hb_ot_face_data (face)->GPOS->table;
 }
-inline const OT::GPOS& _get_gpos_relaxed (hb_face_t *face)
+const OT::GPOS& _get_gpos_relaxed (hb_face_t *face)
 {
   return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table;
 }
commit 967741e4c468ebf0a40f91934ed1923506099806
Author: Behdad Esfahbod 
Date:   Tue Aug 28 18:18:02 2018 -0700

Add explicit to hb_auto_t 1param constructors

diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 8c910748..7e06ff17 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -497,9 +497,10 @@ struct hb_auto_t : Type
*
* Apparently if we template for all types, then gcc seems to
* capture a reference argument in the type, but clang doesn't,
-   * causing unwanted copies and bugs that come with it. */
-  template  hb_auto_t (T1 *t1) { Type::init (t1); }
-  template  hb_auto_t (T1 &t1) { Type::init (t1); }
+   * causing unwanted copies and bugs that come with it.  Ideally
+   * we should use C++11-style rvalue reference &&t1. */
+  template  explicit hb_auto_t (T1 *t1) { Type::init (t1); }
+  template  explicit hb_auto_t (T1 &t1) { Type::init (t1); }
   ~hb_auto_t (void) { Type::fini (); }
   private: /* Hide */
   void init (void) {}
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-12 Thread Behdad Esfahbod
 src/hb-common.cc|   60 ++--
 src/hb-machinery-private.hh |2 -
 2 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 989e71a982658145f28f83f2111bdab9561f3db0
Author: Behdad Esfahbod 
Date:   Sun Aug 12 17:47:59 2018 -0700

Silence clang

diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index a179eea9..99ef485a 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -597,7 +597,7 @@ struct hb_data_wrapper_t
 
   inline Data * get_data (void) const
   {
-return *(((Data **) this) - WheresData);
+return *(((Data **) (void *) this) - WheresData);
   }
 
   template 
commit 6750ec692cdd682bd33cb1c37b137cf3bb641d43
Author: Behdad Esfahbod 
Date:   Sun Aug 12 17:42:16 2018 -0700

[lazy] Use for C_locale

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 6d12c097..22dd52f4 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -28,6 +28,7 @@
 
 #include "hb-private.hh"
 
+#include "hb-machinery-private.hh"
 
 #include 
 #ifdef HAVE_XLOCALE_H
@@ -730,48 +731,47 @@ parse_uint32 (const char **pp, const char *end, uint32_t 
*pv)
 
 #ifdef USE_XLOCALE
 
-static hb_atomic_ptr_t C_locale;
 
-#ifdef HB_USE_ATEXIT
-static void
-free_C_locale (void)
-{
-retry:
-  HB_LOCALE_T locale = C_locale.get ();
+static void free_static_C_locale (void);
 
-  if (unlikely (!C_locale.cmpexch (locale, nullptr)))
-goto retry;
-
-  if (locale)
-HB_FREE_LOCALE (locale);
-}
-#endif
-
-static HB_LOCALE_T
-get_C_locale (void)
+static struct hb_C_locale_lazy_loader_t : 
hb_lazy_loader_t::value,
+ 
hb_C_locale_lazy_loader_t>
 {
-retry:
-  HB_LOCALE_T C = C_locale.get ();
-
-  if (unlikely (!C))
+  static inline HB_LOCALE_T create (void)
   {
-C = HB_CREATE_LOCALE ("C");
-
-if (unlikely (!C_locale.cmpexch (nullptr, C)))
-{
-  HB_FREE_LOCALE (C);
-  goto retry;
-}
+HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
 
 #ifdef HB_USE_ATEXIT
-atexit (free_C_locale); /* First person registers atexit() callback. */
+atexit (free_static_C_locale);
 #endif
+
+return C_locale;
+  }
+  static inline void destroy (HB_LOCALE_T p)
+  {
+HB_FREE_LOCALE (p);
+  }
+  static inline HB_LOCALE_T get_null (void)
+  {
+return nullptr;
   }
+} static_C_locale;
 
-  return C;
+#ifdef HB_USE_ATEXIT
+static
+void free_static_C_locale (void)
+{
+  static_C_locale.free_instance ();
 }
 #endif
 
+static HB_LOCALE_T
+get_C_locale (void)
+{
+  return static_C_locale.get_unconst ();
+}
+#endif /* USE_XLOCALE */
+
 static bool
 parse_float (const char **pp, const char *end, float *pv)
 {
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-12 Thread Behdad Esfahbod
 src/hb-iter-private.hh  |2 +-
 src/hb-machinery-private.hh |   19 ---
 src/hb-private.hh   |   15 ++-
 3 files changed, 27 insertions(+), 9 deletions(-)

New commits:
commit f9a3eab81008c01a458d16f274b1a0eaaae00e7c
Author: Behdad Esfahbod 
Date:   Sun Aug 12 12:21:56 2018 -0700

Add explicit_operator

Fixes https://github.com/harfbuzz/harfbuzz/issues/1127

diff --git a/src/hb-iter-private.hh b/src/hb-iter-private.hh
index 410a50f9..314133ad 100644
--- a/src/hb-iter-private.hh
+++ b/src/hb-iter-private.hh
@@ -72,7 +72,7 @@ struct Iter
 array (array_), length (length_) {}
 
   /* Emptiness. */
-  inline operator bool (void) const { return bool (length); }
+  explicit_operator inline operator bool (void) const { return bool (length); }
 
   /* Current item. */
   inline T &operator * (void)
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 1bc996ed..efe7bda9 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -125,7 +125,20 @@ struct _hb_alignof
 #define alignof(x) (_hb_alignof::value)
 #endif
 
-#endif // __cplusplus < 201103L
+/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
+#ifndef explicit_operator
+#define explicit_operator
+#endif
+
+#else /* __cplusplus >= 201103L */
+
+/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
+#ifndef explicit_operator
+#define explicit_operator explicit
+#endif
+
+#endif /* __cplusplus < 201103L */
+
 
 #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
 #define likely(expr) (__builtin_expect (!!(expr), 1))
commit 470acb6c322fc64556d59847d829d95caa2d51e6
Author: Behdad Esfahbod 
Date:   Sun Aug 12 12:09:20 2018 -0700

Rename

diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index 9b582361..beb61fa9 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -590,13 +590,14 @@ struct BEInt
  * Lazy loaders.
  */
 
-template 
 struct hb_lazy_loader_t
 {
-  static_assert (WheresFace > 0, "");
+  static_assert (WheresData > 0, "");
 
   /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
   inline const Subclass* thiz (void) const { return static_cast (this); }
@@ -623,9 +624,9 @@ struct hb_lazy_loader_t
 Stored *p = this->instance.get ();
 if (unlikely (!p))
 {
-  hb_face_t *face = *(((hb_face_t **) this) - WheresFace);
+  Data *data= *(((Data **) this) - WheresData);
   if (likely (!p))
-   p = thiz ()->create (face);
+   p = thiz ()->create (data);
   if (unlikely (!p))
p = thiz ()->create (nullptr); /* Produce nil object. */
   assert (p);
@@ -670,7 +671,9 @@ struct hb_lazy_loader_t
 /* Specializations. */
 
 template 
-struct hb_object_lazy_loader_t : hb_lazy_loader_t, T>
+struct hb_object_lazy_loader_t : 
hb_lazy_loader_t,
+ hb_face_t, WheresFace,
+ T>
 {
   static inline T *create (hb_face_t *face)
   {
@@ -694,7 +697,9 @@ struct hb_object_lazy_loader_t : 
hb_lazy_loader_t
-struct hb_table_lazy_loader_t : hb_lazy_loader_t, T, hb_blob_t>
+struct hb_table_lazy_loader_t : 
hb_lazy_loader_t,
+hb_face_t, WheresFace,
+T, hb_blob_t>
 {
   static inline hb_blob_t *create (hb_face_t *face)
   {
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-09 Thread Behdad Esfahbod
 src/hb-atomic-private.hh |2 --
 src/hb-iter-private.hh   |2 +-
 src/hb-object-private.hh |7 +--
 3 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit aa3b6017ed71fc251522ff1bedcdae965b4c1c1c
Author: Behdad Esfahbod 
Date:   Thu Aug 9 00:56:28 2018 -0700

Revert "[iter] Make operator bool explicit"

This reverts commit 66920a6bace7c54c8166c4ed938b6ffc5fabcf2b.

Some of our bots (Oracle Studio and Apple gcc 4.2) do not allow
explicit except for constructors.

https://github.com/harfbuzz/harfbuzz/issues/1127

diff --git a/src/hb-iter-private.hh b/src/hb-iter-private.hh
index 039a7734..410a50f9 100644
--- a/src/hb-iter-private.hh
+++ b/src/hb-iter-private.hh
@@ -72,7 +72,7 @@ struct Iter
 array (array_), length (length_) {}
 
   /* Emptiness. */
-  explicit inline operator bool (void) const { return bool (length); }
+  inline operator bool (void) const { return bool (length); }
 
   /* Current item. */
   inline T &operator * (void)
commit e1a2354220c369bd5a62d255acc42c60cd14c473
Author: Behdad Esfahbod 
Date:   Thu Aug 9 00:53:25 2018 -0700

[atomic] More

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 276e696b..297c6469 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -274,8 +274,6 @@ struct hb_atomic_ptr_t
   inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) 
&v); }
   inline bool cmpexch (const T *old, T *new_) const{ return 
hb_atomic_ptr_impl_cmpexch (&v, old, new_); }
 
-  inline T* operator -> (void) const { return get (); }
-
   mutable T *v;
 };
 
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index f5d78e55..4955a68d 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -312,10 +312,13 @@ template 
 static inline void *hb_object_get_user_data (Type   *obj,
 hb_user_data_key_t *key)
 {
-  if (unlikely (!obj || hb_object_is_inert (obj) || !obj->header.user_data.get 
()))
+  if (unlikely (!obj || hb_object_is_inert (obj)))
 return nullptr;
   assert (hb_object_is_valid (obj));
-  return obj->header.user_data->get (key);
+  hb_user_data_array_t *user_data = obj->header.user_data.get ();
+  if (!user_data)
+return nullptr;
+  return user_data->get (key);
 }
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-09 Thread Behdad Esfahbod
 src/hb-atomic-private.hh  |   48 --
 src/hb-common.cc  |   34 ++
 src/hb-face-private.hh|3 +-
 src/hb-face.cc|6 ++--
 src/hb-font.cc|2 -
 src/hb-ft.cc  |   22 +
 src/hb-glib.cc|   11 
 src/hb-graphite2.cc   |   16 +++-
 src/hb-icu.cc |   22 +
 src/hb-machinery-private.hh   |   17 +++--
 src/hb-object-private.hh  |   29 +++---
 src/hb-ot-font.cc |   11 
 src/hb-ot-layout-private.hh   |2 -
 src/hb-ot-post-table.hh   |9 +++
 src/hb-ot-shape-complex-arabic.cc |9 +++
 src/hb-shape-plan.cc  |   19 ---
 src/hb-shape.cc   |   11 
 src/hb-shaper-impl-private.hh |2 -
 src/hb-shaper-private.hh  |   16 +++-
 src/hb-shaper.cc  |   18 +++---
 src/hb-ucdn.cc|   11 
 src/hb-uniscribe.cc   |   14 +--
 22 files changed, 190 insertions(+), 142 deletions(-)

New commits:
commit 1f7380944df9aa81cd48a4764c763d692533c4a6
Author: Behdad Esfahbod 
Date:   Thu Aug 9 00:22:37 2018 -0700

[atomic] Add hb_atomic_ptr_t<> and port all uses

Found and fixed a couple bugs.

Found a couple multithreading issues.  Marked them with "XXX-MT-bug".

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index cdd0a40a..276e696b 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -57,6 +57,8 @@
 #define hb_atomic_int_impl_set_relaxed(AI, V)  __atomic_store_n ((AI), (V), 
__ATOMIC_RELAXED)
 #define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), 
__ATOMIC_RELAXED)
 
+#define hb_atomic_ptr_impl_set_relaxed(P, V)   __atomic_store_n ((P), (V), 
__ATOMIC_RELAXED)
+#define hb_atomic_ptr_impl_get_relaxed(P)  __atomic_load_n ((P), 
__ATOMIC_RELAXED)
 #define hb_atomic_ptr_impl_get(P)  __atomic_load_n ((P), 
__ATOMIC_CONSUME)
 static inline bool
 _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
@@ -76,6 +78,8 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, 
const void *N)
 #define hb_atomic_int_impl_set_relaxed(AI, V)  
(reinterpret_cast *> (AI)->store ((V), 
std::memory_order_relaxed))
 #define hb_atomic_int_impl_get_relaxed(AI) 
(reinterpret_cast *> (AI)->load (std::memory_order_relaxed))
 
+#define hb_atomic_ptr_impl_set_relaxed(P, V)   
(reinterpret_cast *> (P)->store ((V), 
std::memory_order_relaxed))
+#define hb_atomic_ptr_impl_get_relaxed(P)  
(reinterpret_cast *> (P)->load (std::memory_order_relaxed))
 #define hb_atomic_ptr_impl_get(P)  
(reinterpret_cast *> (P)->load (std::memory_order_consume))
 static inline bool
 _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
@@ -231,6 +235,13 @@ static_assert ((sizeof (long) == sizeof (void *)), "");
 #ifndef hb_atomic_int_impl_get_relaxed
 #define hb_atomic_int_impl_get_relaxed(AI) (*(AI))
 #endif
+
+#ifndef hb_atomic_ptr_impl_set_relaxed
+#define hb_atomic_ptr_impl_set_relaxed(P, V)   (*(P) = (V))
+#endif
+#ifndef hb_atomic_ptr_impl_get_relaxed
+#define hb_atomic_ptr_impl_get_relaxed(P)  (*(P))
+#endif
 #ifndef hb_atomic_ptr_impl_get
 inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; 
_hb_memory_r_barrier (); return v; }
 #endif
@@ -239,7 +250,7 @@ inline void *hb_atomic_ptr_impl_get (void **P)  { void 
*v = *P; _hb_memory_r_barr
 #define HB_ATOMIC_INT_INIT(V)  {V}
 struct hb_atomic_int_t
 {
-  inline void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
+  inline void set_relaxed (int v_) const { hb_atomic_int_impl_set_relaxed (&v, 
v_); }
   inline int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed 
(&v); }
   inline int inc (void) { return hb_atomic_int_impl_add (&v,  1); }
   inline int dec (void) { return hb_atomic_int_impl_add (&v, -1); }
@@ -248,8 +259,25 @@ struct hb_atomic_int_t
 };
 
 
-#define hb_atomic_ptr_get(P) hb_atomic_ptr_impl_get((void **) P)
-#define hb_atomic_ptr_cmpexch(P,O,N) hb_atomic_ptr_impl_cmpexch((P),(O),(N))
+template  struct hb_remove_ptr_t { typedef T value; };
+template  struct hb_remove_ptr_t { typedef T value; };
+
+#define HB_ATOMIC_PTR_INIT(V)  {V}
+template 
+struct hb_atomic_ptr_t
+{
+  typedef typename hb_remove_ptr_t::value T;
+
+  inline void init (T* v_ = nullptr) { set_relaxed (v_); }
+  inline void set_relaxed (T* v_) const { hb_atomic_ptr_impl_set_relaxed (&v, 
v_); }
+  inline T *get_relaxed (void) const { return hb_atomic_ptr_impl_get_relaxed 
(&v); }
+  inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) 
&v); }
+  inline bool cmpexch (const T *old, T *new_) const{ return 
hb_atomic_ptr_impl_cm

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-08 Thread Behdad Esfahbod
 NEWS|6 ++
 RELEASING.md|3 +++
 configure.ac|2 +-
 src/hb-machinery-private.hh |   13 ++---
 src/hb-version.h|4 ++--
 5 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit b6fdcf4f8bd09e065c767939125861c9dc8ff18f
Author: Behdad Esfahbod 
Date:   Wed Aug 8 21:54:08 2018 -0700

1.8.7

diff --git a/NEWS b/NEWS
index e97a501d..87907ca8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Overview of changes leading to 1.8.7
+Wednesday, August 8, 2018
+
+- Fix assertion failure with GDEF-blacklisted fonts.
+
+
 Overview of changes leading to 1.8.6
 Tuesday, August 7, 2018
 
diff --git a/RELEASING.md b/RELEASING.md
index c57f8466..d431871c 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -25,6 +25,9 @@ HarfBuzz release walk-through checklist:
 
 6. Do "make distcheck", if it passes, you get a tarball.
Otherwise, fix things and commit them separately before making release,
+   Note: Check src/hb-version.h and make sure the new version number is
+   there.  Sometimes, it does not get updated.  If that's the case,
+   "touch configure.ac" and rebuild.  TODO: debug.
 
 7. "make release-files".  Enter your GPG password.  This creates a sha256 hash
and signs it.
diff --git a/configure.ac b/configure.ac
index c03d79dc..a32b8632 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[1.8.6],
+[1.8.7],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-version.h b/src/hb-version.h
index 7406ea8c..32d95f80 100644
--- a/src/hb-version.h
+++ b/src/hb-version.h
@@ -38,9 +38,9 @@ HB_BEGIN_DECLS
 
 #define HB_VERSION_MAJOR 1
 #define HB_VERSION_MINOR 8
-#define HB_VERSION_MICRO 6
+#define HB_VERSION_MICRO 7
 
-#define HB_VERSION_STRING "1.8.6"
+#define HB_VERSION_STRING "1.8.7"
 
 #define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*1+(minor)*100+(micro) <= \
commit 51ffc3e65aacbece63995be99e2bc20538e3eb75
Author: Behdad Esfahbod 
Date:   Wed Aug 8 22:01:04 2018 -0700

Fix previous commit to use atomic operations

diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index 39a7fd1f..ec41e2bc 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -639,9 +639,16 @@ struct hb_lazy_loader_t
 
   inline void set_stored (Stored *instance_)
   {
-if (instance)
-  thiz ()->destroy (instance);
-instance = instance_;
+/* This *must* be called when there are no other threads accessing.
+ * However, to make TSan, etc, happy, we using cmpexch. */
+  retry:
+Stored *p = (Stored *) hb_atomic_ptr_get (&this->instance);
+if (p)
+{
+  if (unlikely (!hb_atomic_ptr_cmpexch (const_cast(&this->instance), p, instance_)))
+goto retry;
+  thiz ()->destroy (p);
+}
   }
 
   inline const Returned * get (void) const
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-08-06 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt |6 +
 src/hb-font-private.hh |   28 
 src/hb-font.cc |  262 ++---
 src/hb-font.h  |   42 +++
 src/hb-ot-shape.cc |7 -
 5 files changed, 259 insertions(+), 86 deletions(-)

New commits:
commit 79e21984b13bdb879f3007ba9a97fde47df340d3
Author: Behdad Esfahbod 
Date:   Mon Aug 6 09:45:17 2018 -0700

Add batch advance width callback function

New API:
+hb_font_funcs_set_glyph_h_advances_func
+hb_font_funcs_set_glyph_v_advances_func
+hb_font_get_glyph_h_advances
+hb_font_get_glyph_h_advances_func_t
+hb_font_get_glyph_v_advances
+hb_font_get_glyph_v_advances_func_t

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 65ea1f90..f012fbdb 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -208,10 +208,12 @@ hb_font_funcs_set_glyph_contour_point_func
 hb_font_funcs_set_glyph_extents_func
 hb_font_funcs_set_glyph_from_name_func
 hb_font_funcs_set_glyph_h_advance_func
+hb_font_funcs_set_glyph_h_advances_func
 hb_font_funcs_set_glyph_h_kerning_func
 hb_font_funcs_set_glyph_h_origin_func
 hb_font_funcs_set_glyph_name_func
 hb_font_funcs_set_glyph_v_advance_func
+hb_font_funcs_set_glyph_v_advances_func
 hb_font_funcs_set_glyph_v_kerning_func
 hb_font_funcs_set_glyph_v_origin_func
 hb_font_funcs_set_nominal_glyph_func
@@ -233,6 +235,8 @@ hb_font_get_glyph_from_name
 hb_font_get_glyph_from_name_func_t
 hb_font_get_glyph_h_advance
 hb_font_get_glyph_h_advance_func_t
+hb_font_get_glyph_h_advances
+hb_font_get_glyph_h_advances_func_t
 hb_font_get_glyph_h_kerning
 hb_font_get_glyph_h_kerning_func_t
 hb_font_get_glyph_h_origin
@@ -245,6 +249,8 @@ hb_font_get_glyph_origin_for_direction
 hb_font_get_glyph_origin_func_t
 hb_font_get_glyph_v_advance
 hb_font_get_glyph_v_advance_func_t
+hb_font_get_glyph_v_advances
+hb_font_get_glyph_v_advances_func_t
 hb_font_get_glyph_v_kerning
 hb_font_get_glyph_v_kerning_func_t
 hb_font_get_glyph_v_origin
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 81ae4111..6862e062 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -46,6 +46,8 @@
   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_advances) \
+  HB_FONT_FUNC_IMPLEMENT (glyph_v_advances) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
   HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \
@@ -54,7 +56,6 @@
   HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \
   HB_FONT_FUNC_IMPLEMENT (glyph_name) \
   HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \
-  HB_FONT_FUNC_IMPLEMENT (glyph_h_advances) \
   /* ^--- Add new callbacks here */
 
 struct hb_font_funcs_t
@@ -228,18 +229,6 @@ struct hb_font_t
 klass->user_data.glyph_h_advance);
   }
 
-  inline void get_glyph_h_advances(unsigned count,
-   hb_codepoint_t* glyphs,
-   unsigned glyph_struct_size,
-   hb_position_t* advances,
-   unsigned advance_struct_size) {
-return klass->get.f.glyph_h_advances (this, user_data,
-  count,
-  glyphs, glyph_struct_size,
-  advances, advance_struct_size,
- klass->user_data.glyph_h_advances);
-  }
-
   inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
   {
 return klass->get.f.glyph_v_advance (this, user_data,
@@ -247,6 +236,32 @@ struct hb_font_t
 klass->user_data.glyph_v_advance);
   }
 
+  inline void get_glyph_h_advances (unsigned int count,
+   hb_codepoint_t *first_glyph,
+   unsigned int glyph_stride,
+   hb_position_t *first_advance,
+   unsigned int advance_stride)
+  {
+return klass->get.f.glyph_h_advances (this, user_data,
+ count,
+ first_glyph, glyph_stride,
+ first_advance, advance_stride,
+ klass->user_data.glyph_h_advances);
+  }
+
+  inline void get_glyph_v_advances (unsigned int count,
+   hb_codepoint_t *first_glyph,
+   unsigned int glyph_stride,
+   hb_position_t *first_advance,
+   unsigned int advance_stride)
+  {
+return klass->get.f.glyph_v_advances (this, user_data,
+ count,
+ 

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-31 Thread Behdad Esfahbod
 src/hb-atomic-private.hh |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit ad275627425c9b3c4fb1e69aa408067bd0bb77da
Author: Behdad Esfahbod 
Date:   Tue Jul 31 23:01:05 2018 -0700

[atomic] On IBM, use light-weight sync for everything

lwsync() is a full read/write-barrier.  That's all we need, never
need sync().  I'm not sure why an isync() was used in fetch_and_add,
but since that's a read-modify-write, I just changed it to have
lwsync() on both sides.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 0d0badfb..f60c46e3 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -163,20 +163,20 @@ static inline void _hb_memory_barrier (void)  { 
OSMemoryBarrier (); }
 static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) {
   __lwsync();
   int result = __fetch_and_add(AI, V);
-  __isync();
+  __lwsync();
   return result;
 }
 static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) {
-  __sync();
+  __lwsync();
   int result = __compare_and_swaplp (P, &O, N);
-  __sync();
+  __lwsync();
   return result;
 }
 
 typedef int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)   _hb_fetch_and_add ((AI), (V))
 
-static inline void _hb_memory_barrier (void)   { __sync(); }
+static inline void _hb_memory_barrier (void)   { __lwsync(); }
 
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)   _hb_compare_and_swaplp 
((long*)(P), (long)(O), (long)(N))
 
commit fd638d215feb058c2294e447cc68f6f50e2b481d
Author: Behdad Esfahbod 
Date:   Tue Jul 31 23:00:15 2018 -0700

[atomic] Add XXX items around Solaris ops

Since add_int and cas are both read-modify-write, I wonder if we
also need a barrier after them.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index ef72872a..0d0badfb 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -122,11 +122,11 @@ static inline void _hb_memory_barrier (void)  { 
__sync_synchronize (); }
 #include 
 
 typedef unsigned int hb_atomic_int_impl_t;
-#define hb_atomic_int_impl_add(AI, V)  ( ({__machine_rw_barrier ();}), 
atomic_add_int_nv ((AI), (V)) - (V))
+#define hb_atomic_int_impl_add(AI, V)  ( ({__machine_rw_barrier ();}), 
atomic_add_int_nv ((AI), (V)) - (V) /* XXX barrier again? */)
 
 static inline void _hb_memory_barrier (void)   { __machine_rw_barrier (); }
 
-#define hb_atomic_ptr_impl_cmpexch(P,O,N)  ( ({__machine_rw_barrier ();}), 
atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? 
true : false)
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)  ( ({__machine_rw_barrier ();}), 
atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? 
true : false /* XXX barrier again? */)
 
 
 #elif !defined(HB_NO_MT) && defined(__APPLE__)
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-31 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt |2 ++
 src/hb-atomic-private.hh   |   28 +---
 src/hb-gobject-structs.cc  |1 +
 src/hb-gobject-structs.h   |4 
 src/hb-map.cc  |6 ++
 5 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit 896ff15ae60a4a4b94c62946e69196b877839bb5
Author: Behdad Esfahbod 
Date:   Tue Jul 31 22:51:38 2018 -0700

[atomic] Fix get() impl

Originally, glib's atomic_get was implemented as "memory_barrier; load".
I copied this into cairo, fontconfig, and harfbuzz.  However, that's
wrong.  Correct way is "load; memory_barrier".  The details are long
and hard to fully grasp.  Best to read:

  https://www.kernel.org/doc/Documentation/memory-barriers.txt

Also see my report against GNOME:

  https://gitlab.gnome.org/GNOME/glib/issues/1449

Note that this is irrelevant if C++11-like atomic ops are available.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 2e73cd85..ef72872a 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -89,11 +89,10 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void 
*O_, const void *N)
 
 #include 
 
-/* MinGW has a convoluted history of supporting MemoryBarrier
- * properly.  As such, define a function to wrap the whole
- * thing. */
-static inline void _HBMemoryBarrier (void) {
+static inline void _hb_memory_barrier (void)
+{
 #if !defined(MemoryBarrier)
+  /* MinGW has a convoluted history of supporting MemoryBarrier. */
   long dummy = 0;
   InterlockedExchange (&dummy, 1);
 #else
@@ -104,7 +103,6 @@ static inline void _HBMemoryBarrier (void) {
 typedef LONG hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)  InterlockedExchangeAdd ((AI), 
(V))
 
-#define hb_atomic_ptr_impl_get(P)  (_HBMemoryBarrier (), (void *) 
*(P))
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  
(InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) 
== (void *) (O))
 
 
@@ -113,7 +111,8 @@ typedef LONG hb_atomic_int_impl_t;
 typedef int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)  __sync_fetch_and_add ((AI), (V))
 
-#define hb_atomic_ptr_impl_get(P)  (void *) (__sync_synchronize 
(), *(P))
+static inline void _hb_memory_barrier (void)   { __sync_synchronize (); }
+
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  __sync_bool_compare_and_swap 
((P), (O), (N))
 
 
@@ -125,7 +124,8 @@ typedef int hb_atomic_int_impl_t;
 typedef unsigned int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)  ( ({__machine_rw_barrier ();}), 
atomic_add_int_nv ((AI), (V)) - (V))
 
-#define hb_atomic_ptr_impl_get(P)  ( ({__machine_rw_barrier ();}), 
(void *) *(P))
+static inline void _hb_memory_barrier (void)   { __machine_rw_barrier (); }
+
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  ( ({__machine_rw_barrier ();}), 
atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? 
true : false)
 
 
@@ -142,7 +142,8 @@ typedef unsigned int hb_atomic_int_impl_t;
 typedef int32_t hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)  (OSAtomicAdd32Barrier ((V), 
(AI)) - (V))
 
-#define hb_atomic_ptr_impl_get(P)  (OSMemoryBarrier (), (void *) 
*(P))
+static inline void _hb_memory_barrier (void)   { OSMemoryBarrier (); }
+
 #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || 
__IPHONE_VERSION_MIN_REQUIRED >= 20100)
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  
OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
 #else
@@ -175,7 +176,8 @@ static inline int _hb_compare_and_swaplp(volatile long* P, 
long O, long N) {
 typedef int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)   _hb_fetch_and_add ((AI), (V))
 
-#define hb_atomic_ptr_impl_get(P)   (__sync(), (void *) *(P))
+static inline void _hb_memory_barrier (void)   { __sync(); }
+
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)   _hb_compare_and_swaplp 
((long*)(P), (long)(O), (long)(N))
 
 #elif !defined(HB_NO_MT)
@@ -185,7 +187,7 @@ typedef int hb_atomic_int_impl_t;
 typedef volatile int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)  ((*(AI) += (V)) - (V))
 
-#define hb_atomic_ptr_impl_get(P)  ((void *) *(P))
+static inline void _hb_memory_barrier (void)   {}
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  (* (void * volatile *) (P) == 
(void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
 
 
@@ -194,7 +196,8 @@ typedef volatile int hb_atomic_int_impl_t;
 typedef int hb_atomic_int_impl_t;
 #define hb_atomic_int_impl_add(AI, V)  ((*(AI) += (V)) - (V))
 
-#define hb_atomic_ptr_impl_get(P)  ((void *) *(P))
+static inline void _hb_memory_barrier (void)   {}
+
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  (* (void **) (P) == (void *) 
(O) ? (* (void **) (P) = (void *) (N), true) : false)
 
 
@@ -210,

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-31 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-khmer.cc |   26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 6ddd669e205cf2c1c3b0a362330b686386f68519
Author: Behdad Esfahbod 
Date:   Tue Jul 31 13:38:07 2018 -0700

[khmer] Clear syllables before presentation features

Probably not what Uniscribe does, but good idea?

diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index 1a155a16..58236039 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -125,7 +125,7 @@ collect_features_khmer (hb_ot_shape_planner_t *plan)
 map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
   }
 
-  map->add_gsub_pause (nullptr);
+  map->add_gsub_pause (clear_syllables);
 
   for (; i < KHMER_NUM_FEATURES; i++) {
 map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
@@ -134,7 +134,6 @@ collect_features_khmer (hb_ot_shape_planner_t *plan)
   map->add_global_bool_feature (HB_TAG('c','a','l','t'));
   map->add_global_bool_feature (HB_TAG('c','l','i','g'));
 
-  map->add_gsub_pause (clear_syllables);
 }
 
 static void
commit 8eef1964a708c3db52e5e7312689c4664afa9839
Author: Behdad Esfahbod 
Date:   Tue Jul 31 13:35:10 2018 -0700

[khmer] Revert previous change, and remove pauses

This makes test suite happy again (at 44) while fixing the sequences
we were fixing, which were the following with KhmerUI.ttf:

  U+1789,U+17BC
  U+1789,U+17D2,U+1789
  U+1789,U+17D2,U+1789,U+17BC

Fixes rest of https://github.com/harfbuzz/harfbuzz/issues/974

diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index a5f357a5..1a155a16 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -107,18 +107,9 @@ collect_features_khmer (hb_ot_shape_planner_t *plan)
   map->add_gsub_pause (setup_syllables);
   map->add_gsub_pause (reorder);
 
-  map->add_global_bool_feature (HB_TAG('l','o','c','l'));
-  map->add_gsub_pause (nullptr);
-
-  unsigned int i = 0;
-  for (; i < KHMER_BASIC_FEATURES; i++) {
-map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
-map->add_gsub_pause (nullptr);
-  }
-
-  /* Testing suggests that Uniscribe applies 'ccmp' here, NOT before
-   * the basic features.  Test with KhmerUI.ttf and the following
-   * three sequences:
+  /* Testing suggests that Uniscribe does NOT before between basic
+   * features.  Test with KhmerUI.ttf and the following three
+   * sequences:
*
*   U+1789,U+17BC
*   U+1789,U+17D2,U+1789
@@ -126,14 +117,20 @@ collect_features_khmer (hb_ot_shape_planner_t *plan)
*
* https://github.com/harfbuzz/harfbuzz/issues/974
*/
+  map->add_global_bool_feature (HB_TAG('l','o','c','l'));
   map->add_global_bool_feature (HB_TAG('c','c','m','p'));
+
+  unsigned int i = 0;
+  for (; i < KHMER_BASIC_FEATURES; i++) {
+map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
+  }
+
   map->add_gsub_pause (nullptr);
 
   for (; i < KHMER_NUM_FEATURES; i++) {
 map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | 
F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
   }
 
-
   map->add_global_bool_feature (HB_TAG('c','a','l','t'));
   map->add_global_bool_feature (HB_TAG('c','l','i','g'));
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-30 Thread Behdad Esfahbod
 src/hb-machinery-private.hh|6 --
 src/hb-ot-layout-common-private.hh |4 +++-
 2 files changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 66ccd8ac405c9c25b37de9eb467a7382880dda35
Author: Behdad Esfahbod 
Date:   Mon Jul 30 17:03:06 2018 -0700

[serialize] Increase stage count from 8 to 32

Indic shaper uses many stages.  Now we are provably not limiting
functionality whereas the previous limit of 8 was assuming real-world
practices.

diff --git a/src/hb-ot-layout-common-private.hh 
b/src/hb-ot-layout-common-private.hh
index dec237c8..1cf530ea 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -45,8 +45,10 @@
 /*
  * The maximum number of times a lookup can be applied during shaping.
  * Used to limit the number of iterations of the closure algorithm.
+ * This must be larger than the number of times add_pause() is
+ * called in a collect_features call of any shaper.
  */
-#define HB_CLOSURE_MAX_STAGES  8
+#define HB_CLOSURE_MAX_STAGES  32
 #endif
 
 
commit ee8cf919654cb191e955fe1f89b1ebfb2b8b32ee
Author: Behdad Esfahbod 
Date:   Mon Jul 30 16:59:41 2018 -0700

[serialize] Remove unused truncate() method

diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index 653d7c6f..ff56b1dc 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -467,12 +467,6 @@ struct hb_serialize_context_t
 return reinterpret_cast (&obj);
   }
 
-  inline void truncate (void *new_head)
-  {
-assert (this->start < new_head && new_head <= this->head);
-this->head = (char *) new_head;
-  }
-
   unsigned int debug_depth;
   char *start, *end, *head;
   bool ran_out_of_room;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-25 Thread Behdad Esfahbod
 src/Makefile.sources|2 
 src/hb-iter-private.hh  |  147 +
 src/hb-machinery-private.hh |  703 
 src/hb-open-type-private.hh |  669 -
 4 files changed, 855 insertions(+), 666 deletions(-)

New commits:
commit 3c2842cbcf8cded73d1e310379e1a4ca124a6fc2
Author: Behdad Esfahbod 
Date:   Wed Jul 25 17:07:17 2018 -0700

Add hb-iter-private.hh

Unused so far.

diff --git a/src/Makefile.sources b/src/Makefile.sources
index fb4e4a2c..80b8e261 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -14,6 +14,7 @@ HB_BASE_sources = \
hb-face.cc \
hb-font-private.hh \
hb-font.cc \
+   hb-iter-private.hh \
hb-map-private.hh \
hb-map.cc \
hb-machinery-private.hh \
diff --git a/src/hb-iter-private.hh b/src/hb-iter-private.hh
new file mode 100644
index ..a22675cd
--- /dev/null
+++ b/src/hb-iter-private.hh
@@ -0,0 +1,147 @@
+/*
+ * Copyright © 2018  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_ITER_PRIVATE_HH
+#define HB_ITER_PRIVATE_HH
+
+#include "hb-private.hh"
+
+
+/* Unified iterator object.
+ *
+ * The goal of this template is to make the same iterator interface
+ * available to all types, and make it very easy and compact to use.
+ * Iterator objects are small, light-weight, objects that can be
+ * copied by value.  If the collection / object being iterated on
+ * is writable, then the iterator points to lvalues, otherwise it
+ * returns rvalues.
+ *
+ * The way to declare, initialize, and use iterators, eg.:
+ *
+ *   Iter s (src);
+ *   Iter t (dst);
+ *   for (; s && t; s++, t++)
+ * *s = *t;
+ */
+
+template 
+struct Iter;
+
+template 
+struct Iter
+{
+  inline Iter (const T &c);
+};
+
+template 
+struct Iter
+{
+  /* Type of items. */
+  typedef T Value;
+
+  /* Constructors. */
+  inline Iter (T *array_, int length_) :
+array (array_), length (MAX (length_, 0)) {}
+  template 
+  inline Iter (T (&array_)[length_]) :
+array (array_), length (length_) {}
+
+  /* Emptiness. */
+  inline operator bool (void) const { return bool (length); }
+
+  /* Current item. */
+  inline T &operator * (void)
+  {
+if (unlikely (!length)) return CrapOrNull(T);
+return *array;
+  }
+  inline T &operator -> (void)
+  {
+return (operator *);
+  }
+
+  /* Next. */
+  inline Iter & operator ++ (void)
+  {
+if (unlikely (!length)) return *this;
+array++;
+length--;
+return *this;
+  }
+  /* Might return void, or a copy of pre-increment iterator. */
+  inline void operator ++ (int)
+  {
+if (unlikely (!length)) return;
+array++;
+length--;
+  }
+
+  /* Some iterators might implement len(). */
+  inline unsigned int len (void) const { return length; }
+
+  /* Some iterators might implement fast-forward.
+   * Only implement it if it's constant-time. */
+  inline void operator += (unsigned int n)
+  {
+n = MIN (n, length);
+array += n;
+length -= n;
+  }
+
+  /* Some iterators might implement random-access.
+   * Only implement it if it's constant-time. */
+  inline Iter & operator [] (unsigned int i)
+  {
+if (unlikely (i >= length)) return CrapOrNull(T);
+return array[i];
+  }
+
+  private:
+  T *array;
+  unsigned int length;
+};
+
+/* XXX Remove
+ * Just to test these compile. */
+static inline void
+m (void)
+{
+  const int src[10] = {};
+  int dst[20];
+
+  Iter s (src);
+  Iter s2 (src, 5);
+  Iter t (dst);
+
+  s2 = s;
+
+  for (; s && t; s++, t++)
+   {
+*t = *s;
+   }
+}
+
+#endif /* HB_ITER_PRIVATE_HH */
diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index 5fafadbe..649788c1 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -30,6 +30,7 @@
 #define HB_MACHINERY_PRIVATE_HH
 
 #include "hb-private.hh"
+#include "hb-iter-private.hh"
 
 
 namespace OT {
commit 92b1e025

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-25 Thread Behdad Esfahbod
 src/hb-shaper-private.hh |4 
 src/hb-subset-plan.cc|   12 
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit bf90f35302c319ec4699ccbcd1e28b15ef2ec423
Author: Behdad Esfahbod 
Date:   Tue Jul 24 18:00:14 2018 -0700

[coretext] Add note

diff --git a/src/hb-shaper-private.hh b/src/hb-shaper-private.hh
index ce2d9f28..3fa53216 100644
--- a/src/hb-shaper-private.hh
+++ b/src/hb-shaper-private.hh
@@ -97,6 +97,10 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t 
*object) \
   retry: \
   HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, 
object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \
   if (likely (data) && !(condition)) { \
+/* Note that evaluating condition above can be dangerous if another thread
+ * got here first and destructed data.  That's, as always, bad use pattern.
+ * If you modify the font (change font size), other threads must not be
+ * using it at the same time. */
 /* Drop and recreate. */ \
 /* If someone dropped it in the mean time, throw it away and don't touch 
it. \
  * Otherwise, destruct it. */ \
commit fb58cb4b5ca7043fa746b1a01790abf53bedfa86
Author: Garret Rieger 
Date:   Wed Jul 25 13:39:17 2018 -0700

[subset] Only used reachable lookups for gsub closure.

diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index 55c4e3f6..12566827 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -56,11 +56,15 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf,
 static void
 _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain)
 {
-  // TODO(grieger): This uses all lookups, instead collect
-  //the set of lookups that are relevant.
-  //See fontTools implementation.
+  hb_auto_t lookup_indices;
+  hb_ot_layout_collect_lookups (face,
+HB_OT_TAG_GSUB,
+nullptr,
+nullptr,
+nullptr,
+&lookup_indices);
   hb_ot_layout_lookups_substitute_closure (face,
-   nullptr,
+   &lookup_indices,
gids_to_retain);
 }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-17 Thread Behdad Esfahbod
 src/Makefile.am  |1 +
 src/hb-atomic-private.hh |   22 +++---
 src/hb-object-private.hh |2 +-
 test/api/Makefile.am |2 ++
 4 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 04b7b81bcbf19cb85d06d930192d6591ba45ef72
Author: Behdad Esfahbod 
Date:   Tue Jul 17 10:57:01 2018 +0200

Reland "Implement C++11-style GCC builtin atomic ops"

Fixed the crasher in it.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 14960026..02cf6f38 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -46,21 +46,37 @@
 /* Defined externally, i.e. in config.h; must have typedef'ed 
hb_atomic_int_impl_t as well. */
 
 
+#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE)
+
+/* C++11-style GCC primitives. */
+
+typedef int hb_atomic_int_impl_t;
+#define hb_atomic_int_impl_add(AI, V)  __atomic_fetch_add (&(AI), (V), 
__ATOMIC_ACQ_REL)
+
+#define hb_atomic_ptr_impl_get(P)  __atomic_load_n ((P), 
__ATOMIC_ACQUIRE)
+static inline bool
+_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
+{
+  const void *O = O_; // Need lvalue
+  return __atomic_compare_exchange_n ((void **) P, (void **) &O, (void *) N, 
true, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
+}
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)  (_hb_atomic_ptr_impl_cmplexch 
((const void **) (P), (O), (N)))
+
 #elif !defined(HB_NO_MT) && __cplusplus >= 201103L
 
-/* Prefer C++11 atomics. */
+/* C++11 atomics. */
 
 #include 
 
 typedef int hb_atomic_int_impl_t;
-#define hb_atomic_int_impl_add(AI, V)  
(reinterpret_cast *> (&AI)->fetch_add (V, 
std::memory_order_acq_rel))
+#define hb_atomic_int_impl_add(AI, V)  
(reinterpret_cast *> (&AI)->fetch_add ((V), 
std::memory_order_acq_rel))
 
 #define hb_atomic_ptr_impl_get(P)  
(reinterpret_cast *> (P)->load (std::memory_order_acquire))
 static inline bool
 _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
 {
   const void *O = O_; // Need lvalue
-  return reinterpret_cast *> 
(P)->compare_exchange_weak ((O), (N), std::memory_order_acq_rel);
+  return reinterpret_cast *> 
(P)->compare_exchange_weak (O, N, std::memory_order_acq_rel, 
std::memory_order_relaxed);
 }
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)  (_hb_atomic_ptr_impl_cmplexch 
((const void **) (P), (O), (N)))
 
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index fcdc9256..8199c4b8 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -94,7 +94,7 @@ struct hb_user_data_array_t
 struct hb_object_header_t
 {
   hb_reference_count_t ref_count;
-  hb_user_data_array_t *user_data;
+  mutable hb_user_data_array_t *user_data;
 
 #define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, nullptr}
 
commit 019d18e9ae643134bfc3861be65ac618a5892c92
Author: Behdad Esfahbod 
Date:   Tue Jul 17 10:59:19 2018 +0200

Minor

diff --git a/src/Makefile.am b/src/Makefile.am
index 6dfec3bf..66594bbc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,7 @@ check_PROGRAMS =
 
 # Convenience targets:
 lib: $(BUILT_SOURCES) libharfbuzz.la libharfbuzz-subset.la
+libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES)
 fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la libharfbuzz-subset-fuzzing.la
 
 lib_LTLIBRARIES = libharfbuzz.la
diff --git a/test/api/Makefile.am b/test/api/Makefile.am
index 65ceeda3..a2033449 100644
--- a/test/api/Makefile.am
+++ b/test/api/Makefile.am
@@ -9,6 +9,8 @@ MAINTAINERCLEANFILES =
 # Convenience targets:
 lib:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
+libs:
+   @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs
 
 EXTRA_DIST += CMakeLists.txt
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-11 Thread Behdad Esfahbod
 NEWS |8 
 RELEASING.md |2 +-
 configure.ac |2 +-
 src/hb-version.h |4 ++--
 4 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 7796857c93b779e3c93eedd1cceb217d691dfd81
Author: Behdad Esfahbod 
Date:   Wed Jul 11 15:27:37 2018 +0200

Minor

diff --git a/RELEASING.md b/RELEASING.md
index 0aef610b..c57f8466 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -29,7 +29,7 @@ HarfBuzz release walk-through checklist:
 7. "make release-files".  Enter your GPG password.  This creates a sha256 hash
and signs it.
 
-8. Now that you have release files built, commit NEWS and configure.ac changes,
+8. Now that you have release files, commit NEWS, configure.ac, and 
src/hb-version.h,
as well as any REPLACEME changes you made.  The commit message is simply the
release number.  Eg. "1.4.7"
 
commit 2b76767bf572364d3d647cdd139f2044a7ad06b2
Author: Behdad Esfahbod 
Date:   Wed Jul 11 15:27:13 2018 +0200

1.8.3

diff --git a/NEWS b/NEWS
index c4fad25a..9031766d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Overview of changes leading to 1.8.3
+Wednesday, July 11, 2018
+
+- A couple of Indic / USE bug fixes.
+- Disable vectorization, as it was causing unaligned access bus error on
+  certain 32bit architectures.
+
+
 Overview of changes leading to 1.8.2
 Tuesday, July 3, 2018
 
diff --git a/configure.ac b/configure.ac
index 35de036b..b6fcfc02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[1.8.2],
+[1.8.3],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-version.h b/src/hb-version.h
index 7f2e9dd7..c3c38de7 100644
--- a/src/hb-version.h
+++ b/src/hb-version.h
@@ -38,9 +38,9 @@ HB_BEGIN_DECLS
 
 #define HB_VERSION_MAJOR 1
 #define HB_VERSION_MINOR 8
-#define HB_VERSION_MICRO 2
+#define HB_VERSION_MICRO 3
 
-#define HB_VERSION_STRING "1.8.2"
+#define HB_VERSION_STRING "1.8.3"
 
 #define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*1+(minor)*100+(micro) <= \
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-10 Thread Behdad Esfahbod
 src/hb-debug.hh  |1 
 src/hb-dsalgs.hh |  237 
 src/hb-object-private.hh |2 
 src/hb-private.hh|  251 ---
 4 files changed, 245 insertions(+), 246 deletions(-)

New commits:
commit 25aa411ac524ed08624033da473a5e050ff41633
Author: Behdad Esfahbod 
Date:   Tue Jul 10 16:05:03 2018 +0200

Put back include dependencies

diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index 95847b9c..fcdc9256 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -33,6 +33,8 @@
 #define HB_OBJECT_PRIVATE_HH
 
 #include "hb-private.hh"
+#include "hb-atomic-private.hh"
+#include "hb-mutex-private.hh"
 
 
 /* reference_count */
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 3520919f..ff339df4 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -599,11 +599,12 @@ _hb_memalign(void **memptr, size_t alignment, size_t size)
 #endif
 
 
-/* Headers we include for everyone. Specifically ordered to resolve 
dependencies. */
+/* Headers we include for everyone.  Keep sorted.  They express dependency 
amongst
+ * themselves, but no other file should include them.*/
 #include "hb-atomic-private.hh"
-#include "hb-mutex-private.hh"
-#include "hb-dsalgs.hh"
 #include "hb-debug.hh"
+#include "hb-dsalgs.hh"
+#include "hb-mutex-private.hh"
 #include "hb-object-private.hh"
 
 #endif /* HB_PRIVATE_HH */
commit 491d93bf74dd0483715ecca430715b69664e1211
Author: Behdad Esfahbod 
Date:   Tue Jul 10 16:03:31 2018 +0200

Move more stuff from hb-private.hh to hb-dsalgs.hh

diff --git a/src/hb-debug.hh b/src/hb-debug.hh
index c244347b..ae0b6774 100644
--- a/src/hb-debug.hh
+++ b/src/hb-debug.hh
@@ -28,6 +28,7 @@
 #define HB_DEBUG_HH
 
 #include "hb-private.hh"
+#include "hb-dsalgs.hh"
 
 
 #ifndef HB_DEBUG
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 60cb0023..4d3db966 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -30,6 +30,243 @@
 #include "hb-private.hh"
 
 
+/* Void! For when we need a expression-type of void. */
+typedef const struct _hb_void_t *hb_void_t;
+#define HB_VOID ((const _hb_void_t *) nullptr)
+
+
+/*
+ * Bithacks.
+ */
+
+/* Return the number of 1 bits in v. */
+template 
+static inline HB_CONST_FUNC unsigned int
+hb_popcount (T v)
+{
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && 
defined(__OPTIMIZE__)
+  if (sizeof (T) <= sizeof (unsigned int))
+return __builtin_popcount (v);
+
+  if (sizeof (T) <= sizeof (unsigned long))
+return __builtin_popcountl (v);
+
+  if (sizeof (T) <= sizeof (unsigned long long))
+return __builtin_popcountll (v);
+#endif
+
+  if (sizeof (T) <= 4)
+  {
+/* "HACKMEM 169" */
+uint32_t y;
+y = (v >> 1) &0333;
+y = v - y - ((y >>1) & 0333);
+return (((y + (y >> 3)) & 030707070707) % 077);
+  }
+
+  if (sizeof (T) == 8)
+  {
+unsigned int shift = 32;
+return hb_popcount ((uint32_t) v) + hb_popcount ((uint32_t) (v 
>> shift));
+  }
+
+  if (sizeof (T) == 16)
+  {
+unsigned int shift = 64;
+return hb_popcount ((uint64_t) v) + hb_popcount ((uint64_t) (v 
>> shift));
+  }
+
+  assert (0);
+  return 0; /* Shut up stupid compiler. */
+}
+
+/* Returns the number of bits needed to store number */
+template 
+static inline HB_CONST_FUNC unsigned int
+hb_bit_storage (T v)
+{
+  if (unlikely (!v)) return 0;
+
+#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
+  if (sizeof (T) <= sizeof (unsigned int))
+return sizeof (unsigned int) * 8 - __builtin_clz (v);
+
+  if (sizeof (T) <= sizeof (unsigned long))
+return sizeof (unsigned long) * 8 - __builtin_clzl (v);
+
+  if (sizeof (T) <= sizeof (unsigned long long))
+return sizeof (unsigned long long) * 8 - __builtin_clzll (v);
+#endif
+
+#if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__)
+  if (sizeof (T) <= sizeof (unsigned int))
+  {
+unsigned long where;
+_BitScanReverse (&where, v);
+return 1 + where;
+  }
+# if _WIN64
+  if (sizeof (T) <= 8)
+  {
+unsigned long where;
+_BitScanReverse64 (&where, v);
+return 1 + where;
+  }
+# endif
+#endif
+
+  if (sizeof (T) <= 4)
+  {
+/* "bithacks" */
+const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0x};
+const unsigned int S[] = {1, 2, 4, 8, 16};
+unsigned int r = 0;
+for (int i = 4; i >= 0; i--)
+  if (v & b[i])
+  {
+   v >>= S[i];
+   r |= S[i];
+  }
+return r + 1;
+  }
+  if (sizeof (T) <= 8)
+  {
+/* "bithacks" */
+const uint64_t b[] = {0x2ULL, 0xCULL, 0xF0ULL, 0xFF00ULL, 0xULL, 
0xULL};
+const unsigned int S[] = {1, 2, 4, 8, 16, 32};
+unsigned int r = 0;
+for (int i = 5; i >= 0; i--)
+  if (v & b[i])
+  {
+   v >>= S[i];
+   r |= S[i];
+  }
+return r + 1;
+  }
+  if (sizeof (T) == 16)
+  {
+unsigned int shift = 64;
+return (v >> shift) ? hb_bit_storage ((uint64_t) (v >

[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-10 Thread Behdad Esfahbod
 configure.ac  |2 -
 src/hb-private.hh |   63 --
 2 files changed, 53 insertions(+), 12 deletions(-)

New commits:
commit 83ea277178544cd7e417bdfb7b600ede94910e13
Author: Behdad Esfahbod 
Date:   Tue Jul 10 13:17:27 2018 +0200

Add posix_memalign() fallback

diff --git a/configure.ac b/configure.ac
index d6c23e53..35de036b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,7 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 ])
 
 # Functions and headers
-AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale 
strtod_l)
+AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale 
strtod_l posix_memalign)
 
 save_libs="$LIBS"
 LIBS="$LIBS -lm"
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 48a7db10..56606531 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -58,6 +58,7 @@
 #define HB_PASTE1(a,b) a##b
 #define HB_PASTE(a,b) HB_PASTE1(a,b)
 
+
 /* Compile-time custom allocator support. */
 
 #if defined(hb_malloc_impl) \
@@ -72,6 +73,14 @@ extern "C" void  hb_free_impl(void *ptr);
 #define calloc hb_calloc_impl
 #define realloc hb_realloc_impl
 #define free hb_free_impl
+
+#if defined(hb_memalign_impl
+extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
+#define posix_memalign hb_memalign_impl
+#else
+#undef HAVE_POSIX_MEMALIGN
+#endif
+
 #endif
 
 
@@ -550,6 +559,10 @@ _hb_ceil_to_4 (unsigned int v)
   return ((v - 1) | 3) + 1;
 }
 
+static inline bool _hb_ispow2 (unsigned int v)
+{
+  return 0 == (v & (v - 1));
+}
 
 
 /*
@@ -1272,4 +1285,31 @@ _hb_round (double x)
 #endif
 
 
+/* fallback for posix_memalign() */
+static inline int
+_hb_memalign(void **memptr, size_t alignment, size_t size)
+{
+  if (unlikely (!_hb_ispow2 (alignment) ||
+   !alignment ||
+   0 != (alignment & (sizeof (void *) - 1
+return EINVAL;
+
+  char *p = (char *) malloc (size + alignment - 1);
+  if (unlikely (!p))
+return ENOMEM;
+
+  size_t off = (size_t) p & (alignment - 1);
+  if (off)
+p += alignment - off;
+
+  *memptr = (void *) p;
+
+  return 0;
+}
+#if !defined(posix_memalign) && !defined(HAVE_POSIX_MEMALIGN)
+#define posix_memalign _hb_memalign
+#endif
+
+
+
 #endif /* HB_PRIVATE_HH */
commit 292c100d6141eb2e981fa632602d73768f748727
Author: Behdad Esfahbod 
Date:   Tue Jul 10 13:16:52 2018 +0200

Always compile (but not use) alignof() and round() fallback codes

Catches compile-errors in them better.

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 8609e04a..48a7db10 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -78,6 +78,17 @@ extern "C" void  hb_free_impl(void *ptr);
 /* Compiler attributes */
 
 
+template 
+struct _hb_alignof
+{
+  struct s
+  {
+char c;
+T t;
+  };
+  static constexpr unsigned int value = offsetof (s, t);
+};
+
 #if __cplusplus < 201103L
 
 #ifndef nullptr
@@ -104,16 +115,6 @@ extern "C" void  hb_free_impl(void *ptr);
 
 #ifndef alignof
 #define alignof(x) (_hb_alignof::value)
-template 
-struct _hb_alignof
-{
-  struct s
-  {
-char c;
-T t;
-  };
-  static constexpr unsigned int value = offsetof (s, t);
-};
 #endif // alignof
 
 #endif // __cplusplus < 201103L
@@ -1258,7 +1259,6 @@ struct hb_bytes_t
 
 
 /* fallback for round() */
-#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
 static inline double
 _hb_round (double x)
 {
@@ -1267,6 +1267,7 @@ _hb_round (double x)
   else
 return ceil (x - 0.5);
 }
+#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
 #define round(x) _hb_round(x)
 #endif
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-08 Thread Behdad Esfahbod
 src/hb-common.cc |1 +
 src/hb-ot-shape-complex-use-table.cc |4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 46d8f0d5521c3dd0b10c78e66153faefdb9046db
Author: David Corbett 
Date:   Fri Jul 6 15:47:03 2018 -0400

Do not enforce a native direction of LTR for Runic

Fixes #481

diff --git a/src/hb-common.cc b/src/hb-common.cc
index a67fcf85..ca2b3278 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -545,6 +545,7 @@ hb_script_get_horizontal_direction (hb_script_t script)
 
 /* https://github.com/harfbuzz/harfbuzz/issues/1000 */
 case HB_SCRIPT_OLD_ITALIC:
+case HB_SCRIPT_RUNIC:
 
   return HB_DIRECTION_INVALID;
   }
commit 936dadc6610666aa5781e8662b859f18f9baa636
Author: David Corbett 
Date:   Sat Jul 7 11:08:17 2018 -0400

Regenerate the USE table for Grantha and Bhaiksuki (#1090)

Completes #1037 and fixes #1035.

diff --git a/src/hb-ot-shape-complex-use-table.cc 
b/src/hb-ot-shape-complex-use-table.cc
index 14315338..25f7bf42 100644
--- a/src/hb-ot-shape-complex-use-table.cc
+++ b/src/hb-ot-shape-complex-use-table.cc
@@ -560,7 +560,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
 
   /* Grantha */
 
-  /* 11300 */ VMAbv, VMAbv, VMPst, VMPst, O, B, B, B, B,   
  B, B, B, B, O, O, B,
+  /* 11300 */ VMAbv, VMAbv, VMAbv, VMPst, O, B, B, B, B,   
  B, B, B, B, O, O, B,
   /* 11310 */ B, O, O, B, B, B, B, B, B,   
  B, B, B, B, B, B, B,
   /* 11320 */ B, B, B, B, B, B, B, B, B,   
  O, B, B, B, B, B, B,
   /* 11330 */ B, O, B, B, O, B, B, B, B,   
  B, O, CMBlw, CMBlw, B,  VPst,  VPst,
@@ -673,7 +673,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
   /* 11C10 */ B, B, B, B, B, B, B, B, B,   
  B, B, B, B, B, B, B,
   /* 11C20 */ B, B, B, B, B, B, B, B, B,   
  B, B, B, B, B, B,  VPst,
   /* 11C30 */  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VBlw,  VBlw, O,  VAbv,  
VAbv,  VAbv,  VAbv, VMAbv, VMAbv, VMPst, H,
-  /* 11C40 */ B, O, O, O, O, O, O, O, O,   
  O, O, O, O, O, O, O,
+  /* 11C40 */ B, O, O, O,GB,GB, O, O, O,   
  O, O, O, O, O, O, O,
   /* 11C50 */ B, B, B, B, B, B, B, B, B,   
  B, B, B, B, B, B, B,
   /* 11C60 */ B, B, B, B, B, B, B, B, B,   
  B, B, B, B, O, O, O,
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

2018-07-05 Thread Behdad Esfahbod
 src/hb-ot-layout-gsubgpos-private.hh |2 +-
 src/hb-private.hh|   12 
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 1ebaa090d80bf0b59308d2c70f5e58dd8da47450
Author: Behdad Esfahbod 
Date:   Thu Jul 5 14:04:13 2018 +0430

Disable vectorization

Disable vectorization for now.  To correctly use them, we should
use posix_memalign() to allocate them.  Otherwise, can cause
misaligned access.

https://bugs.chromium.org/p/chromium/issues/detail?id=860184

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 41e6c200..5cec8e0b 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -1107,6 +1107,18 @@ struct HbOpXor
 
 /* Compiler-assisted vectorization. */
 
+/*
+ * Disable vectorization for now.  To correctly use them, we should
+ * use posix_memalign() to allocate them.  Otherwise, can cause
+ * misaligned access.
+ *
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=860184
+ */
+#if !defined(HB_VECTOR_SIZE)
+#  define HB_VECTOR_SIZE 0
+#endif
+
+
 /* The `vector_size' attribute was introduced in gcc 3.1. */
 #if !defined(HB_VECTOR_SIZE)
 #  if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
commit 18a06f8a662ca7a9e63f74c6443e24a035c40655
Author: Behdad Esfahbod 
Date:   Thu Jul 5 14:03:48 2018 +0430

Fix warning

../../src/hb-ot-layout-gsubgpos-private.hh:391:18: warning: missed loop 
optimization, the loop counter may overflow [-Wunsafe-loop-optimizations]

diff --git a/src/hb-ot-layout-gsubgpos-private.hh 
b/src/hb-ot-layout-gsubgpos-private.hh
index 661085d5..cbaa6488 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -388,7 +388,7 @@ struct hb_ot_apply_context_t :
 inline bool prev (void)
 {
   assert (num_items > 0);
-  while (idx >= num_items)
+  while (idx > num_items - 1)
   {
idx--;
const hb_glyph_info_t &info = c->buffer->out_info[idx];
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


  1   2   3   4   >