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

2019-03-29 Thread Behdad Esfahbod
 docs/harfbuzz-docs.xml |1 -
 docs/harfbuzz-sections.txt |   10 --
 src/hb-common.h|2 +-
 src/hb-directwrite.cc  |   36 +++-
 src/hb-directwrite.h   |3 +++
 src/hb-subset-input.cc |4 ++--
 6 files changed, 45 insertions(+), 11 deletions(-)

New commits:
commit b292772e6ef15728dd66329e637265748df0efe1
Author: Ebrahim Byagowi 
Date:   Fri Mar 29 13:00:56 2019 -0700

[dwrite] A new API, hb_directwrite_face_get_font_face (#1600)

Can be useful when using HarfBuzz for font loading and shaping
but using DirectWrite for rendering.

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 27dc1e2d..f97902f7 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -217,6 +217,14 @@ hb_coretext_font_get_ct_font
 
 
 
+hb-directwrite
+hb_directwrite_face_create
+hb_directwrite_face_get_font_face
+
+hb_directwrite_shape_experimental_width
+
+
+
 hb-face
 hb_face_count
 hb_face_t
@@ -715,8 +723,6 @@ hb_unicode_script_func_t
 hb-uniscribe
 hb_uniscribe_font_get_hfont
 hb_uniscribe_font_get_logfontw
-
-hb_directwrite_shape_experimental_width
 
 
 
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index cbf04a82..d8076c92 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -846,10 +846,23 @@ _hb_directwrite_shape (hb_shape_plan_t*shape_plan,
 features, num_features, 0);
 }
 
-/*
- * Public [experimental] API
- */
-
+/**
+ * hb_directwrite_shape_experimental_width:
+ * Experimental API to test DirectWrite's justification algorithm.
+ *
+ * It inserts Kashida at wrong order so don't use the API ever.
+ *
+ * It doesn't work with cygwin/msys due to header bugs so one
+ * should use MSVC toolchain in order to use it for now.
+ *
+ * @font:
+ * @buffer:
+ * @features:
+ * @num_features:
+ * @width:
+ *
+ * Since: 1.4.2
+ **/
 hb_bool_t
 hb_directwrite_shape_experimental_width (hb_font_t  *font,
 hb_buffer_t*buffer,
@@ -918,6 +931,7 @@ _hb_directwrite_font_release (void *data)
 /**
  * hb_directwrite_face_create:
  * @font_face:
+ *
  * Since: 2.4.0
  **/
 hb_face_t *
@@ -928,3 +942,15 @@ hb_directwrite_face_create (IDWriteFontFace *font_face)
   return hb_face_create_for_tables (reference_table, font_face,
_hb_directwrite_font_release);
 }
+
+/**
+* hb_directwrite_face_get_font_face:
+* @face:
+*
+* Since: REPLACEME
+**/
+IDWriteFontFace *
+hb_directwrite_face_get_font_face (hb_face_t *face)
+{
+  return face->data.directwrite->fontFace;
+}
diff --git a/src/hb-directwrite.h b/src/hb-directwrite.h
index 09776fd0..de813d06 100644
--- a/src/hb-directwrite.h
+++ b/src/hb-directwrite.h
@@ -37,6 +37,9 @@ hb_directwrite_shape_experimental_width (hb_font_t *font, 
hb_buffer_t *buffer,
 HB_EXTERN hb_face_t *
 hb_directwrite_face_create (IDWriteFontFace *font_face);
 
+HB_EXTERN IDWriteFontFace *
+hb_directwrite_face_get_font_face (hb_face_t *face);
+
 HB_END_DECLS
 
 #endif /* HB_DIRECTWRITE_H */
commit 59f36f36820f6e6fb1d3b6da26d6b5ee7588c42f
Author: Behdad Esfahbod 
Date:   Fri Mar 29 10:55:12 2019 -0700

Replace REPLACEME's left out of 2.4.0

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

diff --git a/src/hb-common.h b/src/hb-common.h
index fbabd71c..371b2bfc 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -358,7 +358,7 @@ typedef enum
   /*11.0*/HB_SCRIPT_SOGDIAN= HB_TAG ('S','o','g','d'),
 
   /*
-   * Since REPLACEME
+   * Since 2.4.0
*/
   /*12.0*/HB_SCRIPT_ELYMAIC= HB_TAG ('E','l','y','m'),
   /*12.0*/HB_SCRIPT_NANDINAGARI= HB_TAG 
('N','a','n','d'),
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 137cd56c..cbf04a82 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -918,7 +918,7 @@ _hb_directwrite_font_release (void *data)
 /**
  * hb_directwrite_face_create:
  * @font_face:
- * Since: REPLACEME
+ * Since: 2.4.0
  **/
 hb_face_t *
 hb_directwrite_face_create (IDWriteFontFace *font_face)
diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc
index 693c9c21..4d203b54 100644
--- a/src/hb-subset-input.cc
+++ b/src/hb-subset-input.cc
@@ -152,7 +152,7 @@ hb_subset_input_get_desubroutinize (hb_subset_input_t 
*subset_input)
  * hb_subset_input_set_retain_gids:
  * @subset_input: a subset_input.
  * @retain_gids: If true the subsetter will not renumber glyph ids.
- * Since: REPLACEME
+ * Since: 2.4.0
  **/
 HB_EXTERN void
 hb_subset_input_set_retain_gids (hb_subset_input_t *subset_input,
@@ -164,7 +164,7 @@ hb_subset_input_set_retain_gids (hb_subset_input_t 
*subset_input,
 /**
  * hb_subset_input_get_retain_gids:
  * Returns: value of retain_gids.
- * Since: REPLACEME
+ * Since: 2.4.0
  **/
 HB_EXTERN hb_bool_t
 hb_subset_input_get_retain_gids (hb_subset_input_t *subset_input)
commit 

[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 _)
   {
 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, [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' - 12 commits

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

New commits:
commit d9dabc00e9278a346e85538212c126da7e610d55
Merge: 81cfd3c7 010e2ddb
Author: Behdad Esfahbod 
Date:   Wed Dec 5 15:39:34 2018 -0800

Merge pull request #1454 from harfbuzz/cff-fixbcd

[CFF] fix oss-fuzz issue 11674: parse_bcd

commit 010e2ddb384b5a721172fd7466aafec58dbf8063
Author: Michiharu Ariza 
Date:   Wed Dec 5 12:23:58 2018 -0800

minimized test case for oss-fuzz issue 11674

diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5672006905757696
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5672006905757696
new file mode 100644
index ..cb5fb83d
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5672006905757696
 differ
commit 2cb9d4c183afc838ecf2ba0d47814e9eaa6f09c6
Merge: a5fa843c 8394a6cb
Author: Michiharu Ariza 
Date:   Wed Dec 5 11:25:29 2018 -0800

Merge branch 'master' into cff-fixbcd

commit a5fa843c746e20aaca48ece6cff057deb8d916ca
Author: Michiharu Ariza 
Date:   Wed Dec 5 11:18:16 2018 -0800

fixed a bug with fractional part in a negative value

diff --git a/src/hb-cff-interp-dict-common.hh b/src/hb-cff-interp-dict-common.hh
index 005e15e6..63ca685e 100644
--- a/src/hb-cff-interp-dict-common.hh
+++ b/src/hb-cff-interp-dict-common.hh
@@ -146,7 +146,11 @@ struct DictOpSet : OpSet
case END:
  value = (double)(neg? -int_part: int_part);
  if (frac_count > 0)
-   value += (frac_part / pow (10.0, (double)frac_count));
+ {
+   double frac = (frac_part / pow (10.0, (double)frac_count));
+   if (neg) frac = -frac;
+   value += frac;
+ }
  if (unlikely (exp_overflow))
  {
if (value == 0.0)
commit 620d1ef588c6ce25644891cfe4b9c20fd8a9d1db
Author: Michiharu Ariza 
Date:   Wed Dec 5 00:36:11 2018 -0800

fix unsigned long const

diff --git a/src/hb-cff-interp-dict-common.hh b/src/hb-cff-interp-dict-common.hh
index 2c7a9710..005e15e6 100644
--- a/src/hb-cff-interp-dict-common.hh
+++ b/src/hb-cff-interp-dict-common.hh
@@ -115,7 +115,7 @@ struct DictOpSet : OpSet
 boolexp_overflow = false;
 enum Part { INT_PART=0, FRAC_PART, EXP_PART } part = INT_PART;
 enum Nibble { DECIMAL=10, EXP_POS, EXP_NEG, RESERVED, NEG, END };
-const uint64_t MAX_FRACT = 0xFlu; /* 1^52-1 */
+const uint64_t MAX_FRACT = 0xFllu; /* 1^52-1 */
 const uint32_t MAX_EXP = 0x7FFu; /* 1^11-1 */
 
 double  value = 0.0;
commit 28dfb4c14280b05ad0a519f9df2b0eda41a62540
Author: Michiharu Ariza 
Date:   Wed Dec 5 00:26:03 2018 -0800

fix signed/unsigned comparison

diff --git a/src/hb-cff-interp-dict-common.hh b/src/hb-cff-interp-dict-common.hh
index d5376e84..2c7a9710 100644
--- a/src/hb-cff-interp-dict-common.hh
+++ b/src/hb-cff-interp-dict-common.hh
@@ -108,7 +108,7 @@ struct DictOpSet : OpSet
   {
 boolneg = false;
 double  int_part = 0;
-int64_t frac_part = 0;
+uint64_t frac_part = 0;
 uint32_t  frac_count = 0;
 boolexp_neg = false;
 uint32_t  exp_part = 0;
@@ -206,7 +206,7 @@ struct DictOpSet : OpSet
case FRAC_PART:
  if (likely ((frac_part <= MAX_FRACT / 10)))
  {
-   frac_part = (frac_part * 10) + d;
+   frac_part = (frac_part * 10) + (unsigned)d;
frac_count++;
  }
  break;
commit f9cee08edd32182044407bf6ffde00df0feb09b7
Author: Michiharu Ariza 
Date:   Tue Dec 4 23:58:26 2018 -0800

use sized int types in parse_bcd

diff --git a/src/hb-cff-interp-dict-common.hh b/src/hb-cff-interp-dict-common.hh
index 0ffd4cec..d5376e84 100644
--- a/src/hb-cff-interp-dict-common.hh
+++ b/src/hb-cff-interp-dict-common.hh
@@ -108,19 +108,19 @@ struct DictOpSet : OpSet
   {
 boolneg = false;
 double  int_part = 0;
-longfrac_part = 0;
-unsigned int  frac_count = 0;
+int64_t frac_part = 0;
+uint32_t  frac_count = 0;
 boolexp_neg = false;
-unsigned int  exp_part = 0;
+uint32_t  exp_part = 0;
 boolexp_overflow = false;
 enum Part { INT_PART=0, FRAC_PART, EXP_PART } part = INT_PART;
 enum Nibble { DECIMAL=10, EXP_POS, EXP_NEG, RESERVED, NEG, END };
-const unsigned long MAX_FRACT = 0xFlu; /* 1^52-1 */
-const unsigned int MAX_EXP = 0x7FFu; /* 1^11-1 */
+const uint64_t MAX_FRACT = 0xFlu; /* 1^52-1 */
+const uint32_t MAX_EXP = 0x7FFu; /* 1^11-1 */
 
 double  value = 0.0;
 unsigned char byte = 0;
-for (unsigned int i = 0;; i++)
+for (uint32_t i = 0;; i++)
 {
   char d;
   if ((i & 1) == 0)
commit c01a5f32a33fa875de68ca29a4672fd36a05245b
Author: 

[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' - 16 commits

2018-12-05 Thread Behdad Esfahbod
 src/Makefile.sources   
 |2 
 src/hb-aat-fdsc-table.hh   
 |  103 ++
 src/hb-aat-layout.cc   
 |1 
 src/hb-cff-interp-cs-common.hh 
 |   22 +-
 src/hb-coretext.cc 
 |   16 -
 src/hb-ot-cff-common.hh
 |2 
 src/hb-ot-cff1-table.hh
 |   16 -
 src/hb-ot-cff2-table.hh
 |3 
 src/hb-ot-gasp-table.hh
 |   84 
 src/hb-ot-layout.cc
 |5 
 src/hb-ot-os2-table.hh 
 |   88 ++--
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5175735354916864
  |binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5700264032468992
  |binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5672913680728064
 |binary
 14 files changed, 290 insertions(+), 52 deletions(-)

New commits:
commit 8394a6cb252dd8b4230c2b59e8c346ec5403bf88
Author: Ebrahim Byagowi 
Date:   Wed Dec 5 15:23:41 2018 +0330

[os2] Make newer table fields accessible (#1452)

diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh
index e53eda73..46e8b708 100644
--- a/src/hb-ot-os2-table.hh
+++ b/src/hb-ot-os2-table.hh
@@ -30,7 +30,7 @@
 #include "hb-open-type.hh"
 #include "hb-ot-os2-unicode-ranges.hh"
 
-namespace OT {
+#include "hb-set.hh"
 
 /*
  * OS/2 and Windows Metrics
@@ -38,16 +38,65 @@ namespace OT {
  */
 #define HB_OT_TAG_OS2 HB_TAG('O','S','/','2')
 
-struct OS2
+
+namespace OT {
+
+struct OS2V1Tail
 {
-  enum { tableTag = HB_OT_TAG_OS2 };
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+TRACE_SANITIZE (this);
+return_trace (c->check_struct (this));
+  }
+
+  public:
+  HBUINT32 ulCodePageRange1;
+  HBUINT32 ulCodePageRange2;
+  public:
+  DEFINE_SIZE_STATIC (8);
+};
+
+struct OS2V2Tail
+{
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+TRACE_SANITIZE (this);
+return_trace (c->check_struct (this));
+  }
+
+  public:
+  HBINT16  sxHeight;
+  HBINT16  sCapHeight;
+  HBUINT16 usDefaultChar;
+  HBUINT16 usBreakChar;
+  HBUINT16 usMaxContext;
+  public:
+  DEFINE_SIZE_STATIC (10);
+};
 
+struct OS2V5Tail
+{
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
 return_trace (c->check_struct (this));
   }
 
+  public:
+  HBUINT16 usLowerOpticalPointSize;
+  HBUINT16 usUpperOpticalPointSize;
+  public:
+  DEFINE_SIZE_STATIC (4);
+};
+
+struct OS2
+{
+  enum { tableTag = HB_OT_TAG_OS2 };
+
+  inline const OS2V1Tail  (void) const { return version >= 1 ? v1X : Null 
(OS2V1Tail); }
+  inline const OS2V2Tail  (void) const { return version >= 2 ? v2X : Null 
(OS2V2Tail); }
+  inline const OS2V5Tail  (void) const { return version >= 5 ? v5X : Null 
(OS2V5Tail); }
+
   inline bool subset (hb_subset_plan_t *plan) const
   {
 hb_blob_t *os2_blob = hb_sanitize_context_t ().reference_table 
(plan->source);
@@ -125,10 +174,18 @@ struct OS2
 return (font_page_t) (fsSelection & 0xFF00);
   }
 
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+TRACE_SANITIZE (this);
+if (unlikely (!c->check_struct (this))) return_trace (false);
+if (unlikely (version >= 1 && !v1X.sanitize (c))) return_trace (false);
+if (unlikely (version >= 2 && !v2X.sanitize (c))) return_trace (false);
+if (unlikely (version >= 5 && !v5X.sanitize (c))) return_trace (false);
+return_trace (true);
+  }
+
   public:
   HBUINT16 version;
-
-  /* Version 0 */
   HBINT16  xAvgCharWidth;
   HBUINT16 usWeightClass;
   HBUINT16 usWidthClass;
@@ -155,24 +212,11 @@ struct OS2
   HBINT16  sTypoLineGap;
   HBUINT16 usWinAscent;
   HBUINT16 usWinDescent;
-
-  /* Version 1 */
-  //HBUINT32   ulCodePageRange1;
-  //HBUINT32   ulCodePageRange2;
-
-  /* Version 2 */
-  //HBINT16sxHeight;
-  //HBINT16sCapHeight;
-  //HBUINT16   usDefaultChar;
-  //HBUINT16   usBreakChar;
-  //HBUINT16   usMaxContext;
-
-  /* Version 5 */
-  //HBUINT16   usLowerOpticalPointSize;
-  //HBUINT16   usUpperOpticalPointSize;
-
+  OS2V1Tailv1X;
+  OS2V2Tailv2X;
+  OS2V5Tailv5X;
   public:
-  DEFINE_SIZE_STATIC (78);
+  DEFINE_SIZE_MIN (78);
 };
 
 } /* namespace OT */
commit 5ab086ebb18112ef48bf6c913acc91b2009a9bed
Author: Ebrahim Byagowi 
Date:   Wed Dec 5 14:17:37 2018 +0330

[fdsc] Implement the table parsing

Related to https://github.com/harfbuzz/harfbuzz/issues/1337


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

2018-12-04 Thread Behdad Esfahbod
 src/hb-cff-interp-common.hh
|   88 +-
 src/hb-cff-interp-dict-common.hh   
|   10 -
 src/hb-cff2-interp-cs.hh   
|6 
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872
 |binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520
 |binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240
 |binary
 6 files changed, 23 insertions(+), 81 deletions(-)

New commits:
commit c968869f212dbfcb86d42fb36049328521cbf00c
Merge: 8c05b955 c48f53d3
Author: Behdad Esfahbod 
Date:   Tue Dec 4 04:14:13 2018 -0500

Merge pull request #1441 from harfbuzz/cff-doublenum

use double as CFF Number implementation

commit c48f53d30901dfc20b7432c2947e66642010dc4e
Author: Michiharu Ariza 
Date:   Mon Dec 3 16:59:41 2018 -0800

more double changes

diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh
index 935a1a1f..d258b814 100644
--- a/src/hb-cff2-interp-cs.hh
+++ b/src/hb-cff2-interp-cs.hh
@@ -49,7 +49,7 @@ struct BlendArg : Number
 
   inline void set_int (int v) { reset_blends (); Number::set_int (v); }
   inline void set_fixed (int32_t v) { reset_blends (); Number::set_fixed (v); }
-  inline void set_real (float v) { reset_blends (); Number::set_real (v); }
+  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_)
@@ -172,7 +172,7 @@ struct CFF2CSInterpEnv : CSInterpEnv
double v = arg.to_real ();
for (unsigned int i = 0; i < scalars.len; i++)
{
- v += scalars[i] * arg.deltas[i].to_real ();
+ v += (double)scalars[i] * arg.deltas[i].to_real ();
}
arg.set_real (v);
arg.deltas.resize (0);
diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c
index bb70a626..49b87997 100644
--- a/test/api/test-ot-extents-cff.c
+++ b/test/api/test-ot-extents-cff.c
@@ -171,7 +171,7 @@ test_extents_cff2_vsindex (void)
   g_assert_cmpint (extents.x_bearing, ==, 11);
   g_assert_cmpint (extents.y_bearing, ==, 656);
   g_assert_cmpint (extents.width, ==, 653);
-  g_assert_cmpint (extents.height, ==, -657);
+  g_assert_cmpint (extents.height, ==, -656);
 
   result = hb_font_get_glyph_extents (font, 2, );
   g_assert (result);
commit 9424e8052686a6a93e0d30e38aecbe927db9d787
Author: Michiharu Ariza 
Date:   Mon Dec 3 16:18:10 2018 -0800

added minimized test cases

diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872
new file mode 100644
index ..068e7e8f
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872
 differ
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520
new file mode 100644
index ..5781bbad
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520
 differ
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240
new file mode 100644
index ..343429cf
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240
 differ
commit 5fff6ab0024547a8ac47723a0047f4b17416d6ce
Author: Michiharu Ariza 
Date:   Mon Dec 3 16:06:58 2018 -0800

additional precision made a difference in extents test

diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh
index 396bc8c7..f2ccc2bd 100644
--- a/src/hb-cff-interp-common.hh
+++ b/src/hb-cff-interp-common.hh
@@ -229,7 +229,7 @@ struct Number
   {
 return (int32_t)(value * 65536.0);
   }
-  inline void set_real (double v)  { value = (double)v; }
+  inline void set_real (double v)  { value = v; }
   inline double to_real (void) const
   {
 return value;
diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh
index 8d193d62..935a1a1f 100644
--- a/src/hb-cff2-interp-cs.hh
+++ b/src/hb-cff2-interp-cs.hh
@@ -169,7 +169,7 @@ struct CFF2CSInterpEnv : CSInterpEnv
 {
   if (likely (scalars.len == arg.deltas.len))
   {
-   float v = arg.to_real ();
+   double v = arg.to_real ();
for (unsigned int i = 0; i < scalars.len; i++)
{
  v += scalars[i] * arg.deltas[i].to_real ();
diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c
index 49b87997..bb70a626 100644
--- a/test/api/test-ot-extents-cff.c
+++ 

[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'

2018-12-03 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt |2 ++
 src/hb-aat-layout.cc   |   20 
 src/hb-aat-layout.h|   16 
 src/hb-aat-layout.hh   |6 --
 4 files changed, 34 insertions(+), 10 deletions(-)

New commits:
commit d19b1680b53e54f449736432f369a676c394ebf8
Author: Behdad Esfahbod 
Date:   Mon Dec 3 10:41:37 2018 -0500

[aat] Expose a couple APIs

New API:
+hb_aat_layout_has_substitution()
+hb_aat_layout_has_positioning()

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 5c45153c..63224317 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -12,6 +12,8 @@ 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_selector_infos
+hb_aat_layout_has_substitution
+hb_aat_layout_has_positioning
 
 
 
diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index fae67800..837dcbae 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -205,7 +205,14 @@ hb_aat_layout_compile_map (const hb_aat_map_builder_t 
*mapper,
 }
 
 
-bool
+/*
+ * hb_aat_layout_has_substitution:
+ * @face:
+ *
+ * Returns:
+ * Since: REPLACEME
+ */
+hb_bool_t
 hb_aat_layout_has_substitution (hb_face_t *face)
 {
   return face->table.morx->has_data () ||
@@ -259,9 +266,14 @@ hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer)
   hb_ot_layout_delete_glyphs_inplace (buffer, is_deleted_glyph);
 }
 
-
-
-bool
+/*
+ * hb_aat_layout_has_positioning:
+ * @face:
+ *
+ * Returns:
+ * Since: REPLACEME
+ */
+hb_bool_t
 hb_aat_layout_has_positioning (hb_face_t *face)
 {
   return face->table.kerx->has_data ();
diff --git a/src/hb-aat-layout.h b/src/hb-aat-layout.h
index 696e9033..f5745096 100644
--- a/src/hb-aat-layout.h
+++ b/src/hb-aat-layout.h
@@ -457,6 +457,22 @@ hb_aat_layout_feature_type_get_selector_infos (hb_face_t
   unsigned int 
 *default_index   /* OUT. May be NULL. */);
 
 
+/*
+ * morx/mort
+ */
+
+HB_EXTERN hb_bool_t
+hb_aat_layout_has_substitution (hb_face_t *face);
+
+
+/*
+ * kerx
+ */
+
+HB_EXTERN hb_bool_t
+hb_aat_layout_has_positioning (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 5fd47ed6..cbb94546 100644
--- a/src/hb-aat-layout.hh
+++ b/src/hb-aat-layout.hh
@@ -56,9 +56,6 @@ HB_INTERNAL void
 hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
   hb_aat_map_t *map);
 
-HB_INTERNAL bool
-hb_aat_layout_has_substitution (hb_face_t *face);
-
 HB_INTERNAL void
 hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan,
  hb_font_t *font,
@@ -70,9 +67,6 @@ hb_aat_layout_zero_width_deleted_glyphs (hb_buffer_t *buffer);
 HB_INTERNAL void
 hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer);
 
-HB_INTERNAL bool
-hb_aat_layout_has_positioning (hb_face_t *face);
-
 HB_INTERNAL void
 hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-12-02 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh
|2 +-
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5768046065483776
 |binary
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 84efe0438e1cfc5b070e114b70e8c070be6119ca
Author: Behdad Esfahbod 
Date:   Sun Dec 2 12:38:53 2018 -0500

[aat] Fix division sign fallout

Happened after 11d2f49af8f53340134c844173f4d8655b00dea3
since now nClasses is unsigned int...

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 588dbdf2..57228c41 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -504,7 +504,7 @@ struct StateTable
   };
 
   inline int new_state (unsigned int newState) const
-  { return Types::extended ? newState : ((int) newState - (int) 
stateArrayTable) / nClasses; }
+  { return Types::extended ? newState : ((int) newState - (int) 
stateArrayTable) / (int) nClasses; }
 
   inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int 
num_glyphs) const
   {
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5768046065483776
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5768046065483776
new file mode 100644
index ..0ab14470
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5768046065483776
 differ
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-12-01 Thread Behdad Esfahbod
 src/hb-open-type.hh |   13 ++---
 src/hb-vector.hh|2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 2087f5a2a743380b36399ba8a2b4ff9e93890fcf
Author: Behdad Esfahbod 
Date:   Sat Dec 1 20:04:45 2018 -0500

Add casts to hb_array_t<>

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 0038ad8b..69cc5ccf 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -374,16 +374,17 @@ struct UnsizedArrayOf
 return *p;
   }
 
-  template  inline operator T * (void) { return arrayZ; }
-  template  inline operator const T * (void) const { return 
arrayZ; }
-
   inline unsigned int get_size (unsigned int len) const
   { return len * Type::static_size; }
 
+  template  inline operator T * (void) { return arrayZ; }
+  template  inline operator const T * (void) const { return 
arrayZ; }
   inline hb_array_t as_array (unsigned int len)
   { return hb_array (arrayZ, len); }
   inline hb_array_t as_array (unsigned int len) const
   { return hb_array (arrayZ, len); }
+  inline operator hb_array_t (void) { return as_array (); }
+  inline operator hb_array_t (void) const { as_array (); }
 
   template 
   inline Type  (unsigned int len, const T , Type _found = Crap 
(Type))
@@ -488,6 +489,8 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf
   { return hb_sorted_array (this->arrayZ, len); }
   inline hb_sorted_array_t as_array (unsigned int len) const
   { return hb_sorted_array (this->arrayZ, len); }
+  inline operator hb_sorted_array_t (void) { return as_array (); }
+  inline operator hb_sorted_array_t (void) const { as_array (); }
 
   template 
   inline Type  (unsigned int len, const T , Type _found = Crap 
(Type))
@@ -533,6 +536,8 @@ struct ArrayOf
   { return hb_array (arrayZ, len); }
   inline hb_array_t as_array (void) const
   { return hb_array (arrayZ, len); }
+  inline operator hb_array_t (void) { return as_array (); }
+  inline operator hb_array_t (void) const { as_array (); }
 
   inline hb_array_t sub_array (unsigned int start_offset, unsigned 
int count) const
   { return as_array ().sub_array (start_offset, count);}
@@ -802,6 +807,8 @@ struct SortedArrayOf : ArrayOf
   { return hb_sorted_array (this->arrayZ, this->len); }
   inline hb_sorted_array_t as_array (void) const
   { return hb_sorted_array (this->arrayZ, this->len); }
+  inline operator hb_sorted_array_t (void) { return as_array (); }
+  inline operator hb_sorted_array_t (void) const { as_array (); }
 
   inline hb_array_t sub_array (unsigned int start_offset, unsigned 
int count) const
   { return as_array ().sub_array (start_offset, count);}
diff --git a/src/hb-vector.hh b/src/hb-vector.hh
index 953a776e..4b34a381 100644
--- a/src/hb-vector.hh
+++ b/src/hb-vector.hh
@@ -105,6 +105,8 @@ struct hb_vector_t
 
   template  explicit_operator inline operator  T * (void) { return 
arrayZ(); }
   template  explicit_operator inline operator const T * (void) 
const { return arrayZ(); }
+  inline operator hb_array_t (void) { return as_array (); }
+  inline operator hb_array_t (void) const { as_array (); }
 
   inline Type * operator  + (unsigned int i) { return arrayZ() + i; }
   inline const Type * operator  + (unsigned int i) const { return arrayZ() + 
i; }
___
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 \

[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 ) const { return (Type) 
v == (Type) o.v; }
   inline bool operator != (const IntType ) 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'

2018-11-30 Thread Behdad Esfahbod
 src/hb-open-type.hh |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit c3a8b047aab47e40dc107a952b3a1472068ec932
Author: Behdad Esfahbod 
Date:   Sat Dec 1 00:14:48 2018 -0500

Revert "Change BigEndian casts to be int-sized"

This reverts commit eb5ddd32bf4e458ca0af8d5784f8fd46485ad225.

Broke tests, badly.  To be investigated and reenabled.

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 99a1c9b9..ee76d7ed 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -66,7 +66,7 @@ struct IntType
   inline int cmp (Type2 a) const
   {
 Type b = v;
-if (Size < sizeof (int) && sizeof (Type2) < sizeof (int))
+if (sizeof (Type) < sizeof (int) && sizeof (Type2) < sizeof (int))
   return (int) a - (int) b;
 else
   return a < b ? -1 : a == b ? 0 : +1;
@@ -82,13 +82,13 @@ struct IntType
   DEFINE_SIZE_STATIC (Size);
 };
 
-typedef IntType HBUINT8;  /* 8-bit unsigned integer. */
-typedef IntType<  signed, 1> HBINT8;   /* 8-bit signed integer. */
-typedef IntType HBUINT16; /* 16-bit unsigned integer. */
-typedef IntType<  signed, 2> HBINT16;  /* 16-bit signed integer. */
-typedef IntType HBUINT24; /* 24-bit unsigned integer. */
-typedef IntType HBUINT32; /* 32-bit unsigned integer. */
-typedef IntType<  signed, 4> HBINT32;  /* 32-bit signed integer. */
+typedef IntType HBUINT8;  /* 8-bit unsigned integer. */
+typedef IntType HBINT8;   /* 8-bit signed integer. */
+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. */
+typedef IntType HBUINT24; /* 24-bit unsigned integer. */
 
 /* 16-bit signed integer (HBINT16) that describes a quantity in FUnits. */
 typedef HBINT16 FWORD;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit be45677ab605efc711a433323d66e4051c289252
Author: Behdad Esfahbod 
Date:   Sat Dec 1 00:04:29 2018 -0500

Minor

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 6acdcf2f..73a852f0 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -270,7 +270,7 @@ struct SingleSubst
   /* TODO(serialize) check for wrap-around */
   delta = substitutes[0] - glyphs[0];
   for (unsigned int i = 1; i < num_glyphs; i++)
-   if (delta != substitutes[i] - glyphs[i]) {
+   if (delta != (int) (substitutes[i] - glyphs[i])) {
  format = 2;
  break;
}
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-open-type.hh |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit eb5ddd32bf4e458ca0af8d5784f8fd46485ad225
Author: Behdad Esfahbod 
Date:   Sat Dec 1 00:03:01 2018 -0500

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..99a1c9b9 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -66,7 +66,7 @@ struct IntType
   inline int cmp (Type2 a) const
   {
 Type b = v;
-if (sizeof (Type) < sizeof (int) && sizeof (Type2) < sizeof (int))
+if (Size < sizeof (int) && sizeof (Type2) < sizeof (int))
   return (int) a - (int) b;
 else
   return a < b ? -1 : a == b ? 0 : +1;
@@ -82,13 +82,13 @@ struct IntType
   DEFINE_SIZE_STATIC (Size);
 };
 
-typedef IntType HBUINT8;  /* 8-bit unsigned integer. */
-typedef IntType HBINT8;   /* 8-bit signed integer. */
-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. */
-typedef IntType HBUINT24; /* 24-bit unsigned integer. */
+typedef IntType HBUINT8;  /* 8-bit unsigned integer. */
+typedef IntType<  signed, 1> HBINT8;   /* 8-bit signed integer. */
+typedef IntType HBUINT16; /* 16-bit unsigned integer. */
+typedef IntType<  signed, 2> HBINT16;  /* 16-bit signed integer. */
+typedef IntType HBUINT24; /* 24-bit unsigned integer. */
+typedef IntType HBUINT32; /* 32-bit unsigned integer. */
+typedef IntType<  signed, 4> HBINT32;  /* 32-bit signed integer. */
 
 /* 16-bit signed integer (HBINT16) that describes a quantity in FUnits. */
 typedef HBINT16 FWORD;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-ot-cff-common.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e8860fdcaa69e3452edd903f78599bc8fa9d109c
Author: Behdad Esfahbod 
Date:   Fri Nov 30 23:38:24 2018 -0500

Fix more warning

diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh
index a83435d4..e824dae3 100644
--- a/src/hb-ot-cff-common.hh
+++ b/src/hb-ot-cff-common.hh
@@ -233,7 +233,7 @@ struct CFFIndex
   inline unsigned int max_offset (void) const
   {
 unsigned int max = 0;
-for (unsigned int i = 0; i < count + 1; i++)
+for (unsigned int i = 0; i < count + 1u; i++)
 {
   unsigned int off = offset_at (i);
   if (off > max) max = off;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-ot-color-cpal-table.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fedd8e6c176dea85194693399e50243eb1c117c4
Author: Behdad Esfahbod 
Date:   Fri Nov 30 16:50:30 2018 -0500

One more.

I wonder if there's something better to do about these :(.

In file included from hb-ot-color.cc:31:
hb-ot-color-cpal-table.hh: In member function 'unsigned int 
OT::CPAL::get_size() const':
hb-ot-color-cpal-table.hh:118: 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:

diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 095f96f2..85bdc7ef 100644
--- a/src/hb-ot-color-cpal-table.hh
+++ b/src/hb-ot-color-cpal-table.hh
@@ -115,7 +115,7 @@ struct CPAL
   inline bool has_data (void) const { return numPalettes; }
 
   inline unsigned int get_size (void) const
-  { return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); }
+  { return min_size + numPalettes * sizeof (colorRecordIndicesZ[0u]); }
 
   inline unsigned int get_palette_count () const { return numPalettes; }
   inline unsigned int get_color_count () const { return numColors; }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-ot-vorg-table.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bc5db9b0807767ac04d6e50070d69cb9c520f06e
Author: Behdad Esfahbod 
Date:   Fri Nov 30 16:04:52 2018 -0500

One more

hb-ot-vorg-table.hh:96: 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:87: note: candidate 1: const Type& hb_vector_t::operator[](unsigned int) const [with Type = 
OT::VertOriginMetric, unsigned int PreallocedCount = 8u]
hb-ot-vorg-table.hh:96: note: candidate 2: operator[](const T*, int) 


diff --git a/src/hb-ot-vorg-table.hh b/src/hb-ot-vorg-table.hh
index f724fe04..e8dcc503 100644
--- a/src/hb-ot-vorg-table.hh
+++ b/src/hb-ot-vorg-table.hh
@@ -93,7 +93,7 @@ struct VORG
   unsigned int  size = VertOriginMetric::static_size * subset_metrics.len;
   VertOriginMetric  *metrics = c.allocate_size (size);
   if (likely (metrics != nullptr))
-memcpy (metrics, _metrics[0], size);
+memcpy (metrics, _metrics[0u], size);
   else
 success = false;
 }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

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

New commits:
commit d39760cabfe4007cefdfc45231e85e93fababac2
Author: Behdad Esfahbod 
Date:   Fri Nov 30 15:55:30 2018 -0500

One more...

Sigh.

hb-ot-kern-table.hh: In member function 'int 
OT::KernSubTableFormat3::get_kerning(hb_codepoint_t, 
hb_codepoint_t) const':
hb-ot-kern-table.hh:59: error: ambiguous overload for 'operator[]' in 
'kernValue[kernIndex[i]]'
hb-ot-kern-table.hh:59: note: candidates are: operator[](T*, int) 
hb-dsalgs.hh:574: note: Type& 
hb_array_t::operator[](unsigned int) const [with Type = const 
OT::IntType]

diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index e1348b70..a184f2e1 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -56,7 +56,7 @@ struct KernSubTableFormat3
 if (unlikely (leftC >= leftClassCount || rightC >= rightClassCount))
   return 0;
 unsigned int i = leftC * rightClassCount + rightC;
-return kernValue[kernIndex[i]];
+return kernValue[(unsigned) kernIndex[i]];
   }
 
   inline bool apply (AAT::hb_aat_apply_context_t *c) const
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-aat-layout-morx-table.hh |4 ++--
 src/hb-ot-layout-gpos-table.hh  |   32 
 src/hb-ot-layout-gsubgpos.hh|   16 
 3 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 9c6921c08c905a0cf45ba0182134e6ff910fac51
Author: Behdad Esfahbod 
Date:   Fri Nov 30 15:16:57 2018 -0500

More...

hb-ot-layout-gsubgpos.hh:1707: 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:
...

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 9b37a713..78a7b7d7 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -249,7 +249,7 @@ struct ContextualSubtable
   {
if (entry->data.markIndex != 0x)
{
- const Lookup  = subs[entry->data.markIndex];
+ const Lookup  = subs[(unsigned) 
entry->data.markIndex];
  replacement = lookup.get_value (buffer->info[mark].codepoint, 
driver->num_glyphs);
}
   }
@@ -274,7 +274,7 @@ struct ContextualSubtable
   {
if (entry->data.currentIndex != 0x)
{
- const Lookup  = subs[entry->data.currentIndex];
+ const Lookup  = subs[(unsigned) 
entry->data.currentIndex];
  replacement = lookup.get_value (buffer->info[idx].codepoint, 
driver->num_glyphs);
}
   }
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 32ed13c0..8559744f 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -625,8 +625,8 @@ struct PairSet
   inline bool intersects (const hb_set_t *glyphs,
  const ValueFormat *valueFormats) const
   {
-unsigned int len1 = valueFormats[0].get_len ();
-unsigned int len2 = valueFormats[1].get_len ();
+unsigned int len1 = valueFormats[0u].get_len ();
+unsigned int len2 = valueFormats[1u].get_len ();
 unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
 
 const PairValueRecord *record = 
@@ -644,8 +644,8 @@ struct PairSet
  const ValueFormat *valueFormats) const
   {
 TRACE_COLLECT_GLYPHS (this);
-unsigned int len1 = valueFormats[0].get_len ();
-unsigned int len2 = valueFormats[1].get_len ();
+unsigned int len1 = valueFormats[0u].get_len ();
+unsigned int len2 = valueFormats[1u].get_len ();
 unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
 
 const PairValueRecord *record = 
@@ -658,8 +658,8 @@ struct PairSet
   {
 TRACE_APPLY (this);
 hb_buffer_t *buffer = c->buffer;
-unsigned int len1 = valueFormats[0].get_len ();
-unsigned int len2 = valueFormats[1].get_len ();
+unsigned int len1 = valueFormats[0u].get_len ();
+unsigned int len2 = valueFormats[1u].get_len ();
 unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
 
 unsigned int count = len;
@@ -681,8 +681,8 @@ struct PairSet
   else
   {
/* Note the intentional use of "|" instead of short-circuit "||". */
-   if (valueFormats[0].apply_value (c, this, >values[0], 
buffer->cur_pos()) |
-   valueFormats[1].apply_value (c, this, >values[len1], 
buffer->pos[pos]))
+   if (valueFormats[0u].apply_value (c, this, >values[0u], 
buffer->cur_pos()) |
+   valueFormats[1u].apply_value (c, this, >values[len1], 
buffer->pos[pos]))
  buffer->unsafe_to_break (buffer->idx, pos + 1);
if (len2)
  pos++;
@@ -698,7 +698,7 @@ struct PairSet
   {
 const void *base;
 const ValueFormat *valueFormats;
-unsigned int len1; /* valueFormats[0].get_len() */
+unsigned int len1; /* valueFormats[0u].get_len() */
 unsigned int stride; /* 1 + len1 + len2 */
   };
 
@@ -713,8 +713,8 @@ struct PairSet
 
 unsigned int count = len;
 const PairValueRecord *record = 
-return_trace (closure->valueFormats[0].sanitize_values_stride_unsafe (c, 
closure->base, >values[0], count, closure->stride) &&
- closure->valueFormats[1].sanitize_values_stride_unsafe (c, 
closure->base, >values[closure->len1], count, closure->stride));
+return_trace (closure->valueFormats[0u].sanitize_values_stride_unsafe (c, 
closure->base, >values[0u], count, closure->stride) &&
+ closure->valueFormats[1u].sanitize_values_stride_unsafe (c, 
closure->base, >values[closure->len1], count, closure->stride));
   }
 
   protected:
@@ -781,8 +781,8 @@ struct PairPosFormat1
 
 if (!c->check_struct (this)) return_trace (false);
 
-unsigned int len1 = valueFormat[0].get_len ();
-unsigned int len2 = valueFormat[1].get_len ();
+unsigned int len1 = valueFormat[0u].get_len ();
+unsigned int len2 = valueFormat[1u].get_len ();
 PairSet::sanitize_closure_t closure =
 {
   this,
@@ -799,10 +799,10 @@ struct PairPosFormat1
   OffsetTo
coverage;

[HarfBuzz] harfbuzz: Branch 'master'

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

New commits:
commit f998bb2086342d6fdcd4295593eddea91396e0b6
Author: Behdad Esfahbod 
Date:   Fri Nov 30 12:52:21 2018 -0500

More weird fixes

In file included from hb-ot-name.cc:29:
hb-ot-name-table.hh: In member function 'unsigned int OT::name::get_size() 
const':
hb-ot-name-table.hh:157: 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::NameRecord]
hb-ot-name-table.hh:157: note: candidate 2: operator[](const T*, int) 

hb-ot-name-table.hh: In member function 'void 
OT::name::accelerator_t::init(hb_face_t*)':
hb-ot-name-table.hh:196: 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-dsalgs.hh:574: note: candidate 1: Type& 
hb_array_t::operator[](unsigned int) const [with Type = const 
OT::NameRecord]
hb-ot-name-table.hh:196: note: candidate 2: operator[](T*, int) 
hb-ot-name-table.hh:197: 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-dsalgs.hh:574: note: candidate 1: Type& 
hb_array_t::operator[](unsigned int) const [with Type = const 
OT::NameRecord]
hb-ot-name-table.hh:197: note: candidate 2: operator[](T*, int) 
hb-ot-name-table.hh:198: 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-dsalgs.hh:574: note: candidate 1: Type& 
hb_array_t::operator[](unsigned int) const [with Type = const 
OT::NameRecord]
hb-ot-name-table.hh:198: note: candidate 2: operator[](T*, int) 
make[4]: *** [libharfbuzz_la-hb-ot-name.lo] Error 1
make[3]: *** [all-recursive] Error 1

diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh
index 4f24d737..a903e1cd 100644
--- a/src/hb-ot-name-table.hh
+++ b/src/hb-ot-name-table.hh
@@ -154,7 +154,7 @@ struct name
   enum { tableTag = HB_OT_TAG_name };
 
   inline unsigned int get_size (void) const
-  { return min_size + count * nameRecordZ[0].min_size; }
+  { return min_size + count * nameRecordZ.item_size; }
 
   inline bool sanitize_records (hb_sanitize_context_t *c) const {
 TRACE_SANITIZE (this);
@@ -189,7 +189,7 @@ struct name
   this->names.init ();
   this->names.alloc (all_names.len);
 
-  for (uint16_t i = 0; i < all_names.len; i++)
+  for (unsigned int i = 0; i < all_names.len; i++)
   {
hb_ot_name_entry_t *entry = this->names.push ();
 
___
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  (>tables[0].tag, table_count, 
data->tables.item_size);
-  Supplier blobs_supplier (>tables[0].blob, table_count, 
data->tables.item_size);
+  Suppliertags_supplier  (>tables[0u].tag, table_count, 
data->tables.item_size);
+  Supplier blobs_supplier (>tables[0u].blob, table_count, 
data->tables.item_size);
   bool ret = f->serialize_single (,
  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 )
   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'

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

New commits:
commit ae79fdaa7774d3f886a8f03926577c3bd2010b03
Author: Behdad Esfahbod 
Date:   Fri Nov 30 11:51:26 2018 -0500

Umm.  Cryptic, yes

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) 

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  (>tables[0].tag, table_count, 
data->tables.item_size);
-  Supplier blobs_supplier (>tables[0].blob, table_count, 
data->tables.item_size);
+  Suppliertags_supplier  (>tables[0u].tag, table_count, 
data->tables.item_size);
+  Supplier blobs_supplier (>tables[0u].blob, table_count, 
data->tables.item_size);
   bool ret = f->serialize_single (,
  sfnt_tag,
  tags_supplier,
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-30 Thread Behdad Esfahbod
 src/hb-face.cc |4 ++--
 src/hb-set.hh  |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 0f32c95e1487ffcc37439635c3294f941eae857a
Author: Behdad Esfahbod 
Date:   Fri Nov 30 11:31:39 2018 -0500

Fix a few more sizeof(vector[0]) errors with weird compilers

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 5b33784f..724f54d5 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  (>tables[0].tag, table_count, 
sizeof (data->tables[0]));
-  Supplier blobs_supplier (>tables[0].blob, table_count, 
sizeof (data->tables[0]));
+  Suppliertags_supplier  (>tables[0].tag, table_count, 
data->tables.item_size);
+  Supplier blobs_supplier (>tables[0].blob, table_count, 
data->tables.item_size);
   bool ret = f->serialize_single (,
  sfnt_tag,
  tags_supplier,
diff --git a/src/hb-set.hh b/src/hb-set.hh
index a3beeef1..f1fccd8f 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -678,7 +678,7 @@ struct hb_set_t
   pages[map.index].init0 ();
   memmove (page_map + i + 1,
   page_map + i,
-  (page_map.len - 1 - i) * sizeof (page_map[0]));
+  (page_map.len - 1 - i) * page_map.item_size);
   page_map[i] = map;
 }
 return [page_map[i].index];
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-ot-deprecated.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 88630a458b21b811075bed9e761a94c50736dc11
Author: Behdad Esfahbod 
Date:   Fri Nov 30 01:11:04 2018 -0500

Fix build for realz

diff --git a/src/hb-ot-deprecated.h b/src/hb-ot-deprecated.h
index 0dfabc9b..bce51b71 100644
--- a/src/hb-ot-deprecated.h
+++ b/src/hb-ot-deprecated.h
@@ -31,7 +31,7 @@
 #ifndef HB_OT_DEPRECATED_H
 #define HB_OT_DEPRECATED_H
 
-#include "hb-common.h"
+#include "hb.h"
 #include "hb-ot-name.h"
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-ot-deprecated.h |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 346286d04eb616c43ba8c796211fa2e5e7bf1983
Author: Behdad Esfahbod 
Date:   Fri Nov 30 00:44:40 2018 -0500

Fix build

diff --git a/src/hb-ot-deprecated.h b/src/hb-ot-deprecated.h
index 1d54dc69..0dfabc9b 100644
--- a/src/hb-ot-deprecated.h
+++ b/src/hb-ot-deprecated.h
@@ -31,6 +31,7 @@
 #ifndef HB_OT_DEPRECATED_H
 #define HB_OT_DEPRECATED_H
 
+#include "hb-common.h"
 #include "hb-ot-name.h"
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-ot-post-table.hh |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 31f39cb41e1497a76c5838c93f9b4034089049f2
Author: Behdad Esfahbod 
Date:   Fri Nov 30 00:38:08 2018 -0500

[post] Rename v2 to v2X

diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index 0ca3760b..64f0936f 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -107,7 +107,7 @@ struct post
   version = table->version.to_int ();
   if (version != 0x0002) return;
 
-  const postV2Tail  = table->v2;
+  const postV2Tail  = table->v2X;
 
   glyphNameIndex = 
   pool =  (v2.glyphNameIndex);
@@ -250,7 +250,7 @@ struct post
 TRACE_SANITIZE (this);
 return_trace (likely (c->check_struct (this) &&
  (version.to_int () == 0x0001 ||
-  (version.to_int () == 0x0002 && v2.sanitize (c)) 
||
+  (version.to_int () == 0x0002 && v2X.sanitize 
(c)) ||
   version.to_int () == 0x0003)));
   }
 
@@ -286,7 +286,7 @@ struct post
 * is downloaded as a Type 1 font. */
   HBUINT32 maxMemType1;/* Maximum memory usage when an 
OpenType font
 * is downloaded as a Type 1 font. */
-  postV2Tail   v2;
+  postV2Tail   v2X;
   DEFINE_SIZE_MIN (32);
 };
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/Makefile.sources   |1 
 src/hb-deprecated.h|   61 
 src/hb-ot-deprecated.h |  106 +
 src/hb-ot.h|1 
 4 files changed, 109 insertions(+), 60 deletions(-)

New commits:
commit e3dd47e6025a7f082af4830ba483d90d9b44381f
Author: Behdad Esfahbod 
Date:   Fri Nov 30 00:32:12 2018 -0500

Move things

diff --git a/src/Makefile.sources b/src/Makefile.sources
index ba90ef02..3ae5806d 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -185,6 +185,7 @@ HB_OT_headers = \
hb-aat-layout.h \
hb-ot.h \
hb-ot-color.h \
+   hb-ot-deprecated.h \
hb-ot-font.h \
hb-ot-layout.h \
hb-ot-math.h \
diff --git a/src/hb-deprecated.h b/src/hb-deprecated.h
index 9ceb2648..4a5e702f 100644
--- a/src/hb-deprecated.h
+++ b/src/hb-deprecated.h
@@ -52,6 +52,7 @@ HB_BEGIN_DECLS
 
 #ifndef HB_DISABLE_DEPRECATED
 
+
 #define HB_SCRIPT_CANADIAN_ABORIGINAL  HB_SCRIPT_CANADIAN_SYLLABICS
 
 #define HB_BUFFER_FLAGS_DEFAULTHB_BUFFER_FLAG_DEFAULT
@@ -217,66 +218,6 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
 hb_direction_t direction,
 hb_position_t *x, hb_position_t *y);
 
-/* Like hb_ot_layout_table_find_script, but takes zero-terminated array of 
scripts to test */
-HB_EXTERN HB_DEPRECATED_FOR (hb_ot_layout_table_select_script) hb_bool_t
-hb_ot_layout_table_choose_script (hb_face_t  *face,
- hb_tag_ttable_tag,
- const hb_tag_t *script_tags,
- unsigned int   *script_index,
- hb_tag_t   *chosen_script);
-
-HB_EXTERN HB_DEPRECATED_FOR (hb_ot_layout_script_select_language) hb_bool_t
-hb_ot_layout_script_find_language (hb_face_t*face,
-  hb_tag_t  table_tag,
-  unsigned int  script_index,
-  hb_tag_t  language_tag,
-  unsigned int *language_index);
-
-HB_EXTERN HB_DEPRECATED_FOR (hb_ot_tags_from_script_and_language) void
-hb_ot_tags_from_script (hb_script_t  script,
-   hb_tag_t*script_tag_1,
-   hb_tag_t*script_tag_2);
-
-HB_EXTERN HB_DEPRECATED_FOR (hb_ot_tags_from_script_and_language) hb_tag_t
-hb_ot_tag_from_language (hb_language_t language);
-
-
-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: 2.2.0
- */
-#define HB_OT_VAR_NO_AXIS_INDEX0xu
-
-/**
- * hb_ot_var_axis_t:
- *
- * Since: 1.4.2
- * Deprecated: 2.2.0
- */
-typedef struct hb_ot_var_axis_t
-{
-  hb_tag_t tag;
-  hb_ot_name_id_t name_id;
-  float min_value;
-  float default_value;
-  float max_value;
-} hb_ot_var_axis_t;
-
-HB_EXTERN HB_DEPRECATED_FOR (hb_ot_var_get_axis_infos) unsigned int
-hb_ot_var_get_axes (hb_face_t*face,
-   unsigned int  start_offset,
-   unsigned int *axes_count /* IN/OUT */,
-   hb_ot_var_axis_t *axes_array /* OUT */);
-
-HB_EXTERN HB_DEPRECATED_FOR (hb_ot_var_find_axis_info) hb_bool_t
-hb_ot_var_find_axis (hb_face_t*face,
-hb_tag_t  axis_tag,
-unsigned int *axis_index,
-hb_ot_var_axis_t *axis_info);
 
 #endif
 
diff --git a/src/hb-ot-deprecated.h b/src/hb-ot-deprecated.h
new file mode 100644
index ..1d54dc69
--- /dev/null
+++ b/src/hb-ot-deprecated.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2018  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_H_IN
+#error "Include  instead."
+#endif
+
+#ifndef HB_OT_DEPRECATED_H
+#define 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-coretext.cc  |2 +-
 src/hb-uniscribe.cc |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 27a6b0a2f7255ed6fc7bfe1f10052c2e344e319b
Author: Behdad Esfahbod 
Date:   Thu Nov 29 16:29:30 2018 -0500

Fix build for realz

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index fbb165e9..15b8c62d 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -598,7 +598,7 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan,
   } else {
 active_feature_t *feature = active_features.find (>feature);
if (feature)
- active_features.remove (feature - (active_feature_t *) 
active_features);
+ active_features.remove (feature - active_features.arrayZ ());
   }
 }
   }
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index c403d165..e98e41f9 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -695,7 +695,7 @@ _hb_uniscribe_shape (hb_shape_plan_t*shape_plan,
   {
 active_feature_t *feature = active_features.find (>feature);
if (feature)
- active_features.remove (feature - (active_feature_t *) 
active_features);
+ active_features.remove (feature - active_features.arrayZ ());
   }
 }
 
@@ -886,8 +886,8 @@ retry:
 [i].a,
 script_tags[i],
 language_tag,
-range_char_counts,
-range_properties,
+range_char_counts.arrayZ (),
+range_properties.arrayZ (),
 range_properties.len,
 pchars + chars_offset,
 item_chars_len,
@@ -927,8 +927,8 @@ retry:
 [i].a,
 script_tags[i],
 language_tag,
-range_char_counts,
-range_properties,
+range_char_counts.arrayZ (),
+range_properties.arrayZ (),
 range_properties.len,
 pchars + chars_offset,
 log_clusters + chars_offset,
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-29 Thread Behdad Esfahbod
 .circleci/config.yml |   48 ++--
 src/hb-machinery.hh  |2 
 src/hb-uniscribe.cc  |2 
 test/shaping/data/in-house/tests/macos.tests |   64 +--
 4 files changed, 58 insertions(+), 58 deletions(-)

New commits:
commit e2af4dd1ecbe398c60fe5f3f370dd35400d7e1eb
Author: Behdad Esfahbod 
Date:   Thu Nov 29 16:03:15 2018 -0500

[uniscribe] Fix build

diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 1fae6435..c403d165 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -695,7 +695,7 @@ _hb_uniscribe_shape (hb_shape_plan_t*shape_plan,
   {
 active_feature_t *feature = active_features.find (>feature);
if (feature)
- active_features.remove (feature - active_features);
+ active_features.remove (feature - (active_feature_t *) 
active_features);
   }
 }
 
commit bf738ba3ba80778c7feb95ece446607a250d9382
Author: Ebrahim Byagowi 
Date:   Fri Nov 30 00:06:40 2018 +0330

[test][aat] Remove extra --shaper ot

As run-tests.py already adds it

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 9fb46e8c..859992cd 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,35 +1,35 @@
 # 10.12.6 https://gist.github.com/ebraminio/1704341fa16b06979e605aafd88198cf
-/System/Library/Fonts/Helvetica.dfont@c7bec2785a4c402b7809b5e35337c3d24c18e281:--shaper
 ot --font-funcs ot:U+006D,U+0300:[m=0+1706|gravecmb=0@-284,10+0]
-/System/Library/Fonts/LucidaGrande.ttc@d89a9d7e57767bfe3b5a4cfd22bb1e9dbe03a062:--shaper
 ot --font-funcs ot:U+006D,U+0300:[mgrave=0+1912]
-/System/Library/Fonts/Times.dfont@39c954614d3f3317b28564db06d5b7b7a6ff0e39:--shaper
 ot --font-funcs ot:U+0066,U+0069:[fi=0+1139]
-/Library/Fonts/Khmer MN.ttc@5f5b1072df99b7355d3066ea85fe82969d13c94a:--shaper 
ot --font-funcs 
ot: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:--shaper 
ot --font-funcs 
ot: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:--shaper
 ot --font-funcs 
ot: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:--shaper
 ot --font-funcs ot:U+05E1,U+05B0:[shevahebrew=0@-7,0+0|samekhhebrew=0+1361]
-/Library/Fonts/Apple 
Chancery.ttf@5fc49ae9bce39e2105864323183b68ea34c9e562:--shaper ot --font-funcs 
ot:U+0054,U+0068,U+0020,U+0074,U+0068,U+0020,U+006C,U+006C,U+0020,U+0074,U+0065,U+0020,U+0074,U+006F,U+0020,U+0074,U+0072,U+0020,U+0066,U+0072,U+0020,U+0066,U+0075,U+0020,U+0066,U+006A:[T_h=0+2308|space=2+569|t_h=3+1687|space=5+569|l_l=6+1108|space=8+569|t_e=9+1408|space=11+569|t_o=12+1531|space=14+569|t_r=15+1385|space=17+569|f_r=18+1432|space=20+569|f_u=21+1733|space=23+569|f_j=24+1098]
-/Library/Fonts/Apple 
Chancery.ttf@5fc49ae9bce39e2105864323183b68ea34c9e562:--shaper ot --font-funcs 
ot:U+0054,U+0065,U+0020,U+0041,U+0056,U+0020,U+0054,U+0072,U+0020,U+0056,U+0061,U+0020,U+0072,U+0054,U+0020,U+0065,U+0054,U+0020,U+0054,U+0064:[T=0+1497|e=1@-62,0+699|space=2+569|A=3+1431|V=4@-37,0+1377|space=5+569|T=6+1510|r=7@-50,0+803|space=8+569|V=9+1376|a=10@-37,0+1014|space=11+569|r=12+853|T=13+1560|space=14+569|e=15+761|T=16+1560|space=17+569|T=18+1515|d=19@-45,0+1006]
-/System/Library/Fonts/GeezaPro.ttc@f43ee7151c2e9f1dddfbc26cfc148609eb5c5820:--shaper
 ot --font-funcs 
ot:U+0627,U+0644,U+0623,U+064E,U+0628,U+0652,U+062C,U+064E,U+062F,U+0650,U+064A,U+064E,U+0651,U+0629,U+0640,U+0627,U+0644,U+0639,U+064E,U+0631,U+064E,U+0628,U+0650,U+064A,U+064E,U+0651,U+0629:[u0629.final.tehMarbuta=26+713|u064e_u0651.shaddaFatha=23@0,-200+0|u064a.medial.yeh=23+656|u0650.kasra=21@80,290+80|u0628.initial.beh=21@-80,0+576|u064e.fatha=19@200,-570+200|u0631.final.reh=19@-200,0+702|u064e.fatha=17@200,-200+200|u0639.medial.ain=17@-200,0+738|u0644.initial.lam=16+515|u0627.final.alef=15+647|u0640.tatweel=14+449|u0629.final.tehMarbuta=13+713|u064e_u0651.shaddaFatha=10@0,-200+0|u064a.initial.yeh=10+656|u0650.kasra=8@80,570+80|u062f.final.dal=8@-80,0+822|u064e.fatha=6@290,-160+290|u062c.medial.jeem=6@-290,0+1069|u0652.sukun=4@0,-200+0|u0628.initial.beh=4+656|u064e.fatha=1@-252,120+-252|u0644_u0623.isolated.lamHamzaOnAlef=1@120,0+1282|u0627.alef=0+647]
-/System/Library/Fonts/GeezaPro.ttc@f43ee7151c2e9f1dddfbc26cfc148609eb5c5820:--shaper
 ot --font-funcs 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-coretext.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ac0264717b949df8840b179d882a9bed2993fb74
Author: Behdad Esfahbod 
Date:   Thu Nov 29 15:07:44 2018 -0500

[coretext] Fix compile

Fingers crossed.

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 918f649d..fbb165e9 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -598,7 +598,7 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan,
   } else {
 active_feature_t *feature = active_features.find (>feature);
if (feature)
- active_features.remove (feature - active_features);
+ active_features.remove (feature - (active_feature_t *) 
active_features);
   }
 }
   }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-29 Thread Behdad Esfahbod
 src/hb-aat-layout-ankr-table.hh |2 +-
 src/hb-aat-layout-bsln-table.hh |2 +-
 src/hb-aat-layout-common.hh |4 ++--
 src/hb-aat-layout-feat-table.hh |2 +-
 src/hb-aat-layout-just-table.hh |2 +-
 src/hb-aat-layout-kerx-table.hh |   10 +-
 src/hb-aat-layout-lcar-table.hh |2 +-
 src/hb-aat-layout-morx-table.hh |   14 +++---
 src/hb-aat-layout-trak-table.hh |2 +-
 src/hb-aat-ltag-table.hh|2 +-
 src/hb-dsalgs.hh|   16 
 src/hb-map.hh   |2 +-
 src/hb-ot-cmap-table.hh |2 +-
 src/hb-ot-color-cbdt-table.hh   |4 ++--
 src/hb-ot-color-colr-table.hh   |2 +-
 src/hb-ot-color-cpal-table.hh   |2 +-
 src/hb-ot-color-sbix-table.hh   |2 +-
 src/hb-ot-color-svg-table.hh|2 +-
 src/hb-ot-glyf-table.hh |4 ++--
 src/hb-ot-hdmx-table.hh |2 +-
 src/hb-ot-head-table.hh |2 +-
 src/hb-ot-hhea-table.hh |4 ++--
 src/hb-ot-hmtx-table.hh |   14 +++---
 src/hb-ot-kern-table.hh |   14 +++---
 src/hb-ot-layout-base-table.hh  |2 +-
 src/hb-ot-layout-gdef-table.hh  |2 +-
 src/hb-ot-layout-gpos-table.hh  |2 +-
 src/hb-ot-layout-gsub-table.hh  |2 +-
 src/hb-ot-layout-jstf-table.hh  |2 +-
 src/hb-ot-layout.cc |4 ++--
 src/hb-ot-math-table.hh |2 +-
 src/hb-ot-maxp-table.hh |2 +-
 src/hb-ot-name-table.hh |2 +-
 src/hb-ot-os2-table.hh  |2 +-
 src/hb-ot-post-table.hh |2 +-
 src/hb-ot-stat-table.hh |2 +-
 src/hb-ot-var-avar-table.hh |2 +-
 src/hb-ot-var-fvar-table.hh |2 +-
 src/hb-ot-var-hvar-table.hh |8 
 src/hb-ot-var-mvar-table.hh |2 +-
 src/hb-ot-vorg-table.hh |2 +-
 src/hb-set-digest.hh|   14 +++---
 42 files changed, 85 insertions(+), 85 deletions(-)

New commits:
commit 5c4fead734b082e0168e6811bec4bcaa19acc36a
Author: Behdad Esfahbod 
Date:   Thu Nov 29 15:04:34 2018 -0500

Convert "static const hb_tag_t" constants to enum

diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh
index b793245a..763bbedd 100644
--- a/src/hb-aat-layout-ankr-table.hh
+++ b/src/hb-aat-layout-ankr-table.hh
@@ -58,7 +58,7 @@ typedef LArrayOf GlyphAnchors;
 
 struct ankr
 {
-  static const hb_tag_t tableTag = HB_AAT_TAG_ankr;
+  enum { tableTag = HB_AAT_TAG_ankr };
 
   inline const Anchor _anchor (hb_codepoint_t glyph_id,
   unsigned int i,
diff --git a/src/hb-aat-layout-bsln-table.hh b/src/hb-aat-layout-bsln-table.hh
index b8640862..d2ea71d1 100644
--- a/src/hb-aat-layout-bsln-table.hh
+++ b/src/hb-aat-layout-bsln-table.hh
@@ -116,7 +116,7 @@ struct BaselineTableFormat3Part
 
 struct bsln
 {
-  static const hb_tag_t tableTag = HB_AAT_TAG_bsln;
+  enum { tableTag = HB_AAT_TAG_bsln };
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
diff --git a/src/hb-aat-layout-feat-table.hh b/src/hb-aat-layout-feat-table.hh
index 4e63ec8e..1565d432 100644
--- a/src/hb-aat-layout-feat-table.hh
+++ b/src/hb-aat-layout-feat-table.hh
@@ -155,7 +155,7 @@ struct FeatureName
 
 struct feat
 {
-  static const hb_tag_t tableTag = HB_AAT_TAG_feat;
+  enum { tableTag = HB_AAT_TAG_feat };
 
   inline bool has_data (void) const { return version.to_int (); }
 
diff --git a/src/hb-aat-layout-just-table.hh b/src/hb-aat-layout-just-table.hh
index 92ca6603..295205fd 100644
--- a/src/hb-aat-layout-just-table.hh
+++ b/src/hb-aat-layout-just-table.hh
@@ -382,7 +382,7 @@ struct JustificationHeader
 
 struct just
 {
-  static const hb_tag_t tableTag = HB_AAT_TAG_just;
+  enum { tableTag = HB_AAT_TAG_just };
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 9a2351a1..b25feea2 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -982,7 +982,7 @@ struct kerx : KerxTable
 {
   friend struct KerxTable;
 
-  static const hb_tag_t tableTag = HB_AAT_TAG_kerx;
+  enum { tableTag = HB_AAT_TAG_kerx };
   enum { minVersion = 2u };
 
   typedef KerxSubTableHeader SubTableHeader;
diff --git a/src/hb-aat-layout-lcar-table.hh b/src/hb-aat-layout-lcar-table.hh
index 40d34f59..9bfb6849 100644
--- a/src/hb-aat-layout-lcar-table.hh
+++ b/src/hb-aat-layout-lcar-table.hh
@@ -40,7 +40,7 @@ typedef ArrayOf LigCaretClassEntry;
 
 struct lcar
 {
-  static const hb_tag_t tableTag = HB_AAT_TAG_lcar;
+  enum { tableTag = HB_AAT_TAG_lcar };
 
   inline unsigned int get_lig_carets (hb_font_t  *font,
  hb_direction_t  direction,
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index e8a0cdfc..9b37a713 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -1096,7 +1096,7 @@ struct Chain
 template 
 struct mortmorx
 {
-  static const 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-machinery.hh |2 +-
 src/hb-ot-cmap-table.hh |3 ++-
 src/hb-set.hh   |4 ++--
 src/hb-subset.cc|2 +-
 src/hb-vector.hh|4 ++--
 5 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 861bc75349257f74c12b261abfcd5ab9e2f04863
Author: Behdad Esfahbod 
Date:   Thu Nov 29 14:34:44 2018 -0500

[vector] Make pointer cast explicit

Too bad this doesn't help MSVC 2008 build, as explicit operators are
C++11.

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 39e96293..5f3d153e 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -658,7 +658,7 @@ struct Supplier
   }
   inline Supplier (const hb_vector_t *v)
   {
-head = *v;
+head = (const Type *) *v;
 len = v->len;
 stride = sizeof (Type);
   }
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index cdc610be..a2e611c9 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -495,7 +495,8 @@ struct CmapSubtableLongSegmented
   {
 TRACE_SERIALIZE (this);
 if (unlikely (!c->extend_min (*this))) return_trace (false);
-Supplier supplier (group_data, group_data.len);
+Supplier supplier ((const 
OT::CmapSubtableLongGroup*) group_data,
+ group_data.len);
 if (unlikely (!groups.serialize (c, supplier, group_data.len))) 
return_trace (false);
 return true;
   }
diff --git a/src/hb-set.hh b/src/hb-set.hh
index 100bdb2a..a3beeef1 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -375,8 +375,8 @@ struct hb_set_t
 if (!resize (count))
   return;
 population = other->population;
-memcpy (pages, other->pages, count * pages.item_size);
-memcpy (page_map, other->page_map, count * page_map.item_size);
+memcpy ((void *) pages, (const void *) other->pages, count * 
pages.item_size);
+memcpy ((void *) page_map, (const void *) other->page_map, count * 
page_map.item_size);
   }
 
   inline bool is_equal (const hb_set_t *other) const
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index a3917b86..14d4774c 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -77,7 +77,7 @@ _subset2 (hb_subset_plan_t *plan)
   return false;
 }
   retry:
-hb_serialize_context_t serializer (buf, buf_size);
+hb_serialize_context_t serializer ((void *) buf, buf_size);
 hb_subset_context_t c (plan, );
 result = table->subset ();
 if (serializer.ran_out_of_room)
diff --git a/src/hb-vector.hh b/src/hb-vector.hh
index 787512f9..313c24c4 100644
--- a/src/hb-vector.hh
+++ b/src/hb-vector.hh
@@ -101,8 +101,8 @@ struct hb_vector_t
   inline hb_sorted_array_t as_sorted_array (void) const
   { return hb_sorted_array (arrayZ(), len); }
 
-  template  inline operator  T * (void) { return arrayZ(); }
-  template  inline operator const T * (void) const { return 
arrayZ(); }
+  template  explicit_operator inline operator  T * (void) { return 
arrayZ(); }
+  template  explicit_operator inline operator const T * (void) 
const { return arrayZ(); }
 
   inline Type * operator  + (unsigned int i) { return arrayZ() + i; }
   inline const Type * operator  + (unsigned int i) const { return arrayZ() + 
i; }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 src/hb-set.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 72955e68256806f082439d65e6f9b5cf2e35fa8a
Author: Behdad Esfahbod 
Date:   Thu Nov 29 14:28:44 2018 -0500

Hand-hold older compilers

diff --git a/src/hb-set.hh b/src/hb-set.hh
index 8b7a0f3d..100bdb2a 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -660,7 +660,7 @@ struct hb_set_t
 unsigned int count = pages.len;
 for (int i = count - 1; i >= 0; i++)
   if (!page_at (i).is_empty ())
-return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_max ();
+return page_map[(unsigned) i].major * page_t::PAGE_BITS + page_at 
(i).get_max ();
 return INVALID;
   }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-29 Thread Behdad Esfahbod
 test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-0.ttf   
|binary
 test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-Missing.ttf 
|binary
 2 files changed

New commits:
commit 1a182e97ee71de0e78a70ff823ae17fa93a31830
Author: Behdad Esfahbod 
Date:   Thu Nov 29 12:39:52 2018 -0500

[test/text-rendering-tests] Update from upstream

diff --git 
a/test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-0.ttf 
b/test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-0.ttf
new file mode 100644
index ..07e68821
Binary files /dev/null and 
b/test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-0.ttf differ
diff --git 
a/test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-Missing.ttf 
b/test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-Missing.ttf
new file mode 100644
index ..58dd961c
Binary files /dev/null and 
b/test/shaping/data/text-rendering-tests/fonts/TestGVAR-Composite-Missing.ttf 
differ
___
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 = _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 = >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'

2018-11-29 Thread Behdad Esfahbod
 src/hb-null.hh |   25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

New commits:
commit 282ce7230b8bd8ad65c408cdaf1499504038247d
Author: Behdad Esfahbod 
Date:   Thu Nov 29 12:18:14 2018 -0500

Fix "typename outside template" issues

Nothing an extra template class wouldn't fix...

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

diff --git a/src/hb-null.hh b/src/hb-null.hh
index 1583d5b9..dde4b2e9 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -77,6 +77,7 @@ struct hb_static_size
 /*
  * Null()
  */
+
 extern HB_INTERNAL
 hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof 
(hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)];
 
@@ -86,7 +87,13 @@ static inline Type const & Null (void) {
   static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase 
HB_NULL_POOL_SIZE.");
   return *reinterpret_cast (_hb_NullPool);
 }
-#define Null(Type) Null ()
+template 
+struct NullHelper
+{
+  typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type;
+  static inline const Type & get_null (void) { return Null (); }
+};
+#define Null(Type) NullHelper::get_null ()
 
 /* Specializations for arbitrary-content Null objects expressed in bytes. */
 #define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \
@@ -129,17 +136,23 @@ static inline Type& Crap (void) {
   memcpy (obj, (Type), sizeof (*obj));
   return *obj;
 }
-#define Crap(Type) Crap ()
+template 
+struct CrapHelper
+{
+  typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type;
+  static inline Type & get_crap (void) { return Crap (); }
+};
+#define Crap(Type) CrapHelper::get_crap ()
 
 template 
-struct CrapOrNull {
+struct CrapOrNullHelper {
   static inline Type & get (void) { return Crap(Type); }
 };
 template 
-struct CrapOrNull {
-  static inline Type const & get (void) { return Null(Type); }
+struct CrapOrNullHelper {
+  static inline const Type & get (void) { return Null(Type); }
 };
-#define CrapOrNull(Type) CrapOrNull::get ()
+#define CrapOrNull(Type) CrapOrNullHelper::get ()
 
 
 /*
___
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 

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

2018-11-29 Thread Behdad Esfahbod
 docs/usermanual-getting-started.xml   
|3 +
 src/hb-icu.cc 
|3 +
 test/shaping/data/in-house/Makefile.sources   
|1 
 test/shaping/data/in-house/fonts/e39391c77a6321c2ac7a2d644de0396470cd4bfe.ttf 
|binary
 test/shaping/data/in-house/tests/kern-format2.tests   
|3 +
 test/shaping/data/in-house/tests/macos.tests  
|   16 ++
 6 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 0bcb1de1265368a27e53c6d935c965cbcb4130a0
Merge: e0307de8 a85886fc
Author: Behdad Esfahbod 
Date:   Thu Nov 29 10:39:18 2018 -0500

Merge pull request #1418 from gvictor/replace_icu_deprecated

Replace @Deprecated ICU API - USCRIPT_CODE_LIMIT

commit e0307de818ad1f70ef96938642bda61d7a62532a
Author: Ebrahim Byagowi 
Date:   Thu Nov 29 11:36:05 2018 +0330

[test][aat.kern] More (#1427)

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 8bce2530..9fb46e8c 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,4 +1,4 @@
-# 10.12.6
+# 10.12.6 https://gist.github.com/ebraminio/1704341fa16b06979e605aafd88198cf
 
/System/Library/Fonts/Helvetica.dfont@c7bec2785a4c402b7809b5e35337c3d24c18e281:--shaper
 ot --font-funcs ot:U+006D,U+0300:[m=0+1706|gravecmb=0@-284,10+0]
 
/System/Library/Fonts/LucidaGrande.ttc@d89a9d7e57767bfe3b5a4cfd22bb1e9dbe03a062:--shaper
 ot --font-funcs ot:U+006D,U+0300:[mgrave=0+1912]
 
/System/Library/Fonts/Times.dfont@39c954614d3f3317b28564db06d5b7b7a6ff0e39:--shaper
 ot --font-funcs ot:U+0066,U+0069:[fi=0+1139]
@@ -7,14 +7,16 @@
 
/System/Library/Fonts/Times.dfont@39c954614d3f3317b28564db06d5b7b7a6ff0e39:--shaper
 ot --font-funcs 
ot: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:--shaper
 ot --font-funcs ot:U+05E1,U+05B0:[shevahebrew=0@-7,0+0|samekhhebrew=0+1361]
 /Library/Fonts/Apple 
Chancery.ttf@5fc49ae9bce39e2105864323183b68ea34c9e562:--shaper ot --font-funcs 
ot:U+0054,U+0068,U+0020,U+0074,U+0068,U+0020,U+006C,U+006C,U+0020,U+0074,U+0065,U+0020,U+0074,U+006F,U+0020,U+0074,U+0072,U+0020,U+0066,U+0072,U+0020,U+0066,U+0075,U+0020,U+0066,U+006A:[T_h=0+2308|space=2+569|t_h=3+1687|space=5+569|l_l=6+1108|space=8+569|t_e=9+1408|space=11+569|t_o=12+1531|space=14+569|t_r=15+1385|space=17+569|f_r=18+1432|space=20+569|f_u=21+1733|space=23+569|f_j=24+1098]
+/Library/Fonts/Apple 
Chancery.ttf@5fc49ae9bce39e2105864323183b68ea34c9e562:--shaper ot --font-funcs 
ot:U+0054,U+0065,U+0020,U+0041,U+0056,U+0020,U+0054,U+0072,U+0020,U+0056,U+0061,U+0020,U+0072,U+0054,U+0020,U+0065,U+0054,U+0020,U+0054,U+0064:[T=0+1497|e=1@-62,0+699|space=2+569|A=3+1431|V=4@-37,0+1377|space=5+569|T=6+1510|r=7@-50,0+803|space=8+569|V=9+1376|a=10@-37,0+1014|space=11+569|r=12+853|T=13+1560|space=14+569|e=15+761|T=16+1560|space=17+569|T=18+1515|d=19@-45,0+1006]
 
/System/Library/Fonts/GeezaPro.ttc@f43ee7151c2e9f1dddfbc26cfc148609eb5c5820:--shaper
 ot --font-funcs 
ot:U+0627,U+0644,U+0623,U+064E,U+0628,U+0652,U+062C,U+064E,U+062F,U+0650,U+064A,U+064E,U+0651,U+0629,U+0640,U+0627,U+0644,U+0639,U+064E,U+0631,U+064E,U+0628,U+0650,U+064A,U+064E,U+0651,U+0629:[u0629.final.tehMarbuta=26+713|u064e_u0651.shaddaFatha=23@0,-200+0|u064a.medial.yeh=23+656|u0650.kasra=21@80,290+80|u0628.initial.beh=21@-80,0+576|u064e.fatha=19@200,-570+200|u0631.final.reh=19@-200,0+702|u064e.fatha=17@200,-200+200|u0639.medial.ain=17@-200,0+738|u0644.initial.lam=16+515|u0627.final.alef=15+647|u0640.tatweel=14+449|u0629.final.tehMarbuta=13+713|u064e_u0651.shaddaFatha=10@0,-200+0|u064a.initial.yeh=10+656|u0650.kasra=8@80,570+80|u062f.final.dal=8@-80,0+822|u064e.fatha=6@290,-160+290|u062c.medial.jeem=6@-290,0+1069|u0652.sukun=4@0,-200+0|u0628.initial.beh=4+656|u064e.fatha=1@-252,120+-252|u0644_u0623.isolated.lamHamzaOnAlef=1@120,0+1282|u0627.alef=0+647]
 
/System/Library/Fonts/GeezaPro.ttc@f43ee7151c2e9f1dddfbc26cfc148609eb5c5820:--shaper
 ot --font-funcs 
ot:U+0628,U+064A,U+064E,U+0651,U+0629:[u0629.final.tehMarbuta=4+713|u064e_u0651.shaddaFatha=1@0,-200+0|u064a.medial.yeh=1+656|u0628.initial.beh=0+656]
 
/System/Library/Fonts/GeezaPro.ttc@f43ee7151c2e9f1dddfbc26cfc148609eb5c5820:--shaper
 ot --font-funcs ot:U+0631,U+0628:[u0628.beh=1+1415|u0631.reh=0@-202,0+700]
 
/System/Library/Fonts/GeezaPro.ttc@f43ee7151c2e9f1dddfbc26cfc148609eb5c5820:--shaper
 ot --font-funcs 
ot:U+0628,U+064F:[u064f.damma=0@250,-250+250|u0628.beh=0@-250,0+1165]
-/System/Library/Fonts/SFNSDisplay.ttf@92787c30716672737e9059bc367c15d04fbc1ced:--shaper
 ot --font-funcs 
ot:U+0056,U+0041,U+0056,U+0041:[gid265=0+1227|gid4=1@-65,0+1162|gid265=2@-65,0+1162|gid4=3@-65,0+1227]

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-28 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |   14 ++
 src/hb-aat-layout-kerx-table.hh |2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 42a2b496e428521151ff5cb07454d2e993f892cc
Author: Behdad Esfahbod 
Date:   Wed Nov 28 15:24:30 2018 -0500

[kerx] Fix Format2 index calc again

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 253b56fe..c0b0e375 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -689,6 +689,13 @@ struct ObsoleteTypes
 return (offset - ((const char *) array - (const char *) base)) / sizeof 
(T);
   }
   template 
+  static inline unsigned int byteOffsetToIndex (unsigned int offset,
+   const void *base,
+   const T *array)
+  {
+return offsetToIndex (offset, base, array);
+  }
+  template 
   static inline unsigned int wordOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
@@ -712,6 +719,13 @@ struct ExtendedTypes
 return offset;
   }
   template 
+  static inline unsigned int byteOffsetToIndex (unsigned int offset,
+   const void *base,
+   const T *array)
+  {
+return offset / 2;
+  }
+  template 
   static inline unsigned int wordOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index abd577b9..7caf45d5 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -255,7 +255,7 @@ struct KerxSubTableFormat1
unsigned int tuple_count = MAX (1u, table->header.tuple_count ());
 
unsigned int kern_idx = Format1EntryT::kernActionIndex (entry);
-   kern_idx = Types::offsetToIndex (kern_idx, >machine, 
kernAction.arrayZ);
+   kern_idx = Types::byteOffsetToIndex (kern_idx, >machine, 
kernAction.arrayZ);
const FWORD *actions = [kern_idx];
if (!c->sanitizer.check_array (actions, depth, tuple_count))
{
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[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]

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

2018-11-28 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |   44 
 src/hb-aat-layout-kerx-table.hh |   18 +++-
 2 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit a3267cf803082af157a7f2b0026af2633b14f8e3
Author: Behdad Esfahbod 
Date:   Wed Nov 28 15:06:01 2018 -0500

[kern] Fix kern table Format2 offsetToIndex

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

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 48526edf..abd577b9 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -392,9 +392,13 @@ struct KerxSubTableFormat2
 unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
 unsigned int l = (this+leftClassTable).get_class (left, num_glyphs, 0);
 unsigned int r = (this+rightClassTable).get_class (right, num_glyphs, 0);
-unsigned int offset = l + r;
-const FWORD *v =  (&(this+array), offset);
+
+const UnsizedArrayOf  = this+array;
+unsigned int kern_idx = l + r;
+kern_idx = Types::offsetToIndex (kern_idx, this, );
+const FWORD *v = [kern_idx];
 if (unlikely (!v->sanitize (>sanitizer))) return 0;
+
 return kerxTupleKern (*v, header.tuple_count (), this, c);
   }
 
commit f9a9c0fd1e561715d696c7bd840bab552d0718ee
Author: Behdad Esfahbod 
Date:   Wed Nov 28 14:51:56 2018 -0500

[kerx] Fix ClassTable implementation for 'kern' table Format 2

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 94885216..253b56fe 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -488,7 +488,7 @@ struct StateTable
 {
   typedef typename Types::HBUINT HBUINT;
   typedef typename Types::HBUSHORT HBUSHORT;
-  typedef typename Types::ClassType ClassType;
+  typedef typename Types::ClassTypeNarrow ClassType;
 
   enum State
   {
@@ -678,7 +678,8 @@ struct ObsoleteTypes
   static const bool extended = false;
   typedef HBUINT16 HBUINT;
   typedef HBUINT8 HBUSHORT;
-  typedef ClassTable ClassType;
+  typedef ClassTable ClassTypeNarrow;
+  typedef ClassTable ClassTypeWide;
 
   template 
   static inline unsigned int offsetToIndex (unsigned int offset,
@@ -700,7 +701,8 @@ struct ExtendedTypes
   static const bool extended = true;
   typedef HBUINT32 HBUINT;
   typedef HBUINT16 HBUSHORT;
-  typedef Lookup ClassType;
+  typedef Lookup ClassTypeNarrow;
+  typedef Lookup ClassTypeWide;
 
   template 
   static inline unsigned int offsetToIndex (unsigned int offset,
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 8dc74991..48526edf 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -437,19 +437,13 @@ struct KerxSubTableFormat2
  c->check_range (this, array)));
   }
 
-  /* Note:
-   * OT kern table specifies ClassTable as having 16-bit entries, whereas
-   * AAT kern table specifies them as having 8bit entries.
-   * I've not seen any fonts with this format in kern table.
-   * We follow AAT. */
-
   protected:
   KernSubTableHeader   header;
   HBUINT   rowWidth;   /* The width, in bytes, of a row in the 
table. */
-  OffsetTo
+  OffsetTo
leftClassTable; /* Offset from beginning of this 
subtable to
 * left-hand class table. */
-  OffsetTo
+  OffsetTo
rightClassTable;/* Offset from beginning of this 
subtable to
 * right-hand class table. */
   OffsetTo, HBUINT, false>
commit 5b4a789ca857664668ff69936574dcd09bee6065
Author: Behdad Esfahbod 
Date:   Wed Nov 28 14:46:26 2018 -0500

[aat] Towards adding two ClassTable's

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 3ee96bc9..94885216 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -363,6 +363,14 @@ struct Lookup
 }
   }
 
+  inline typename T::type get_class (hb_codepoint_t glyph_id,
+unsigned int num_glyphs,
+unsigned int outOfRange) const
+  {
+const T *v = get_value (glyph_id, num_glyphs);
+return v ? *v : outOfRange;
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
@@ -638,6 +646,7 @@ struct StateTable
   DEFINE_SIZE_STATIC (4 * sizeof (HBUINT));
 };
 
+template 
 struct ClassTable
 {
   inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int 
outOfRange) const
@@ -645,6 +654,12 @@ struct ClassTable
 unsigned int i = glyph_id - firstGlyph;
 return i >= classArray.len ? outOfRange : classArray.arrayZ[i];
   }
+  inline unsigned int get_class (hb_codepoint_t glyph_id,
+unsigned int num_glyphs HB_UNUSED,
+unsigned int outOfRange) const
+  {
+return get_class (glyph_id, outOfRange);
+  }
   inline bool sanitize (hb_sanitize_context_t *c) 

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

2018-11-27 Thread Behdad Esfahbod
 .codecov.yml |7 +++
 src/hb-machinery.hh  |6 ++
 test/shaping/data/in-house/tests/macos.tests |3 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 987f4187722a05e3f360b85c66309a351fc5d6ad
Merge: 1042d9fb 4e2a03b6
Author: Behdad Esfahbod 
Date:   Tue Nov 27 17:40:32 2018 -0500

Merge pull request #1398 from Adenilson/bigInt01

Optimize harfbuzz big integer conversions

commit 4e2a03b6b6e0c0d1c4edea10dc1aae63eeb6c581
Author: Behdad Esfahbod 
Date:   Tue Nov 27 17:40:09 2018 -0500

Comment

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index c3848415..0e75c824 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -692,8 +692,10 @@ struct BEInt
   inline operator Type (void) const
   {
 #if defined(__GNUC__) || defined(__clang__)
+/* Spoon-feed the compiler a big-endian integer with alignment 1.
+ * https://github.com/harfbuzz/harfbuzz/pull/1398 */
 struct __attribute__((packed)) packed_uint16_t { uint16_t v; };
-return __builtin_bswap16(((packed_uint16_t *) this)->v);
+return __builtin_bswap16 (((packed_uint16_t *) this)->v);
 #endif
 return (v[0] <<  8)
  + (v[1]  );
commit 4a719a7f4c997ea7e47588bc0288c97706dae015
Author: Adenilson Cavalcanti 
Date:   Tue Nov 20 14:41:19 2018 -0800

Optimize harfbuzz big integer conversions

Profiling showed that type conversions were adding considerable cycles in 
time
spent doing text shaping.

The idea is to optimize it using native processor instructions to help Blink
layout performance.

Doing further investigation revelead that compilers may not use the
proper instruction on ARM 32bits builds (i.e. REV16).

One way to insure that the generated ASM was ideal for both gcc/clang
was using __builtin_bswap16.

Added bonus is that we no longer need to test for CPU architecture.

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 3c11243f..c3848415 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -691,6 +691,10 @@ struct BEInt
   }
   inline operator Type (void) const
   {
+#if defined(__GNUC__) || defined(__clang__)
+struct __attribute__((packed)) packed_uint16_t { uint16_t v; };
+return __builtin_bswap16(((packed_uint16_t *) this)->v);
+#endif
 return (v[0] <<  8)
  + (v[1]  );
   }
commit 1042d9fbc05aff9d51f15c2824a8521e963d0acd
Author: Ebrahim Byagowi 
Date:   Mon Nov 26 18:58:39 2018 +0330

[ci] Add .codecov.yml

Similar to 
https://github.com/GoogleChrome/lighthouse/blob/master/.codecov.yml

No strong preference on commenting, feel free to enable it again

diff --git a/.codecov.yml b/.codecov.yml
new file mode 100644
index ..e9b8ab48
--- /dev/null
+++ b/.codecov.yml
@@ -0,0 +1,7 @@
+comment: off
+
+coverage:
+  status:
+project:
+  default:
+threshold: 1%
commit 97eaedca5de76c74534bab41562aee130098558a
Author: Ebrahim Byagowi 
Date:   Mon Nov 26 16:58:58 2018 +0330

[test][aat] Enable Tamil MN test (#1414)

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 05dafd19..9f1f9fa1 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -18,8 +18,7 @@
 
/System/Library/Fonts/LucidaGrande.ttc@63ba1b1de4709bd832ca76bd62368dd99fc34269::U+006D,U+0300:[mgrave=0+1912]
 
/System/Library/Fonts/Times.ttc@896098b6979306ad84355025459f7c68b029139c::U+0066,U+0069:[fi=0+1139]
 /Library/Fonts/Khmer 
MN.ttc@782ba6cf3fca0512ab348dfe08345a2d5dc5bf2c::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]
-# The following is broken https://github.com/harfbuzz/harfbuzz/issues/1410
-#/Library/Fonts/Tamil 
MN.ttc@3de37f3f8f3cb6015b093fbd6e9d323daaf6fb1d::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]
+/Library/Fonts/Tamil 
MN.ttc@3de37f3f8f3cb6015b093fbd6e9d323daaf6fb1d::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.ttc@896098b6979306ad84355025459f7c68b029139c::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@63ba1b1de4709bd832ca76bd62368dd99fc34269::U+05E1,U+05B0:[shevahebrew=0@-7,0+0|samekhhebrew=0+1361]
 /Library/Fonts/Apple 

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

2018-11-25 Thread Behdad Esfahbod
 src/hb-ot-layout-gdef-table.hh |   13 +++-
 src/hb-ot-layout-gpos-table.hh |3 +
 src/hb-ot-layout-gsub-table.hh |3 +
 src/hb-ot-layout-gsubgpos.hh   |5 +++
 src/hb-ot-layout.cc|   63 +++--
 5 files changed, 65 insertions(+), 22 deletions(-)

New commits:
commit 574d888c8a409295a952361a39c8e83a52a0fc3d
Author: Behdad Esfahbod 
Date:   Sun Nov 25 16:51:22 2018 -0500

[aat] Ignore GSUB table of Muthu Foundry if they have morx table

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

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 907fd463..2589218d 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1643,6 +1643,9 @@ struct GPOS : GSUBGPOS
   inline bool sanitize (hb_sanitize_context_t *c) const
   { return GSUBGPOS::sanitize (c); }
 
+  HB_INTERNAL bool is_blacklisted (hb_blob_t *blob,
+  hb_face_t *face) const;
+
   typedef GSUBGPOS::accelerator_t accelerator_t;
 };
 
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 501f2308..27bd440d 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1486,6 +1486,9 @@ struct GSUB : GSUBGPOS
   inline bool sanitize (hb_sanitize_context_t *c) const
   { return GSUBGPOS::sanitize (c); }
 
+  HB_INTERNAL bool is_blacklisted (hb_blob_t *blob,
+  hb_face_t *face) const;
+
   typedef GSUBGPOS::accelerator_t accelerator_t;
 };
 
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 3d70c55c..a9bfee15 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -2753,6 +2753,11 @@ struct GSUBGPOS
 inline void init (hb_face_t *face)
 {
   this->table = hb_sanitize_context_t().reference_table (face);
+  if (unlikely (this->table->is_blacklisted (this->table.get_blob (), 
face)))
+  {
+   hb_blob_destroy (this->table.get_blob ());
+   this->table = hb_blob_get_empty ();
+  }
 
   this->lookup_count = table->get_lookup_count ();
 
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 6d6834fc..d0b22efe 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -34,15 +34,17 @@
 #include "hb-ot-map.hh"
 #include "hb-map.hh"
 
+#include "hb-ot-kern-table.hh"
 #include "hb-ot-layout-gdef-table.hh"
 #include "hb-ot-layout-gsub-table.hh"
 #include "hb-ot-layout-gpos-table.hh"
 #include "hb-ot-layout-base-table.hh" // Just so we compile it; unused 
otherwise
 #include "hb-ot-layout-jstf-table.hh" // Just so we compile it; unused 
otherwise
-#include "hb-ot-kern-table.hh"
 #include "hb-ot-name-table.hh"
+#include "hb-ot-os2-table.hh"
 
 #include "hb-aat-layout-lcar-table.hh"
+#include "hb-aat-layout-morx-table.hh"
 
 
 /**
@@ -284,6 +286,38 @@ hb_ot_layout_get_ligature_carets (hb_font_t  *font,
  * GSUB/GPOS
  */
 
+bool
+OT::GSUB::is_blacklisted (hb_blob_t *blob HB_UNUSED,
+ hb_face_t *face) const
+{
+  /* Mac OS X prefers morx over GSUB.  It also ships with various Indic fonts,
+   * all by 'MUTF' foundry (Tamil MN, Tamil Sangam MN, etc.), that have broken
+   * GSUB/GPOS tables.  Some have GSUB with zero scripts, those are ignored by
+   * our morx/GSUB preference code.  But if GSUB has non-zero scripts, we tend
+   * to prefer it over morx because we want to be consistent with other 
OpenType
+   * shapers.
+   *
+   * To work around broken Indic Mac system fonts, we ignore GSUB table if
+   * OS/2 VendorId is 'MUTF' and font has morx table as well.
+   *
+   * https://github.com/harfbuzz/harfbuzz/issues/1410
+   * https://github.com/harfbuzz/harfbuzz/issues/1348
+   * https://github.com/harfbuzz/harfbuzz/issues/1391
+   */
+  if (unlikely (face->table.OS2->achVendID == HB_TAG ('M','U','T','F') &&
+   face->table.morx->has_data ()))
+return true;
+
+  return false;
+}
+
+bool
+OT::GPOS::is_blacklisted (hb_blob_t *blob HB_UNUSED,
+ hb_face_t *face HB_UNUSED) const
+{
+  return false;
+}
+
 static const OT::GSUBGPOS&
 get_gsubgpos_table (hb_face_t *face,
hb_tag_t   table_tag)
commit 4151c2848d8df75b6d0a4f5d79bee843158aa4a4
Author: Behdad Esfahbod 
Date:   Sun Nov 25 16:38:36 2018 -0500

[GDEF] Move more code

diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index a7ba9511..a0ae27e7 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -413,7 +413,15 @@ struct GDEF
 
   struct accelerator_t
   {
-HB_INTERNAL void init (hb_face_t *face);
+inline void init (hb_face_t *face)
+{
+  this->table = hb_sanitize_context_t().reference_table (face);
+  if (unlikely (this->table->is_blacklisted (this->table.get_blob (), 
face)))
+  {
+   hb_blob_destroy (this->table.get_blob ());
+   this->table = hb_blob_get_empty ();
+  }
+}
 
 inline void fini 

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

2018-11-25 Thread Behdad Esfahbod
 test/shaping/data/in-house/tests/macos.tests |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 0e3a48e54248d69197e8fb23c824d987f91b3bf7
Author: Ebrahim Byagowi 
Date:   Sun Nov 25 13:37:23 2018 +0330

[test][aat] fix 10.13.6 Helvetica expectation

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 06bdacba..05dafd19 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -14,7 +14,7 @@
 
/System/Library/Fonts/SFNSDisplay.ttf@92787c30716672737e9059bc367c15d04fbc1ced::U+0056,U+0041,U+0056,U+0041:[gid265=0+1227|gid4=1@-65,0+1162|gid265=2@-65,0+1162|gid4=3@-65,0+1227]
 
 # 10.13.6
-/System/Library/Fonts/Helvetica.ttc@8a928f9866299d2455f41360202b7a3b48503a5e::U+006D,U+0300:[m=0+1422|gravecmb=0@0,96+283]
+/System/Library/Fonts/Helvetica.ttc@8a928f9866299d2455f41360202b7a3b48503a5e::U+006D,U+0300:[m=0+1706|gravecmb=0@-284,10+0]
 
/System/Library/Fonts/LucidaGrande.ttc@63ba1b1de4709bd832ca76bd62368dd99fc34269::U+006D,U+0300:[mgrave=0+1912]
 
/System/Library/Fonts/Times.ttc@896098b6979306ad84355025459f7c68b029139c::U+0066,U+0069:[fi=0+1139]
 /Library/Fonts/Khmer 
MN.ttc@782ba6cf3fca0512ab348dfe08345a2d5dc5bf2c::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]
commit cbc541b426f01717641f1f3529a7c9703aec7a28
Author: Ebrahim Byagowi 
Date:   Sun Nov 25 12:50:30 2018 +0330

[aat] Add m grave test (#1412)

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 78b5112e..06bdacba 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,4 +1,6 @@
 # 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]
@@ -12,6 +14,8 @@
 
/System/Library/Fonts/SFNSDisplay.ttf@92787c30716672737e9059bc367c15d04fbc1ced::U+0056,U+0041,U+0056,U+0041:[gid265=0+1227|gid4=1@-65,0+1162|gid265=2@-65,0+1162|gid4=3@-65,0+1227]
 
 # 10.13.6
+/System/Library/Fonts/Helvetica.ttc@8a928f9866299d2455f41360202b7a3b48503a5e::U+006D,U+0300:[m=0+1422|gravecmb=0@0,96+283]
+/System/Library/Fonts/LucidaGrande.ttc@63ba1b1de4709bd832ca76bd62368dd99fc34269::U+006D,U+0300:[mgrave=0+1912]
 
/System/Library/Fonts/Times.ttc@896098b6979306ad84355025459f7c68b029139c::U+0066,U+0069:[fi=0+1139]
 /Library/Fonts/Khmer 
MN.ttc@782ba6cf3fca0512ab348dfe08345a2d5dc5bf2c::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]
 # The following is broken https://github.com/harfbuzz/harfbuzz/issues/1410
commit fa26ad0f48462063f2160a43cb62b018bb21e251
Author: Ebrahim Byagowi 
Date:   Sun Nov 25 11:25:17 2018 +0330

[aat] Fix macos expectation

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 4d76d84e..78b5112e 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,7 +1,7 @@
 # 10.12.6
 
/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+1074|tgc_ka=2@-74,0+1518|tgm_u=2+1205|tgc_ka=4+1592|tgm_pulli=4+503|tgc_ka=6+1592|tgc_pa=7+1370|tgm_pulli=7+503|tgc_pa=9+1370|tgc_tta=10+1566|tgm_pulli=10+503|tgc_tta=12+1566|tgm_u=12+1205]
+/Library/Fonts/Tamil 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-25 Thread Behdad Esfahbod
 src/hb-machinery.hh |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 6ee401049d475b2a2d9c859e6dbf8ff2750a1609
Author: Behdad Esfahbod 
Date:   Sun Nov 25 00:21:13 2018 -0500

Simplify sanitize set_object() / fix bots

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 56e279e6..3717c4d3 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -259,17 +259,10 @@ struct hb_sanitize_context_t :
 
   inline void set_max_ops (int max_ops_) { max_ops = max_ops_; }
 
-  struct dummy_get_size_t
-  { inline unsigned int get_size (void) const { return 0; } };
-
-  template 
-  inline void set_object (const T *obj = nullptr)
+  template 
+  inline void set_object (const T *obj)
   {
-this->start = this->blob->data;
-this->end = this->start + this->blob->length;
-assert (this->start <= this->end); /* Must not overflow. */
-
-if (!obj) return;
+reset_object ();
 
 const char *obj_start = (const char *) obj;
 const char *obj_end = (const char *) obj + obj->get_size ();
@@ -284,9 +277,16 @@ struct hb_sanitize_context_t :
 }
   }
 
+  inline void reset_object (void)
+  {
+this->start = this->blob->data;
+this->end = this->start + this->blob->length;
+assert (this->start <= this->end); /* Must not overflow. */
+  }
+
   inline void start_processing (void)
   {
-set_object ();
+reset_object ();
 this->max_ops = MAX ((unsigned int) (this->end - this->start) * 
HB_SANITIZE_MAX_OPS_FACTOR,
 (unsigned) HB_SANITIZE_MAX_OPS_MIN);
 this->edit_count = 0;
@@ -482,7 +482,7 @@ struct hb_sanitize_context_t :
 
 struct hb_sanitize_with_object_t
 {
-  template 
+  template 
   inline hb_sanitize_with_object_t (hb_sanitize_context_t *c,
const T& obj) : c (c)
   {
@@ -490,7 +490,7 @@ struct hb_sanitize_with_object_t
   }
   inline ~hb_sanitize_with_object_t (void)
   {
-c->set_object ();
+c->reset_object ();
   }
 
   private:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-24 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |   19 ++---
 src/hb-aat-layout-morx-table.hh |   18 
 src/hb-machinery.hh |   43 +++-
 3 files changed, 46 insertions(+), 34 deletions(-)

New commits:
commit c5a6b355e165e90d8d90454ceeca7b100282945f
Author: Behdad Esfahbod 
Date:   Sat Nov 24 23:49:23 2018 -0500

[kerx] Port to hb_sanitize_with_object_t

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 33f626c6..8dc74991 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -926,13 +926,11 @@ struct KerxTable
   if (reverse)
c->buffer->reverse ();
 
-  /* See comment in sanitize() for conditional here. */
-  if (i < count - 1)
-   c->sanitizer.set_object (st);
-  else
-   c->sanitizer.set_object ();
-
-  ret |= st->dispatch (c);
+  {
+   /* See comment in sanitize() for conditional here. */
+   hb_sanitize_with_object_t with (>sanitizer, i < count - 1 ? st : 
(const SubTable *) nullptr);
+   ret |= st->dispatch (c);
+  }
 
   if (reverse)
c->buffer->reverse ();
@@ -943,7 +941,6 @@ struct KerxTable
   st =  (*st);
   c->set_lookup_index (c->lookup_index + 1);
 }
-c->sanitizer.set_object ();
 
 return ret;
   }
@@ -962,7 +959,6 @@ struct KerxTable
 unsigned int count = thiz()->tableCount;
 for (unsigned int i = 0; i < count; i++)
 {
-  c->set_object ();
   if (unlikely (!st->u.header.sanitize (c)))
return_trace (false);
   /* OpenType kern table has 2-byte subtable lengths.  That's limiting.
@@ -972,14 +968,13 @@ struct KerxTable
* is simply ignored.  Which makes sense.  It's only needed if you
* have multiple subtables.  To handle such fonts, we just ignore
* the length for the last subtable. */
-  if (i < count - 1)
-   c->set_object (st);
+  hb_sanitize_with_object_t with (c, i < count - 1 ? st : (const SubTable 
*) nullptr);
 
   if (unlikely (!st->sanitize (c)))
return_trace (false);
+
   st =  (*st);
 }
-c->set_object ();
 
 return_trace (true);
   }
commit c405ed0509afaa7c3846e8e461bedfbceb0cd937
Author: Behdad Esfahbod 
Date:   Sat Nov 24 23:46:15 2018 -0500

[morx] Port to hb_sanitize_with_object_t

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index bc7c3c37..15332d0f 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -911,6 +911,13 @@ struct ChainSubtable
 }
   }
 
+  inline bool apply (hb_aat_apply_context_t *c) const
+  {
+TRACE_APPLY (this);
+hb_sanitize_with_object_t with (>sanitizer, this);
+return_trace (dispatch (c));
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
@@ -919,6 +926,7 @@ struct ChainSubtable
!c->check_range (this, length))
   return_trace (false);
 
+hb_sanitize_with_object_t with (c, this);
 return_trace (dispatch (c));
   }
 
@@ -1026,9 +1034,7 @@ struct Chain
   if (reverse)
 c->buffer->reverse ();
 
-  c->sanitizer.set_object (subtable);
-
-  subtable->dispatch (c);
+  subtable->apply (c);
 
   if (reverse)
 c->buffer->reverse ();
@@ -1041,7 +1047,6 @@ struct Chain
   subtable =  > (*subtable);
   c->set_lookup_index (c->lookup_index + 1);
 }
-c->sanitizer.set_object ();
   }
 
   inline unsigned int get_size (void) const { return length; }
@@ -1061,15 +1066,10 @@ struct Chain
 unsigned int count = subtableCount;
 for (unsigned int i = 0; i < count; i++)
 {
-  c->set_object ();
-  if (unlikely (!c->check_struct (subtable)))
-   return_trace (false);
-  c->set_object (subtable);
   if (!subtable->sanitize (c))
return_trace (false);
   subtable =  > (*subtable);
 }
-c->set_object ();
 
 return_trace (true);
   }
commit 1e8994221fb5cfdb1902d5249c7a75cde6d6e3c8
Author: Behdad Esfahbod 
Date:   Sat Nov 24 23:38:06 2018 -0500

Add hb_sanitize_with_object_t

Context manager.

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 7457a099..56e279e6 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -480,6 +480,23 @@ struct hb_sanitize_context_t :
   bool  num_glyphs_set;
 };
 
+struct hb_sanitize_with_object_t
+{
+  template 
+  inline hb_sanitize_with_object_t (hb_sanitize_context_t *c,
+   const T& obj) : c (c)
+  {
+c->set_object (obj);
+  }
+  inline ~hb_sanitize_with_object_t (void)
+  {
+c->set_object ();
+  }
+
+  private:
+  hb_sanitize_context_t *c;
+};
+
 
 /*
  * Serialize
commit b3c5affc05a3c7bbcfbd98521703d3d3447fcd7d
Author: Behdad Esfahbod 
Date:   Sat Nov 24 23:34:34 2018 -0500

Simplify sanitize set_object()

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index fbeb35b0..33f626c6 100644

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

2018-11-24 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh  |6 +
 src/hb-aat-layout-kerx-table.hh  |   21 +
 src/hb-aat-layout-lcar-table.hh  |6 -
 src/hb-aat-layout-morx-table.hh  |8 ++
 src/hb-debug.hh  |   16 ++--
 src/hb-dsalgs.hh |   44 +++
 src/hb-machinery.hh  |   25 ++
 src/hb-open-type.hh  |   70 ++-
 src/hb-ot-layout-gdef-table.hh   |   14 ++-
 src/hb-ot-math-table.hh  |   10 +-
 test/shaping/data/aots/fonts/classdef1_font1.otf |binary
 test/shaping/data/aots/fonts/classdef1_font2.otf |binary
 test/shaping/data/aots/tests/classdef1_empty.tests   |2 
 test/shaping/data/in-house/Makefile.sources  |3 
 test/shaping/data/in-house/tests/macos-10.12.6.tests |   11 --
 test/shaping/data/in-house/tests/macos-10.13.6.tests |   13 ---
 test/shaping/data/in-house/tests/macos.tests |   26 +++
 test/shaping/run-tests.py|4 -
 18 files changed, 195 insertions(+), 84 deletions(-)

New commits:
commit 3d3097269995aa227b4b198d4da2baf942b65c66
Author: Behdad Esfahbod 
Date:   Sat Nov 24 23:12:28 2018 -0500

[aat] Skip terminator in VarSizedBinSearchArray<>

Fixes shaping with Apple Chancery on 10.13 again.  In that font,
there was a terminator segment, that was tripping off sanitize().

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 2c09a796..3ee96bc9 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -76,6 +76,8 @@ struct LookupFormat0
 template 
 struct LookupSegmentSingle
 {
+  enum { TerminationWordCount = 2 };
+
   inline int cmp (hb_codepoint_t g) const {
 return g < first ? -1 : g <= last ? 0 : +1 ;
   }
@@ -134,6 +136,8 @@ struct LookupFormat2
 template 
 struct LookupSegmentArray
 {
+  enum { TerminationWordCount = 2 };
+
   inline const T* get_value (hb_codepoint_t glyph_id, const void *base) const
   {
 return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - 
first] : nullptr;
@@ -204,6 +208,8 @@ struct LookupFormat4
 template 
 struct LookupSingle
 {
+  enum { TerminationWordCount = 1 };
+
   inline int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 8970ec78..9b412dbc 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -874,6 +874,22 @@ struct VarSizedBinSearchArrayOf
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type);
 
+  inline bool last_is_terminator (void) const
+  {
+if (unlikely (!header.nUnits)) return false;
+
+/* Gah.
+ *
+ * "The number of termination values that need to be included is 
table-specific.
+ * The value that indicates binary search termination is 0x." */
+const HBUINT16 *words =  (, (header.nUnits 
- 1) * header.unitSize);
+unsigned int count = Type::TerminationWordCount;
+for (unsigned int i = 0; i < count; i++)
+  if (words[i] != 0xu)
+return false;
+return true;
+  }
+
   inline const Type& operator [] (unsigned int i) const
   {
 if (unlikely (i >= get_length ())) return Null (Type);
@@ -884,7 +900,10 @@ struct VarSizedBinSearchArrayOf
 if (unlikely (i >= get_length ())) return Crap (Type);
 return StructAtOffset (, i * header.unitSize);
   }
-  inline unsigned int get_length (void) const { return header.nUnits; }
+  inline unsigned int get_length (void) const
+  {
+return header.nUnits - last_is_terminator ();
+  }
   inline unsigned int get_size (void) const
   { return header.static_size + header.nUnits * header.unitSize; }
 
commit 4202a3cde3b6065124feb7f4c662563de1e08126
Author: Behdad Esfahbod 
Date:   Sat Nov 24 22:48:34 2018 -0500

Minor

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 83edc773..8970ec78 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -443,8 +443,17 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf
 {
   inline const Type& operator [] (unsigned int i) const
   {
-return this+this->arrayZ[i];
+const OffsetTo *p = >arrayZ[i];
+if (unlikely (p < this->arrayZ)) return Null (Type); /* Overflowed. */
+return this+*p;
   }
+  inline Type& operator [] (unsigned int i)
+  {
+const OffsetTo *p = >arrayZ[i];
+if (unlikely (p < this->arrayZ)) return Crap (Type); /* Overflowed. */
+return this+*p;
+  }
+
 
   inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
   {
@@ -867,13 +876,15 @@ struct VarSizedBinSearchArrayOf
 
   inline const Type& operator [] (unsigned int i) const
   {
-if (unlikely (i >= header.nUnits)) return Null (Type);
+if (unlikely (i >= get_length ())) return Null (Type);
 return 

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

2018-11-24 Thread Behdad Esfahbod
 .circleci/config.yml |   16 ++--
 src/hb-aat-layout-kerx-table.hh  |   21 ---
 src/hb-aat-layout-morx-table.hh  |8 --
 src/hb-machinery.hh  |   25 ---
 test/shaping/data/in-house/Makefile.sources  |3 +-
 test/shaping/data/in-house/tests/macos-10.12.6.tests |2 -
 test/shaping/data/in-house/tests/macos-10.13.6.tests |   13 +
 7 files changed, 30 insertions(+), 58 deletions(-)

New commits:
commit bbdb6edb3e1cea4c5b7076c4f6b3e6998ae36dae
Author: Behdad Esfahbod 
Date:   Sat Nov 24 17:15:38 2018 -0500

[sanitize] Remove now-unused set_object() machinery

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index edef5405..9ca247d9 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -259,34 +259,11 @@ struct hb_sanitize_context_t :
 
   inline void set_max_ops (int max_ops_) { max_ops = max_ops_; }
 
-  template 
-  inline void set_object (const T& obj)
-  {
-reset_object ();
-
-const char *obj_start = (const char *) 
-const char *obj_end = (const char *)  + obj.get_size ();
-assert (obj_start <= obj_end); /* Must not overflow. */
-
-if (unlikely (obj_end < this->start || this->end < obj_start))
-  this->start = this->end = nullptr;
-else
-{
-  this->start = MAX (this->start, obj_start);
-  this->end   = MIN (this->end  , obj_end  );
-}
-  }
-
-  inline void reset_object (void)
+  inline void start_processing (void)
   {
 this->start = this->blob->data;
 this->end = this->start + this->blob->length;
 assert (this->start <= this->end); /* Must not overflow. */
-  }
-
-  inline void start_processing (void)
-  {
-reset_object ();
 this->max_ops = MAX ((unsigned int) (this->end - this->start) * 
HB_SANITIZE_MAX_OPS_FACTOR,
 (unsigned) HB_SANITIZE_MAX_OPS_MIN);
 this->edit_count = 0;
commit 15905a2a2998f7ddd964f920a4828602235d6b00
Author: Behdad Esfahbod 
Date:   Sat Nov 24 17:14:39 2018 -0500

[aat.kerx] Remove kerx subtable boundary enforcement

Have not encountered fonts needing this, but same reasoning as
for morx (see previos commit.)

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index fbeb35b0..b5c1e1d1 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -926,12 +926,6 @@ struct KerxTable
   if (reverse)
c->buffer->reverse ();
 
-  /* See comment in sanitize() for conditional here. */
-  if (i < count - 1)
-   c->sanitizer.set_object (*st);
-  else
-   c->sanitizer.reset_object ();
-
   ret |= st->dispatch (c);
 
   if (reverse)
@@ -943,7 +937,6 @@ struct KerxTable
   st =  (*st);
   c->set_lookup_index (c->lookup_index + 1);
 }
-c->sanitizer.reset_object ();
 
 return ret;
   }
@@ -962,24 +955,10 @@ struct KerxTable
 unsigned int count = thiz()->tableCount;
 for (unsigned int i = 0; i < count; i++)
 {
-  c->reset_object ();
-  if (unlikely (!st->u.header.sanitize (c)))
-   return_trace (false);
-  /* OpenType kern table has 2-byte subtable lengths.  That's limiting.
-   * MS implementation also only supports one subtable, of format 0,
-   * anyway.  Certain versions of some fonts, like Calibry, contain
-   * kern subtable that exceeds 64kb.  Looks like, the subtable length
-   * is simply ignored.  Which makes sense.  It's only needed if you
-   * have multiple subtables.  To handle such fonts, we just ignore
-   * the length for the last subtable. */
-  if (i < count - 1)
-   c->set_object (*st);
-
   if (unlikely (!st->sanitize (c)))
return_trace (false);
   st =  (*st);
 }
-c->reset_object ();
 
 return_trace (true);
   }
commit ae8ed58a6e53441d9ccbf67afd8a00b815cde99e
Author: Behdad Esfahbod 
Date:   Sat Nov 24 17:11:09 2018 -0500

[aat.morx] Remove set_object() business

With OS X 10.13 Apple Chancery fails to ligate if we limit each morx
sub-chain to its declared length.  Perhaps their newer compiler does
object-sharing across sub-chains.  Anyway, since that's a valid, if
unspecified, way to compile tables, remove enforcement.

Probably do the same with kern/kerx.

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index dc406f59..77abf457 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -1026,8 +1026,6 @@ struct Chain
   if (reverse)
 c->buffer->reverse ();
 
-  c->sanitizer.set_object (*subtable);
-
   subtable->dispatch (c);
 
   if (reverse)
@@ -1041,7 +1039,6 @@ struct Chain
   subtable =  > (*subtable);
   c->set_lookup_index (c->lookup_index + 1);
 }
-c->sanitizer.reset_object ();
   }
 
   inline unsigned int get_size (void) const { return length; }
@@ 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-24 Thread Behdad Esfahbod
 test/shaping/data/in-house/tests/macos.tests |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b7f7950e8fc4b9e229b466ac2453d57b8da9a5a6
Author: Behdad Esfahbod 
Date:   Sat Nov 24 15:56:17 2018 -0500

[aat] Add test for recent regression

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 4788f256..53268fba 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,5 +1,6 @@
 
 # 10.12:
+/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+1074|tgc_ka=2@-74,0+1518|tgm_u=2+1205|tgc_ka=4+1592|tgm_pulli=4+503|tgc_ka=6+1592|tgc_pa=7+1370|tgm_pulli=7+503|tgc_pa=9+1370|tgc_tta=10+1566|tgm_pulli=10+503|tgc_tta=12+1566|tgm_u=12+1205]
 
/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]
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-24 Thread Behdad Esfahbod
 test/shaping/data/in-house/Makefile.sources  |2 
 test/shaping/data/in-house/tests/macos.tests |2 
 test/shaping/run-tests.py|   61 ---
 3 files changed, 41 insertions(+), 24 deletions(-)

New commits:
commit ea9512e61a7ed333b810918e74cce4c8bd2291b9
Author: Behdad Esfahbod 
Date:   Sat Nov 24 15:49:33 2018 -0500

[tests] Redo test runner logging a  bit

diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index 4c7fee1e..959d08f9 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -27,7 +27,7 @@ process = subprocess.Popen ([hb_shape, '--batch'],
stdout=subprocess.PIPE,
stderr=sys.stdout)
 
-ran_once = False
+passes = 0
 fails = 0
 skips = 0
 
@@ -69,13 +69,13 @@ for filename in args:
with open (fontfile, 'rb') as ff:
actual_hash = hashlib.sha1 
(ff.read()).hexdigest ().strip ()
if actual_hash != expected_hash:
-   print ('different versions of 
the font is found, expected %s hash was %s but got %s, skip' %
+   print ('different version of %s 
found; Expected hash %s, got %s; skipping.' %
   (fontfile, 
expected_hash, actual_hash))
-   skips = skips + 1
+   skips += 1
continue
except:
-   print ('%s is not found, skip.' % fontfile)
-   skips = skips + 1
+   print ('%s not found, skip.' % fontfile)
+   skips += 1
continue
else:
cwd = os.path.dirname(filename)
@@ -108,12 +108,12 @@ for filename in args:
fontfile] + extra_options + ["--unicodes",
unicodes] + (options.split (' ') if options else []))
 
-   ran_once = True
-
if glyphs1 != glyphs2 and glyphs_expected != '*':
print ("FT funcs: " + glyphs1) # file=sys.stderr
print ("OT funcs: " + glyphs2) # file=sys.stderr
-   fails = fails + 1
+   fails += 1
+   else:
+   passes += 1
 
if reference:
print (":".join ([fontfile, options, unicodes, 
glyphs1]))
@@ -122,18 +122,20 @@ for filename in args:
if glyphs1.strip() != glyphs_expected and glyphs_expected != 
'*':
print ("Actual:   " + glyphs1) # file=sys.stderr
print ("Expected: " + glyphs_expected) # file=sys.stderr
-   fails = fails + 1
+   fails += 1
+   else:
+   passes += 1
 
-if fails != 0 or skips != 0:
-   if not reference:
-   print ("%d tests are failed and %d tests are skipped." % 
(fails, skips)) # file=sys.stderr
-   if fails != 0:
-   sys.exit (1)
-   sys.exit (77)
-else:
-   if not ran_once:
-   if not reference:
-   print ("No tests ran.")
-   sys.exit (77)
-   elif not reference:
+if not reference:
+   print ("%d tests passed; %d failed; %d skipped." % (passes, fails, 
skips)) # file=sys.stderr
+   if not (fails + passes):
+   print ("No tests ran.")
+   elif not (fails + skips):
print ("All tests passed.")
+
+if fails:
+   sys.exit (1)
+elif passes:
+   sys.exit (0)
+else:
+   sys.exit (77)
commit 5020affc3877d39377506245ecaf01a659eef82a
Author: Behdad Esfahbod 
Date:   Sat Nov 24 15:42:11 2018 -0500

[tests] Minor

diff --git a/test/shaping/data/in-house/tests/macos.tests 
b/test/shaping/data/in-house/tests/macos.tests
index 6841ef93..4788f256 100644
--- a/test/shaping/data/in-house/tests/macos.tests
+++ b/test/shaping/data/in-house/tests/macos.tests
@@ -1,3 +1,5 @@
+
+# 10.12:
 /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+1074|tgc_ka=2@-74,0+1518|tgm_u=2+1205|tgc_ka=4+1592|tgm_pulli=4+503|tgc_ka=6+1592|tgc_pa=7+1370|tgm_pulli=7+503|tgc_pa=9+1370|tgc_tta=10+1566|tgm_pulli=10+503|tgc_tta=12+1566|tgm_u=12+1205]
 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-24 Thread Behdad Esfahbod
 src/hb-ot-color-colr-table.hh |   16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

New commits:
commit ae96c98dfaef3a789227ffecd40b92518dface8a
Author: Behdad Esfahbod 
Date:   Sat Nov 24 10:25:10 2018 -0500

[color] Use SortedUnsizedArrayOf<>

diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh
index fa40223b..84c34332 100644
--- a/src/hb-ot-color-colr-table.hh
+++ b/src/hb-ot-color-colr-table.hh
@@ -66,13 +66,6 @@ struct BaseGlyphRecord
   inline int cmp (hb_codepoint_t g) const
   { return g < glyphId ? -1 : g > glyphId ? 1 : 0; }
 
-  static int cmp (const void *pa, const void *pb)
-  {
-const hb_codepoint_t *a = (const hb_codepoint_t *) pa;
-const BaseGlyphRecord *b = (const BaseGlyphRecord *) pb;
-return b->cmp (*a);
-  }
-
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
 TRACE_SANITIZE (this);
@@ -103,12 +96,7 @@ struct COLR
unsigned int*count, /* IN/OUT.  
May be NULL. */
hb_ot_color_layer_t *layers /* OUT. 
May be NULL. */) const
   {
-const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (,
- 
&(this+baseGlyphsZ),
- numBaseGlyphs,
- sizeof 
(BaseGlyphRecord),
- 
BaseGlyphRecord::cmp);
-const BaseGlyphRecord  = rec ? *rec : Null (BaseGlyphRecord);
+const BaseGlyphRecord  = (this+baseGlyphsZ).bsearch (numBaseGlyphs, 
glyph);
 
 hb_array_t all_layers ((this+layersZ).arrayZ, 
numLayers);
 hb_array_t glyph_layers = all_layers.sub_array 
(record.firstLayerIdx,
@@ -137,7 +125,7 @@ struct COLR
   protected:
   HBUINT16 version;/* Table version number (starts at 0). */
   HBUINT16 numBaseGlyphs;  /* Number of Base Glyph Records. */
-  LOffsetTo, false>
+  LOffsetTo, false>
baseGlyphsZ;/* Offset to Base Glyph records. */
   LOffsetTo, false>
layersZ;/* Offset to Layer Records. */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-24 Thread Behdad Esfahbod
 src/hb-aat-layout-trak-table.hh
|1 
 src/hb-dsalgs.hh   
|   29 --
 src/hb-open-file.hh
|9 ---
 src/hb-open-type.hh
|   28 +
 src/hb-ot-layout-common.hh 
|   10 ---
 src/hb-set.hh  
|6 +-
 src/hb-vector.hh   
|6 +-
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5634620935110656
 |binary
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5716208469409792
 |binary
 9 files changed, 51 insertions(+), 38 deletions(-)

New commits:
commit 4a3b20738fca3231e5d9a36adba333b5bce05f4a
Author: Behdad Esfahbod 
Date:   Sat Nov 24 10:17:59 2018 -0500

[trak] Coment

diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index 91c0f456..5474d1d1 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -133,7 +133,6 @@ struct TrackData
 if (!sizes) return 0.;
 if (sizes == 1) return trackTableEntry->get_value (base, 0, sizes);
 
-/* TODO bfind() */
 hb_array_t size_table ((base+sizeTable).arrayZ, sizes);
 unsigned int size_index;
 for (size_index = 0; size_index < sizes - 1; size_index++)
commit 918b1ee54d43eb493c9226bff7677ed8ec07934b
Author: Behdad Esfahbod 
Date:   Sat Nov 24 10:09:17 2018 -0500

[arrays] Add not_found to reference bsearch as well

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 1c810e71..2e3db31d 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -469,11 +469,11 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf
   { return hb_sorted_array (this->arrayZ, len); }
 
   template 
-  inline Type  (unsigned int len, const T )
-  { return *as_array (len).bsearch (x,  (Type)); }
+  inline Type  (unsigned int len, const T , Type _found = Crap 
(Type))
+  { return *as_array (len).bsearch (x, _found); }
   template 
-  inline const Type  (unsigned int len, const T ) const
-  { return *as_array (len).bsearch (x,  (Type)); }
+  inline const Type  (unsigned int len, const T , const Type 
_found = Null (Type)) const
+  { return *as_array (len).bsearch (x, _found); }
   template 
   inline bool bfind (unsigned int len, const T , unsigned int *i = nullptr,
 hb_bfind_not_found_t not_found = 
HB_BFIND_NOT_FOUND_DONT_STORE,
@@ -778,11 +778,11 @@ struct SortedArrayOf : ArrayOf
   { return hb_sorted_array (this->arrayZ, this->len); }
 
   template 
-  inline Type  (const T )
-  { return *as_array ().bsearch (x,  (Type)); }
+  inline Type  (const T , Type _found = Crap (Type))
+  { return *as_array ().bsearch (x, _found); }
   template 
-  inline const Type  (const T ) const
-  { return *as_array ().bsearch (x,  (Type)); }
+  inline const Type  (const T , const Type _found = Null (Type)) 
const
+  { return *as_array ().bsearch (x, _found); }
   template 
   inline bool bfind (const T , unsigned int *i = nullptr,
 hb_bfind_not_found_t not_found = 
HB_BFIND_NOT_FOUND_DONT_STORE,
commit d77a098b735cf14aa601feab5bdb9f4e474c794f
Author: Behdad Esfahbod 
Date:   Sat Nov 24 10:06:13 2018 -0500

[arrays] Improve bfind() interface

Much more useful now. :)

diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index cc1a1d42..1680bf91 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -650,6 +650,13 @@ template 
 inline hb_array_t hb_array (T *array, unsigned int len)
 { return hb_array_t (array, len); }
 
+enum hb_bfind_not_found_t
+{
+  HB_BFIND_NOT_FOUND_DONT_STORE,
+  HB_BFIND_NOT_FOUND_STORE,
+  HB_BFIND_NOT_FOUND_STORE_CLOSEST,
+};
+
 template 
 struct hb_sorted_array_t : hb_array_t
 {
@@ -669,7 +676,9 @@ struct hb_sorted_array_t : hb_array_t
 return bfind (x, ) ? >arrayZ[i] : not_found;
   }
   template 
-  inline bool bfind (const T , unsigned int *i = nullptr) const
+  inline bool bfind (const T , unsigned int *i = nullptr,
+hb_bfind_not_found_t not_found = 
HB_BFIND_NOT_FOUND_DONT_STORE,
+unsigned int to_store = (unsigned int) -1) const
   {
 int min = 0, max = (int) this->len - 1;
 const Type *array = this->arrayZ;
@@ -690,9 +699,21 @@ struct hb_sorted_array_t : hb_array_t
 }
 if (i)
 {
-  if (max < 0 || (max < (int) this->len && array[max].cmp (x) > 0))
-   max++;
-  *i = max;
+  switch (not_found)
+  {
+   case HB_BFIND_NOT_FOUND_DONT_STORE:
+ break;
+
+   case HB_BFIND_NOT_FOUND_STORE:
+ *i = to_store;
+ break;
+
+   case HB_BFIND_NOT_FOUND_STORE_CLOSEST:
+ if (max < 0 || (max < (int) this->len && array[max].cmp (x) > 0))
+   max++;
+  

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

2018-11-23 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |   16 ++-
 src/hb-open-file.hh |   12 +++
 src/hb-open-type.hh |   42 +++-
 src/hb-ot-cmap-table.hh |   30 +++-
 src/hb-ot-color-svg-table.hh|3 --
 src/hb-ot-layout-common.hh  |   40 ++
 src/hb-ot-vorg-table.hh |9 +++-
 src/hb-vector.hh|   14 -
 8 files changed, 85 insertions(+), 81 deletions(-)

New commits:
commit 30cb45b3eaacda15cc45435815cae3fd50e87557
Author: Behdad Esfahbod 
Date:   Sat Nov 24 00:35:31 2018 -0500

Change ArrayOf.bsearch() return semantics

Towards consolidating all array bsearch/...

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index c60f29a6..521c4c72 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -49,7 +49,7 @@ kerxTupleKern (int value,
   const void *base,
   hb_aat_apply_context_t *c)
 {
-  if (likely (!tupleCount)) return value;
+  if (likely (!tupleCount || !c)) return value;
 
   unsigned int offset = value;
   const FWORD *pv =  (base, offset);
@@ -93,21 +93,11 @@ struct KernPair
 template 
 struct KerxSubTableFormat0
 {
-  inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
-  {
-hb_glyph_pair_t pair = {left, right};
-int i = pairs.bsearch (pair);
-if (i == -1) return 0;
-return pairs[i].get_kerning ();
-  }
-
   inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
- hb_aat_apply_context_t *c) const
+ hb_aat_apply_context_t *c = nullptr) const
   {
 hb_glyph_pair_t pair = {left, right};
-int i = pairs.bsearch (pair);
-if (i == -1) return 0;
-int v = pairs[i].get_kerning ();
+int v = pairs.bsearch (pair).get_kerning ();
 return kerxTupleKern (v, header.tuple_count (), this, c);
   }
 
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index cd5f9dbc..d3ecc606 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -111,10 +111,14 @@ typedef struct OffsetTable
   {
 Tag t;
 t.set (tag);
-int i = tables.bsearch (t);
-if (table_index)
-  *table_index = i == -1 ? (unsigned) Index::NOT_FOUND_INDEX : (unsigned) 
i;
-return i != -1;
+unsigned int i;
+if (tables.bfind (t, ))
+{
+  if (table_index) *table_index = i;
+  return true;
+}
+if (table_index) *table_index = (unsigned) Index::NOT_FOUND_INDEX;
+return false;
   }
   inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
   {
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 1c7b738b..f255ea12 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -740,21 +740,45 @@ struct ArrayOfM1
 template 
 struct SortedArrayOf : ArrayOf
 {
-  template 
-  inline int bsearch (const SearchType ) const
+  template 
+  inline Type  (const T )
+  {
+unsigned int i;
+return bfind (x, ) ? this->arrayZ[i] : Crap(Type);
+  }
+  template 
+  inline const Type  (const T ) const
+  {
+unsigned int i;
+return bfind (x, ) ? this->arrayZ[i] : Null(Type);
+  }
+  template 
+  inline bool bfind (const T , unsigned int *i = nullptr) const
   {
-/* Hand-coded bsearch here since this is in the hot inner loop. */
-const Type *arr = this->arrayZ;
 int min = 0, max = (int) this->len - 1;
+const Type *array = this->arrayZ;
 while (min <= max)
 {
   int mid = ((unsigned int) min + (unsigned int) max) / 2;
-  int c = arr[mid].cmp (x);
-  if (c < 0) max = mid - 1;
-  else if (c > 0) min = mid + 1;
-  else return mid;
+  int c = array[mid].cmp (x);
+  if (c < 0)
+max = mid - 1;
+  else if (c > 0)
+min = mid + 1;
+  else
+  {
+   if (i)
+ *i = mid;
+   return true;
+  }
 }
-return -1;
+if (i)
+{
+  if (max < 0 || (max < (int) this->len && array[max].cmp (x) > 0))
+   max++;
+  *i = max;
+}
+return false;
   }
 };
 
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 70373ee8..cdc610be 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -468,10 +468,7 @@ struct CmapSubtableLongSegmented
 
   inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
   {
-int i = groups.bsearch (codepoint);
-if (i == -1)
-  return false;
-hb_codepoint_t gid = T::group_get_glyph (groups[i], codepoint);
+hb_codepoint_t gid = T::group_get_glyph (groups.bsearch (codepoint), 
codepoint);
 if (!gid)
   return false;
 *glyph = gid;
@@ -518,7 +515,8 @@ struct CmapSubtableFormat12 : 
CmapSubtableLongSegmented
 {
   static inline hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup 
,
hb_codepoint_t u)
-  { return group.glyphID + (u - 

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

2018-11-23 Thread Behdad Esfahbod
 src/hb-aat-layout-common.hh |6 --
 src/hb-atomic.hh|2 +-
 src/hb-blob.hh  |4 ++--
 src/hb-common.cc|2 +-
 src/hb-dsalgs.hh|2 ++
 src/hb-ft.cc|2 +-
 src/hb-null.hh  |   30 +-
 src/hb-open-file.hh |4 +---
 src/hb-open-type.hh |7 +++
 src/hb-ot-cmap-table.hh |1 +
 src/hb-static.cc|4 +++-
 src/hb-vector.hh|   11 ---
 src/hb.hh   |3 +++
 13 files changed, 59 insertions(+), 19 deletions(-)

New commits:
commit bb2a2065080a3099eb0dc82d1df0891ad2601316
Author: Behdad Esfahbod 
Date:   Sat Nov 24 00:31:40 2018 -0500

Assert that item-type of arrays have static size

diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index da8aad01..c133a532 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -562,6 +562,8 @@ struct hb_bytes_t
 template 
 struct hb_array_t
 {
+  static_assert ((bool) (unsigned) hb_static_size (Type), "");
+
   inline hb_array_t (void) : arrayZ (nullptr), len (0) {}
   inline hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len 
(len_) {}
 
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 17bc9c5b..1c7b738b 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -345,6 +345,8 @@ static inline Type& operator + (Base , OffsetTo
 template 
 struct UnsizedArrayOf
 {
+  static_assert ((bool) (unsigned) hb_static_size (Type), "");
+
   enum { item_size = Type::static_size };
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
@@ -449,6 +451,8 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf
 template 
 struct ArrayOf
 {
+  static_assert ((bool) (unsigned) hb_static_size (Type), "");
+
   enum { item_size = Type::static_size };
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
diff --git a/src/hb-vector.hh b/src/hb-vector.hh
index 926f0054..c1d7f946 100644
--- a/src/hb-vector.hh
+++ b/src/hb-vector.hh
@@ -34,6 +34,8 @@
 template 
 struct hb_vector_t
 {
+  static_assert ((bool) (unsigned) hb_static_size (Type), "");
+
   typedef Type ItemType;
   enum { item_size = sizeof (Type) };
 
commit 690d9eb83d3421b397b0cb824cd768d6d73cbf12
Author: Behdad Esfahbod 
Date:   Sat Nov 24 00:29:22 2018 -0500

[vector] Rename

diff --git a/src/hb-vector.hh b/src/hb-vector.hh
index c1f680ed..926f0054 100644
--- a/src/hb-vector.hh
+++ b/src/hb-vector.hh
@@ -31,13 +31,13 @@
 #include "hb.hh"
 
 
-template 
+template 
 struct hb_vector_t
 {
   typedef Type ItemType;
   enum { item_size = sizeof (Type) };
 
-  HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, StaticSize);
+  HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, PreallocedCount);
   inline hb_vector_t (void) { init (); }
   inline ~hb_vector_t (void) { fini (); }
 
@@ -45,7 +45,7 @@ struct hb_vector_t
   private:
   unsigned int allocated; /* == 0 means allocation failed. */
   Type *arrayZ_;
-  Type static_array[StaticSize];
+  Type static_array[PreallocedCount];
   public:
 
   void init (void)
commit ba38378fd4374f3d44bdc9aa0de902401b60b13d
Author: Behdad Esfahbod 
Date:   Sat Nov 24 00:27:57 2018 -0500

[aat] Minor

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 7340996e..2c09a796 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -436,8 +436,10 @@ struct Entry
  * which ensures that data has a simple sanitize(). To be determined
  * if I need to remove that as well.
  *
- * XXX Because we are a template, our DEFINE_SIZE_STATIC assertion
- * wouldn't be checked. */
+ * HOWEVER! Because we are a template, our DEFINE_SIZE_STATIC
+ * assertion wouldn't be checked, hence the line below. */
+static_assert (T::static_size, "");
+
 return_trace (c->check_struct (this));
   }
 
commit 39b9d63b014380d421cc9b94a49dd411c7a5aabf
Author: Behdad Esfahbod 
Date:   Sat Nov 24 00:25:40 2018 -0500

Add hb_static_size(T)

diff --git a/src/hb-null.hh b/src/hb-null.hh
index c0cefc9a..1583d5b9 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -44,6 +44,7 @@
 /* The hard way...
  * 
https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol
  */
+
 template struct _hb_bool_type {};
 
 template 
@@ -58,6 +59,24 @@ struct hb_null_size
 { enum { value = _hb_null_size >::value }; };
 #define hb_null_size(T) hb_null_size::value
 
+/* This doesn't belong here, but since is copy/paste from above, put it here. 
*/
+
+template 
+struct _hb_static_size
+{ enum { value = sizeof (T) }; };
+template 
+struct _hb_static_size >
+{ enum { value = T::static_size }; };
+
+template 
+struct hb_static_size
+{ enum { value = _hb_static_size >::value }; };
+#define hb_static_size(T) hb_static_size::value
+
+
+/*
+ * Null()
+ */
 extern HB_INTERNAL
 hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof 
(hb_vector_size_impl_t) - 1) / sizeof 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-23 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |   19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 9552f4ef0da0b7e1fb28cb2738b865888e7941d9
Author: Behdad Esfahbod 
Date:   Fri Nov 23 15:24:17 2018 -0500

[kern] Don't enforce length of last subtable

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 74fecbb1..c60f29a6 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -936,7 +936,11 @@ struct KerxTable
   if (reverse)
c->buffer->reverse ();
 
-  c->sanitizer.set_object (*st);
+  /* See comment in sanitize() for conditional here. */
+  if (i < count - 1)
+   c->sanitizer.set_object (*st);
+  else
+   c->sanitizer.reset_object ();
 
   ret |= st->dispatch (c);
 
@@ -968,7 +972,18 @@ struct KerxTable
 unsigned int count = thiz()->tableCount;
 for (unsigned int i = 0; i < count; i++)
 {
-  c->set_object (*st);
+  /* OpenType kern table has 2-byte subtable lengths.  That's limiting.
+   * MS implementation also only supports one subtable, of format 0,
+   * anyway.  Certain versions of some fonts, like Calibry, contain
+   * kern subtable that exceeds 64kb.  Looks like, the subtable length
+   * is simply ignored.  Which makes sense.  It's only needed if you
+   * have multiple subtables.  To handle such fonts, we just ignore
+   * the length for the last subtable. */
+  if (i < count - 1)
+   c->set_object (*st);
+  else
+   c->reset_object ();
+
   if (unlikely (!st->sanitize (c)))
return_trace (false);
   st =  (*st);
___
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
 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'

2018-11-23 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |   15 +++
 src/hb-ot-kern-table.hh |9 +
 src/hb-ot-layout.cc |6 ++
 src/hb-ot-layout.hh |3 +++
 src/hb-ot-shape.cc  |4 +++-
 5 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 748962264a9f098b32b9cb3fe4d18c786907a184
Author: Behdad Esfahbod 
Date:   Fri Nov 23 11:10:17 2018 -0500

[aat] Disable mark advance zeroing if kern table has state-machines

Geeza Pro for example, relies on that for fancy mark positioning.

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

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index bb88d9d1..74fecbb1 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -843,6 +843,21 @@ struct KerxTable
   /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
   inline const T* thiz (void) const { return static_cast (this); }
 
+  inline bool has_state_machine (void) const
+  {
+typedef typename T::SubTable SubTable;
+
+const SubTable *st = ()->firstSubTable;
+unsigned int count = thiz()->tableCount;
+for (unsigned int i = 0; i < count; i++)
+{
+  if (st->get_type () == 1)
+return true;
+  st =  (*st);
+}
+return false;
+  }
+
   inline bool has_cross_stream (void) const
   {
 typedef typename T::SubTable SubTable;
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index b2d57140..b57ebaea 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -274,6 +274,15 @@ struct kern
   inline bool has_data (void) const { return u.version32; }
   inline unsigned int get_type (void) const { return u.major; }
 
+  inline bool has_state_machine (void) const
+  {
+switch (get_type ()) {
+case 0: return u.ot.has_state_machine ();
+case 1: return u.aat.has_state_machine ();
+default:return false;
+}
+  }
+
   inline bool has_cross_stream (void) const
   {
 switch (get_type ()) {
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 092633c5..9488fe82 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -66,6 +66,12 @@ hb_ot_layout_has_kerning (hb_face_t *face)
 }
 
 bool
+hb_ot_layout_has_machine_kerning (hb_face_t *face)
+{
+  return face->table.kern->has_state_machine ();
+}
+
+bool
 hb_ot_layout_has_cross_kerning (hb_face_t *face)
 {
   return face->table.kern->has_cross_stream ();
diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh
index db85508d..a00b940b 100644
--- a/src/hb-ot-layout.hh
+++ b/src/hb-ot-layout.hh
@@ -49,6 +49,9 @@ HB_INTERNAL bool
 hb_ot_layout_has_kerning (hb_face_t *face);
 
 HB_INTERNAL bool
+hb_ot_layout_has_machine_kerning (hb_face_t *face);
+
+HB_INTERNAL bool
 hb_ot_layout_has_cross_kerning (hb_face_t *face);
 
 HB_INTERNAL void
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 8d844807..ef974357 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -146,7 +146,9 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t  
 ,
   plan.apply_kern = true;
   }
 
-  plan.zero_marks = script_zero_marks && !plan.apply_kerx;
+  plan.zero_marks = script_zero_marks &&
+   !plan.apply_kerx &&
+   (!plan.apply_kern || !hb_ot_layout_has_machine_kerning 
(face));
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
 
   plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos &&
___
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: 

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

2018-11-22 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-use.cc
|   48 ++
 src/hb.hh 
|6 -
 test/shaping/data/in-house/fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf 
|binary
 test/shaping/data/in-house/tests/use.tests
|3 
 4 files changed, 40 insertions(+), 17 deletions(-)

New commits:
commit 22798e93c414a2655c757a6e41b300f67e04a9a3
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:47:51 2018 -0500

[use] Minor clarification

diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index 4daa2787..2e3f202f 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -450,22 +450,22 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int 
start, unsigned int end)
 
   hb_glyph_info_t *info = buffer->info;
 
-#define POST_BASE_FLAGS (FLAG64 (USE_FM) | \
-FLAG64 (USE_FAbv) | \
-FLAG64 (USE_FBlw) | \
-FLAG64 (USE_FPst) | \
-FLAG64 (USE_MAbv) | \
-FLAG64 (USE_MBlw) | \
-FLAG64 (USE_MPst) | \
-FLAG64 (USE_MPre) | \
-FLAG64 (USE_VAbv) | \
-FLAG64 (USE_VBlw) | \
-FLAG64 (USE_VPst) | \
-FLAG64 (USE_VPre) | \
-FLAG64 (USE_VMAbv) | \
-FLAG64 (USE_VMBlw) | \
-FLAG64 (USE_VMPst) | \
-FLAG64 (USE_VMPre))
+#define POST_BASE_FLAGS64 (FLAG64 (USE_FM) | \
+  FLAG64 (USE_FAbv) | \
+  FLAG64 (USE_FBlw) | \
+  FLAG64 (USE_FPst) | \
+  FLAG64 (USE_MAbv) | \
+  FLAG64 (USE_MBlw) | \
+  FLAG64 (USE_MPst) | \
+  FLAG64 (USE_MPre) | \
+  FLAG64 (USE_VAbv) | \
+  FLAG64 (USE_VBlw) | \
+  FLAG64 (USE_VPst) | \
+  FLAG64 (USE_VPre) | \
+  FLAG64 (USE_VMAbv) | \
+  FLAG64 (USE_VMBlw) | \
+  FLAG64 (USE_VMPst) | \
+  FLAG64 (USE_VMPre))
 
   /* Move things forward. */
   if (info[start].use_category() == USE_R && end - start > 1)
@@ -474,7 +474,7 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, 
unsigned int end)
  * glyph. */
 for (unsigned int i = start + 1; i < end; i++)
 {
-  bool is_post_base_glyph = (FLAG64_UNSAFE (info[i].use_category()) & 
POST_BASE_FLAGS) ||
+  bool is_post_base_glyph = (FLAG64_UNSAFE (info[i].use_category()) & 
POST_BASE_FLAGS64) ||
is_halant (info[i]);
   if (is_post_base_glyph || i == end - 1)
   {
commit a2d6c1075a5595a08ef09357293919d9df8eb64a
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:40:57 2018 -0500

Minor tweak to FLAG64

diff --git a/src/hb.hh b/src/hb.hh
index a40e6f2c..be8b2148 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 int)(x) < 32) + (1U << 
(unsigned int)(x)))
-#define FLAG_UNSAFE(x) ((unsigned int)(x) < 32 ? (1U << (unsigned int)(x)) : 0)
+#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_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - 
FLAG(x))
-#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned long long)(x) < 64) + 
(1ULL << (unsigned long long)(x)))
-#define FLAG64_UNSAFE(x) ((unsigned long long)(x) < 64 ? (1ULL << (unsigned 
long long)(x)) : 0)
+#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (1ULL << 
(unsigned)(x)))
+#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (1ULL << (unsigned)(x)) : 0)
 
 
 /* Size signifying variable-sized array */
commit 8280459e74cff2dec3de012abd309cda9578b759
Merge: e4a4555d 3c7792ca
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:39:12 2018 -0500

Merge pull request #1291 from harfbuzz/use-reordering

[use] Fix reordering

commit 3c7792ca326abfb989285f794d6ee71ad9f6bf89
Author: David Corbett 
Date:   Sat Oct 20 15:02:26 2018 -0400

[use] Fix reordering

Fixes #1235.

diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index af25b07f..4daa2787 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -432,7 +432,8 @@ record_pref (const hb_ot_shape_plan_t *plan HB_UNUSED,
 static inline bool
 is_halant (const hb_glyph_info_t )
 {
-  return 

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

2018-11-22 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh |3 +++
 src/hb-aat-layout-morx-table.hh |3 +++
 src/hb-machinery.hh |   30 +++---
 src/hb-ot-cmap-table.hh |   18 ++
 4 files changed, 35 insertions(+), 19 deletions(-)

New commits:
commit e4a4555d1e40dacdf72452805e9e6b6109627d63
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:17:49 2018 -0500

[cmap] Move code around

diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index b7d17018..4297550f 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -863,14 +863,6 @@ struct cmap
 hb_vector_t format12_groups;
   };
 
-  inline bool sanitize (hb_sanitize_context_t *c) const
-  {
-TRACE_SANITIZE (this);
-return_trace (c->check_struct (this) &&
- likely (version == 0) &&
- encodingRecord.sanitize (c, this));
-  }
-
   inline bool _create_plan (const hb_subset_plan_t *plan,
subset_plan *cmap_plan) const
   {
@@ -1171,6 +1163,16 @@ struct cmap
 return &(this+encodingRecord[result].subtable);
   }
 
+  public:
+
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+TRACE_SANITIZE (this);
+return_trace (c->check_struct (this) &&
+ likely (version == 0) &&
+ encodingRecord.sanitize (c, this));
+  }
+
   protected:
   HBUINT16 version;/* Table version number (0). */
   SortedArrayOf
commit 758c9d68e2143493978d8ac8391f4af2a2abc26a
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:16:12 2018 -0500

[morx/kerx] Limit range to subtable when sanitizing

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 8292dca6..bb88d9d1 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -953,10 +953,12 @@ struct KerxTable
 unsigned int count = thiz()->tableCount;
 for (unsigned int i = 0; i < count; i++)
 {
+  c->set_object (*st);
   if (unlikely (!st->sanitize (c)))
return_trace (false);
   st =  (*st);
 }
+c->reset_object ();
 
 return_trace (true);
   }
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index cb871d2a..7a39eea8 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -1061,10 +1061,12 @@ struct Chain
 unsigned int count = subtableCount;
 for (unsigned int i = 0; i < count; i++)
 {
+  c->set_object (*subtable);
   if (!subtable->sanitize (c))
return_trace (false);
   subtable =  > (*subtable);
 }
+c->reset_object ();
 
 return_trace (true);
   }
commit a9fe787a11fc391d9a43a4ea19e6eb1c474199bd
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:12:36 2018 -0500

[sanitizer] Add reset_object(), make set_object() do bounds-check

Affects morx/kerx run-time only currently.  Will adjust their sanitize next.

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 21097276..8292dca6 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -934,6 +934,7 @@ struct KerxTable
   st =  (*st);
   c->set_lookup_index (c->lookup_index + 1);
 }
+c->sanitizer.reset_object ();
 
 return ret;
   }
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index bbe952fa..cb871d2a 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -1041,6 +1041,7 @@ struct Chain
   subtable =  > (*subtable);
   c->set_lookup_index (c->lookup_index + 1);
 }
+c->sanitizer.reset_object ();
   }
 
   inline unsigned int get_size (void) const { return length; }
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index cb30e990..edef5405 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -259,26 +259,34 @@ struct hb_sanitize_context_t :
 
   inline void set_max_ops (int max_ops_) { max_ops = max_ops_; }
 
-  /* TODO
-   * This set_object() thing is to use sanitize at runtime lookup
-   * application time.  This is very distinct from the regular
-   * sanitizer operation, so, eventually, separate into another
-   * type and make hb_aat_apply_context_t use that one instead
-   * of abusing this one.
-   */
   template 
   inline void set_object (const T& obj)
   {
-this->start = (const char *) 
-this->end = (const char *)  + obj.get_size ();
-assert (this->start <= this->end); /* Must not overflow. */
+reset_object ();
+
+const char *obj_start = (const char *) 
+const char *obj_end = (const char *)  + obj.get_size ();
+assert (obj_start <= obj_end); /* Must not overflow. */
+
+if (unlikely (obj_end < this->start || this->end < obj_start))
+  this->start = this->end = nullptr;
+else
+{
+  this->start = MAX (this->start, obj_start);
+  this->end   = MIN (this->end  , obj_end  );
+}
   }
 
-  inline void start_processing (void)
+  inline void reset_object 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-22 Thread Behdad Esfahbod
 src/hb-aat-layout-kerx-table.hh
|1 +
 src/hb-aat-layout-morx-table.hh
|2 +-
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5722888989048832
 |binary
 3 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2c8188bf599e351a4e0804d74612f9643b3d2443
Author: Behdad Esfahbod 
Date:   Thu Nov 22 22:02:19 2018 -0500

[kerx] Make sure subtables are non-zero-length

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

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index f075a270..21097276 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -812,6 +812,7 @@ struct KerxSubTable
   {
 TRACE_SANITIZE (this);
 if (!u.header.sanitize (c) ||
+   u.header.length <= u.header.static_size ||
!c->check_range (this, u.header.length))
   return_trace (false);
 
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 43073270..bbe952fa 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -915,7 +915,7 @@ struct ChainSubtable
   {
 TRACE_SANITIZE (this);
 if (!length.sanitize (c) ||
-   length < min_size ||
+   length <= min_size ||
!c->check_range (this, length))
   return_trace (false);
 
diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5722888989048832
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5722888989048832
new file mode 100644
index ..df1556b5
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5722888989048832
 differ
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-22 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh 
 |5 +++-
 src/hb-set.hh  
 |   12 +-
 
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5067936541179904
 |binary
 3 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit a9e0bdc35dfcbead7d4b6fa249d60ebedd7d43ca
Author: Behdad Esfahbod 
Date:   Thu Nov 22 21:30:04 2018 -0500

[GSUB] Don't flush glyphset during recursion in closure()

See comment.

Supercedes https://github.com/harfbuzz/harfbuzz/pull/1401
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11366

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 715317b5..501f2308 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1449,7 +1449,10 @@ struct SubstLookup : Lookup
 
 hb_closure_context_t::return_t ret = dispatch_recurse_func (c, 
lookup_index);
 
-c->flush ();
+/* While in theory we should flush here, it will cause timeouts because a 
recursive
+ * lookup can keep growing the glyph set.  Skip, and outer loop will retry 
up to
+ * HB_CLOSURE_MAX_STAGES time, which should be enough for every realistic 
font. */
+//c->flush ();
 
 return ret;
   }
commit 8982830d3ec54f50cc951de9569520fafc735e75
Author: Garret Rieger 
Date:   Mon Nov 19 13:00:24 2018 -0800

[subset] add fuzzer testcase.

diff --git 
a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5067936541179904
 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5067936541179904
new file mode 100644
index ..9f57f7be
Binary files /dev/null and 
b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5067936541179904
 differ
commit d0e81b2cc85d09d01905c5fc5b3382c25eaa3bb3
Author: Behdad Esfahbod 
Date:   Thu Nov 22 21:20:39 2018 -0500

[set] Rename

diff --git a/src/hb-set.hh b/src/hb-set.hh
index bc26ed3c..cc061a7c 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -341,11 +341,11 @@ struct hb_set_t
   {
 /* TODO perform op even if !successful. */
 if (unlikely (!successful)) return;
-page_t *p = page_for (g);
-if (!p)
+page_t *page = page_for (g);
+if (!page)
   return;
 dirty ();
-p->del (g);
+page->del (g);
   }
   inline void del_range (hb_codepoint_t a, hb_codepoint_t b)
   {
@@ -357,10 +357,10 @@ struct hb_set_t
   }
   inline bool has (hb_codepoint_t g) const
   {
-const page_t *p = page_for (g);
-if (!p)
+const page_t *page = page_for (g);
+if (!page)
   return false;
-return p->has (g);
+return page->has (g);
   }
   inline bool intersects (hb_codepoint_t first,
  hb_codepoint_t last) const
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-22 Thread Behdad Esfahbod
 src/hb-null.hh  |2 +-
 src/hb-open-type.hh |   19 +--
 src/hb-ot-glyf-table.hh |8 ++--
 3 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit e866910579e9cdc5b1ffa2e401fd0c056d44ca6a
Author: Behdad Esfahbod 
Date:   Thu Nov 22 18:07:59 2018 -0500

Enforce requiring null_size even if min_size is 0

This concludes null-size enforcement changes

diff --git a/src/hb-null.hh b/src/hb-null.hh
index b87775b6..58151d72 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -50,7 +50,7 @@ template 
 struct _hb_null_size
 { enum { value = sizeof (T) }; };
 template 
-struct _hb_null_size >
+struct _hb_null_size 
>
 { enum { value = T::null_size }; };
 
 template 
commit 4d4fd64ff47da04a7008d410c92e8fb4ad970781
Author: Behdad Esfahbod 
Date:   Thu Nov 22 18:07:36 2018 -0500

Allow non-nullable OffsetTo<> to non-Null'able objects

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 0ecd3c6b..f4a9a5e8 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -231,17 +231,31 @@ struct FixedVersion
  * Use: (base+offset)
  */
 
+template 
+struct _hb_has_null
+{
+  static inline const Type *get_null (void) { return nullptr; }
+  static inline Type *get_crap (void) { return nullptr; }
+};
+template 
+struct _hb_has_null
+{
+  static inline const Type *get_null (void) { return (Type); }
+  static inline Type *get_crap (void) { return (Type); }
+};
+
 template 
 struct OffsetTo : Offset
 {
   inline const Type& operator () (const void *base) const
   {
-if (unlikely (this->is_null ())) return Null (Type);
+if (unlikely (this->is_null ())) return *_hb_has_null::get_null ();
 return StructAtOffset (base, *this);
   }
   inline Type& operator () (void *base) const
   {
 if (unlikely (this->is_null ())) return Crap (Type);
+if (unlikely (this->is_null ())) return *_hb_has_null::get_crap ();
 return StructAtOffset (base, *this);
   }
 
commit fa9f585ec53bc7145d3bed1a4bd756d64dae1e55
Author: Behdad Esfahbod 
Date:   Thu Nov 22 17:56:51 2018 -0500

[glyf] Don't mark structs UNBOUNDED

See comments.

diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index a3ef1ad0..c88f4338 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -56,7 +56,9 @@ struct loca
   protected:
   UnsizedArrayOf  dataZ;  /* Location data. */
   public:
-  DEFINE_SIZE_UNBOUNDED (0);
+  DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we 
always
+   * check the size externally, allow Null() object of it 
by
+   * defining it MIN() instead. */
 };
 
 
@@ -465,7 +467,9 @@ struct glyf
   protected:
   UnsizedArrayOf  dataZ;  /* Glyphs data. */
   public:
-  DEFINE_SIZE_UNBOUNDED (0);
+  DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we 
always
+   * check the size externally, allow Null() object of it 
by
+   * defining it MIN() instead. */
 };
 
 struct glyf_accelerator_t : glyf::accelerator_t {};
commit f47a60a7543dbaf41086c25a1a22ae518d8b92a9
Author: Behdad Esfahbod 
Date:   Thu Nov 22 17:53:29 2018 -0500

Mark UnsizedArrayOf<> as UNBOUNDED

Since min_size is 0, Null() still accepts this type.

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 41169664..0ecd3c6b 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -317,6 +317,7 @@ struct OffsetTo : Offset
   DEFINE_SIZE_STATIC (sizeof (OffsetType));
 };
 template  struct LOffsetTo : OffsetTo {};
+
 template 
 static inline const Type& operator + (const Base , const OffsetTo ) { return offset (base); }
 template 
@@ -401,7 +402,7 @@ struct UnsizedArrayOf
   public:
   Type arrayZ[VAR];
   public:
-  DEFINE_SIZE_ARRAY (0, arrayZ);
+  DEFINE_SIZE_UNBOUNDED (0);
 };
 
 /* Unsized array of offset's */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-22 Thread Behdad Esfahbod
 src/hb-ot-shape.cc |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 199a0f7b41b691e371487fd569c0d0146da3c3f3
Author: Behdad Esfahbod 
Date:   Thu Nov 22 17:31:07 2018 -0500

[ot-shape] Simplify logic

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 31fb3b7c..8d844807 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -149,9 +149,12 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t 
  ,
   plan.zero_marks = script_zero_marks && !plan.apply_kerx;
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
 
-  bool has_kern_mark = plan.apply_kern && hb_ot_layout_has_cross_kerning 
(face);
-  plan.fallback_mark_positioning = script_fallback_mark_positioning && 
!plan.apply_gpos && !plan.apply_kerx && !has_kern_mark;
-  plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos && 
!plan.apply_kerx && !has_kern_mark;
+  plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos &&
+ !plan.apply_kerx &&
+ (!plan.apply_kern || 
!hb_ot_layout_has_cross_kerning (face));
+
+  plan.fallback_mark_positioning = plan.adjust_mark_positioning_when_zeroing &&
+  script_fallback_mark_positioning;
 
   /* Currently we always apply trak. */
   plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking 
(face);
commit 014e4980ed9c8c473001abdb3a44121eb73fd50d
Author: Behdad Esfahbod 
Date:   Thu Nov 22 16:21:49 2018 -0500

Move

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index a7ec6b34..31fb3b7c 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -146,10 +146,10 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t
   ,
   plan.apply_kern = true;
   }
 
-  bool has_kern_mark = plan.apply_kern && hb_ot_layout_has_cross_kerning 
(face);
   plan.zero_marks = script_zero_marks && !plan.apply_kerx;
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
 
+  bool has_kern_mark = plan.apply_kern && hb_ot_layout_has_cross_kerning 
(face);
   plan.fallback_mark_positioning = script_fallback_mark_positioning && 
!plan.apply_gpos && !plan.apply_kerx && !has_kern_mark;
   plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos && 
!plan.apply_kerx && !has_kern_mark;
 
commit 62890dee18b88865a2014fb6a1322c1c9218bd49
Author: Behdad Esfahbod 
Date:   Thu Nov 22 16:20:29 2018 -0500

[aat] Zero mark advances if decided so even if there's cross-kerning

Cross-kerning can only take care of positioning vertically.  It doesn't
adjust mark advance...

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index e87848d2..a7ec6b34 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -147,7 +147,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t  
 ,
   }
 
   bool has_kern_mark = plan.apply_kern && hb_ot_layout_has_cross_kerning 
(face);
-  plan.zero_marks = script_zero_marks && !plan.apply_kerx && !has_kern_mark;
+  plan.zero_marks = script_zero_marks && !plan.apply_kerx;
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
 
   plan.fallback_mark_positioning = script_fallback_mark_positioning && 
!plan.apply_gpos && !plan.apply_kerx && !has_kern_mark;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-22 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-myanmar.cc |   21 
 src/hb-ot-shape-complex.hh |   28 +--
 src/hb-ot-shape.cc |   38 ++---
 src/hb-ot-shape.hh |3 ++
 4 files changed, 44 insertions(+), 46 deletions(-)

New commits:
commit a201fa74cd67f36a402a5c8093889c9d793e9fd5
Author: Behdad Esfahbod 
Date:   Thu Nov 22 15:52:29 2018 -0500

[aat] Tweak fallback positioning logic when applying morx

Such that for Indic-like scripts (eg. Khmer), we don't do any fallback mark
advance-zeroing / positioning, but we do for Latin, etc.  Reuses preferences
of our script-specific OpenType shapers for those.

Fixes regression: https://github.com/harfbuzz/harfbuzz/issues/1393
Which means, fixes again: https://github.com/harfbuzz/harfbuzz/issues/1264
While not regressing: https://github.com/harfbuzz/harfbuzz/issues/1357

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index ccee8d34..e87848d2 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -76,10 +76,16 @@ hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t 
*fac
props (*props),
map (face, props),
aat_map (face, props),
-   apply_morx (_hb_apply_morx 
(face)),
-   shaper (apply_morx ?
-   
&_hb_ot_complex_shaper_default :
-   
hb_ot_shape_complex_categorize (this)) {}
+   apply_morx (_hb_apply_morx 
(face))
+{
+  shaper = hb_ot_shape_complex_categorize (this);
+
+  script_zero_marks = shaper->zero_width_marks != 
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE;
+  script_fallback_mark_positioning = shaper->fallback_position;
+
+  if (apply_morx)
+shaper = &_hb_ot_complex_shaper_default;
+}
 
 void
 hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t   ,
@@ -141,9 +147,11 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t 
  ,
   }
 
   bool has_kern_mark = plan.apply_kern && hb_ot_layout_has_cross_kerning 
(face);
-  plan.zero_marks = !plan.apply_morx && !plan.apply_kerx && !has_kern_mark;
+  plan.zero_marks = script_zero_marks && !plan.apply_kerx && !has_kern_mark;
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
-  plan.fallback_mark_positioning = !plan.apply_gpos && plan.zero_marks;
+
+  plan.fallback_mark_positioning = script_fallback_mark_positioning && 
!plan.apply_gpos && !plan.apply_kerx && !has_kern_mark;
+  plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos && 
!plan.apply_kerx && !has_kern_mark;
 
   /* Currently we always apply trak. */
   plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking 
(face);
@@ -158,6 +166,7 @@ hb_ot_shape_plan_t::init0 (hb_face_t 
*face,
 
   hb_ot_shape_planner_t planner (face,
 >props);
+
   hb_ot_shape_collect_features (,
key->user_features,
key->num_user_features);
@@ -811,17 +820,16 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
   hb_glyph_info_t *info = c->buffer->info;
   hb_glyph_position_t *pos = c->buffer->pos;
 
-  /* If the font has no GPOS, AND, no fallback positioning will
-   * happen, AND, direction is forward, then when zeroing mark
-   * widths, we shift the mark with it, such that the mark
-   * is positioned hanging over the previous glyph.  When
+  /* If the font has no GPOS and direction is forward, then when
+   * zeroing mark widths, we shift the mark with it, such that the
+   * mark is positioned hanging over the previous glyph.  When
* direction is backward we don't shift and it will end up
* hanging over the next glyph after the final reordering.
-   * If fallback positinoing happens or GPOS is present, we don't
-   * care.
+   *
+   * Note: If fallback positinoing happens, we don't care about
+   * this as it will be overriden.
*/
-  bool adjust_offsets_when_zeroing = c->plan->fallback_mark_positioning &&
-!c->plan->shaper->fallback_position &&
+  bool adjust_offsets_when_zeroing = 
c->plan->adjust_mark_positioning_when_zeroing &&
 HB_DIRECTION_IS_FORWARD 
(c->buffer->props.direction);
 
   /* We change glyph origin to what GPOS expects (horizontal), apply GPOS, 
change it back. */
@@ -877,7 +885,7 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
[i].x_offset,
[i].y_offset);
 
-  if (c->plan->fallback_mark_positioning && c->plan->shaper->fallback_position)
+  if (c->plan->fallback_mark_positioning)

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-21 Thread Behdad Esfahbod
 src/hb-null.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit eeed802b1d0f932c61a088d3e0156ae70645b9e2
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:53:36 2018 -0500

Fix spurious gcc warnings

../../src/hb-null.hh:53:39: warning: enum constant in boolean context 
[-Wint-in-bool-context]

diff --git a/src/hb-null.hh b/src/hb-null.hh
index 166d2089..b87775b6 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -50,7 +50,7 @@ template 
 struct _hb_null_size
 { enum { value = sizeof (T) }; };
 template 
-struct _hb_null_size >
+struct _hb_null_size >
 { enum { value = T::null_size }; };
 
 template 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-21 Thread Behdad Esfahbod
 src/hb-blob.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b96ecb9971a9ad089a631d0139f05ae9d880fc55
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:49:12 2018 -0500

More

This makes more of the gcc spurious warning:

../../src/hb-null.hh:53:39: warning: enum constant in boolean context 
[-Wint-in-bool-context]

But not going to let that defeat correct code.  Type to switch to clang
as my main compiler...

diff --git a/src/hb-blob.hh b/src/hb-blob.hh
index 802b1f07..4f9d8f04 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 length < Type::min_size ? (Type) : reinterpret_cast (data);
+return length < hb_null_size::value ? (Type) : 
reinterpret_cast (data);
   }
   inline hb_bytes_t as_bytes (void) const
   {
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-21 Thread Behdad Esfahbod
 src/hb-null.hh  |   12 +---
 src/hb-open-type.hh |5 -
 src/hb-ot-glyf-table.hh |4 ++--
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 2737aa81e5aee721e868bf0c72f19c0245c721fe
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:44:27 2018 -0500

Fix up recent change

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

diff --git a/src/hb-null.hh b/src/hb-null.hh
index 92c7a351..166d2089 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -40,16 +40,22 @@
 
 /* Use SFINAE to sniff whether T has min_size; in which case return 
T::null_size,
  * otherwise return sizeof(T). */
-template 
+
+/* The hard way...
+ * 
https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol
+ */
+template struct _hb_bool_type {};
+
+template 
 struct _hb_null_size
 { enum { value = sizeof (T) }; };
 template 
-struct _hb_null_size
+struct _hb_null_size >
 { enum { value = T::null_size }; };
 
 template 
 struct hb_null_size
-{ enum { value = _hb_null_size::value }; };
+{ enum { value = _hb_null_size >::value }; };
 
 extern HB_INTERNAL
 hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof 
(hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)];
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index c5d1aa84..41169664 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -231,14 +231,9 @@ struct FixedVersion
  * Use: (base+offset)
  */
 
-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_null_size) || true, "");
-
   inline const Type& operator () (const void *base) const
   {
 if (unlikely (this->is_null ())) return Null (Type);
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 5d9e7a20..a3ef1ad0 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -56,7 +56,7 @@ struct loca
   protected:
   UnsizedArrayOf  dataZ;  /* Location data. */
   public:
-  DEFINE_SIZE_ARRAY (0, dataZ);
+  DEFINE_SIZE_UNBOUNDED (0);
 };
 
 
@@ -465,7 +465,7 @@ struct glyf
   protected:
   UnsizedArrayOf  dataZ;  /* Glyphs data. */
   public:
-  DEFINE_SIZE_ARRAY (0, dataZ);
+  DEFINE_SIZE_UNBOUNDED (0);
 };
 
 struct glyf_accelerator_t : glyf::accelerator_t {};
___
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-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 )
   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 (_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  = 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  = 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  = 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 _instance (unsigned int i) const
+  inline const InstanceRecord *get_instance (unsigned int i) const
   {
-if (unlikely (i >= instanceCount)) return Null 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-21 Thread Behdad Esfahbod
 src/hb-machinery.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7dd945a8764cbbf76f686fd9387918b63f7d2fb4
Author: Behdad Esfahbod 
Date:   Thu Nov 22 01:05:02 2018 -0500

One more time..

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 86eb58d4..a8d1ad53 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -95,7 +95,7 @@ static inline Type& StructAfter(TObject )
 
 
 #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 { 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'

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

New commits:
commit fb10c021c8a32f8dc054f008caf86af82667e109
Author: Behdad Esfahbod 
Date:   Thu Nov 22 00:21:49 2018 -0500

Revert alignof() == 1 check

Bots not happy with using "this" inside assertion...

This reverts 2656644887e77a9d814bb12374af3c26b42fd935

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 2f57fb6b..f29a02aa 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -97,8 +97,7 @@ static inline Type& StructAfter(TObject )
 
 
 #define DEFINE_SIZE_STATIC(size) \
-  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-sizeof (*this) == (size)); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
   inline unsigned int get_size (void) const { return (size); } \
   enum { null_size = (size) }; \
   enum { min_size = (size) }; \
@@ -106,21 +105,18 @@ static inline Type& StructAfter(TObject )
 
 #define DEFINE_SIZE_UNION(size, _member) \
   DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
-  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-sizeof(this->u._member) == (size)); \
+  DEFINE_INSTANCE_ASSERTION (sizeof(this->u._member) == (size)); \
   enum { null_size = (size) }; \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_MIN(size) \
-  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-sizeof (*this) >= (size)); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)); \
   enum { null_size = (size) }; \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
-  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-sizeof (*this) == (size) + VAR * sizeof 
((array)[0])); \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof 
((array)[0])); \
   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' - 7 commits

2018-11-21 Thread Behdad Esfahbod
 src/hb-machinery.hh|   39 ++-
 src/hb-null.hh |4 ++--
 src/hb-ot-layout-common.hh |8 
 src/hb-ot-post-table.hh|6 +++---
 4 files changed, 31 insertions(+), 26 deletions(-)

New commits:
commit 8d778877b88155dec1808a994416ead0b3d98ae7
Author: Behdad Esfahbod 
Date:   Wed Nov 21 23:46:09 2018 -0500

..

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 24e45441..2f57fb6b 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -100,24 +100,28 @@ static inline Type& StructAfter(TObject )
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 sizeof (*this) == (size)); \
   inline unsigned int get_size (void) const { return (size); } \
-  enum { static_size = (size) }; \
-  enum { min_size = (size) }
+  enum { null_size = (size) }; \
+  enum { min_size = (size) }; \
+  enum { static_size = (size) }
 
 #define DEFINE_SIZE_UNION(size, _member) \
   DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 sizeof(this->u._member) == (size)); \
+  enum { null_size = (size) }; \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_MIN(size) \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 sizeof (*this) >= (size)); \
+  enum { null_size = (size) }; \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 sizeof (*this) == (size) + VAR * sizeof 
((array)[0])); \
+  enum { null_size = (size) }; \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
diff --git a/src/hb-null.hh b/src/hb-null.hh
index 25a24f05..51f653d2 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -52,7 +52,7 @@ static inline Type const & Null (void) {
 /* Specializations for arbitrary-content Null objects expressed in bytes. */
 #define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \
} /* Close namespace. */ \
-   extern HB_INTERNAL const unsigned char 
_hb_Null_##Namespace##_##Type[Namespace::Type::min_size]; \
+   extern HB_INTERNAL const unsigned char 
_hb_Null_##Namespace##_##Type[Namespace::Type::null_size]; \
template <> \
/*static*/ inline const Namespace::Type& Null (void) { 
\
  return *reinterpret_cast 
(_hb_Null_##Namespace##_##Type); \
@@ -60,7 +60,7 @@ static inline Type const & Null (void) {
namespace Namespace { \
static_assert (true, "Just so we take semicolon after.")
 #define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
-   const unsigned char 
_hb_Null_##Namespace##_##Type[Namespace::Type::min_size]
+   const unsigned char 
_hb_Null_##Namespace##_##Type[Namespace::Type::null_size]
 
 /* Specializations for arbitrary-content Null objects expressed as struct 
initializer. */
 #define DECLARE_NULL_INSTANCE(Type) \
commit 8cfeed99486e87c3217dc141bc24b7768a460f32
Author: Behdad Esfahbod 
Date:   Wed Nov 21 23:42:31 2018 -0500

Minor

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index c209efe2..24e45441 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -107,12 +107,12 @@ static inline Type& StructAfter(TObject )
   DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 sizeof(this->u._member) == (size)); \
-  static const unsigned int min_size = (size)
+  enum { min_size = (size) }
 
 #define DEFINE_SIZE_MIN(size) \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 sizeof (*this) >= (size)); \
-  static const unsigned int min_size = (size)
+  enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
commit e5d954a2fb0c390ea67e83763e3c3a47caa2eb50
Author: Behdad Esfahbod 
Date:   Wed Nov 21 23:30:50 2018 -0500

Minor

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index df5023bd..c209efe2 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -104,8 +104,8 @@ static inline Type& StructAfter(TObject )
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_UNION(size, _member) \
+  DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-0*sizeof(this->u._member.static_size) + \
 sizeof(this->u._member) == (size)); \
   static const unsigned int min_size = (size)
 
@@ -115,9 +115,9 @@ static inline Type& StructAfter(TObject )
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_ARRAY(size, array) \
+  DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \

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

2018-11-21 Thread Behdad Esfahbod
 src/gen-use-table.py  
|7 ++-
 src/hb-ot-shape-complex-use-table.cc  
|2 +-
 test/shaping/data/in-house/fonts/86cdd983c4e4c4d7f27dd405d6ceb7d4b9ed3d35.ttf 
|binary
 test/shaping/data/in-house/tests/use-syllable.tests   
|1 +
 4 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit f961c1eb88af0d178e5d3431b9d57bdf79669488
Merge: ecdceea8 264439c6
Author: Behdad Esfahbod 
Date:   Wed Nov 21 17:27:27 2018 -0500

Merge pull request #1400 from harfbuzz/sharada-sandhi-mark

Test U+111C9 SHARADA SANDHI MARK

commit 264439c6c308ac5f01c4ba4faf64daa2d642236a
Author: David Corbett 
Date:   Wed Nov 21 16:33:45 2018 -0500

Test U+111C9 SHARADA SANDHI MARK

diff --git 
a/test/shaping/data/in-house/fonts/86cdd983c4e4c4d7f27dd405d6ceb7d4b9ed3d35.ttf 
b/test/shaping/data/in-house/fonts/86cdd983c4e4c4d7f27dd405d6ceb7d4b9ed3d35.ttf
new file mode 100644
index ..5a47a396
Binary files /dev/null and 
b/test/shaping/data/in-house/fonts/86cdd983c4e4c4d7f27dd405d6ceb7d4b9ed3d35.ttf 
differ
diff --git a/test/shaping/data/in-house/tests/use-syllable.tests 
b/test/shaping/data/in-house/tests/use-syllable.tests
index d8f1dff1..6a247ed0 100644
--- a/test/shaping/data/in-house/tests/use-syllable.tests
+++ b/test/shaping/data/in-house/tests/use-syllable.tests
@@ -9,3 +9,4 @@
 
../fonts/28f497629c04ceb15546c9a70e0730125ed6698d.ttf::U+11013,U+11042,U+11046:[brm_KA=0+754|brm_vowelEE=0@-383,0+0|brm_virama=0@-524,0+0]
 
../fonts/28f497629c04ceb15546c9a70e0730125ed6698d.ttf::U+11013,U+11044,U+11046:[brm_KA=0+754|brm_vowelOO=0@-647,0+0|brm_virama=0@-524,0+0]
 
../fonts/28f497629c04ceb15546c9a70e0730125ed6698d.ttf::U+11013,U+1103C:[brm_KA=0+754|brm_vowelU=0@-403,0+0]
+../fonts/86cdd983c4e4c4d7f27dd405d6ceb7d4b9ed3d35.ttf::U+111C8,U+111C9,U+111C9:[u111C8=0+500|u111C9=0@-500,0+0|u111C9=0@-500,0+0]
commit ecdceea861952be003e1d435aa3282a4e3e200a9
Merge: b89c7fd3 b3d5b0a5
Author: Behdad Esfahbod 
Date:   Wed Nov 21 16:12:32 2018 -0500

Merge pull request #1399 from harfbuzz/sharada-sandhi-mark

Fix USE categories for U+111C9 SHARADA SANDHI MARK

commit b3d5b0a5d92115ca672b8103999ab7ac88e39a4a
Author: David Corbett 
Date:   Wed Nov 21 11:35:44 2018 -0500

Fix USE categories for U+111C9 SHARADA SANDHI MARK

diff --git a/src/gen-use-table.py b/src/gen-use-table.py
index a8a7a232..099f6a18 100755
--- a/src/gen-use-table.py
+++ b/src/gen-use-table.py
@@ -50,6 +50,8 @@ data[0][0x20F0] = defaults[0]
 # TODO https://github.com/roozbehp/unicode-data/issues/9
 data[0][0x11C44] = 'Consonant_Placeholder'
 data[0][0x11C45] = 'Consonant_Placeholder'
+# TODO https://github.com/harfbuzz/harfbuzz/pull/1399
+data[0][0x111C8] = 'Consonant_Placeholder'
 for u in range (0xFE00, 0xFE0F + 1):
data[0][u] = defaults[0]
 
@@ -168,7 +170,7 @@ def is_BASE(U, UISC, UGC):
 def is_BASE_IND(U, UISC, UGC):
#SPEC-DRAFT return (UISC in [Consonant_Dead, Modifying_Letter] or UGC 
== Po)
return (UISC in [Consonant_Dead, Modifying_Letter] or
-   (UGC == Po and not U in [0x104B, 0x104E, 0x2022, 0x11A3F, 
0x11A45, 0x11C44, 0x11C45]) or
+   (UGC == Po and not U in [0x104B, 0x104E, 0x2022, 0x111C8, 
0x11A3F, 0x11A45, 0x11C44, 0x11C45]) or
False # SPEC-DRAFT-OUTDATED! U == 0x002D
)
 def is_BASE_NUM(U, UISC, UGC):
@@ -354,6 +356,9 @@ def map_to_use(data):
# TODO: https://github.com/harfbuzz/harfbuzz/issues/1105
if U == 0x11134: UISC = Gemination_Mark
 
+   # TODO: https://github.com/harfbuzz/harfbuzz/pull/1399
+   if U == 0x111C9: UISC = Consonant_Final
+
values = [k for k,v in items if v(U,UISC,UGC)]
assert len(values) == 1, "%s %s %s %s" % (hex(U), UISC, UGC, 
values)
USE = values[0]
diff --git a/src/hb-ot-shape-complex-use-table.cc 
b/src/hb-ot-shape-complex-use-table.cc
index bfc92d3b..2f3eb703 100644
--- a/src/hb-ot-shape-complex-use-table.cc
+++ b/src/hb-ot-shape-complex-use-table.cc
@@ -544,7 +544,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
   /* 11190 */ B, B, B, B, B, B, B, B, B,   
  B, B, B, B, B, B, B,
   /* 111A0 */ B, B, B, B, B, B, B, B, B,   
  B, B, B, B, B, B, B,
   /* 111B0 */ B, B, B,  VPst,  VPre,  VPst,  VBlw,  VBlw,  VBlw,  
VBlw,  VBlw,  VBlw,  VAbv,  VAbv,  VAbv,  VAbv,
-  /* 111C0 */ H, B, R, R, O, O, O, O, O,   
 FM, CMBlw,  VAbv,  VBlw, O, O, O,
+  /* 111C0 */ H, B, R, R, O, O, O, O,GB,  
FBlw, CMBlw,  VAbv,  VBlw, O, O, O,
   /* 111D0 */ B, B, B, B, B, B, B, B, B,   
  B, O, O, O, O, O, O,
 
   /* 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-21 Thread Behdad Esfahbod
 src/hb-common.cc|   10 +-
 src/hb-ft.cc|   12 ++--
 src/hb-glib.cc  |6 +++---
 src/hb-icu.cc   |6 +++---
 src/hb-ot-font.cc   |6 +++---
 src/hb-shape.cc |6 +++---
 src/hb-shaper.cc|6 +++---
 src/hb-ucdn.cc  |6 +++---
 src/hb-uniscribe.cc |4 ++--
 src/hb.hh   |5 -
 10 files changed, 35 insertions(+), 32 deletions(-)

New commits:
commit b89c7fd3dc505a958dd4b6acec0e0f8e57224fd8
Author: Behdad Esfahbod 
Date:   Wed Nov 21 12:32:48 2018 -0500

Allow defining HB_USE_ATEXIT to 0

That's better use of that value than requiring extra macro HB_NO_ATEXIT

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 37be8a34..28b0c2b8 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -276,7 +276,7 @@ struct hb_language_item_t {
 
 static hb_atomic_ptr_t  langs;
 
-#ifdef HB_USE_ATEXIT
+#if HB_USE_ATEXIT
 static void
 free_langs (void)
 {
@@ -323,7 +323,7 @@ retry:
 goto retry;
   }
 
-#ifdef HB_USE_ATEXIT
+#if HB_USE_ATEXIT
   if (!first_lang)
 atexit (free_langs); /* First person registers atexit() callback. */
 #endif
@@ -780,7 +780,7 @@ parse_uint32 (const char **pp, const char *end, uint32_t 
*pv)
 
 #ifdef USE_XLOCALE
 
-#ifdef HB_USE_ATEXIT
+#if HB_USE_ATEXIT
 static void free_static_C_locale (void);
 #endif
 
@@ -791,7 +791,7 @@ static struct hb_C_locale_lazy_loader_t : 
hb_lazy_loader_tinit ();
 
-#ifdef HB_USE_ATEXIT
+#if HB_USE_ATEXIT
 atexit (free_static_uniscribe_shaper_funcs);
 #endif
 
@@ -261,7 +261,7 @@ static struct hb_uniscribe_shaper_funcs_lazy_loader_t : 
hb_lazy_loader_thttps://bugs.freedesktop.org/show_bug.cgi?id=82246 */
@@ -313,6 +313,9 @@ static int errno = 0; /* Use something better? */
 #ifdef HB_NO_ATEXIT
 #  undef HB_USE_ATEXIT
 #endif
+#ifndef HB_USE_ATEXIT
+#  define HB_USE_ATEXIT 0
+#endif
 
 #define HB_STMT_START do
 #define HB_STMT_END   while (0)
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-20 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt|   14 +--
 src/gen-emoji-table.py|   13 +-
 src/hb-deprecated.h   |   37 
 src/hb-ot-var-fvar-table.hh   |  114 +
 src/hb-ot-var.cc  |   41 ++---
 src/hb-ot-var.h   |   66 ++
 src/hb-unicode-emoji-table.hh |  189 +++---
 test/api/test-ot-face.c   |2 
 8 files changed, 208 insertions(+), 268 deletions(-)

New commits:
commit f48bb9a3939067f24a81007e642caaac77cc7167
Author: Behdad Esfahbod 
Date:   Tue Nov 20 20:40:55 2018 -0500

[var] Deprecated axis enumeration API and add new version

New version has axis flags.

New API:
+hb_ot_var_axis_info_t
+hb_ot_var_find_axis_info()
+hb_ot_var_get_axis_infos()

Deprecated API:
-HB_OT_VAR_NO_AXIS_INDEX
-hb_ot_var_axis_t
-hb_ot_var_find_axis()
-hb_ot_var_get_axes()

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 63d5f6ce..5f5dcef7 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -161,6 +161,10 @@ hb_ot_layout_table_choose_script
 hb_ot_layout_table_find_script
 hb_ot_tag_from_language
 hb_ot_tags_from_script
+HB_OT_VAR_NO_AXIS_INDEX
+hb_ot_var_axis_t
+hb_ot_var_find_axis
+hb_ot_var_get_axes
 hb_set_invert
 hb_unicode_eastasian_width_func_t
 hb_unicode_eastasian_width
@@ -581,14 +585,12 @@ HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE
 HB_OT_TAG_VAR_AXIS_SLANT
 HB_OT_TAG_VAR_AXIS_WEIGHT
 HB_OT_TAG_VAR_AXIS_WIDTH
-HB_OT_VAR_NO_AXIS_INDEX
-hb_ot_var_axis_t
 hb_ot_var_has_data
-hb_ot_var_find_axis
-hb_ot_var_get_axis_count
-hb_ot_var_get_axes
 hb_ot_var_axis_flags_t
-hb_ot_var_axis_get_flags
+hb_ot_var_axis_info_t
+hb_ot_var_find_axis_info
+hb_ot_var_get_axis_count
+hb_ot_var_get_axis_infos
 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
diff --git a/src/hb-deprecated.h b/src/hb-deprecated.h
index e39b79f7..a74431f0 100644
--- a/src/hb-deprecated.h
+++ b/src/hb-deprecated.h
@@ -241,6 +241,43 @@ HB_EXTERN HB_DEPRECATED_FOR 
(hb_ot_tags_from_script_and_language) hb_tag_t
 hb_ot_tag_from_language (hb_language_t language);
 
 
+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
+ */
+#define HB_OT_VAR_NO_AXIS_INDEX0xu
+
+/**
+ * hb_ot_var_axis_t:
+ *
+ * Since: 1.4.2
+ * Deprecated: REPLACEME
+ */
+typedef struct hb_ot_var_axis_t
+{
+  hb_tag_t tag;
+  hb_ot_name_id_t name_id;
+  float min_value;
+  float default_value;
+  float max_value;
+} hb_ot_var_axis_t;
+
+HB_EXTERN HB_DEPRECATED_FOR (hb_ot_var_get_axis_infos) unsigned int
+hb_ot_var_get_axes (hb_face_t*face,
+   unsigned int  start_offset,
+   unsigned int *axes_count /* IN/OUT */,
+   hb_ot_var_axis_t *axes_array /* OUT */);
+
+HB_EXTERN HB_DEPRECATED_FOR (hb_ot_var_find_axis_info) hb_bool_t
+hb_ot_var_find_axis (hb_face_t*face,
+hb_tag_t  axis_tag,
+unsigned int *axis_index,
+hb_ot_var_axis_t *axis_info);
+
 #endif
 
 HB_END_DECLS
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 0bf9d10d..5c8832e1 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -115,28 +115,62 @@ struct fvar
   inline unsigned int get_axis_count (void) const
   { return axisCount; }
 
-  inline bool get_axis (unsigned int index, hb_ot_var_axis_t *info) const
+  inline void get_axis_deprecated (unsigned int axis_index,
+  hb_ot_var_axis_t *info) const
   {
-if (info)
+const AxisRecord  = get_axes ()[axis_index];
+info->tag = axis.axisTag;
+info->name_id =  axis.axisNameID;
+info->default_value = axis.defaultValue / 65536.;
+/* Ensure order, to simplify client math. */
+info->min_value = MIN (info->default_value, axis.minValue / 65536.);
+info->max_value = MAX (info->default_value, axis.maxValue / 65536.);
+  }
+
+  inline void get_axis_info (unsigned int axis_index,
+hb_ot_var_axis_info_t *info) const
+  {
+const AxisRecord  = get_axes ()[axis_index];
+info->axis_index = axis_index;
+info->tag = axis.axisTag;
+info->name_id =  axis.axisNameID;
+info->flags = (hb_ot_var_axis_flags_t) (unsigned int) axis.flags;
+info->default_value = axis.defaultValue / 65536.;
+/* Ensure order, to simplify client math. */
+info->min_value = MIN (info->default_value, axis.minValue / 65536.);
+info->max_value = MAX (info->default_value, axis.maxValue / 65536.);
+info->reserved = 0;
+  }
+
+  inline unsigned int get_axes_deprecated (unsigned int  start_offset,
+  unsigned int *axes_count /* 
IN/OUT */,
+

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-20 Thread Behdad Esfahbod
 src/hb-ot-var-fvar-table.hh |2 +-
 src/hb-ot-var.cc|2 +-
 src/hb-ot-var.h |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit be1828daaa1e1a72d971aed8d34fff54688d0f41
Author: Behdad Esfahbod 
Date:   Tue Nov 20 11:16:23 2018 -0500

[var] Fix type of coords returned

Ouch.  Wonder how none of the bots caught the float->int truncation.

diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index f61296d1..47c2516f 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -210,7 +210,7 @@ struct fvar
 
   inline unsigned int get_instance_coords (unsigned int  index,
   unsigned int *coords_length, /* 
IN/OUT */
-  int  *coords /* OUT 
*/) const
+  float*coords /* OUT 
*/) const
   {
 if (unlikely (index >= instanceCount))
 {
diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc
index bb8d2649..9ad2f861 100644
--- a/src/hb-ot-var.cc
+++ b/src/hb-ot-var.cc
@@ -144,7 +144,7 @@ unsigned int
 hb_ot_var_named_instance_get_design_coords (hb_face_t*face,
unsigned int  instance_index,
unsigned int *coords_length, /* 
IN/OUT */
-   int  *coords /* OUT 
*/)
+   float*coords /* OUT 
*/)
 {
   return face->table.fvar->get_instance_coords (instance_index, coords_length, 
coords);
 }
diff --git a/src/hb-ot-var.h b/src/hb-ot-var.h
index e0ac5c4a..79ce7d72 100644
--- a/src/hb-ot-var.h
+++ b/src/hb-ot-var.h
@@ -124,7 +124,7 @@ HB_EXTERN unsigned int
 hb_ot_var_named_instance_get_design_coords (hb_face_t*face,
unsigned int  instance_index,
unsigned int *coords_length, /* 
IN/OUT */
-   int  *coords /* OUT 
*/);
+   float*coords /* OUT 
*/);
 
 
 /*
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-19 Thread Behdad Esfahbod
 src/test-name-table.cc  |2 +-
 src/test-ot-color.cc|   14 +++---
 test/api/test-buffer.c  |5 +++--
 test/api/test-object.c  |2 +-
 test/api/test-ot-name.c |2 +-
 5 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 831ba74382e35f110006539f22bebce4d57c8502
Author: Behdad Esfahbod 
Date:   Tue Nov 20 01:16:08 2018 -0500

Fix Codacy "issues"

diff --git a/src/test-name-table.cc b/src/test-name-table.cc
index 33305272..58c98f07 100644
--- a/src/test-name-table.cc
+++ b/src/test-name-table.cc
@@ -48,7 +48,7 @@ main (int argc, char **argv)
 
   for (unsigned int i = 0; i < count; i++)
   {
-printf ("%d%s  ",
+printf ("%u%s  ",
entries[i].name_id,
hb_language_to_string (entries[i].language));
 
diff --git a/src/test-ot-color.cc b/src/test-ot-color.cc
index 4b10e017..4050a664 100644
--- a/src/test-ot-color.cc
+++ b/src/test-ot-color.cc
@@ -54,7 +54,7 @@ svg_dump (hb_face_t *face, unsigned int face_index)
 const char *data = hb_blob_get_data (blob, );
 
 char output_path[255];
-sprintf (output_path, "out/svg-%d-%d.svg%s",
+sprintf (output_path, "out/svg-%u-%u.svg%s",
 glyph_id,
 face_index,
 // append "z" if the content is gzipped, 
https://stackoverflow.com/a/6059405
@@ -108,7 +108,7 @@ png_dump (hb_face_t *face, unsigned int face_index)
const char *data = hb_blob_get_data (blob, );
 
char output_path[255];
-   sprintf (output_path, "out/png-%d-%d-%d.png", glyph_id, strike, 
face_index);
+   sprintf (output_path, "out/png-%u-%u-%u.png", glyph_id, strike, 
face_index);
 
FILE *f = fopen (output_path, "wb");
fwrite (data, 1, length, f);
@@ -167,9 +167,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t 
*cairo_face, unsigned int
 
   // Render
   unsigned int palette_count = hb_ot_color_palette_get_count (face);
-  for (unsigned int palette = 0; palette < palette_count; palette++) {
-   char output_path[255];
-
+  for (unsigned int palette = 0; palette < palette_count; palette++)
+  {
unsigned int num_colors = hb_ot_color_palette_get_colors (face, 
palette, 0, NULL, NULL);
if (!num_colors)
  continue;
@@ -178,7 +177,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t 
*cairo_face, unsigned int
hb_ot_color_palette_get_colors (face, palette, 0, _colors, colors);
if (num_colors)
{
- sprintf (output_path, "out/colr-%d-%d-%d.svg", gid, palette, 
face_index);
+ char output_path[255];
+ sprintf (output_path, "out/colr-%u-%u-%u.svg", gid, palette, 
face_index);
 
  cairo_surface_t *surface = cairo_svg_surface_create (output_path, 
extents.width, extents.height);
  cairo_t *cr = cairo_create (surface);
@@ -245,7 +245,7 @@ dump_glyphs (cairo_font_face_t *cairo_face, unsigned int 
upem,
 // Render
 {
   char output_path[255];
-  sprintf (output_path, "out/%d-%d.svg", face_index, i);
+  sprintf (output_path, "out/%u-%u.svg", face_index, i);
   cairo_surface_t *surface = cairo_svg_surface_create (output_path, 
extents.width, extents.height);
   cairo_t *cr = cairo_create (surface);
   cairo_set_font_face (cr, cairo_face);
diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c
index 5fba3b22..64ab3db9 100644
--- a/test/api/test-buffer.c
+++ b/test/api/test-buffer.c
@@ -379,14 +379,15 @@ static void
 test_buffer_utf8_conversion (void)
 {
   hb_buffer_t *b;
-  hb_glyph_info_t *glyphs;
-  unsigned int bytes, chars, i, j, len;
+  unsigned int chars, i, j, len;
 
   b = hb_buffer_create ();
   hb_buffer_set_replacement_codepoint (b, (hb_codepoint_t) -1);
 
   for (i = 0; i < G_N_ELEMENTS (utf8_conversion_tests); i++)
   {
+unsigned int bytes;
+hb_glyph_info_t *glyphs;
 const utf8_conversion_test_t *test = _conversion_tests[i];
 char *escaped;
 
diff --git a/test/api/test-object.c b/test/api/test-object.c
index 02b9760d..093615e8 100644
--- a/test/api/test-object.c
+++ b/test/api/test-object.c
@@ -235,7 +235,7 @@ test_object (void)
 
 {
   unsigned int j;
-  data_t data[2] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
+  data_t data[1000] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
   deadlock_test_t deadlock_test;
 
   g_test_message ("Testing object %s", o->name);
diff --git a/test/api/test-ot-name.c b/test/api/test-ot-name.c
index 71a8727b..9e88015f 100644
--- a/test/api/test-ot-name.c
+++ b/test/api/test-ot-name.c
@@ -81,7 +81,7 @@ test_ot_name (void)
   hb_ot_name_id_t name_id = entries[3].name_id;
   g_assert_cmpuint (3, ==, name_id);
   hb_language_t lang = entries[3].language;
-  g_assert_cmpstr ("en", ==, hb_language_to_string (lang));
+  g_assert_cmpstr (hb_language_to_string (lang), ==, "en");
   char text[10];
   unsigned int text_size = 10;
   g_assert_cmpuint (27, ==, hb_ot_name_get_utf8 (face, name_id, lang, 
_size, text));

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-19 Thread Behdad Esfahbod
 .travis.yml |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 96b24c5124a085b7601215360eed847ce5302699
Author: Behdad Esfahbod 
Date:   Tue Nov 20 01:03:42 2018 -0500

[travis] Add codecov.io

diff --git a/.travis.yml b/.travis.yml
index eadfa767..7f4bb47f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,6 +29,7 @@ matrix:
 - rm -rf freetype-2.9
   after_success:
 - bash .ci/run-coveralls.sh # for coveralls.io code coverage tracking
+- bash <(curl -s https://codecov.io/bash)
 - bash .ci/deploy-docs.sh
 - bash .ci/trigger-coverity.sh
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-19 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt  |4 +++
 src/hb-ot-var-fvar-table.hh |   55 +---
 src/hb-ot-var.cc|   33 ++
 src/hb-ot-var.h |   32 +
 4 files changed, 121 insertions(+), 3 deletions(-)

New commits:
commit 587d49fc657c10c8a20f2409a04d72bf80bb361e
Author: Behdad Esfahbod 
Date:   Mon Nov 19 14:27:19 2018 -0500

[fvar] Add named-instance API

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

diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 63594cfc..63d5f6ce 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -589,6 +589,10 @@ hb_ot_var_get_axis_count
 hb_ot_var_get_axes
 hb_ot_var_axis_flags_t
 hb_ot_var_axis_get_flags
+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
 hb_ot_var_normalize_variations
 hb_ot_var_normalize_coords
 
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 99d2fd5c..f61296d1 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -42,6 +42,11 @@ namespace OT {
 
 struct InstanceRecord
 {
+  friend struct fvar;
+
+  inline hb_array_t get_coordinates (unsigned int axis_count) 
const
+  { return coordinatesZ.as_array (axis_count); }
+
   inline bool sanitize (hb_sanitize_context_t *c, unsigned int axis_count) 
const
   {
 TRACE_SANITIZE (this);
@@ -104,7 +109,7 @@ struct fvar
  axisSize == 20 && /* Assumed in our code. */
  instanceSize >= axisCount * 4 + 4 &&
  get_axes ().sanitize (c) &&
- c->check_range (get_first_instance (), instanceCount, 
instanceSize));
+ c->check_range (_instance (0), instanceCount, 
instanceSize));
   }
 
   inline unsigned int get_axis_count (void) const
@@ -186,12 +191,56 @@ struct fvar
 return (int) (v * 16384.f + (v >= 0.f ? .5f : -.5f));
   }
 
+  inline unsigned int get_instance_count (void) const
+  { return instanceCount; }
+
+  inline hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int index) 
const
+  {
+const InstanceRecord  = get_instance (index);
+return instance.subfamilyNameID;
+  }
+
+  inline hb_ot_name_id_t get_instance_postscript_name_id (unsigned int index) 
const
+  {
+const InstanceRecord  = get_instance (index);
+if (instanceSize >= axisCount * 4 + 6)
+  return StructAfter (instance.get_coordinates (axisCount));
+return HB_OT_NAME_ID_INVALID;
+  }
+
+  inline unsigned int get_instance_coords (unsigned int  index,
+  unsigned int *coords_length, /* 
IN/OUT */
+  int  *coords /* OUT 
*/) const
+  {
+if (unlikely (index >= instanceCount))
+{
+  if (coords_length)
+*coords_length = 0;
+  return 0;
+}
+
+if (coords_length && *coords_length)
+{
+  const InstanceRecord  = get_instance (index);
+  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 ();
+}
+return axisCount;
+  }
+
   protected:
   inline hb_array_t get_axes (void) const
   { return hb_array (&(this+firstAxis), axisCount); }
 
-  inline const InstanceRecord * get_first_instance (void) const
-  { return  (get_axes ()); }
+  inline const InstanceRecord _instance (unsigned int i) const
+  {
+if (unlikely (i >= instanceCount)) return Null (InstanceRecord);
+
+   return StructAtOffset ( 
(get_axes ()),
+ i * instanceSize);
+  }
 
   protected:
   FixedVersion<>version;   /* Version of the fvar table
diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc
index 14c73cfd..bb8d2649 100644
--- a/src/hb-ot-var.cc
+++ b/src/hb-ot-var.cc
@@ -116,6 +116,39 @@ hb_ot_var_axis_get_flags (hb_face_t*face,
   return face->table.fvar->get_axis_flags (axis_index);
 }
 
+/*
+ * Named instances.
+ */
+
+unsigned int
+hb_ot_var_get_named_instance_count (hb_face_t *face)
+{
+  return face->table.fvar->get_instance_count ();
+}
+
+hb_ot_name_id_t
+hb_ot_var_named_instance_get_subfamily_name_id (hb_face_t   *face,
+   unsigned int instance_index)
+{
+  return face->table.fvar->get_instance_subfamily_name_id (instance_index);
+}
+
+hb_ot_name_id_t
+hb_ot_var_named_instance_get_postscript_name_id (hb_face_t  *face,
+   unsigned int instance_index)
+{
+  return face->table.fvar->get_instance_postscript_name_id (instance_index);
+}
+
+unsigned int
+hb_ot_var_named_instance_get_design_coords (hb_face_t*face,
+  

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-19 Thread Behdad Esfahbod
 src/hb-dsalgs.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 46c0da820fc313bad8afaf019d2cd9065fa5f514
Author: Behdad Esfahbod 
Date:   Mon Nov 19 13:32:48 2018 -0500

Fix build

diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 8e59fdee..da8aad01 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -603,7 +603,7 @@ struct hb_array_t
   unsigned int len;
 };
 template 
-hb_array_t hb_array (T *array, unsigned int len) { return hb_array_t 
(array, len); }
+inline hb_array_t hb_array (T *array, unsigned int len) { return 
hb_array_t (array, len); }
 
 
 struct HbOpOr
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2018-11-19 Thread Behdad Esfahbod
 docs/harfbuzz-sections.txt  |2 ++
 src/hb-buffer.h |2 ++
 src/hb-dsalgs.hh|6 ++
 src/hb-ot-var-fvar-table.hh |   37 ++---
 src/hb-ot-var.cc|   12 
 src/hb-ot-var.h |   15 ++-
 6 files changed, 58 insertions(+), 16 deletions(-)

New commits:
commit 56c9238d3da8c034336cf80ba37e03e33c493718
Author: Behdad Esfahbod 
Date:   Mon Nov 19 13:09:53 2018 -0500

[fvar] Rewrite sanitize

diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index b4fdd5fa..99d2fd5c 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -101,12 +101,10 @@ struct fvar
 return_trace (version.sanitize (c) &&
  likely (version.major == 1) &&
  c->check_struct (this) &&
+ axisSize == 20 && /* Assumed in our code. */
  instanceSize >= axisCount * 4 + 4 &&
- axisSize <= 1024 && /* Arbitrary, just to simplify overflow 
checks. */
- instanceSize <= 1024 && /* Arbitrary, just to simplify 
overflow checks. */
- c->check_range (this, firstAxis) &&
- c->check_range ( (this, firstAxis),
- axisCount * axisSize + instanceCount * 
instanceSize));
+ get_axes ().sanitize (c) &&
+ c->check_range (get_first_instance (), instanceCount, 
instanceSize));
   }
 
   inline unsigned int get_axis_count (void) const
commit 4a6a692e3ea4fab632a0162c6d513dc151054d8f
Author: Behdad Esfahbod 
Date:   Mon Nov 19 13:04:43 2018 -0500

[fvar] Use hb_array_t for axes

diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 7a207f5d..8e59fdee 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -573,6 +573,10 @@ struct hb_array_t
 
   inline unsigned int get_size (void) const { return len * sizeof (Type); }
 
+  template 
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  { return c->check_array (arrayZ, len); }
+
   template  inline operator  T * (void) const { return arrayZ; }
 
   inline Type * operator & (void) const { return arrayZ; }
@@ -598,6 +602,8 @@ struct hb_array_t
   Type *arrayZ;
   unsigned int len;
 };
+template 
+hb_array_t hb_array (T *array, unsigned int len) { return hb_array_t 
(array, len); }
 
 
 struct HbOpOr
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 66618a5a..b4fdd5fa 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -114,9 +114,6 @@ struct fvar
 
   inline bool get_axis (unsigned int index, hb_ot_var_axis_t *info) const
   {
-if (unlikely (index >= axisCount))
-  return false;
-
 if (info)
 {
   const AxisRecord  = get_axes ()[index];
@@ -133,9 +130,6 @@ struct fvar
 
   inline hb_ot_var_axis_flags_t get_axis_flags (unsigned int index) const
   {
-if (unlikely (index >= axisCount))
-  return (hb_ot_var_axis_flags_t) 0;
-
 const AxisRecord  = get_axes ()[index];
 return (hb_ot_var_axis_flags_t) (unsigned int) axis.flags;
   }
@@ -195,11 +189,11 @@ struct fvar
   }
 
   protected:
-  inline const AxisRecord * get_axes (void) const
-  { return &(this+firstAxis); }
+  inline hb_array_t get_axes (void) const
+  { return hb_array (&(this+firstAxis), axisCount); }
 
-  inline const InstanceRecord * get_instances (void) const
-  { return  (get_axes () + axisCount, 0); }
+  inline const InstanceRecord * get_first_instance (void) const
+  { return  (get_axes ()); }
 
   protected:
   FixedVersion<>version;   /* Version of the fvar table
commit e0097396010c40cf62641cd12ceb12dd5d79c9c7
Author: Behdad Esfahbod 
Date:   Mon Nov 19 12:53:53 2018 -0500

[fvar] Minor

diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 3c8a3da4..66618a5a 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -104,8 +104,8 @@ struct fvar
  instanceSize >= axisCount * 4 + 4 &&
  axisSize <= 1024 && /* Arbitrary, just to simplify overflow 
checks. */
  instanceSize <= 1024 && /* Arbitrary, just to simplify 
overflow checks. */
- c->check_range (this, things) &&
- c->check_range ( (this, things),
+ c->check_range (this, firstAxis) &&
+ c->check_range ( (this, firstAxis),
  axisCount * axisSize + instanceCount * 
instanceSize));
   }
 
@@ -196,7 +196,7 @@ struct fvar
 
   protected:
   inline const AxisRecord * get_axes (void) const
-  { return  (this, things); }
+  { return &(this+firstAxis); }
 
   inline const InstanceRecord * get_instances (void) const
   { return  (get_axes () + axisCount, 0); }
@@ -204,7 +204,8 @@ struct fvar
   protected:
   FixedVersion<>version;   /* Version of the fvar table
 * initially set to 0x0001u */
-  Offset16 things; /* Offset in bytes 

[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 = [i];
+Type *p = [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' - 3 commits

2018-11-16 Thread Behdad Esfahbod
 src/hb-aat-layout.cc |2 +-
 src/hb-open-type.hh  |   22 --
 2 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 0328a1ce41611ed981d41384ae5727479699f3a0
Author: Behdad Esfahbod 
Date:   Fri Nov 16 16:48:28 2018 -0800

Revert b4c61130324455bfd42095b01fa14ac901e441f1

Was causing more trouble than it solved.  We use unsigned for indexing,
and it's not helpful to allow that wrapping to negative integers on
32bit machines.  The only way we could work around it would have been
by accepting int64_t arg, but that's overkill.

Ignore the MSVC 2008 build issue.  We don't support that compiler.

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index bae73da4..c77c25fa 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -339,25 +339,16 @@ struct UnsizedArrayOf
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
 
-  /* Unlikely other places, use "ssize_t i" instead of "unsigned int i" for our
-   * indexing operator.  For three reasons:
-   * 1. For UnsizedArrayOf, it's not totally unimaginable to want to look
-   *at items before the start of current array.
-   * 2. Use the largest type, to help detect overflows.
-   * 3. Fixes MSVC 2008 "overloads have similar conversions" issue with the
-   *built-in operator [] that takes int, in expressions like sizeof 
(array[0])).
-   *I suppose I could fix that by replacing 0 with 0u, but like this fix
-   *more now. */
-  inline const Type& operator [] (ssize_t i) const
+  inline const Type& operator [] (unsigned int i) const
   {
 const Type *p = [i];
-if (unlikely ((0 <= i) != (arrayZ <= p))) return Null (Type); /* 
Over/under-flowed. */
+if (unlikely (p < arrayZ)) return Null (Type); /* Overflowed. */
 return *p;
   }
-  inline Type& operator [] (ssize_t i)
+  inline Type& operator [] (unsigned int i)
   {
 const Type *p = [i];
-if (unlikely ((0 <= i) != (arrayZ <= p))) return Crap (Type); /* 
Over/under-flowed. */
+if (unlikely (p < arrayZ)) return Crap (Type); /* Overflowed. */
 return *p;
   }
 
commit 52f61cdb87b67ef42a25288d8624170d0b6d3a25
Author: Behdad Esfahbod 
Date:   Fri Nov 16 16:41:59 2018 -0800

Detect over/under-flow in UnsizedArray::operator[]

Was causing bad substitutions in mort table because of WordOffsetToIndex()
producing negative numbers that were cast to unsigned int and returned as
large numbers (which was desirable, so they would be rejected), but then
they were cast to int when passed to this operator and acting as small
negative integers, which was bad...

Detect overflow.  Ouch, however, now I see this still fails on 32-bit.
Guess I'm going to revert an earlier change.

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index a14d0f02..bae73da4 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -339,16 +339,27 @@ struct UnsizedArrayOf
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
 
-  /* Unlikely other places, use "int i" instead of "unsigned int i" for our
-   * indexing operator.  For two reasons:
+  /* Unlikely other places, use "ssize_t i" instead of "unsigned int i" for our
+   * indexing operator.  For three reasons:
* 1. For UnsizedArrayOf, it's not totally unimaginable to want to look
*at items before the start of current array.
-   * 2. Fixes MSVC 2008 "overloads have similar conversions" issue with the
+   * 2. Use the largest type, to help detect overflows.
+   * 3. Fixes MSVC 2008 "overloads have similar conversions" issue with the
*built-in operator [] that takes int, in expressions like sizeof 
(array[0])).
*I suppose I could fix that by replacing 0 with 0u, but like this fix
*more now. */
-  inline const Type& operator [] (int i) const { return arrayZ[i]; }
-  inline Type& operator [] (int i) { return arrayZ[i]; }
+  inline const Type& operator [] (ssize_t i) const
+  {
+const Type *p = [i];
+if (unlikely ((0 <= i) != (arrayZ <= p))) return Null (Type); /* 
Over/under-flowed. */
+return *p;
+  }
+  inline Type& operator [] (ssize_t i)
+  {
+const Type *p = [i];
+if (unlikely ((0 <= i) != (arrayZ <= p))) return Crap (Type); /* 
Over/under-flowed. */
+return *p;
+  }
 
   template  inline operator T * (void) { return arrayZ; }
   template  inline operator const T * (void) const { return 
arrayZ; }
commit 6910ff03e66f5f4c9eb5592262d414ef7d91df04
Author: Behdad Esfahbod 
Date:   Fri Nov 16 16:11:02 2018 -0800

[aat] Fix mort shaping

Ouch!

diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index da6908a4..d9580c15 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -215,7 +215,7 @@ hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan,
 return;
   }
 
-  hb_blob_t *mort_blob = font->face->table.morx.get_blob ();
+  hb_blob_t *mort_blob = font->face->table.mort.get_blob ();
   const AAT::mort& mort = *mort_blob->as 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-16 Thread Behdad Esfahbod
 NEWS |   13 -
 configure.ac |2 +-
 src/hb-version.h |4 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit fdb29ab2b0058c9813f9fc44c83dd9048db92d16
Author: Behdad Esfahbod 
Date:   Fri Nov 16 15:38:11 2018 -0800

2.1.2

diff --git a/NEWS b/NEWS
index 04579d68..d72ea3db 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,15 @@
-Overview of changes leading to 2.1.1
+Overview of changes leading to 2.1.2
+Friday, November 16, 2018
+
+- Various internal changes.
+- AAT shaping improvements:
+  o Implement kern table Format 1 state-machine-based kerning.
+  o Implement cross-stream kerning (cursive positioning, etc).
+  o Ignore emptyish GSUB tables (zero scripts) if morx present.
+  o Don't apply GPOS if morx is being applied.  Matches Apple.
+
+
+-Overview of changes leading to 2.1.1
 Monday, November 5, 2018
 
 - AAT improvements:
diff --git a/configure.ac b/configure.ac
index 48ee9ce9..0db1fd0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([HarfBuzz],
-[2.1.1],
+[2.1.2],
 [https://github.com/harfbuzz/harfbuzz/issues/new],
 [harfbuzz],
 [http://harfbuzz.org/])
diff --git a/src/hb-version.h b/src/hb-version.h
index ec150d5d..a18c897c 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 1
+#define HB_VERSION_MICRO 2
 
-#define HB_VERSION_STRING "2.1.1"
+#define HB_VERSION_STRING "2.1.2"
 
 #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'

2018-11-16 Thread Behdad Esfahbod
 src/hb-ot-shape-fallback.cc   |8 
 test/shaping/data/in-house/tests/spaces.tests |   22 +++---
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit cff4c6087fdb667a40f54f20ca3c49251bf076de
Author: Behdad Esfahbod 
Date:   Fri Nov 16 15:04:41 2018 -0800

Fix vertical fallback space sign

Ouch!

Follow-up to cf203af8a33591c163b63dbdf0fd341bc4606190

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

diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index bbc410ad..d3afdffa 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -509,16 +509,16 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t 
*plan HB_UNUSED,
case t::SPACE_EM_6:
case t::SPACE_EM_16:
  if (horizontal)
-   pos[i].x_advance = (font->x_scale + ((int) space_type)/2) / (int) 
space_type;
+   pos[i].x_advance = +(font->x_scale + ((int) space_type)/2) / (int) 
space_type;
  else
-   pos[i].y_advance = (font->y_scale + ((int) space_type)/2) / (int) 
space_type;
+   pos[i].y_advance = -(font->y_scale + ((int) space_type)/2) / (int) 
space_type;
  break;
 
case t::SPACE_4_EM_18:
  if (horizontal)
-   pos[i].x_advance = (int64_t) font->x_scale * 4 / 18;
+   pos[i].x_advance = (int64_t) +font->x_scale * 4 / 18;
  else
-   pos[i].y_advance = (int64_t) font->y_scale * 4 / 18;
+   pos[i].y_advance = (int64_t) -font->y_scale * 4 / 18;
  break;
 
case t::SPACE_FIGURE:
diff --git a/test/shaping/data/in-house/tests/spaces.tests 
b/test/shaping/data/in-house/tests/spaces.tests
index 526d158b..ea909988 100644
--- a/test/shaping/data/in-house/tests/spaces.tests
+++ b/test/shaping/data/in-house/tests/spaces.tests
@@ -18,17 +18,17 @@
 ../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+0020:[gid1=0@-280,0+0,-2048]
 ../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+00A0:[gid1=0@-280,0+0,-2048]
 ../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+1680:[gid0=0@-346,0+0,-2048]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2000:[gid1=0@-280,0+0,1024]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2001:[gid1=0@-280,0+0,2048]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2002:[gid1=0@-280,0+0,1024]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2003:[gid1=0@-280,0+0,2048]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2004:[gid1=0@-280,0+0,683]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2005:[gid1=0@-280,0+0,512]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2006:[gid1=0@-280,0+0,341]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2000:[gid1=0@-280,0+0,-1024]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2001:[gid1=0@-280,0+0,-2048]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2002:[gid1=0@-280,0+0,-1024]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2003:[gid1=0@-280,0+0,-2048]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2004:[gid1=0@-280,0+0,-683]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2005:[gid1=0@-280,0+0,-512]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2006:[gid1=0@-280,0+0,-341]
 ../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2007:[gid1=0@-280,0+0,-2048]
 ../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2008:[gid1=0@-280,0+0,-2048]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2009:[gid1=0@-280,0+0,410]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+200A:[gid1=0@-280,0+0,128]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+2009:[gid1=0@-280,0+0,-410]
+../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+200A:[gid1=0@-280,0+0,-128]
 ../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+202F:[gid1=0@-280,0+0,-1024]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+205F:[gid1=0@-280,0+0,455]
-../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot 
--direction=ttb:U+3000:[gid1=0@-280,0+0,2048]

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

2018-11-16 Thread Behdad Esfahbod
 src/hb-aat-layout-trak-table.hh |2 +-
 src/hb-ot-layout-gdef-table.hh  |2 +-
 src/hb-ot-layout-gsubgpos.hh|2 +-
 src/hb-ot-math-table.hh |2 +-
 src/hb-ot-shape.cc  |8 ++--
 src/hb-ot-var-fvar-table.hh |2 +-
 6 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 7a97f7074052a5d746af29f0743abd20682b09a2
Author: Behdad Esfahbod 
Date:   Fri Nov 16 14:46:40 2018 -0800

Don't apply GPOS if applying morx

That's what Apple does, and it wouldn't degrade our OpenType performance.

Part of https://github.com/harfbuzz/harfbuzz/issues/1348

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 00d4c0b6..ccee8d34 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -126,7 +126,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t  
 ,
 
   if (hb_options ().aat && hb_aat_layout_has_positioning (face))
 plan.apply_kerx = true;
-  else if (!disable_gpos && hb_ot_layout_has_positioning (face))
+  else if (!apply_morx && !disable_gpos && hb_ot_layout_has_positioning (face))
 plan.apply_gpos = true;
   else if (hb_aat_layout_has_positioning (face))
 plan.apply_kerx = true;
commit eafd515639497098436ecf4c7b836e231bced323
Author: Behdad Esfahbod 
Date:   Fri Nov 16 14:45:56 2018 -0800

Prefer morx table if GSUB is empty (no scripts)

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

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 093511ef..00d4c0b6 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -62,7 +62,11 @@ _hb_apply_morx (hb_face_t *face)
   hb_aat_layout_has_substitution (face))
 return true;
 
-  return !hb_ot_layout_has_substitution (face) &&
+  /* Ignore empty GSUB tables. */
+  return (!hb_ot_layout_has_substitution (face) ||
+ !hb_ot_layout_table_get_script_tags (face,
+  HB_OT_TAG_GSUB,
+  0, nullptr, nullptr)) &&
 hb_aat_layout_has_substitution (face);
 }
 
commit aa06574823e27c4dbb378d2467a3e6f6f36af9fe
Author: Behdad Esfahbod 
Date:   Fri Nov 16 14:31:05 2018 -0800

Minor

diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index 3b55967c..91c0f456 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -169,7 +169,7 @@ struct trak
 {
   static const hb_tag_t tableTag = HB_AAT_TAG_trak;
 
-  inline bool has_data (void) const { return version.to_int () != 0; }
+  inline bool has_data (void) const { return version.to_int (); }
 
   inline bool apply (hb_aat_apply_context_t *c) const
   {
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index e6804e6b..22e07f7a 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -348,7 +348,7 @@ struct GDEF
 ComponentGlyph = 4
   };
 
-  inline bool has_data (void) const { return version.to_int () != 0; }
+  inline bool has_data (void) const { return version.to_int (); }
   inline bool has_glyph_classes (void) const { return glyphClassDef != 0; }
   inline unsigned int get_glyph_class (hb_codepoint_t glyph) const
   { return (this+glyphClassDef).get_class (glyph); }
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 82648680..3d70c55c 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -2657,7 +2657,7 @@ struct hb_ot_layout_lookup_accelerator_t
 
 struct GSUBGPOS
 {
-  inline bool has_data (void) const { return version.to_int () != 0; }
+  inline bool has_data (void) const { return version.to_int (); }
   inline unsigned int get_script_count (void) const
   { return (this+scriptList).len; }
   inline const Tag& get_script_tag (unsigned int i) const
diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh
index a28acef7..b8730497 100644
--- a/src/hb-ot-math-table.hh
+++ b/src/hb-ot-math-table.hh
@@ -684,7 +684,7 @@ struct MATH
 {
   static const hb_tag_t tableTag   = HB_OT_TAG_MATH;
 
-  inline bool has_data (void) const { return version.to_int () != 0; }
+  inline bool has_data (void) const { return version.to_int (); }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 96c39c10..6d229c38 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -88,7 +88,7 @@ struct fvar
 {
   static const hb_tag_t tableTag   = HB_OT_TAG_fvar;
 
-  inline bool has_data (void) const { return version.to_int () != 0; }
+  inline bool has_data (void) const { return version.to_int (); }
 
   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'

2018-11-16 Thread Behdad Esfahbod
 src/hb-coretext.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 50d1a41c08ad3508a94240b52df03c383ae8f1f8
Author: Behdad Esfahbod 
Date:   Fri Nov 16 08:52:57 2018 -0500

[coretext] Hopefully the last one

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 0831ecb9..918f649d 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -357,7 +357,7 @@ retry:
 /* Drop and recreate. */
 /* If someone dropped it in the mean time, throw it away and don't touch 
it.
  * Otherwise, destruct it. */
-if (likely (font->data.coretext.cmpexch (data, nullptr)))
+if (likely (font->data.coretext.cmpexch 
(const_cast (data), nullptr)))
   _hb_coretext_shaper_font_data_destroy 
(const_cast (data));
 else
   goto retry;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-16 Thread Behdad Esfahbod
 src/hb-coretext.cc |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0aab861f9cda6fba5ce71562d9f087d924e8a161
Author: Behdad Esfahbod 
Date:   Fri Nov 16 08:43:25 2018 -0500

[coretext] Another round

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index eb1bf545..0831ecb9 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -357,8 +357,8 @@ retry:
 /* 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);
+if (likely (font->data.coretext.cmpexch (data, nullptr)))
+  _hb_coretext_shaper_font_data_destroy 
(const_cast (data));
 else
   goto retry;
   }
@@ -384,7 +384,7 @@ hb_coretext_font_create (CTFontRef ct_font)
   hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));
 
   /* Let there be dragons here... */
-  font->data.coretext.exchange (nullptr, (hb_coretext_font_data_t *) CFRetain 
(ct_font));
+  font->data.coretext.cmpexch (nullptr, (hb_coretext_font_data_t *) CFRetain 
(ct_font));
 
   return font;
 }
@@ -392,7 +392,7 @@ hb_coretext_font_create (CTFontRef ct_font)
 CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font)
 {
-  const hb_coretext_font_data *data = hb_coretext_font_data_sync (font);
+  const hb_coretext_font_data_t *data = hb_coretext_font_data_sync (font);
   return data ? (CTFontRef) data : nullptr;
 }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-16 Thread Behdad Esfahbod
 src/hb-coretext.cc |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 0809b76a9a1d7bd53818df7e83a9c81e664dfe0e
Author: Behdad Esfahbod 
Date:   Fri Nov 16 08:29:47 2018 -0500

[coretext] One more try..

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index b65f5b6e..eb1bf545 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -313,7 +313,7 @@ hb_coretext_font_data_t *
 _hb_coretext_shaper_font_data_create (hb_font_t *font)
 {
   hb_face_t *face = font->face;
-  const hb_coretext_face_data *face_data = face->data.coretext;
+  const hb_coretext_face_data_t *face_data = face->data.coretext;
   if (unlikely (!face_data)) return nullptr;
   CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext;
 
@@ -338,7 +338,7 @@ static const hb_coretext_font_data_t *
 hb_coretext_font_data_sync (hb_font_t *font)
 {
 retry:
-  const hb_coretext_font_data_t *data = font->data.font;
+  const hb_coretext_font_data_t *data = font->data.coretext;
   if (unlikely (!data)) return nullptr;
 
   if (fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem 
(font->ptem)) > .5)
@@ -384,7 +384,7 @@ hb_coretext_font_create (CTFontRef ct_font)
   hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));
 
   /* Let there be dragons here... */
-  HB_SHAPER_DATA (HB_SHAPER, font).set_relaxed ((hb_coretext_font_data_t *) 
CFRetain (ct_font));
+  font->data.coretext.exchange (nullptr, (hb_coretext_font_data_t *) CFRetain 
(ct_font));
 
   return font;
 }
@@ -453,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) hb_coretext_font_data *data = 
hb_coretext_font_data_sync (font);
+  CTFontRef ct_font = (CTFontRef) hb_coretext_font_data_sync (font);
 
   CGFloat ct_font_size = CTFontGetSize (ct_font);
   CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
@@ -1171,7 +1171,7 @@ _hb_coretext_aat_shaper_face_data_create (hb_face_t *face)
 if (hb_blob_get_length (blob))
 {
   hb_blob_destroy (blob);
-  return hb_coretext_shaper_face_data_ensure (face) ? 
(hb_coretext_aat_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr;
+  return face->data.coretext ? (hb_coretext_aat_face_data_t *) 
HB_SHAPER_DATA_SUCCEEDED : nullptr;
 }
 hb_blob_destroy (blob);
   }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-16 Thread Behdad Esfahbod
 src/hb-coretext.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 78bd4475946f2d255539306e4b1115f408c54b54
Author: Behdad Esfahbod 
Date:   Fri Nov 16 04:10:53 2018 -0500

[coretext] One more try

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 85d0be3f..b65f5b6e 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -338,7 +338,7 @@ 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;
+  const hb_coretext_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)
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-16 Thread Behdad Esfahbod
 src/hb-coretext.cc |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit fd27a23c824bbbd4f4c7e75701cc5d287289704b
Author: Behdad Esfahbod 
Date:   Fri Nov 16 03:57:12 2018 -0500

[coretext] Another build fix attemt

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 73d226a8..85d0be3f 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -1154,9 +1154,6 @@ fail:
  * AAT shaper
  */
 
-HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, face);
-HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, font);
-
 /*
  * shaper face data
  */
___
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 && 

[HarfBuzz] harfbuzz: Branch 'master'

2018-11-15 Thread Behdad Esfahbod
 src/hb-coretext.cc |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e3e9547365417e547beec84494c8bf6e4e2947fb
Author: Behdad Esfahbod 
Date:   Fri Nov 16 02:55:29 2018 -0500

[coretext] Unbreak build

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 2d0b..2830a426 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -101,8 +101,8 @@ _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
-);
+// fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem 
(font->ptem)) <= .5
+//);
 
 static CTFontDescriptorRef
 get_last_resort_font_desc (void)
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz: Branch 'master'

2018-11-15 Thread Behdad Esfahbod
 src/hb-coretext.cc   |   17 ++
 src/hb-directwrite.cc|9 ---
 src/hb-face.cc   |   12 
 src/hb-face.hh   |   13 ++---
 src/hb-fallback-shape.cc |5 --
 src/hb-font.cc   |   14 +
 src/hb-font.hh   |   12 ++--
 src/hb-graphite2.cc  |   11 +---
 src/hb-machinery.hh  |   14 ++---
 src/hb-ot-shape.cc   |5 --
 src/hb-shape-plan.cc |4 -
 src/hb-shaper-impl.hh|9 ---
 src/hb-shaper.hh |  117 ---
 src/hb-uniscribe.cc  |   32 
 14 files changed, 127 insertions(+), 147 deletions(-)

New commits:
commit ce5da0f36a2ece29c387810a060531df15ad6c7b
Author: Behdad Esfahbod 
Date:   Fri Nov 16 02:29:13 2018 -0500

[shaper] Rewrite shaper data code to be more template-driven than 
macro-driven

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 3cedb5b2..2d0b 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -26,8 +26,6 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#define HB_SHAPER coretext
-
 #include "hb.hh"
 #include "hb-shaper-impl.hh"
 
@@ -101,8 +99,8 @@ _hb_cg_font_release (void *data)
 }
 
 
-HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face);
-HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
+/* XXX TODO */
+//HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem 
(font->ptem)) <= .5
 );
 
@@ -312,8 +310,7 @@ hb_coretext_face_create (CGFontRef cg_font)
 CGFontRef
 hb_coretext_face_get_cg_font (hb_face_t *face)
 {
-  if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr;
-  return (CGFontRef) HB_SHAPER_DATA_GET (face);
+  return (CGFontRef) (const void *) face->data.coretext;
 }
 
 
@@ -322,7 +319,7 @@ _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;
-  CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face);
+  CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext;
 
   CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size_from_ptem 
(font->ptem));
 
@@ -368,7 +365,7 @@ CTFontRef
 hb_coretext_font_get_ct_font (hb_font_t *font)
 {
   if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
-  return (CTFontRef) HB_SHAPER_DATA_GET (font);
+  return (CTFontRef) (const void *) font->data.coretext;
 }
 
 
@@ -427,8 +424,8 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan,
 unsigned intnum_features)
 {
   hb_face_t *face = font->face;
-  CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face);
-  CTFontRef ct_font = (CTFontRef) HB_SHAPER_DATA_GET (font);
+  CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext;
+  CTFontRef ct_font = (CTFontRef) (const void *) font->data.coretext;
 
   CGFloat ct_font_size = CTFontGetSize (ct_font);
   CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index b34ae601..4ae6e7f5 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -23,7 +23,6 @@
  */
 
 #include "hb.hh"
-#define HB_SHAPER directwrite
 #include "hb-shaper-impl.hh"
 
 #include 
@@ -31,10 +30,6 @@
 #include "hb-directwrite.h"
 
 
-HB_SHAPER_DATA_ENSURE_DEFINE (directwrite, face);
-HB_SHAPER_DATA_ENSURE_DEFINE (directwrite, font);
-
-
 /*
  * hb-directwrite uses new/delete syntatically but as we let users
  * to override malloc/free, we will redefine new/delete so users
@@ -534,8 +529,8 @@ _hb_directwrite_shape_full (hb_shape_plan_t*shape_plan,
   float   lineWidth)
 {
   hb_face_t *face = font->face;
-  hb_directwrite_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-  hb_directwrite_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
+  const hb_directwrite_face_data_t *face_data = face->data.directwrite;
+  const hb_directwrite_font_data_t *font_data = font->data.directwrite;
   IDWriteFactory *dwriteFactory = face_data->dwriteFactory;
   IDWriteFontFace *fontFace = face_data->fontFace;
 
diff --git a/src/hb-face.cc b/src/hb-face.cc
index 3294ed4c..e23842fb 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -90,12 +90,6 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
   HB_ATOMIC_INT_INIT (1000), /* upem */
   HB_ATOMIC_INT_INIT (0),/* num_glyphs */
 
-  {
-#define HB_SHAPER_IMPLEMENT(shaper) HB_ATOMIC_PTR_INIT 
(HB_SHAPER_DATA_INVALID),
-#include "hb-shaper-list.hh"
-#undef HB_SHAPER_IMPLEMENT
-  },
-
   /* Zero for the rest is fine. */
 };
 
@@ -131,6 +125,7 @@ hb_face_create_for_tables (hb_reference_table_func_t  
reference_table_func,
 
   face->num_glyphs.set_relaxed (-1);
 
+  face->data.init0 (face);
   face->table.init0 (face);
 
   return face;
@@ -272,10 +267,7 @@ hb_face_destroy (hb_face_t *face)
 node = next;
   }
 
-#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_DESTROY(shaper, face);
-#include "hb-shaper-list.hh"

[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 (>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 (>dataZ, i * sizeDeviceRecord);
+return StructAtOffset (>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' - 3 commits

2018-11-15 Thread Behdad Esfahbod
 src/hb-open-type.hh|   70 +--
 src/hb-ot-cmap-table.hh|  182 +++---
 src/hb-ot-glyf-table.hh|  242 +++--
 src/hb-ot-hdmx-table.hh|   20 +--
 src/hb-ot-hmtx-table.hh|   14 +-
 src/hb-ot-layout-common.hh |   77 +
 src/hb-ot-layout-gpos-table.hh |   16 +-
 src/hb-ot-layout-gsub-table.hh |4 
 src/hb-ot-layout-gsubgpos.hh   |   88 +++---
 src/hb-ot-math-table.hh|   28 ++--
 src/hb-ot-os2-table.hh |   24 ++--
 src/hb-ot-post-table.hh|   26 +---
 src/hb-subset-glyf.cc  |  182 +++---
 src/hb-subset-glyf.hh  |6 -
 src/hb-subset-input.cc |4 
 src/hb-subset-plan.cc  |   45 ---
 src/hb-subset-plan.hh  |   12 +-
 src/hb-subset.cc   |   46 +++
 src/hb-subset.h|7 -
 util/hb-subset.cc  |2 
 20 files changed, 537 insertions(+), 558 deletions(-)

New commits:
commit 9e9f16c92debecb4caf533fa112898dfec116d98
Author: Behdad Esfahbod 
Date:   Fri Nov 16 01:48:26 2018 -0500

[subset] Remove invalid glyphs from glypset to retain

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

diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index 6b526222..56a2bba5 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -67,6 +67,17 @@ _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain)
   gids_to_retain);
 }
 
+static void
+_remove_invalid_gids (hb_set_t *glyphs,
+ unsigned int num_glyphs)
+{
+  hb_codepoint_t gid = HB_SET_VALUE_INVALID;
+  while (glyphs->next ())
+  {
+if (gid >= num_glyphs)
+  glyphs->del (gid);
+  }
+}
 
 static hb_set_t *
 _populate_gids_to_retain (hb_face_t *face,
@@ -112,6 +123,8 @@ _populate_gids_to_retain (hb_face_t *face,
   }
   hb_set_destroy (initial_gids_to_retain);
 
+  _remove_invalid_gids (all_gids_to_retain, face->get_num_glyphs ());
+
   glyphs->alloc (all_gids_to_retain->get_population ());
   gid = HB_SET_VALUE_INVALID;
   while (all_gids_to_retain->next ())
commit 11aa0468ac2c62ff734ba6b0f6eb43d1bd6f602b
Author: Ebrahim Byagowi 
Date:   Thu Nov 15 23:10:56 2018 +0330

[subset] minor, adjust spaces

diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 3f8e2c08..a14d0f02 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -58,7 +58,7 @@ struct IntType
 {
   typedef Type type;
   inline void set (Type i) { v.set (i); }
-  inline operator Type(void) const { return v; }
+  inline operator Type (void) const { return v; }
   inline bool operator == (const IntType ) const { return (Type) 
v == (Type) o.v; }
   inline bool operator != (const IntType ) const { return !(*this 
== o); }
   static inline int cmp (const IntType *a, const IntType 
*b) { return b->cmp (*a); }
@@ -173,7 +173,7 @@ struct Offset : Type
   }
 
   public:
-  DEFINE_SIZE_STATIC (sizeof(Type));
+  DEFINE_SIZE_STATIC (sizeof (Type));
 };
 
 typedef Offset Offset16;
@@ -211,7 +211,7 @@ struct CheckSum : HBUINT32
 template 
 struct FixedVersion
 {
-  inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 
8)) + minor; }
+  inline uint32_t to_int (void) const { return (major << (sizeof (FixedType) * 
8)) + minor; }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -222,7 +222,7 @@ struct FixedVersion
   FixedType major;
   FixedType minor;
   public:
-  DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
+  DEFINE_SIZE_STATIC (2 * sizeof (FixedType));
 };
 
 
@@ -241,12 +241,12 @@ struct OffsetTo : Offset
 
   inline const Type& operator () (const void *base) const
   {
-if (unlikely (this->is_null ())) return Null(Type);
+if (unlikely (this->is_null ())) return Null (Type);
 return StructAtOffset (base, *this);
   }
   inline Type& operator () (void *base) const
   {
-if (unlikely (this->is_null ())) return Crap(Type);
+if (unlikely (this->is_null ())) return Crap (Type);
 return StructAtOffset (base, *this);
   }
 
@@ -258,7 +258,7 @@ struct OffsetTo : Offset
   template 
   inline void serialize_subset (hb_subset_context_t *c, const T , const 
void *base)
   {
-if ( == (T))
+if ( ==  (T))
 {
   this->set (0);
   return;
@@ -319,7 +319,7 @@ struct OffsetTo : Offset
 if (!has_null) return false;
 return c->try_set (this, 0);
   }
-  DEFINE_SIZE_STATIC (sizeof(OffsetType));
+  DEFINE_SIZE_STATIC (sizeof (OffsetType));
 };
 template  struct LOffsetTo : OffsetTo {};
 template 
@@ -344,7 +344,7 @@ struct UnsizedArrayOf
* 1. For UnsizedArrayOf, it's not totally unimaginable to want to look
*at items before the start of current array.
* 2. Fixes MSVC 2008 "overloads have similar conversions" issue with the
-   *built-in operator [] that takes int, in expressions like 
sizeof(array[0])).
+   *built-in operator [] that takes int, in 

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

2018-11-14 Thread Behdad Esfahbod
 src/Makefile.sources   |1 
 src/hb-aat-layout-common.hh|4 
 src/hb-aat-layout.cc   |8 -
 src/hb-aat-layout.hh   |6 
 src/hb-ot-face.hh  |2 
 src/hb-ot-font.cc  |4 
 src/hb-ot-hmtx-table.hh|   11 -
 src/hb-ot-layout-base-table.hh |9 -
 src/hb-ot-layout.cc|2 
 src/hb-ot-layout.hh|2 
 src/hb-ot-shape.cc |   44 --
 src/hb-ot-shape.hh |6 
 src/hb-ot-stat-table.hh|  280 +
 src/hb-shape-plan.cc   |2 
 src/hb-shape.cc|2 
 src/hb-shaper.cc   |   16 +-
 src/hb-shaper.hh   |4 
 17 files changed, 351 insertions(+), 52 deletions(-)

New commits:
commit cabe433fbb81d314ad9e3cbed768dd13983a4477
Author: Behdad Esfahbod 
Date:   Thu Nov 15 02:48:50 2018 -0500

[base] Add TODO items

diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh
index 582e6015..fb57e762 100644
--- a/src/hb-ot-layout-base-table.hh
+++ b/src/hb-ot-layout-base-table.hh
@@ -198,6 +198,7 @@ struct MinMax
   const BaseCoord **min,
   const BaseCoord **max) const
   {
+/* TODO Replace hb_bsearch() with .bsearch(). */
 const FeatMinMaxRecord *minMaxCoord = (const FeatMinMaxRecord *)
  hb_bsearch (_tag, 
featMinMaxRecords.arrayZ,
  featMinMaxRecords.len,
@@ -230,7 +231,7 @@ struct MinMax
maxCoord;   /* Offset to BaseCoord table that defines
 * maximum extent value, from the beginning
 * of MinMax table (may be NULL) */
-  ArrayOf
+  SortedArrayOf
featMinMaxRecords;
/* Array of FeatMinMaxRecords, in alphabetical
 * order by featureTableTag */
@@ -302,6 +303,7 @@ struct BaseScript
 {
   inline const MinMax _min_max (hb_tag_t language_tag) const
   {
+/* TODO Replace hb_bsearch() with .bsearch(). */
 const BaseLangSysRecord* record = (const BaseLangSysRecord *)
  hb_bsearch (_tag, 
baseLangSysRecords.arrayZ,
  baseLangSysRecords.len,
@@ -332,7 +334,7 @@ struct BaseScript
   OffsetTo
defaultMinMax;  /* Offset to MinMax table, from beginning of
 * BaseScript table (may be NULL) */
-  ArrayOf
+  SortedArrayOf
baseLangSysRecords;
/* Number of BaseLangSysRecords
 * defined — may be zero (0) */
@@ -377,6 +379,7 @@ struct BaseScriptList
 {
   inline const BaseScriptRecord *find_record (hb_tag_t script) const
   {
+/* TODO Replace hb_bsearch() with .bsearch(). */
 return (const BaseScriptRecord *) hb_bsearch (, 
baseScriptRecords.arrayZ,
  baseScriptRecords.len,
  BaseScriptRecord::static_size,
@@ -400,7 +403,7 @@ struct BaseScriptList
   }
 
   protected:
-  ArrayOf
+  SortedArrayOf
baseScriptRecords;
 
   public:
commit 3bf1ce748fa89316dd32de28bfdc636495e657fb
Author: Behdad Esfahbod 
Date:   Wed Nov 14 21:08:54 2018 -0500

[shaper] Rename

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index acb589ad..460d77b5 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -108,7 +108,7 @@ hb_shape_plan_key_t::init (bool   
copy,
   }
   else
   {
-const hb_shaper_pair_static_t *shapers = _hb_shapers_get ();
+const hb_shaper_entry_t *shapers = _hb_shapers_get ();
 for (unsigned int i = 0; i < HB_SHAPERS_COUNT; i++)
   if (false)
;
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 325be0f1..270da3d7 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -63,7 +63,7 @@ static struct hb_shaper_list_lazy_loader_t : 
hb_lazy_loader_t
 {
-  static inline hb_shaper_pair_static_t *create (void)
+  static inline hb_shaper_entry_t *create (void)
   {
 char *env = getenv ("HB_SHAPER_LIST");
 if (!env || !*env)
   return nullptr;
 
-hb_shaper_pair_static_t *shapers = (hb_shaper_pair_static_t *) calloc (1, 
sizeof (all_shapers));
+hb_shaper_entry_t *shapers = (hb_shaper_entry_t *) calloc (1, sizeof 
(all_shapers));
 if (unlikely (!shapers))
   return nullptr;
 
@@ -68,7 +68,7 @@ static struct hb_shapers_lazy_loader_t : 
hb_lazy_loader_t
Date:   Wed Nov 14 14:49:34 2018 -0500

[ot-shape] Move code around

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index adc7538c..6572b26d 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -801,7 +801,7 @@ struct hb_aat_apply_context_t :
   static return_t 

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

2018-11-14 Thread Behdad Esfahbod
 src/hb-ot-color.cc
|2 +-
 src/hb-ot-hmtx-table.hh   
|6 +++---
 test/shaping/data/in-house/fonts/dcf774ca21062e7439f98658b18974ea8b956d0c.ttf 
|binary
 test/shaping/data/in-house/tests/use.tests
|1 +
 4 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 48d16c2ab2b181c733accd4fd9730963e59b6323
Author: Behdad Esfahbod 
Date:   Wed Nov 14 09:56:30 2018 -0500

[hmtx] Fix signedness issue

Fixes 
https://github.com/harfbuzz/harfbuzz/issues/1248#issuecomment-438689499

diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index 20948edb..80994c15 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -289,9 +289,9 @@ struct hmtxvmtx
 
 public:
 bool has_font_extents;
-unsigned short ascender;
-unsigned short descender;
-unsigned short line_gap;
+int ascender;
+int descender;
+int line_gap;
 
 protected:
 unsigned int num_metrics;
commit 29db2a44a6b7a28ade5e288779dbf5a200b43acd
Author: Ebrahim Byagowi 
Date:   Wed Nov 14 12:13:16 2018 +0330

[ot-color/svg] Note that it can be gzipped

diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc
index cac289b2..791135b1 100644
--- a/src/hb-ot-color.cc
+++ b/src/hb-ot-color.cc
@@ -238,7 +238,7 @@ hb_ot_color_has_svg (hb_face_t *face)
  * @face:  a font face.
  * @glyph: a svg glyph index.
  *
- * Get SVG document for a glyph.
+ * Get SVG document for a glyph. The blob may be either plain text or 
gzip-encoded.
  *
  * Returns: (transfer full): respective svg blob of the glyph, if available.
  *
commit a9c27d576ffe4452d1a3dae73964a8f4d6dcc088
Merge: 3c3eb5ea e543e1a0
Author: Ebrahim Byagowi 
Date:   Wed Nov 14 08:29:17 2018 +0330

Merge pull request #1383 from punchcutter/master

Add test for https://github.com/harfbuzz/harfbuzz/issues/1379

commit e543e1a0858bb5d7384d82600a789d40b62d9821
Author: punchcutter 
Date:   Tue Nov 13 20:44:27 2018 -0800

Add Grantha test

diff --git 
a/test/shaping/data/in-house/fonts/dcf774ca21062e7439f98658b18974ea8b956d0c.ttf 
b/test/shaping/data/in-house/fonts/dcf774ca21062e7439f98658b18974ea8b956d0c.ttf
new file mode 100644
index ..4d3e11d5
Binary files /dev/null and 
b/test/shaping/data/in-house/fonts/dcf774ca21062e7439f98658b18974ea8b956d0c.ttf 
differ
diff --git a/test/shaping/data/in-house/tests/use.tests 
b/test/shaping/data/in-house/tests/use.tests
index 4b46620b..18d1991e 100644
--- a/test/shaping/data/in-house/tests/use.tests
+++ b/test/shaping/data/in-house/tests/use.tests
@@ -8,3 +8,4 @@
 
../fonts/2a670df15b73a5dc75a5cc491bde5ac93c5077dc.ttf::U+11124,U+11134,U+11131:[u11124=0+514|u11134=0+0|u11131=0+0]
 
../fonts/2a670df15b73a5dc75a5cc491bde5ac93c5077dc.ttf::U+11124,U+11131,U+11134:[u11124=0+514|u11131=0+0|uni25CC=0+547|u11134=0+0]
 
../fonts/573d3a3177c9a8646e94c8a0d7b224334340946a.ttf:--font-funcs=ft:U+11410,U+11442,U+11411,U+11440,U+11443,U+11410,U+11442,U+11411,U+11441,U+11443:[E_dv.alt=0+275|Ga.icd=0+367|Gha.diag=0@100,0+386|AA_dv.alt=0+208|Candrabindu=0@17,-8+0|E_dv.alt=5+275|Ga.icd=5+367|Gha.diag=5@100,0+386|AU_dv_part.alt=5+213|Candrabindu.sm=5@-52,179+0]
+../fonts/dcf774ca21062e7439f98658b18974ea8b956d0c.ttf::U+11328,U+1134D,U+1CF4:[gid1=0+793|gid2=0+0|gid3=0+0]
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz


  1   2   3   4   5   6   7   8   9   10   >