Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-09-07 Thread Behdad Esfahbod
On 09/06/2012 10:39 PM, Harshula wrote:
 On Thu, 2012-09-06 at 15:17 -0400, Behdad Esfahbod wrote:
 On 09/06/2012 02:47 PM, Harshula wrote:
ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
 +  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);
 Why is the length chars_len + 2?

 1. I *think* old harfbuzz also adds a final entry to that array,
 2. It's widely reported (from Chromium people for example) that some of the
 old HarfBuzz backends (Tibetan IIRC) make an off-by-one access past that 
 array.

 In short: to be on the safe side.
 
 OK. Also when you calculate num_glyphs that will fit in the scratch
 space:
 
   ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
   ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);
 
  unsigned int num_glyphs = scratch_size  / (sizeof (HB_Glyph) +
 sizeof (HB_GlyphAttributes) +
 sizeof (HB_Fixed) +
 sizeof (HB_FixedPoint) +
 sizeof (uint32_t));
 
   ALLOCATE_ARRAY (HB_Glyph, item.glyphs, num_glyphs);
   ALLOCATE_ARRAY (HB_GlyphAttributes, item.attributes, num_glyphs);
   ALLOCATE_ARRAY (HB_Fixed, item.advances, num_glyphs);
   ALLOCATE_ARRAY (HB_FixedPoint, item.offsets, num_glyphs);
   ALLOCATE_ARRAY (uint32_t, vis_clusters, num_glyphs);
 
 shouldn't you first subtract the space consumed by the already allocated
 arrays for item.string and item.log_clusters? For example:

No.  The ALLOCATE_ARRAY does that already.

b
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-09-06 Thread Harshula
On Wed, 2012-07-25 at 16:21 -0700, Behdad Esfahbod wrote:
 src/hb-old.cc|   51 
 +--
  src/hb-old/harfbuzz-shaper.h |1 
  src/hb-uniscribe.cc  |5 ++--
  3 files changed, 44 insertions(+), 13 deletions(-)
 
 New commits:
 commit 91e721ea8693205f4f738bca97a5055ee75cf463
 Author: Behdad Esfahbod beh...@behdad.org
 Date:   Wed Jul 25 19:20:34 2012 -0400
 
 [hb-old] Fix clusters
 
 Unlike its documentation, hb-old's log_clusters are, well, indeed
 logical, not visual.  Fixup.  Adapted / copied from hb-uniscribe.

snip

HB_ShaperItem item = {0};
  
ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
 +  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);

Why is the length chars_len + 2?

Exactly what should be the correct length is not clear from:

struct HB_ShaperItem_ {
...
246 hb_uint32 num_glyphs;   /* input: capacity of
output arrays glyphs, attributes, advances, offsets, and
log_clusters; */
247 /* output: required
capacity (may be larger than actual capacity) */
...
249 HB_Glyph *glyphs;   /* output: num_glyphs
indicesof shaped glyphs */
250 HB_GlyphAttributes *attributes; /* output: num_glyphs
glyph attributes */
251 HB_Fixed *advances; /* output: num_glyphs
advances */
252 HB_FixedPoint *offsets; /* output: num_glyphs
offsets */
253 unsigned short *log_clusters;   /* output: for each
output glyph, the index in the input of the start of its logical cluster
*/
254 /* XXX the discription for log_clusters is wrong.  It maps each
input position to output glyph position! */
255 
...
};

= hb_uint32 num_glyphs; /* input: capacity of output arrays glyphs,
attributes, advances, offsets, and log_clusters; */

= XXX the discription for log_clusters is wrong.  It maps each input
position to output glyph position!

But looking at src/hb-old/harfbuzz-indic.cpp:

1198 static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem
*item, bool invalid)
...
1208 int len = (int)item-item.length;
...
1211 if ((int)item-num_glyphs  len+4) {
1212 item-num_glyphs = len+4;
1213 return false;
1214 }
...
1554 HB_STACKARRAY(unsigned short, clusters, len);
...
1643 item-log_clusters = clusters;
...
1678 while (i  item-num_glyphs) {
1679 if (form(reordered[otl_glyphs[i].cluster]) ==
Control) {
1680 ++i;
1681 if (i = item-num_glyphs)
1682 break;
1683 }
1684 item-glyphs[j] = item-glyphs[i];
1685 item-attributes[j] = item-attributes[i];
1686 item-offsets[j] = item-offsets[i];
1687 item-advances[j] = item-advances[i];
1688 ++i;
1689 ++j;
1690 }

= item's log_clusters array has a length of item.item.length
= item's glyphs, attributes, offsets, advances arrays have a length of
item.num_glyphs.

and looking at src/hb-old.cc:

_hb_old_shape (hb_shape_plan_t*shape_plan,
...
  item.stringLength = chars_len;
...
  item.item.length = item.stringLength;

= item.item.length is chars_len.

So the chars_len + 2 probably should just be chars_len in:

272 _hb_old_shape (hb_shape_plan_t*shape_plan,
...
316   ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);


cya,
#

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-09-06 Thread Behdad Esfahbod
On 09/06/2012 02:47 PM, Harshula wrote:
 ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
  +  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);
 Why is the length chars_len + 2?

1. I *think* old harfbuzz also adds a final entry to that array,
2. It's widely reported (from Chromium people for example) that some of the
old HarfBuzz backends (Tibetan IIRC) make an off-by-one access past that array.

In short: to be on the safe side.

behdad
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-09-06 Thread Harshula
On Thu, 2012-09-06 at 15:17 -0400, Behdad Esfahbod wrote:
 On 09/06/2012 02:47 PM, Harshula wrote:
  ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
   +  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);
  Why is the length chars_len + 2?
 
 1. I *think* old harfbuzz also adds a final entry to that array,
 2. It's widely reported (from Chromium people for example) that some of the
 old HarfBuzz backends (Tibetan IIRC) make an off-by-one access past that 
 array.
 
 In short: to be on the safe side.

OK. Also when you calculate num_glyphs that will fit in the scratch
space:

  ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);

 unsigned int num_glyphs = scratch_size  / (sizeof (HB_Glyph) +
sizeof (HB_GlyphAttributes) +
sizeof (HB_Fixed) +
sizeof (HB_FixedPoint) +
sizeof (uint32_t));

  ALLOCATE_ARRAY (HB_Glyph, item.glyphs, num_glyphs);
  ALLOCATE_ARRAY (HB_GlyphAttributes, item.attributes, num_glyphs);
  ALLOCATE_ARRAY (HB_Fixed, item.advances, num_glyphs);
  ALLOCATE_ARRAY (HB_FixedPoint, item.offsets, num_glyphs);
  ALLOCATE_ARRAY (uint32_t, vis_clusters, num_glyphs);

shouldn't you first subtract the space consumed by the already allocated
arrays for item.string and item.log_clusters? For example:

  unsigned int num_glyphs = (scratch_size 
 - (chars_len * sizeof (HB_UChar16))
 - ((chars_len + 2) * sizeof (unsigned short)))
 / (sizeof (HB_Glyph) +
sizeof (HB_GlyphAttributes) +
sizeof (HB_Fixed) +
sizeof (HB_FixedPoint) +
sizeof (uint32_t));

I noted that the test cases I had tried this on, num_glyphs would change
from N to N-1.

cya,
#

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-08-11 Thread Behdad Esfahbod
 TODO   |4 +
 src/hb-ot-shape-complex-arabic.cc  |  110 +
 src/hb-ot-shape-complex-indic.cc   |1 
 src/hb-ot-shape-complex-misc.cc|   12 ++--
 src/hb-ot-shape-complex-private.hh |   15 -
 src/hb-ot-shape-fallback.cc|   22 ++-
 src/hb-ot-shape.cc |3 +
 7 files changed, 123 insertions(+), 44 deletions(-)

New commits:
commit 9f9f04c2229227bb0712166e824157bbbf5cef80
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Aug 11 18:34:13 2012 -0400

[OT] Unbreak Thai shaping and fallback Arabic shaping

The merger of normalizer and glyph-mapping broke shapers that
modified text stream.  Unbreak them by adding a new preprocess_text
shaping stage that happens before normalizing/cmap and disallow
setup_mask modification of actual text.

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index e0db41c..e1a2791 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -274,12 +274,8 @@ arabic_fallback_shape (hb_font_t *font, hb_buffer_t 
*buffer)
 }
 
 static void
-setup_masks_arabic (const hb_ot_shape_plan_t *plan,
-   hb_buffer_t  *buffer,
-   hb_font_t*font)
+arabic_joining (hb_buffer_t *buffer)
 {
-  const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) 
plan-data;
-
   unsigned int count = buffer-len;
   unsigned int prev = 0, state = 0;
 
@@ -305,14 +301,37 @@ setup_masks_arabic (const hb_ot_shape_plan_t *plan,
 state = entry-next_state;
   }
 
-  if (likely (!arabic_plan-do_fallback)) {
-/* Has OpenType tables */
-for (unsigned int i = 0; i  count; i++)
-  buffer-info[i].mask |= 
arabic_plan-mask_array[buffer-info[i].arabic_shaping_action()];
-  } else
+  HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
+}
+
+static void
+preprocess_text_arabic (const hb_ot_shape_plan_t *plan,
+   hb_buffer_t  *buffer,
+   hb_font_t*font)
+{
+  const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) 
plan-data;
+
+  if (unlikely (arabic_plan-do_fallback))
+  {
+arabic_joining (buffer);
 arabic_fallback_shape (font, buffer);
+  }
+}
 
-  HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
+static void
+setup_masks_arabic (const hb_ot_shape_plan_t *plan,
+   hb_buffer_t  *buffer,
+   hb_font_t*font)
+{
+  const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) 
plan-data;
+
+  if (likely (!arabic_plan-do_fallback))
+  {
+arabic_joining (buffer);
+unsigned int count = buffer-len;
+for (unsigned int i = 0; i  count; i++)
+  buffer-info[i].mask |= 
arabic_plan-mask_array[buffer-info[i].arabic_shaping_action()];
+  }
 }
 
 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
@@ -322,6 +341,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
   NULL, /* override_features */
   data_create_arabic,
   data_destroy_arabic,
+  preprocess_text_arabic,
   NULL, /* normalization_preference */
   setup_masks_arabic,
   true, /* zero_width_attached_marks */
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 4f9a5af..6fbd5c8 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1134,6 +1134,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
   override_features_indic,
   data_create_indic,
   data_destroy_indic,
+  NULL, /* preprocess_text */
   NULL, /* normalization_preference */
   setup_masks_indic,
   false, /* zero_width_attached_marks */
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 4f1dd5b..13bc22b 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010  Google, Inc.
+ * Copyright © 2010,2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -90,6 +90,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
   NULL, /* override_features */
   NULL, /* data_create */
   NULL, /* data_destroy */
+  NULL, /* preprocess_text */
   normalization_preference_default,
   NULL, /* setup_masks */
   true, /* zero_width_attached_marks */
@@ -99,9 +100,9 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
 /* Thai / Lao shaper */
 
 static void
-setup_masks_thai (const hb_ot_shape_plan_t *plan HB_UNUSED,
- hb_buffer_t  *buffer,
- hb_font_t*font HB_UNUSED)
+preprocess_text_thai (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_buffer_t  *buffer,
+ hb_font_t*font HB_UNUSED)
 {
   /* The following is NOT specified in the MS OT Thai spec, however, it seems
* to be what Uniscribe and 

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

2012-08-11 Thread Behdad Esfahbod
 TODO  |1 
 configure.ac  |2 +
 src/hb-buffer.cc  |9 ++---
 src/hb-glib.cc|   26 ++-
 src/hb-icu.cc |   75 --
 src/hb-unicode-private.hh |   13 +--
 src/hb-unicode.cc |   35 -
 src/hb-warning.cc |8 
 8 files changed, 113 insertions(+), 56 deletions(-)

New commits:
commit b7a4d37d0b162fb65d09b9271b8c636086f8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Aug 11 21:32:23 2012 -0400

minor

diff --git a/configure.ac b/configure.ac
index 7246d1a..5a2f854 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,6 +152,8 @@ AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
 
 dnl ==
 
+dnl The following check is misleading since it would print ICU...no if there's
+dnl no pkgconfig file for icu.
 PKG_CHECK_MODULES(ICU, icu, have_icu=true, [
have_icu=true
AC_CHECK_HEADERS(unicode/uchar.h,, have_icu=false)
commit d5045a5f4017631a4660f985fe451c5a64c42ca0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Aug 11 21:26:25 2012 -0400

[ICU] Use new normalizer2 compose/decompose API

It's considerably faster than the fallback implementation we had
previously!

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index db4edce..eddd5d0 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -37,8 +37,6 @@
 #define HB_DEBUG_BUFFER (HB_DEBUG+0)
 #endif
 
-#define _HB_BUFFER_UNICODE_FUNCS_DEFAULT (const_casthb_unicode_funcs_t * 
(_hb_unicode_funcs_default))
-
 /* Here is how the buffer works internally:
  *
  * There are two info pointers: info and out_info.  They always have
@@ -144,7 +142,7 @@ hb_buffer_t::reset (void)
 return;
 
   hb_unicode_funcs_destroy (unicode);
-  unicode = _HB_BUFFER_UNICODE_FUNCS_DEFAULT;
+  unicode = hb_unicode_funcs_get_default ();
 
   hb_segment_properties_t default_props = _HB_BUFFER_PROPS_DEFAULT;
   props = default_props;
@@ -552,7 +550,7 @@ hb_buffer_get_empty (void)
   static const hb_buffer_t _hb_buffer_nil = {
 HB_OBJECT_HEADER_STATIC,
 
-_HB_BUFFER_UNICODE_FUNCS_DEFAULT,
+const_casthb_unicode_funcs_t * (_hb_unicode_funcs_nil),
 _HB_BUFFER_PROPS_DEFAULT,
 
 true, /* in_error */
@@ -608,7 +606,8 @@ hb_buffer_set_unicode_funcs (hb_buffer_t*buffer,
 return;
 
   if (!unicode)
-unicode = _HB_BUFFER_UNICODE_FUNCS_DEFAULT;
+unicode = hb_unicode_funcs_get_default ();
+
 
   hb_unicode_funcs_reference (unicode);
   hb_unicode_funcs_destroy (buffer-unicode);
diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index 7af92cc..0462758 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -250,9 +250,6 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
   /* We don't ifdef-out the fallback code such that compiler always
* sees it and makes sure it's compilable. */
 
-  if (!a || !b)
-return false;
-
   gchar utf8[12];
   gchar *normalized;
   int len;
@@ -367,22 +364,21 @@ hb_glib_unicode_decompose_compatibility 
(hb_unicode_funcs_t *ufuncs,
   return utf8_decomposed_len;
 }
 
-extern HB_INTERNAL const hb_unicode_funcs_t _hb_glib_unicode_funcs;
-const hb_unicode_funcs_t _hb_glib_unicode_funcs = {
-  HB_OBJECT_HEADER_STATIC,
+hb_unicode_funcs_t *
+hb_glib_get_unicode_funcs (void)
+{
+  static const hb_unicode_funcs_t _hb_glib_unicode_funcs = {
+HB_OBJECT_HEADER_STATIC,
 
-  NULL, /* parent */
-  true, /* immutable */
-  {
+NULL, /* parent */
+true, /* immutable */
+{
 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_glib_unicode_##name,
-HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
+  HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_UNICODE_FUNC_IMPLEMENT
-  }
-};
+}
+  };
 
-hb_unicode_funcs_t *
-hb_glib_get_unicode_funcs (void)
-{
   return const_casthb_unicode_funcs_t * (_hb_glib_unicode_funcs);
 }
 
diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index 5e92058..4bb7af2 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -33,7 +33,7 @@
 
 #include hb-unicode-private.hh
 
-#include unicode/uversion.h
+#include unicode/uvernum.h
 #include unicode/uchar.h
 #include unicode/unorm.h
 #include unicode/ustring.h
@@ -164,6 +164,10 @@ hb_icu_unicode_script (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
   return hb_icu_script_to_script (scriptCode);
 }
 
+#if U_ICU_VERSION_MAJOR_NUM = 49
+static const UNormalizer2 *normalizer;
+#endif
+
 static hb_bool_t
 hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t  a,
@@ -171,8 +175,17 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
hb_codepoint_t *ab,
void   *user_data HB_UNUSED)
 {
-  if (!a || !b)
-return false;
+#if U_ICU_VERSION_MAJOR_NUM = 49
+  {
+UChar32 ret = unorm2_composePair (normalizer, a, b);
+if (ret  0) return false;
+*ab = ret;
+return true;
+  }

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

2012-08-10 Thread Behdad Esfahbod
 src/hb-ot-shape-normalize.cc |  106 +--
 src/hb-ot-shape.cc   |2 
 2 files changed, 63 insertions(+), 45 deletions(-)

New commits:
commit f4cb4762986a28634fa7de9b706f9d37859b881e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Aug 10 03:51:44 2012 -0400

[OT] Slightly adjust normalizer

The change is very subtle.  If we have a single-char cluster that
decomposes to three or more characters, then try recomposition, in
case the farther mark may compose with the base.

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 23c28cc..93dd00c 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -286,41 +286,50 @@ skip_char (hb_buffer_t *buffer)
   buffer-skip_glyph ();
 }
 
-static bool
+/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
+static inline unsigned int
 decompose (hb_font_t *font, hb_buffer_t *buffer, bool shortest, hb_codepoint_t 
ab)
 {
   hb_codepoint_t a, b, a_glyph, b_glyph;
 
   if (!decompose_func (buffer-unicode, ab, a, b) ||
   (b  !font-get_glyph (b, 0, b_glyph)))
-return false;
+return 0;
 
   bool has_a = font-get_glyph (a, 0, a_glyph);
   if (shortest  has_a) {
 /* Output a and b */
 output_char (buffer, a, a_glyph);
-if (b)
+if (likely (b)) {
   output_char (buffer, b, b_glyph);
-return true;
+  return 2;
+}
+return 1;
   }
 
-  if (decompose (font, buffer, shortest, a)) {
-if (b)
+  unsigned int ret;
+  if ((ret = decompose (font, buffer, shortest, a))) {
+if (b) {
   output_char (buffer, b, b_glyph);
-return true;
+  return ret + 1;
+}
+return ret;
   }
 
   if (has_a) {
 output_char (buffer, a, a_glyph);
-if (b)
+if (likely (b)) {
   output_char (buffer, b, b_glyph);
-return true;
+  return 2;
+}
+return 1;
   }
 
-  return false;
+  return 0;
 }
 
-static bool
+/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
+static inline bool
 decompose_compatibility (hb_font_t *font, hb_buffer_t *buffer, hb_codepoint_t 
u)
 {
   unsigned int len, i;
@@ -329,34 +338,42 @@ decompose_compatibility (hb_font_t *font, hb_buffer_t 
*buffer, hb_codepoint_t u)
 
   len = buffer-unicode-decompose_compatibility (u, decomposed);
   if (!len)
-return false;
+return 0;
 
   for (i = 0; i  len; i++)
 if (!font-get_glyph (decomposed[i], 0, glyphs[i]))
-  return false;
+  return 0;
 
   for (i = 0; i  len; i++)
 output_char (buffer, decomposed[i], glyphs[i]);
 
-  return true;
+  return len;
 }
 
-static void
+/* Returns true if recomposition may be benefitial. */
+static inline bool
 decompose_current_character (hb_font_t *font, hb_buffer_t *buffer, bool 
shortest)
 {
   hb_codepoint_t glyph;
+  unsigned int len = 1;
 
   /* Kind of a cute waterfall here... */
   if (shortest  font-get_glyph (buffer-cur().codepoint, 0, glyph))
 next_char (buffer, glyph);
-  else if (decompose (font, buffer, shortest, buffer-cur().codepoint))
+  else if ((len = decompose (font, buffer, shortest, buffer-cur().codepoint)))
 skip_char (buffer);
   else if (!shortest  font-get_glyph (buffer-cur().codepoint, 0, glyph))
 next_char (buffer, glyph);
-  else if (decompose_compatibility (font, buffer, buffer-cur().codepoint))
+  else if ((len = decompose_compatibility (font, buffer, 
buffer-cur().codepoint)))
 skip_char (buffer);
   else
 next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
+
+  /*
+   * A recomposition would only be useful if we decomposed into at least three
+   * characters...
+   */
+  return len  2;
 }
 
 static inline void
@@ -378,20 +395,34 @@ handle_variation_selector_cluster (hb_font_t *font, 
hb_buffer_t *buffer, unsigne
   }
 }
 
-static void
+/* Returns true if recomposition may be benefitial. */
+static inline bool
 decompose_multi_char_cluster (hb_font_t *font, hb_buffer_t *buffer, unsigned 
int end)
 {
   /* TODO Currently if there's a variation-selector we give-up, it's just too 
hard. */
   for (unsigned int i = buffer-idx; i  end; i++)
 if (unlikely (buffer-unicode-is_variation_selector 
(buffer-info[i].codepoint))) {
   handle_variation_selector_cluster (font, buffer, end);
-  return;
+  return false;
 }
 
   while (buffer-idx  end)
 decompose_current_character (font, buffer, false);
+  /* We can be smarter here and only return true if there are at least two 
ccc!=0 marks.
+   * But does not matter. */
+  return true;
+}
+
+static inline bool
+decompose_cluster (hb_font_t *font, hb_buffer_t *buffer, bool recompose, 
unsigned int end)
+{
+  if (likely (buffer-idx + 1 == end))
+return decompose_current_character (font, buffer, recompose);
+  else
+return decompose_multi_char_cluster (font, buffer, end);
 }
 
+
 static int
 compare_combining_class (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
 {
@@ -401,12 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-08-10 Thread Behdad Esfahbod
 AUTHORS  |8 +++
 COPYING  |9 ++-
 Makefile.am  |   13 ++---
 NEWS |  136 +++
 THANKS   |7 +++
 configure.ac |4 -
 6 files changed, 165 insertions(+), 12 deletions(-)

New commits:
commit e297ee4acd6f9d950f8542fc6ad71fd580b69284
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Aug 10 14:49:37 2012 -0400

Bump version to 0.9.2

A *real* release this time, with NEWS, ChangeLog, etc.

diff --git a/AUTHORS b/AUTHORS
index e69de29..c611d7d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -0,0 +1,8 @@
+Behdad Esfahbod
+Simon Hausmann
+Martin Hosken
+Jonathan Kew
+Lars Knoll
+Werner Lemberg
+Owen Taylor
+David Turner
diff --git a/COPYING b/COPYING
index 4bb77a0..f6748da 100644
--- a/COPYING
+++ b/COPYING
@@ -1,11 +1,14 @@
 HarfBuzz is licensed under the so-called Old MIT license.  Details follow.
 
-Copyright © 2011 Codethink Limited
-Copyright © 2010,2011  Google, Inc.
-Copyright © 2006  Behdad Esfahbod
+Copyright © 2010,2011,2012  Google, Inc.
+Copyright © 2012  Mozilla Foundation
+Copyright © 2011  Codethink Limited
+Copyright © 2008,2010  Nokia Corporation and/or its subsidiary(-ies)
 Copyright © 2009  Keith Stribley
 Copyright © 2009  Martin Hosken and SIL International
 Copyright © 2007  Chris Wilson
+Copyright © 2006  Behdad Esfahbod
+Copyright © 2005  David Turner
 Copyright © 2004,2007,2008,2009,2010  Red Hat, Inc.
 Copyright © 1998-2004  David Turner and Werner Lemberg
 
diff --git a/Makefile.am b/Makefile.am
index 8b69c2d..08f8a93 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,19 +34,18 @@ MAINTAINERCLEANFILES = \
 # ChangeLog generation
 #
 CHANGELOG_RANGE =
-ChangeLog: $(srcdir)/ChangeLog
-$(srcdir)/ChangeLog:
-   $(AM_V_GEN) if test -d $(srcdir)/.git; then \
- (GIT_DIR=$(top_srcdir)/.git ./missing --run \
+ChangeLog:
+   $(AM_V_GEN) if test -d $(top_srcdir)/.git; then \
+ (GIT_DIR=$(top_srcdir)/.git $(top_srcdir)/missing --run \
   git log $(CHANGELOG_RANGE) --stat) | fmt --split-only  $@.tmp \
-  mv -f $@.tmp $@ \
+  mv -f $@.tmp $(srcdir)/$@ \
  || ($(RM) $@.tmp; \
  echo Failed to generate ChangeLog, your ChangeLog may be outdated 
2; \
- (test -f $@ || echo git-log is required to generate this file  
$@)); \
+ (test -f $@ || echo git-log is required to generate this file  
$(srcdir)/$@)); \
else \
  test -f $@ || \
  (echo A git checkout and git-log is required to generate ChangeLog 
2  \
- echo A git checkout and git-log is required to generate this file  
$@); \
+ echo A git checkout and git-log is required to generate this file  
$(srcdir)/$@); \
fi
 .PHONY: $(srcdir)/ChangeLog
 
diff --git a/NEWS b/NEWS
index d31c548..5b0232c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,139 @@
+Overview of changes leading to 0.9.2
+Friday, Aug 10, 2011
+
+
+- Over a thousand commits!  This is the first major release of HarfBuzz.
+
+- HarfBuzz is feature-complete now!  It should be in par, or better, than
+  both Pango's shapers and old HarfBuzz / Qt shapers.
+
+- New Indic shaper, supporting main Indic scripts, Sinhala, and Khmer.
+
+- Improved Arabic shaper, with fallback Arabic shaping, supporting Arabic,
+  Sinhala, N'ko, Mongolian, and Mandaic.
+
+- New Thai / Lao shaper.
+
+- Tibetan / Hangul support in the generic shaper.
+
+- Synthetic GDEF support for fonts without a GDEF table.
+
+- Fallback mark positioning for fonts without a GPOS table.
+
+- Unicode normalization shaping heuristic during glyph mapping.
+
+- New experimental Graphite2 backend.
+
+- New Uniscribe backend (primarily for testing).
+
+- New CoreText backend (primarily for testing).
+
+- Major optimization and speedup.
+
+- Test suites and testing infrastructure (work in progress).
+
+- Greatly improved hb-view cmdline tool.
+
+- hb-shape cmdline tool.
+
+- Unicode 6.1 support.
+
+Summary of API changes:
+
+o Changed API:
+
+  - Users are expected to only include main header files now (ie. hb.h,
+hb-glib.h, hb-ft.h, ...)
+
+  - All struct tag names had their initial underscore removed.
+Ie. struct _hb_buffer_t is struct hb_buffer_t now.
+
+  - All set_user_data() functions now take a replace boolean parameter.
+
+  - hb_buffer_create() takes zero arguments now.
+Use hb_buffer_pre_allocate() to pre-allocate.
+
+  - hb_buffer_add_utf*() now accept -1 for length parameteres,
+meaning nul-terminated.
+
+  - hb_direction_t enum values changed.
+
+  - All *_from_string() APIs now take a length parameter to allow for
+non-nul-terminated strings. A -1 length means nul-terminated.
+
+  - Typedef for hb_language_t changed.
+
+  - hb_get_table_func_t renamed to hb_reference_table_func_t.
+
+  - hb_ot_layout_table_choose_script()
+
+  - Various renames in hb-unicode.h.
+
+o New API:
+
+  - hb_buffer_guess_properties()
+Automatically called by 

[HarfBuzz] harfbuzz-ng: Branch 'master' - 12 commits

2012-08-08 Thread Behdad Esfahbod
 TODO |4 
 configure.ac |   14 +
 src/Makefile.am  |   27 ++
 src/check-exported-symbols.sh|   40 +++
 src/check-internal-symbols.sh|   12 -
 src/check-static-inits.sh|   10 
 src/hb-buffer-private.hh |   10 
 src/hb-buffer.h  |4 
 src/hb-common.cc |   15 -
 src/hb-common.h  |7 
 src/hb-font-private.hh   |   29 ++
 src/hb-font.cc   |   63 ++
 src/hb-font.h|2 
 src/hb-graphite2.cc  |4 
 src/hb-icu.h |1 
 src/hb-old.cc|2 
 src/hb-old/harfbuzz-external.h   |3 
 src/hb-ot-layout.cc  |6 
 src/hb-ot-layout.h   |1 
 src/hb-ot-shape-complex-indic.cc |2 
 src/hb-ot-shape-fallback-private.hh  |   39 +++
 src/hb-ot-shape-fallback.cc  |  274 ++
 src/hb-ot-shape-position-fallback-private.hh |   39 ---
 src/hb-ot-shape-position-fallback.cc |  276 ---
 src/hb-ot-shape.cc   |   12 -
 src/hb-shape-plan.cc |6 
 src/hb-shape-plan.h  |2 
 src/hb-tt-font.cc|  166 
 28 files changed, 496 insertions(+), 574 deletions(-)

New commits:
commit a02d86484be870615297abfc7be9f94645434762
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Aug 8 18:04:29 2012 -0400

Add check-exported-symbols.sh

And misc linking fixes.

diff --git a/src/Makefile.am b/src/Makefile.am
index d8f7502..5894b20 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -241,6 +241,7 @@ test_would_substitute_LDADD = libharfbuzz.la $(HBLIBS) 
$(FREETYPE_LIBS)
 dist_check_SCRIPTS = \
check-c-linkage-decls.sh \
check-header-guards.sh \
+   check-exported-symbols.sh \
check-includes.sh \
check-internal-symbols.sh \
check-static-inits.sh \
diff --git a/src/check-exported-symbols.sh b/src/check-exported-symbols.sh
new file mode 100755
index 000..a7d6f9b
--- /dev/null
+++ b/src/check-exported-symbols.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+LC_ALL=C
+export LC_ALL
+
+test -z $srcdir  srcdir=.
+test -z $MAKE  MAKE=make
+stat=0
+
+if which nm 2/dev/null /dev/null; then
+   :
+else
+   echo check-exported-symbols.sh: 'nm' not found; skipping test
+   exit 77
+fi
+
+defs=harfbuzz.def
+$MAKE $defs  /dev/null
+tested=false
+for def in $defs; do
+   lib=`echo $def | sed 's/[.]def$//;s@.*/@@'`
+   so=.libs/lib${lib}.so
+   if test -f $so; then
+   echo Checking that $so has the same symbol list as $def
+   {
+   echo EXPORTS
+   nm $so | grep ' [BCDGINRSTVW] ' | grep -v ' T 
_fini\\| T _init\' | cut -d' ' -f3
+   stat=1
+   # cheat: copy the last line from the def file!
+   tail -n1 $def
+   } | diff $def - 2 || stat=1
+   tested=true
+   fi
+done
+if ! $tested; then
+   echo check-exported-symbols.sh: libharfbuzz shared library not found; 
skipping test
+   exit 77
+fi
+
+exit $stat
diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh
index 7ad5743..f48d144 100755
--- a/src/check-internal-symbols.sh
+++ b/src/check-internal-symbols.sh
@@ -19,7 +19,7 @@ for suffix in .so; do
so=`echo .libs/libharfbuzz$suffix`
if test -f $so; then
echo Checking that we are not exposing internal symbols
-   if nm $so | grep ' [TW] ' | grep -v ' T _fini\\| T _init\\| T 
hb_'; then
+   if nm $so | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\\| T 
_init\\| T hb_'; then
echo Ouch, internal symbols exposed
stat=1
fi
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0dbf412..4f9a5af 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -57,7 +57,7 @@ indic_options_init (void)
   return u;
 }
 
-inline indic_options_t
+static inline indic_options_t
 indic_options (void)
 {
   static indic_options_union_t options;
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 4c055d3..d1e1d6c 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -40,7 +40,7 @@
 #include hb-set-private.hh
 
 
-hb_tag_t common_features[] = {
+static hb_tag_t common_features[] = {
   HB_TAG('c','c','m','p'),
   HB_TAG('l','i','g','a'),
   HB_TAG('l','o','c','l'),
@@ -50,7 +50,7 @@ hb_tag_t common_features[] = {
 };
 
 
-hb_tag_t 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-08-03 Thread Behdad Esfahbod
 src/hb-glib.cc |4 ++--
 src/hb-icu.cc  |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3a7e137a68ec8f723dc3afa89c918ca2df7ff6bf
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Aug 3 17:23:40 2012 -0700

Dn't use gint

diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index fe2368a..7af92cc 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -255,7 +255,7 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
 
   gchar utf8[12];
   gchar *normalized;
-  gint len;
+  int len;
   hb_bool_t ret;
 
   len = g_unichar_to_utf8 (a, utf8);
@@ -292,7 +292,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
 
   gchar utf8[6];
   gchar *normalized;
-  gint len;
+  int len;
   hb_bool_t ret;
 
   len = g_unichar_to_utf8 (ab, utf8);
diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index 4694e31..d7fd185 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -278,7 +278,7 @@ hb_icu_unicode_decompose_compatibility (hb_unicode_funcs_t 
*ufuncs HB_UNUSED,
void   *user_data HB_UNUSED)
 {
   UChar utf16[2], normalized[2 * HB_UNICODE_MAX_DECOMPOSITION_LEN + 1];
-  gint len;
+  int len;
   int32_t utf32_len;
   hb_bool_t err;
   UErrorCode icu_err;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-08-03 Thread Behdad Esfahbod
 src/hb-ot-shape.cc   |7 ++-
 src/hb-shape-plan.cc |2 ++
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 46ee108ef80f5d4675899862698a8c34d8fcfab5
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Aug 3 18:21:13 2012 -0700

Fix leak

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 974c370..ddfb501 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -148,6 +148,8 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
 #include hb-shaper-list.hh
 #undef HB_SHAPER_IMPLEMENT
 
+  hb_face_destroy (shape_plan-face);
+
   free (shape_plan);
 }
 
commit 71baea0062da4d7f143d62da38492a0813814e49
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Aug 3 17:40:07 2012 -0700

[OT] Use general-category, not GDEF class, to decide to zero mark advances

At this point, the GDEF glyph synthesis looks pointless.  Not that I
have many fonts without GDEF lying around.

As for mark advance zeroing when GPOS not available, that also is being
replaced by proper fallback mark positioning soon.

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 28bb1f9..08457be 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -347,10 +347,7 @@ hb_synthesize_glyph_classes (hb_ot_shape_context_t *c)
 {
   unsigned int count = c-buffer-len;
   for (unsigned int i = 0; i  count; i++)
-c-buffer-info[i].glyph_props() = FLAG 
(_hb_glyph_info_get_general_category (c-buffer-info[i])) 
-  (FLAG 
(HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
-   FLAG 
(HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
-   FLAG 
(HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)) ?
+c-buffer-info[i].glyph_props() = _hb_glyph_info_get_general_category 
(c-buffer-info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ?
   HB_OT_LAYOUT_GLYPH_CLASS_MARK :
   HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
 }
@@ -398,7 +395,7 @@ hb_zero_mark_advances (hb_ot_shape_context_t *c)
 {
   unsigned int count = c-buffer-len;
   for (unsigned int i = 0; i  count; i++)
-if (c-buffer-info[i].glyph_props()  HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+if (_hb_glyph_info_get_general_category (c-buffer-info[i]) == 
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
 {
   c-buffer-pos[i].x_advance = 0;
   c-buffer-pos[i].y_advance = 0;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-08-02 Thread Behdad Esfahbod
 src/hb-ot-layout-gpos-table.hh   |2 
 src/hb-ot-layout-gsub-table.hh   |5 -
 src/hb-ot-layout-gsubgpos-private.hh |   10 +-
 src/hb-ot-layout-private.hh  |3 
 src/hb-ot-layout.cc  |   34 +++
 src/hb-ot-map-private.hh |   85 +++--
 src/hb-ot-map.cc |   18 +--
 src/hb-ot-shape-complex-indic-private.hh |   16 ---
 src/hb-ot-shape-complex-indic.cc |  149 ++-
 9 files changed, 184 insertions(+), 138 deletions(-)

New commits:
commit 610e5e8f713bb2a68939b72cb2b801a7aaede4f9
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Aug 2 05:27:46 2012 -0400

[Indic] Streamline feature would_apply()

Comes with some 10% speedup for Devanagari even!

diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index 2ba0f76..5e3c967 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -42,6 +42,38 @@ struct hb_ot_map_t
 
   public:
 
+  struct feature_map_t {
+hb_tag_t tag; /* should be first for our bsearch to work */
+unsigned int index[2]; /* GSUB/GPOS */
+unsigned int stage[2]; /* GSUB/GPOS */
+unsigned int shift;
+hb_mask_t mask;
+hb_mask_t _1_mask; /* mask for value=1, for quick access */
+
+static int cmp (const feature_map_t *a, const feature_map_t *b)
+{ return a-tag  b-tag ? -1 : a-tag  b-tag ? 1 : 0; }
+  };
+
+  struct lookup_map_t {
+unsigned int index;
+hb_mask_t mask;
+
+static int cmp (const lookup_map_t *a, const lookup_map_t *b)
+{ return a-index  b-index ? -1 : a-index  b-index ? 1 : 0; }
+  };
+
+  typedef void (*pause_func_t) (const hb_ot_map_t *map, void *face_or_font, 
hb_buffer_t *buffer, void *user_data);
+  typedef struct {
+pause_func_t func;
+void *user_data;
+  } pause_callback_t;
+
+  struct pause_map_t {
+unsigned int num_lookups; /* Cumulative */
+pause_callback_t callback;
+  };
+
+
   hb_ot_map_t (void) { memset (this, 0, sizeof (*this)); }
 
   typedef void (*gsub_pause_func_t) (const hb_ot_map_t *map, hb_face_t *face, 
hb_buffer_t *buffer, void *user_data);
@@ -60,11 +92,30 @@ struct hb_ot_map_t
 return map ? map-_1_mask : 0;
   }
 
-  inline hb_mask_t get_feature_index (unsigned int table_index, hb_tag_t 
feature_tag) const {
+  inline unsigned int get_feature_index (unsigned int table_index, hb_tag_t 
feature_tag) const {
 const feature_map_t *map = features.bsearch (feature_tag);
 return map ? map-index[table_index] : HB_OT_LAYOUT_NO_FEATURE_INDEX;
   }
 
+  inline unsigned int get_feature_stage (unsigned int table_index, hb_tag_t 
feature_tag) const {
+const feature_map_t *map = features.bsearch (feature_tag);
+return map ? map-stage[table_index] : (unsigned int) -1;
+  }
+
+  inline void get_stage_lookups (unsigned int table_index, unsigned int stage,
+const struct lookup_map_t **plookups, unsigned 
int *lookup_count) const {
+if (unlikely (stage == (unsigned int) -1)) {
+  *plookups = NULL;
+  *lookup_count = 0;
+  return;
+}
+assert (stage = pauses[table_index].len);
+unsigned int start = stage ? pauses[table_index][stage - 1].num_lookups : 
0;
+unsigned int end   = stage  pauses[table_index].len ? 
pauses[table_index][stage].num_lookups : lookups[table_index].len;
+*plookups = lookups[table_index][start];
+*lookup_count = end - start;
+  }
+
   inline hb_tag_t get_chosen_script (unsigned int table_index) const
   { return chosen_script[table_index]; }
 
@@ -80,38 +131,8 @@ struct hb_ot_map_t
 pauses[1].finish ();
   }
 
-  private:
-
-  struct feature_map_t {
-hb_tag_t tag; /* should be first for our bsearch to work */
-unsigned int index[2]; /* GSUB/GPOS */
-unsigned int stage[2]; /* GSUB/GPOS */
-unsigned int shift;
-hb_mask_t mask;
-hb_mask_t _1_mask; /* mask for value=1, for quick access */
-
-static int cmp (const feature_map_t *a, const feature_map_t *b)
-{ return a-tag  b-tag ? -1 : a-tag  b-tag ? 1 : 0; }
-  };
-
-  struct lookup_map_t {
-unsigned int index;
-hb_mask_t mask;
-
-static int cmp (const lookup_map_t *a, const lookup_map_t *b)
-{ return a-index  b-index ? -1 : a-index  b-index ? 1 : 0; }
-  };
 
-  typedef void (*pause_func_t) (const hb_ot_map_t *map, void *face_or_font, 
hb_buffer_t *buffer, void *user_data);
-  typedef struct {
-pause_func_t func;
-void *user_data;
-  } pause_callback_t;
-
-  struct pause_map_t {
-unsigned int num_lookups; /* Cumulative */
-pause_callback_t callback;
-  };
+  private:
 
   HB_INTERNAL void add_lookups (hb_face_t*face,
unsigned int  table_index,
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 20e8e6f..ae0cb61 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -89,7 +89,8 @@ void hb_ot_map_t::substitute (hb_face_t *face, hb_buffer_t 
*buffer) const
 
 

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

2012-08-02 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh   |   13 -
 src/hb-ot-layout-gsubgpos-private.hh |9 
 src/hb-ot-layout-private.hh  |   40 +++
 src/hb-ot-layout.cc  |   38 ---
 src/hb-ot-layout.h   |   34 ---
 src/hb-ot-map-private.hh |   15 -
 src/hb-ot-map.cc |   12 -
 src/hb-ot-shape-complex-indic-private.hh |  210 
 src/hb-ot-shape-complex-indic.cc |  319 ++-
 src/hb-ot-shape.cc   |6 
 10 files changed, 343 insertions(+), 353 deletions(-)

New commits:
commit 24eacf17c801c66a2d466e8ae02b73f501a26b25
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Aug 2 08:42:11 2012 -0400

[Indic] Move consonant-position-setting into initial_reordering()

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index cbc1231..19ff048 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -237,6 +237,34 @@ override_features_indic (const hb_ot_complex_shaper_t  
*shaper,
 
 
 static void
+setup_masks_indic (const hb_ot_complex_shaper_t *shaper,
+  const hb_ot_map_t*map,
+  hb_buffer_t  *buffer,
+  hb_font_t*font HB_UNUSED)
+{
+  HB_BUFFER_ALLOCATE_VAR (buffer, indic_category);
+  HB_BUFFER_ALLOCATE_VAR (buffer, indic_position);
+
+  /* We cannot setup masks here.  We save information about characters
+   * and setup masks later on in a pause-callback. */
+
+  unsigned int count = buffer-len;
+  for (unsigned int i = 0; i  count; i++)
+set_indic_properties (buffer-info[i]);
+}
+
+static int
+compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
+{
+  int a = pa-indic_position();
+  int b = pb-indic_position();
+
+  return a  b ? -1 : a == b ? 0 : +1;
+}
+
+
+
+static void
 update_consonant_positions (const hb_ot_map_t *map,
hb_buffer_t   *buffer,
hb_font_t *font)
@@ -254,7 +282,7 @@ update_consonant_positions (const hb_ot_map_t *map,
 case HB_SCRIPT_MALAYALAM:  virama = 0x0D4D; break;
 case HB_SCRIPT_SINHALA:virama = 0x0DCA; break;
 case HB_SCRIPT_KHMER:  virama = 0x17D2; break;
-default:   virama = 0;   break;
+default:   virama = 0;  break;
   }
 
   indic_shape_plan_t indic_plan (map);
@@ -263,43 +291,18 @@ update_consonant_positions (const hb_ot_map_t *map,
   hb_codepoint_t glyphs[2];
   if (virama  font-get_glyph (virama, 0, glyphs[1 - consonant_pos]))
   {
+/* Technically speaking, the spec says we should apply 'locl' to virama 
too.
+ * Maybe one day... */
 hb_face_t *face = font-face;
 unsigned int count = buffer-len;
 for (unsigned int i = 0; i  count; i++)
   if (buffer-info[i].indic_position() == POS_BASE_C) {
-   font-get_glyph (buffer-info[i].codepoint, 0, glyphs[consonant_pos]);
+   glyphs[consonant_pos] = buffer-info[i].codepoint;
buffer-info[i].indic_position() = consonant_position_from_font 
(indic_plan, glyphs, 2, face);
   }
   }
 }
 
-static void
-setup_masks_indic (const hb_ot_complex_shaper_t *shaper,
-  const hb_ot_map_t*map,
-  hb_buffer_t  *buffer,
-  hb_font_t*font)
-{
-  HB_BUFFER_ALLOCATE_VAR (buffer, indic_category);
-  HB_BUFFER_ALLOCATE_VAR (buffer, indic_position);
-
-  /* We cannot setup masks here.  We save information about characters
-   * and setup masks later on in a pause-callback. */
-
-  unsigned int count = buffer-len;
-  for (unsigned int i = 0; i  count; i++)
-set_indic_properties (buffer-info[i]);
-
-  update_consonant_positions (map, buffer, font);
-}
-
-static int
-compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
-{
-  int a = pa-indic_position();
-  int b = pb-indic_position();
-
-  return a  b ? -1 : a == b ? 0 : +1;
-}
 
 /* Rules from:
  * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */
@@ -696,10 +699,12 @@ initial_reordering_non_indic (const hb_ot_map_t *map 
HB_UNUSED,
 
 static void
 initial_reordering (const hb_ot_map_t *map,
-   hb_font_t *font HB_UNUSED,
+   hb_font_t *font,
hb_buffer_t *buffer,
void *user_data HB_UNUSED)
 {
+  update_consonant_positions (map, buffer, font);
+
   hb_mask_t basic_mask_array[ARRAY_LENGTH (indic_basic_features)] = {0};
   unsigned int num_masks = ARRAY_LENGTH (indic_basic_features);
   for (unsigned int i = 0; i  num_masks; i++)
commit afbcc24be01a64bdb5c05c63880269145fa1d3c8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Aug 2 08:36:40 2012 -0400

[GSUB] Wire the font, not just the face, down to substitute()

We need the font for glyph lookup during GSUB pauses in 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-08-01 Thread Behdad Esfahbod
 src/hb-ot-layout-gpos-table.hh |   11 ---
 src/hb-ot-layout-gsub-table.hh |   11 ---
 2 files changed, 22 deletions(-)

New commits:
commit 0120ce9679aab3ac936aeb18f6709529eef000a4
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Aug 1 21:56:35 2012 -0400

[GSUB/GPOS] Remove unused get_coverage() methods

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 34b9723..c9afd31 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1500,17 +1500,6 @@ struct PosLookup : Lookup
   inline const PosLookupSubTable get_subtable (unsigned int i) const
   { return this+CastROffsetArrayOfPosLookupSubTable  (subTable)[i]; }
 
-  inline const Coverage *get_coverage (void) const
-  {
-/* Only return non-NULL if there's just one Coverage table we care about. 
*/
-const Coverage *c = get_subtable (0).get_coverage (get_type ());
-unsigned int count = get_subtable_count ();
-for (unsigned int i = 1; i  count; i++)
-  if (c != get_subtable (i).get_coverage (get_type ()))
-return NULL;
-return c;
-  }
-
   template typename set_t
   inline void add_coverage (set_t *glyphs) const
   {
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 182f780..b836df9 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1154,17 +1154,6 @@ struct SubstLookup : Lookup
   get_subtable (i).closure (c, lookup_type);
   }
 
-  inline const Coverage *get_coverage (void) const
-  {
-/* Only return non-NULL if there's just one Coverage table we care about. 
*/
-const Coverage *c = get_subtable (0).get_coverage (get_type ());
-unsigned int count = get_subtable_count ();
-for (unsigned int i = 1; i  count; i++)
-  if (c != get_subtable (i).get_coverage (get_type ()))
-return NULL;
-return c;
-  }
-
   template typename set_t
   inline void add_coverage (set_t *glyphs) const
   {
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master' - 8 commits

2012-07-31 Thread Behdad Esfahbod
 TODO   |   29 -
 src/hb-old.cc  |   24 ++--
 src/hb-old/harfbuzz-shaper.cpp |1 +
 src/hb-ot-layout-gpos-table.hh |   14 --
 src/hb-ot-layout-gsub-table.hh |5 -
 src/hb-ot-layout.cc|4 ++--
 src/hb-ot-layout.h |3 ++-
 src/hb-ot-shape-complex-arabic.cc  |1 +
 src/hb-ot-shape-complex-indic.cc   |1 +
 src/hb-ot-shape-complex-misc.cc|2 ++
 src/hb-ot-shape-complex-private.hh |2 ++
 src/hb-ot-shape.cc |   37 +
 src/hb-shape.cc|2 ++
 13 files changed, 80 insertions(+), 45 deletions(-)

New commits:
commit 0834d952017a04c6f4599e574cb75ecf3ca27d3b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Aug 1 00:21:09 2012 -0400

[hb-old] Adjust mark positioning parameters

Fallback mark positioning works now...  With hb-ft and hb-view /
hb-shape at least.

diff --git a/src/hb-old.cc b/src/hb-old.cc
index 1f6bf7f..9d1a005 100644
--- a/src/hb-old.cc
+++ b/src/hb-old.cc
@@ -149,12 +149,12 @@ hb_old_getGlyphMetrics (HB_Font old_font,
 
   hb_font_get_glyph_extents (font, glyph, extents);
 
-  metrics-xOffset = extents.x_bearing;
-  metrics-yOffset = extents.y_bearing;
+  metrics-x   = extents.x_bearing;
+  metrics-y   = extents.y_bearing;
   metrics-width   = extents.width;
-  metrics-height  = extents.height;
-  metrics-x   = hb_font_get_glyph_h_advance (font, glyph);
-  metrics-y   = 0;
+  metrics-height  = -extents.height;
+  metrics-xOffset = hb_font_get_glyph_h_advance (font, glyph);
+  metrics-yOffset = 0;
 }
 
 static HB_Fixed
diff --git a/src/hb-old/harfbuzz-shaper.cpp b/src/hb-old/harfbuzz-shaper.cpp
index 62886f3..f410780 100644
--- a/src/hb-old/harfbuzz-shaper.cpp
+++ b/src/hb-old/harfbuzz-shaper.cpp
@@ -63,6 +63,7 @@ static inline void positionCluster(HB_ShaperItem *item, int 
gfrom,  int glast)
 offsetBase += HB_FIXED_CONSTANT(4);
 else
 offsetBase += size;
+offsetBase = -offsetBase;
 //qreal offsetBase = (size - 4) / 4 + qMinqreal(size, 4) + 1;
 // qDebug(offset = %f, offsetBase);
 
commit 4ca743dfb8e09f9fa525061c7f1144d55f72effb
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Aug 1 00:03:41 2012 -0400

[old] Implement fontMetrics

diff --git a/src/hb-old.cc b/src/hb-old.cc
index 84a431c..1f6bf7f 100644
--- a/src/hb-old.cc
+++ b/src/hb-old.cc
@@ -161,7 +161,16 @@ static HB_Fixed
 hb_old_getFontMetric (HB_Font old_font,
  HB_FontMetric metric)
 {
-  return 0; // TODO
+  hb_font_t *font = (hb_font_t *) old_font-userData;
+
+  switch (metric)
+  {
+case HB_FontAscent:
+   return font-y_scale; /* XXX We don't have ascent data yet. */
+
+default:
+  return 0;
+  }
 }
 
 static const HB_FontClass hb_old_font_class = {
commit 1e7d860613032e40a3f90e2caa2ee5ac44ab8c8c
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jul 31 23:41:06 2012 -0400

[GPOS] Adjust mark advance-width zeroing logic

If there is no GPOS, zero mark advances.

If there *is* GPOS and the shaper requests so, zero mark advances for
attached marks.

Fixes regression with Tibetan, where the font has GPOS, and marks a
glyph as mark where it shouldn't get zero advance.

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 339749e..2e8a389 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1587,7 +1587,7 @@ struct GPOS : GSUBGPOS
   { return get_lookup (lookup_index).apply_string (c); }
 
   static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
-  static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
+  static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer, 
hb_bool_t zero_width_attahced_marks);
 
   inline bool sanitize (hb_sanitize_context_t *c) {
 TRACE_SANITIZE ();
@@ -1620,15 +1620,17 @@ fix_cursive_minor_offset (hb_glyph_position_t *pos, 
unsigned int i, hb_direction
 }
 
 static void
-fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t 
direction)
+fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t 
direction, hb_bool_t zero_width_attached_marks)
 {
   if (likely (!(pos[i].attach_lookback(
 return;
 
   unsigned int j = i - pos[i].attach_lookback();
 
-//  pos[i].x_advance = 0;
-//  pos[i].y_advance = 0;
+  if (zero_width_attached_marks) {
+pos[i].x_advance = 0;
+pos[i].y_advance = 0;
+  }
   pos[i].x_offset += pos[j].x_offset;
   pos[i].y_offset += pos[j].y_offset;
 
@@ -1655,7 +1657,7 @@ GPOS::position_start (hb_font_t *font HB_UNUSED, 
hb_buffer_t *buffer)
 }
 
 void
-GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, 
hb_bool_t 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-30 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh |   
11 +++---
 test/shaping/texts/in-tree/shaper-indic/indic/script-kannada/misc/misc.txt |   
 1 
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit a973b5ce86051e8ef0d20df362db1a50488842ab
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 01:46:34 2012 -0400

[GSUB] Further adjustments to mark-attachment vs ligation interaction

The d1d69ec52e75a78575b620a1c456d528b6078170 change broke Kannada badly,
since it was ligating consonants, pushing matra out, and then ligating
with the matra.  Adjust for that.  See comments.

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index b5520ed..4ad61a9 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -522,7 +522,11 @@ struct Ligature
  * - Ligatures cannot be formed across glyphs attached to different 
components
  *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, 
and
  *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
- *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
+ *   However, it would be wrong to ligate that SHADDA,FATHA sequence.o
+ *   There is an exception to this: If a ligature tries ligating with 
marks that
+ *   belong to it itself, go ahead, assuming that the font designer knows 
what
+ *   they are doing (otherwise it can break Indic stuff when a matra wants 
to
+ *   ligate with a conjunct...)
  */
 
 bool is_mark_ligature = !!(c-property  HB_OT_LAYOUT_GLYPH_CLASS_MARK);
@@ -543,6 +547,7 @@ struct Ligature
 
   unsigned int this_lig_id = get_lig_id (c-buffer-info[skippy_iter.idx]);
   unsigned int this_lig_comp = get_lig_comp 
(c-buffer-info[skippy_iter.idx]);
+
   if (first_lig_id  first_lig_comp) {
 /* If first component was attached to a previous ligature component,
 * all subsequent components should be attached to the same ligature
@@ -552,8 +557,8 @@ struct Ligature
   } else {
 /* If first component was NOT attached to a previous ligature 
component,
 * all subsequent components should also NOT be attached to any ligature
-* component, otherwise we shouldn't ligate them. */
-if (this_lig_id  this_lig_comp)
+* component, unless they are attached to the first component itself! */
+if (this_lig_id  this_lig_comp  (this_lig_id != first_lig_id))
  return TRACE_RETURN (false);
   }
 
diff --git 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-kannada/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-kannada/misc/misc.txt
index 5defb0c..19bec8c 100644
--- a/test/shaping/texts/in-tree/shaper-indic/indic/script-kannada/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-kannada/misc/misc.txt
@@ -16,3 +16,4 @@
 ಕೈ
 ಕೋ
 ಕ್ಷ
+ಕ್ಷಿ
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-30 Thread Behdad Esfahbod
 src/hb-ot-layout-private.hh|   27 -
 src/hb-ot-layout.cc|   73 +++--
 src/hb-ot-layout.h |5 --
 src/hb-ot-map-private.hh   |   26 ++---
 src/hb-ot-map.cc   |   35 -
 src/hb-ot-shape-complex-indic.cc   |2 -
 src/hb-ot-shape-complex-private.hh |5 --
 7 files changed, 118 insertions(+), 55 deletions(-)

New commits:
commit f860366456d9e59b139a940da6d89c3c4fb9e96e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 02:38:39 2012 -0400

[OT] Gain back some lost speed

diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 705fe67..78c9d64 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -1,5 +1,6 @@
 /*
  * Copyright © 2007,2008,2009  Red Hat, Inc.
+ * Copyright © 2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -22,6 +23,7 @@
  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  *
  * Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
  */
 
 #ifndef HB_OT_LAYOUT_PRIVATE_HH
@@ -33,9 +35,13 @@
 
 #include hb-font-private.hh
 #include hb-buffer-private.hh
-#include hb-ot-shape-complex-private.hh
 
 
+/* buffer var allocations, used during the GSUB/GPOS processing */
+#define props_cache()  var1.u16[1] /* GSUB/GPOS glyph_props cache */
+#define syllable() var2.u8[0] /* GSUB/GPOS shaping boundaries */
+#define lig_props()var2.u8[1] /* GSUB/GPOS ligature tracking */
+
 #define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face-shaper_data.ot)
 
 /*
@@ -142,6 +148,25 @@ static inline uint8_t allocate_lig_id (hb_buffer_t 
*buffer) {
 }
 
 
+HB_INTERNAL hb_bool_t
+hb_ot_layout_would_substitute_lookup_fast (hb_face_t*face,
+  const hb_codepoint_t *glyphs,
+  unsigned int  glyphs_length,
+  unsigned int  lookup_index);
+
+HB_INTERNAL hb_bool_t
+hb_ot_layout_substitute_lookup_fast (hb_face_t*face,
+hb_buffer_t  *buffer,
+unsigned int  lookup_index,
+hb_mask_t mask);
+
+HB_INTERNAL hb_bool_t
+hb_ot_layout_position_lookup_fast (hb_font_t*font,
+  hb_buffer_t  *buffer,
+  unsigned int  lookup_index,
+  hb_mask_t mask);
+
+
 /*
  * hb_ot_layout_t
  */
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index c7f1f09..617034b 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -2,6 +2,7 @@
  * Copyright © 1998-2004  David Turner and Werner Lemberg
  * Copyright © 2006  Behdad Esfahbod
  * Copyright © 2007,2008,2009  Red Hat, Inc.
+ * Copyright © 2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -24,6 +25,7 @@
  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  *
  * Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
  */
 
 #include hb-ot-layout-private.hh
@@ -93,6 +95,24 @@ _get_gpos (hb_face_t *face)
   return *hb_ot_layout_from_face (face)-gpos;
 }
 
+static inline const GDEF
+_get_gdef_fast (hb_face_t *face)
+{
+  return *hb_ot_layout_from_face (face)-gdef;
+}
+static inline const GSUB
+_get_gsub_fast (hb_face_t *face)
+{
+  if (unlikely (!hb_ot_layout_ensure (face))) return Null(GSUB);
+  return *hb_ot_layout_from_face (face)-gsub;
+}
+static inline const GPOS
+_get_gpos_fast (hb_face_t *face)
+{
+  if (unlikely (!hb_ot_layout_ensure (face))) return Null(GPOS);
+  return *hb_ot_layout_from_face (face)-gpos;
+}
+
 
 /*
  * GDEF
@@ -110,7 +130,7 @@ _hb_ot_layout_get_glyph_property (hb_face_t   *face,
 {
   if (!info-props_cache())
   {
-const GDEF gdef = _get_gdef (face);
+const GDEF gdef = _get_gdef_fast (face);
 info-props_cache() = gdef.get_glyph_props (info-codepoint);
   }
 
@@ -127,7 +147,7 @@ _hb_ot_layout_match_properties_mark (hb_face_t  *face,
* lookup_props has the set index.
*/
   if (lookup_props  LookupFlag::UseMarkFilteringSet)
-return _get_gdef (face).mark_set_covers (lookup_props  16, glyph);
+return _get_gdef_fast (face).mark_set_covers (lookup_props  16, glyph);
 
   /* The second byte of lookup_props has the meaning
* ignore marks of attachment type different than
@@ -479,6 +499,17 @@ hb_ot_layout_would_substitute_lookup (hb_face_t
*face,
   return _get_gsub (face).would_substitute_lookup (c, lookup_index);
 }
 
+hb_bool_t
+hb_ot_layout_would_substitute_lookup_fast (hb_face_t*face,
+  const hb_codepoint_t *glyphs,
+  unsigned int  glyphs_length,
+ 

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

2012-07-30 Thread Behdad Esfahbod
 src/hb-ot-shape.cc |2 ++
 src/hb-private.hh  |5 +
 2 files changed, 7 insertions(+)

New commits:
commit 3f4764bb56bb7e42ba8859f1905810bd2f998838
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 10:06:42 2012 -0400

Don't lock user_data set during destruction if empty

diff --git a/src/hb-private.hh b/src/hb-private.hh
index ea3254c..2f85025 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -442,6 +442,11 @@ struct hb_lockable_set_t
 
   inline void finish (lock_t l)
   {
+if (!items.len) {
+  /* No need for locking. */
+  items.finish ();
+  return;
+}
 l.lock ();
 while (items.len) {
   item_t old = items[items.len - 1];
commit 4ba647eecf0f70917ac4229af1f2dd3c62fcb7d5
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 09:53:06 2012 -0400

Fix leak

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index e04e700..7831f90 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -203,6 +203,8 @@ void
 _hb_ot_shaper_shape_plan_data_destroy (hb_ot_shaper_shape_plan_data_t *data)
 {
   data-map.finish ();
+
+  free (data);
 }
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-30 Thread Behdad Esfahbod
 src/hb-old/harfbuzz-arabic.c|  
 12 +++---
 src/hb-old/harfbuzz-gpos.c  |  
  6 ++---
 src/hb-old/harfbuzz-gsub.c  |  
  6 ++---
 src/hb-old/harfbuzz-tibetan.c   |  
  1 
 src/hb-ot-shape-complex-arabic.cc   |  
  2 -
 src/hb-ot-shape-complex-indic.cc|  
  4 ---
 src/hb-ot-shape-complex-misc.cc |  
 12 +++---
 src/hb-ot-shape-complex-private.hh  |  
  9 +++
 src/hb-ot-shape.cc  |  
  4 ++-
 src/hb-unicode.cc   |  
  8 ++
 src/indic.cc|  
 11 ++---
 test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt |  
  1 
 12 files changed, 51 insertions(+), 25 deletions(-)

New commits:
commit 7e34601dededd521bcef15111e39293df3d0d13d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 14:53:41 2012 -0400

Unbreak Hangul jamo composition

When we removed the separate Hangul shaper, the specific normalization
preference of Hangul was lost.  Fix that.  Also, the Thai shaper was
copied from Hangul, so had the fully-composed normalization behavior,
which was unnecessary.  So, fix that too.

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 75f5fe9..1f63c12 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -206,7 +206,7 @@ _hb_ot_shape_complex_override_features_arabic 
(hb_ot_map_builder_t *map,
 }
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_arabic (void)
+_hb_ot_shape_complex_normalization_preference_arabic (const 
hb_segment_properties_t *props)
 {
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index e4c151a..c7025ff 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -420,10 +420,8 @@ _hb_ot_shape_complex_override_features_indic 
(hb_ot_map_builder_t *map,
 
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_indic (void)
+_hb_ot_shape_complex_normalization_preference_indic (const 
hb_segment_properties_t *props)
 {
-  /* We want split matras decomposed by the common shaping logic. */
-  /* XXX sort this out after adding per-shaper normalizers. */
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 4578f0b..4b9e6a6 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -79,8 +79,14 @@ _hb_ot_shape_complex_override_features_default 
(hb_ot_map_builder_t *map HB_UNUS
 }
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_default (void)
+_hb_ot_shape_complex_normalization_preference_default (const 
hb_segment_properties_t *props)
 {
+  switch ((hb_tag_t) props-script)
+  {
+/* Unicode-1.1 additions */
+case HB_SCRIPT_HANGUL:
+  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+  }
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
@@ -108,9 +114,9 @@ _hb_ot_shape_complex_override_features_thai 
(hb_ot_map_builder_t *map HB_UNUSED,
 }
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_thai (void)
+_hb_ot_shape_complex_normalization_preference_thai (const 
hb_segment_properties_t *props HB_UNUSED)
 {
-  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
 void
diff --git a/src/hb-ot-shape-complex-private.hh 
b/src/hb-ot-shape-complex-private.hh
index d444cd6..689ca61 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -270,23 +270,22 @@ hb_ot_shape_complex_override_features 
(hb_ot_complex_shaper_t shaper,
  * normalization_preference()
  *
  * Called during shape_execute().
- *
- * Shapers should return true if it prefers decomposed (NFD) input rather than 
precomposed (NFC).
  */
 
-typedef hb_ot_shape_normalization_mode_t 
hb_ot_shape_complex_normalization_preference_func_t (void);
+typedef hb_ot_shape_normalization_mode_t 
hb_ot_shape_complex_normalization_preference_func_t (const 
hb_segment_properties_t *props HB_UNUSED);
 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
   HB_INTERNAL hb_ot_shape_complex_normalization_preference_func_t 
_hb_ot_shape_complex_normalization_preference_##name;
   HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
 #undef HB_COMPLEX_SHAPER_IMPLEMENT
 
 static inline hb_ot_shape_normalization_mode_t

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-30 Thread Behdad Esfahbod
 src/hb-coretext.cc |  161 ++---
 1 file changed, 80 insertions(+), 81 deletions(-)

New commits:
commit 301168dae77a63ee25adfb26ce2b54a708f83791
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 17:48:04 2012 -0400

[CoreText] Port to shape_plan infrastructure

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 6e09c5e..5e1be9c 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -1,5 +1,6 @@
 /*
  * Copyright © 2012  Mozilla Foundation.
+ * Copyright © 2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -22,10 +23,11 @@
  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  *
  * Mozilla Author(s): Jonathan Kew
+ * Google Author(s): Behdad Esfahbod
  */
 
 #define HB_SHAPER coretext
-#include hb-shaper-private.hh
+#include hb-shaper-impl-private.hh
 
 #define GlyphID GlyphID_mac
 #include ApplicationServices/ApplicationServices.h
@@ -33,28 +35,23 @@
 
 #include hb-coretext.h
 
-#include hb-font-private.hh
-#include hb-buffer-private.hh
-
 
 #ifndef HB_DEBUG_CORETEXT
 #define HB_DEBUG_CORETEXT (HB_DEBUG+0)
 #endif
 
 
-static hb_user_data_key_t hb_coretext_data_key;
+HB_SHAPER_DATA_ENSURE_DECLARE(coretext, face)
+HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font)
 
-static struct hb_coretext_face_data_t {
-  CGFontRef  cg_font;
-} _hb_coretext_face_data_nil = {0};
 
-static void
-_hb_coretext_face_data_destroy (hb_coretext_face_data_t *data)
-{
-  if (data-cg_font)
-CFRelease (data-cg_font);
-  free (data);
-}
+/*
+ * shaper face data
+ */
+
+struct hb_coretext_shaper_face_data_t {
+  CGFontRef cg_font;
+};
 
 static void
 release_data (void *info, const void *data, size_t size)
@@ -65,16 +62,12 @@ release_data (void *info, const void *data, size_t size)
   hb_blob_destroy ((hb_blob_t *) info);
 }
 
-static hb_coretext_face_data_t *
-_hb_coretext_face_get_data (hb_face_t *face)
+hb_coretext_shaper_face_data_t *
+_hb_coretext_shaper_face_data_create (hb_face_t *face)
 {
-  hb_coretext_face_data_t *data = (hb_coretext_face_data_t *) 
hb_face_get_user_data (face, hb_coretext_data_key);
-  if (likely (data)) return data;
-
-  data = (hb_coretext_face_data_t *) calloc (1, sizeof 
(hb_coretext_face_data_t));
+  hb_coretext_shaper_face_data_t *data = (hb_coretext_shaper_face_data_t *) 
calloc (1, sizeof (hb_coretext_shaper_face_data_t));
   if (unlikely (!data))
-return _hb_coretext_face_data_nil;
-
+return NULL;
 
   hb_blob_t *blob = hb_face_reference_blob (face);
   unsigned int blob_length;
@@ -86,86 +79,103 @@ _hb_coretext_face_get_data (hb_face_t *face)
   data-cg_font = CGFontCreateWithDataProvider (provider);
   CGDataProviderRelease (provider);
 
-  if (unlikely (!data-cg_font))
+  if (unlikely (!data-cg_font)) {
 DEBUG_MSG (CORETEXT, face, Face CGFontCreateWithDataProvider() failed);
-
-
-  if (unlikely (!hb_face_set_user_data (face, hb_coretext_data_key, data,
-(hb_destroy_func_t) 
_hb_coretext_face_data_destroy,
-false)))
-  {
-_hb_coretext_face_data_destroy (data);
-data = (hb_coretext_face_data_t *) hb_face_get_user_data (face, 
hb_coretext_data_key);
-if (data)
-  return data;
-else
-  return _hb_coretext_face_data_nil;
+free (data);
+return NULL;
   }
 
   return data;
 }
 
-
-static struct hb_coretext_font_data_t {
-  CTFontRef ct_font;
-} _hb_coretext_font_data_nil = {0};
-
-static void
-_hb_coretext_font_data_destroy (hb_coretext_font_data_t *data)
+void
+_hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
 {
-  if (data-ct_font)
-CFRelease (data-ct_font);
+  CFRelease (data-cg_font);
   free (data);
 }
 
-static hb_coretext_font_data_t *
-_hb_coretext_font_get_data (hb_font_t *font)
+
+/*
+ * shaper font data
+ */
+
+struct hb_coretext_shaper_font_data_t {
+  CTFontRef ct_font;
+};
+
+hb_coretext_shaper_font_data_t *
+_hb_coretext_shaper_font_data_create (hb_font_t *font)
 {
-  hb_coretext_font_data_t *data = (hb_coretext_font_data_t *) 
hb_font_get_user_data (font, hb_coretext_data_key);
-  if (likely (data)) return data;
+  if (unlikely (!hb_coretext_shaper_face_data_ensure (font-face))) return 
NULL;
 
-  data = (hb_coretext_font_data_t *) calloc (1, sizeof 
(hb_coretext_font_data_t));
+  hb_coretext_shaper_font_data_t *data = (hb_coretext_shaper_font_data_t *) 
calloc (1, sizeof (hb_coretext_shaper_font_data_t));
   if (unlikely (!data))
-return _hb_coretext_font_data_nil;
+return NULL;
 
-  hb_coretext_face_data_t *face_data = _hb_coretext_face_get_data (font-face);
+  hb_face_t *face = font-face;
+  hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
 
   data-ct_font = CTFontCreateWithGraphicsFont (face_data-cg_font, 
font-y_scale, NULL, NULL);
-  if (unlikely (!data-ct_font))
+  if (unlikely (!data-ct_font)) {
 DEBUG_MSG (CORETEXT, font, Font 

Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 12 commits

2012-07-29 Thread Jonathan Kew

On 27/7/12 17:56, Behdad Esfahbod wrote:


@@ -114,6 +115,7 @@ hb_shape_plan_get_empty (void)
static const hb_shape_plan_t _hb_shape_plan_nil = {
  HB_OBJECT_HEADER_STATIC,

+TRUE, /* default_shaper_list */
  NULL, /* face */
  _HB_BUFFER_PROPS_DEFAULT, /* props */

s/TRUE/true/, please, otherwise this fails to compile on OS X (at 
least), where TRUE isn't defined.



___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-29 Thread Behdad Esfahbod
 src/hb-shape-plan.cc |2 +-
 src/hb-uniscribe.cc  |6 +-
 src/hb-uniscribe.h   |4 
 src/test-would-substitute.cc |2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit bb0e4ba3e9c5a407fc5d73c914e429d24d336380
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Jul 29 17:34:14 2012 -0400

Minor

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index af3c18d..f9f9f3d 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -115,7 +115,7 @@ hb_shape_plan_get_empty (void)
   static const hb_shape_plan_t _hb_shape_plan_nil = {
 HB_OBJECT_HEADER_STATIC,
 
-TRUE, /* default_shaper_list */
+false, /* default_shaper_list */
 NULL, /* face */
 _HB_BUFFER_PROPS_DEFAULT, /* props */
 
diff --git a/src/test-would-substitute.cc b/src/test-would-substitute.cc
index 34538bf..2a2c3ef 100644
--- a/src/test-would-substitute.cc
+++ b/src/test-would-substitute.cc
@@ -60,7 +60,7 @@ main (int argc, char **argv)
 hb_memory_mode_t mm;
 
 #ifdef HAVE_GLIB
-GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL);
+GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
 font_data = g_mapped_file_get_contents (mf);
 len = g_mapped_file_get_length (mf);
 destroy = (hb_destroy_func_t) g_mapped_file_unref;
commit a00ad60bc0fe74bf0e11d73da563239f3392f351
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jul 28 21:16:08 2012 -0400

[Uniscribe] Remove hb_uniscribe_font_ensure()

Wasn't a huge fan of putting the burden on the user.  Just remove it and
do what we've got to do transparently.

diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 7d06a6b..dc2c6d9 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -58,7 +58,7 @@ DWORD GetFontData(
 
 HB_SHAPER_DATA_ENSURE_DECLARE(uniscribe, face)
 HB_SHAPER_DATA_ENSURE_DECLARE(uniscribe, font)
-hb_bool_t
+static hb_bool_t
 hb_uniscribe_font_ensure (hb_font_t *font)
 {
   hb_face_t *face = font-face;
@@ -223,6 +223,8 @@ _hb_uniscribe_shaper_shape_plan_data_destroy 
(hb_uniscribe_shaper_shape_plan_dat
 LOGFONTW *
 hb_uniscribe_font_get_logfontw (hb_font_t *font)
 {
+  if (unlikely (!hb_uniscribe_font_ensure (font)))
+return NULL;
   hb_uniscribe_shaper_font_data_t *font_data =  HB_SHAPER_DATA_GET (font);
   return font_data-log_font;
 }
@@ -230,6 +232,8 @@ hb_uniscribe_font_get_logfontw (hb_font_t *font)
 HFONT
 hb_uniscribe_font_get_hfont (hb_font_t *font)
 {
+  if (unlikely (!hb_uniscribe_font_ensure (font)))
+return NULL;
   hb_uniscribe_shaper_font_data_t *font_data =  HB_SHAPER_DATA_GET (font);
   return font_data-hfont;
 }
diff --git a/src/hb-uniscribe.h b/src/hb-uniscribe.h
index 2758dab..bb99f39 100644
--- a/src/hb-uniscribe.h
+++ b/src/hb-uniscribe.h
@@ -34,10 +34,6 @@
 
 HB_BEGIN_DECLS
 
-/* Must call before all other funtions in this file.  Idempotent. */
-hb_bool_t
-hb_uniscribe_font_ensure (hb_font_t *font);
-
 
 LOGFONTW *
 hb_uniscribe_font_get_logfontw (hb_font_t *font);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 12 commits

2012-07-29 Thread Behdad Esfahbod
On 07/29/2012 02:05 PM, Jonathan Kew wrote:
 On 27/7/12 17:56, Behdad Esfahbod wrote:
 
 @@ -114,6 +115,7 @@ hb_shape_plan_get_empty (void)
 static const hb_shape_plan_t _hb_shape_plan_nil = {
   HB_OBJECT_HEADER_STATIC,

 +TRUE, /* default_shaper_list */
   NULL, /* face */
   _HB_BUFFER_PROPS_DEFAULT, /* props */

 s/TRUE/true/, please, otherwise this fails to compile on OS X (at least),
 where TRUE isn't defined.

Fixed.

BTW, I get to porting the coretext and graphite backends to the new
facilities.  Unless you beat me to that...

Cheers,
behdad
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-29 Thread Khaled Hosny
On Sun, Jul 29, 2012 at 02:34:16PM -0700, Behdad Esfahbod wrote:
 diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
 index af3c18d..f9f9f3d 100644
 --- a/src/hb-shape-plan.cc
 +++ b/src/hb-shape-plan.cc
 @@ -115,7 +115,7 @@ hb_shape_plan_get_empty (void)
static const hb_shape_plan_t _hb_shape_plan_nil = {
  HB_OBJECT_HEADER_STATIC,
  
 -TRUE, /* default_shaper_list */
 +false, /* default_shaper_list */

Was the false really intended here?

Regards,
 Khaled
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-29 Thread Behdad Esfahbod
 src/hb-old.cc  
|   12 +-
 src/hb-ot-layout-gsub-table.hh 
|   18 +++---
 src/hb-shape-plan.cc   
|2 -
 src/test.cc
|2 -
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST 
   |1 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt
 |   18 ++
 6 files changed, 38 insertions(+), 15 deletions(-)

New commits:
commit ef6e9cec3399e4f63f4b662abd77cf6d4683e8a3
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Jul 29 21:35:22 2012 -0400

Fixup bb0e4ba3e9c5a407fc5d73c914e429d24d336380

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index f9f9f3d..a478ba5 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -115,7 +115,7 @@ hb_shape_plan_get_empty (void)
   static const hb_shape_plan_t _hb_shape_plan_nil = {
 HB_OBJECT_HEADER_STATIC,
 
-false, /* default_shaper_list */
+true, /* default_shaper_list */
 NULL, /* face */
 _HB_BUFFER_PROPS_DEFAULT, /* props */
 
commit cb3d34063154bf164c61eeba41c6166b0bd304fb
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Jul 29 20:37:38 2012 -0400

[GSUB] Don't set new lig_id on mark ligatures

If two marks form a ligature, retain their previous lig_id, such that
the mark ligature can attach to ligature components...

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676343

In fact, I noticed that we should not let ligatures form between glyphs
coming from different components of a previous ligature.  For example,
if the sequence is: LAM,SHADDA,LAM,FATHA,HEH, the LAM,LAM,HEH form a
ligature, putting SHADDA and FATHA next to eachother.  However, it would
be wrong to ligate them.  Uniscribe has this bug also.

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 03244b5..a74f707 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -499,11 +499,20 @@ struct Ligature
   if (likely (c-buffer-info[skippy_iter.idx].codepoint != component[i])) 
return TRACE_RETURN (false);
 }
 
-unsigned int klass = first_was_mark  found_non_mark ? 
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE : 0;
+bool is_a_mark_ligature = first_was_mark  !found_non_mark;
+
+unsigned int klass = is_a_mark_ligature ? 0 : 
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
+
+/* If it's a mark ligature, we should leave the lig_id / lig_comp alone 
such that
+ * the resulting mark ligature has the opportunity to attach to ligature 
components
+ * of it's base later on.  See for example:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=676343
+ */
 
 /* Allocate new ligature id */
-unsigned int lig_id = allocate_lig_id (c-buffer);
-set_lig_props (c-buffer-cur(), lig_id, 0);
+unsigned int lig_id = is_a_mark_ligature ? 0 : allocate_lig_id (c-buffer);
+if (!is_a_mark_ligature)
+  set_lig_props (c-buffer-cur(), lig_id, 0);
 
 if (skippy_iter.idx  c-buffer-idx + count) /* No input glyphs skipped */
 {
@@ -526,7 +535,8 @@ struct Ligature
   {
while (c-should_mark_skip_current_glyph ())
{
- set_lig_props (c-buffer-cur(),  lig_id, i);
+ if (!is_a_mark_ligature)
+   set_lig_props (c-buffer-cur(),  lig_id, i);
  c-buffer-next_glyph ();
}
 
commit 97a201becf936f62046914b568e5763e27ee936e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Jul 29 20:31:36 2012 -0400

Add Arabic tests for mark ligature component attachments

diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
index 242b2a1..c71d035 100644
--- 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
@@ -2,5 +2,6 @@ lam-alef.txt
 language-arabic.txt
 language-persian.txt
 language-urdu.txt
+ligature-components.txt
 ligature-diacritics.txt
 mark-skipping.txt
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt
new file mode 100644
index 000..0d4d47f
--- /dev/null
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt
@@ -0,0 +1,18 @@
+لّله
+لَّله
+لَّله
+للّه
+للَّه
+للَّه
+للهّ
+للهَّ
+للهَّ
+لّلَه
+لَلّه
+لّلهَ
+لَلهّ
+للّهَ
+للَهّ
+لّلّهَ
+لّلَّه
+لَّلّه
commit 

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

2012-07-29 Thread Behdad Esfahbod
On 07/29/2012 09:27 PM, Khaled Hosny wrote:
 On Sun, Jul 29, 2012 at 02:34:16PM -0700, Behdad Esfahbod wrote:
 diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
 index af3c18d..f9f9f3d 100644
 --- a/src/hb-shape-plan.cc
 +++ b/src/hb-shape-plan.cc
 @@ -115,7 +115,7 @@ hb_shape_plan_get_empty (void)
static const hb_shape_plan_t _hb_shape_plan_nil = {
  HB_OBJECT_HEADER_STATIC,
  
 -TRUE, /* default_shaper_list */
 +false, /* default_shaper_list */
 
 Was the false really intended here?

Ouch.  Nice catch :).

behdad
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-29 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh   |  119 ++-
 src/hb-ot-layout-gsubgpos-private.hh |8 --
 src/hb-ot-layout-private.hh  |   33 -
 3 files changed, 106 insertions(+), 54 deletions(-)

New commits:
commit fe20c0f84f5ff518dc471bf22ac5a83ef079eb69
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 00:00:59 2012 -0400

[GSUB] Fix mark component stuff when ligatures form ligatures!

See comments.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=437633

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 2c76ae0..7c3c54c 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -485,8 +485,45 @@ struct Ligature
 hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, 
c-buffer-idx, count - 1);
 if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
 
-bool first_was_mark = (c-property  HB_OT_LAYOUT_GLYPH_CLASS_MARK);
-bool found_non_mark = false;
+/*
+ * This is perhaps the trickiest part of GSUB...  Remarks:
+ *
+ * - If all components of the ligature were marks, we call this a mark 
ligature.
+ *
+ * - If there is no GDEF, and the ligature is NOT a mark ligature, we 
categorize
+ *   it as a ligature glyph.  Though, really, this will not really be 
used...
+ *
+ * - If it *is* a mark ligature, we don't allocate a new ligature id, and 
leave
+ *   the ligature to keep its old ligature id.  This will allow it to 
attach to
+ *   a base ligature in GPOS.  Eg. if the sequence is: 
LAM,LAM,SHADDA,FATHA,HEH,
+ *   and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA wit a
+ *   ligature id and component value of 2.  Then if SHADDA,FATHA form a 
ligature
+ *   later, we don't want them to lose their ligature id/component, 
otherwise
+ *   GPOS will fail to correctly position the mark ligature on top of the
+ *   LAM,LAM,HEH ligature.  See:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=676343
+ *
+ * - If a ligature is formed of components that some of which are also 
ligatures
+ *   themselves, and those ligature components had marks attached to 
*their*
+ *   components, we have to attach the marks to the new ligature component
+ *   positions!  Now *that*'s tricky!  And these marks may be following the
+ *   last component of the whole sequence, so we should loop forward 
looking
+ *   for them and update them.
+ *
+ *   Eg. the sequence is LAM,LAM,SHADDA,FATHA,HEH, and the font first 
forms a
+ *   'clig' ligature of LAM,HEH, leaving the SHADDA and FATHA with a 
ligature
+ *   id and component == 1.  Now, during 'liga', the LAM and the LAM-HEH 
ligature
+ *   form a LAM-LAM-HEH ligature.  We need to reassign the SHADDA and 
FATHA to
+ *   the new ligature with a component value of 2.
+ *
+ *   This in fact happened to a font...  See:
+ *   https://bugzilla.gnome.org/show_bug.cgi?id=437633
+ */
+
+bool is_mark_ligature = !!(c-property  HB_OT_LAYOUT_GLYPH_CLASS_MARK);
+
+unsigned int total_component_count = 0;
+total_component_count += get_lig_num_comps (c-buffer-cur());
 
 for (unsigned int i = 1; i  count; i++)
 {
@@ -494,54 +531,54 @@ struct Ligature
 
   if (!skippy_iter.next (property)) return TRACE_RETURN (false);
 
-  found_non_mark |= !(property  HB_OT_LAYOUT_GLYPH_CLASS_MARK);
-
   if (likely (c-buffer-info[skippy_iter.idx].codepoint != component[i])) 
return TRACE_RETURN (false);
-}
 
-bool is_a_mark_ligature = first_was_mark  !found_non_mark;
+  is_mark_ligature = is_mark_ligature  (property  
HB_OT_LAYOUT_GLYPH_CLASS_MARK);
+  total_component_count += get_lig_num_comps 
(c-buffer-info[skippy_iter.idx]);
+}
 
-unsigned int klass = is_a_mark_ligature ? 0 : 
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
+/* Deal, we are forming the ligature. */
+c-buffer-merge_clusters (c-buffer-idx, skippy_iter.idx + 1);
 
-/* If it's a mark ligature, we should leave the lig_id / lig_comp alone 
such that
- * the resulting mark ligature has the opportunity to attach to ligature 
components
- * of it's base later on.  See for example:
- * https://bugzilla.gnome.org/show_bug.cgi?id=676343
- */
+unsigned int klass = is_mark_ligature ? 0 : 
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
+unsigned int lig_id = is_mark_ligature ? 0 : allocate_lig_id (c-buffer);
+unsigned int last_lig_id = get_lig_id (c-buffer-cur());
+unsigned int last_num_components = get_lig_num_comps (c-buffer-cur());
+unsigned int components_so_far = last_num_components;
 
-/* Allocate new ligature id */
-unsigned int lig_id = is_a_mark_ligature ? 0 : allocate_lig_id (c-buffer);
-if (!is_a_mark_ligature)
-  set_lig_props_for_ligature (c-buffer-cur(), lig_id, count);
+if (!is_mark_ligature)
+  set_lig_props_for_ligature 

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

2012-07-28 Thread Behdad Esfahbod
 src/hb-ot-layout-common-private.hh   |8 -
 src/hb-ot-layout-gpos-table.hh   |  179 +
 src/hb-ot-layout-gsub-table.hh   |  188 ++-
 src/hb-ot-layout-gsubgpos-private.hh |   52 ++---
 4 files changed, 313 insertions(+), 114 deletions(-)

New commits:
commit 338fe662b50f9309bf0050dd99becb644874195b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jul 28 18:53:01 2012 -0400

[GSUB] Minor

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index d95b691..03244b5 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1106,22 +1106,6 @@ struct SubstLookup : Lookup
 if (!_hb_ot_layout_check_glyph_property (c-face, c-buffer-cur(), 
c-lookup_props, c-property))
   return false;
 
-/* TODO: For the most common case this can move out of the main
- * loop, but it's not a big deal for now. */
-if (unlikely (lookup_type == SubstLookupSubTable::Extension))
-{
-  /* The spec says all subtables should have the same type.
-   * This is specially important if one has a reverse type!
-   *
-   * This is rather slow to do this here for every glyph,
-   * but it's easiest, and who uses extension lookups anyway?!*/
-  unsigned int type = get_subtable(0).u.extension.get_type ();
-  unsigned int count = get_subtable_count ();
-  for (unsigned int i = 1; i  count; i++)
-if (get_subtable(i).u.extension.get_type () != type)
- return false;
-}
-
 unsigned int count = get_subtable_count ();
 for (unsigned int i = 0; i  count; i++)
   if (get_subtable (i).apply (c, lookup_type))
@@ -1191,7 +1175,22 @@ struct SubstLookup : Lookup
 TRACE_SANITIZE ();
 if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
 OffsetArrayOfSubstLookupSubTable list = 
CastROffsetArrayOfSubstLookupSubTable  (subTable);
-return TRACE_RETURN (list.sanitize (c, this, get_type ()));
+if (unlikely (!list.sanitize (c, this, get_type ( return TRACE_RETURN 
(false);
+
+if (unlikely (get_type () == SubstLookupSubTable::Extension))
+{
+  /* The spec says all subtables of an Extension lookup should
+   * have the same type.  This is specially important if one has
+   * a reverse type!
+   *
+   * We just check that they are all either forward, or reverse. */
+  unsigned int type = get_subtable (0).u.extension.get_type ();
+  unsigned int count = get_subtable_count ();
+  for (unsigned int i = 1; i  count; i++)
+if (get_subtable (i).u.extension.get_type () != type)
+ return TRACE_RETURN (false);
+}
+return TRACE_RETURN (true);
   }
 };
 
commit e6f7479fe34fb4a7cada61d84c2ed70d1fd565c8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jul 28 18:34:58 2012 -0400

[GSUB] Simplify would-apply

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 2cbab32..d95b691 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -55,11 +55,6 @@ struct SingleSubstFormat1
 return this+coverage;
   }
 
-  inline bool would_apply (hb_would_apply_context_t *c) const
-  {
-return c-len == 1  (this+coverage) (c-first) != NOT_COVERED;
-  }
-
   inline bool apply (hb_apply_context_t *c) const
   {
 TRACE_APPLY ();
@@ -112,11 +107,6 @@ struct SingleSubstFormat2
 return this+coverage;
   }
 
-  inline bool would_apply (hb_would_apply_context_t *c) const
-  {
-return c-len == 1  (this+coverage) (c-first) != NOT_COVERED;
-  }
-
   inline bool apply (hb_apply_context_t *c) const
   {
 TRACE_APPLY ();
@@ -174,15 +164,6 @@ struct SingleSubst
 }
   }
 
-  inline bool would_apply (hb_would_apply_context_t *c) const
-  {
-switch (u.format) {
-case 1: return u.format1.would_apply (c);
-case 2: return u.format2.would_apply (c);
-default:return false;
-}
-  }
-
   inline bool apply (hb_apply_context_t *c) const
   {
 TRACE_APPLY ();
@@ -276,11 +257,6 @@ struct MultipleSubstFormat1
 return this+coverage;
   }
 
-  inline bool would_apply (hb_would_apply_context_t *c) const
-  {
-return c-len == 1  (this+coverage) (c-first) != NOT_COVERED;
-  }
-
   inline bool apply (hb_apply_context_t *c) const
   {
 TRACE_APPLY ();
@@ -331,14 +307,6 @@ struct MultipleSubst
 }
   }
 
-  inline bool would_apply (hb_would_apply_context_t *c) const
-  {
-switch (u.format) {
-case 1: return u.format1.would_apply (c);
-default:return false;
-}
-  }
-
   inline bool apply (hb_apply_context_t *c) const
   {
 TRACE_APPLY ();
@@ -393,11 +361,6 @@ struct AlternateSubstFormat1
 return this+coverage;
   }
 
-  inline bool would_apply (hb_would_apply_context_t *c) const
-  {
-return c-len == 1  (this+coverage) (c-first) != NOT_COVERED;
-  }
-
   inline bool apply (hb_apply_context_t *c) const
   {
 TRACE_APPLY ();
@@ -466,14 +429,6 @@ struct 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-28 Thread Behdad Esfahbod
 src/hb-ot-layout-gpos-table.hh 
  |   27 +++---
 src/hb-ot-layout-private.hh
  |5 +
 test/shaping/texts/in-tree/shaper-indic/MANIFEST   
  |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST 
  |1 
 test/shaping/texts/in-tree/shaper-indic/south-asian/MANIFEST   
  |1 
 test/shaping/texts/in-tree/shaper-indic/south-asian/script-tibetan/MANIFEST
  |1 
 
test/shaping/texts/in-tree/shaper-indic/south-asian/script-tibetan/misc/MANIFEST
 |1 
 
test/shaping/texts/in-tree/shaper-indic/south-asian/script-tibetan/misc/misc.txt
 |1 
 8 files changed, 29 insertions(+), 9 deletions(-)

New commits:
commit 5d874d566fe5d2cc4cfaf02c79b663d8a626ca1e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jul 28 21:05:25 2012 -0400

[GPOS] Fix mark-to-mark positioning when one of the marks is a ligature

This commit: a3313e54008167e415b72c780ca7b9cda958d07e broke MarkMarkPos
when one of the marks itself is a ligature.  That regressed 26 Tibetan
tests (up from zero!).  Fix that.  Tibetan back to zero.

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 3b1ae2a..83252c1 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1263,14 +1263,27 @@ struct MarkMarkPosFormat1
 
 unsigned int j = skippy_iter.idx;
 
-/* Two marks match only if they belong to the same base, or same component
- * of the same ligature.  That is, the lig_id numbers must match, and
- * if those are non-zero, the lig_comp number should also match. */
-if ((get_lig_id (c-buffer-info[j]) != get_lig_id (c-buffer-cur())) ||
-   (get_lig_id (c-buffer-info[j])  0 
-get_lig_comp (c-buffer-info[j]) != get_lig_comp (c-buffer-cur(
-  return TRACE_RETURN (false);
+unsigned int id1 = get_lig_id (c-buffer-cur());
+unsigned int id2 = get_lig_id (c-buffer-info[j]);
+unsigned int comp1 = get_lig_comp (c-buffer-cur());
+unsigned int comp2 = get_lig_comp (c-buffer-info[j]);
+
+if (likely (id1 == id2)) {
+  if (id1 == 0) /* Marks belonging to the same base. */
+   goto good;
+  else if (comp1 == comp2) /* Marks belonging to the same ligature 
component. */
+goto good;
+} else {
+  /* If ligature ids don't match, it may be the case that one of the marks
+   * itself is a ligature.  In which case match. */
+  if ((id1  0  !comp1) || (id2  0  !comp2))
+   goto good;
+}
+
+/* Didn't match. */
+return TRACE_RETURN (false);
 
+good:
 unsigned int mark2_index = (this+mark2Coverage) 
(c-buffer-info[j].codepoint);
 if (mark2_index == NOT_COVERED) return TRACE_RETURN (false);
 
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 294c359..1c108e0 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -73,7 +73,8 @@ _hb_ot_layout_skip_mark (hb_face_t*face,
  *
  * When a ligature is formed:
  *
- *   - The ligature glyph and any marks in between all get a unique lig_id,
+ *   - The ligature glyph and any marks in between all the same newly allocated
+ * lig_id,
  *   - The ligature glyph will get lig_comp = 0
  *   - The marks get lig_comp  0, reflecting which component of the ligature
  * they were applied to.
@@ -84,7 +85,7 @@ _hb_ot_layout_skip_mark (hb_face_t*face,
  *
  *   - All resulting glyphs will have lig_id = 0,
  *   - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively.
- *   - This is used in GPOS to attack marks to the first component of a
+ *   - This is used in GPOS to attach marks to the first component of a
  * multiple substitution in MarkBasePos.
  *
  * The numbers are also used in GPOS to do mark-to-mark positioning only
diff --git a/test/shaping/texts/in-tree/shaper-indic/MANIFEST 
b/test/shaping/texts/in-tree/shaper-indic/MANIFEST
index 3f2011f..5e0651b 100644
--- a/test/shaping/texts/in-tree/shaper-indic/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-indic/MANIFEST
@@ -1,2 +1,3 @@
 indic
+south-asian
 south-east-asian
diff --git 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST
index 3c2a4fb..7eff9e1 100644
--- a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST
@@ -1,2 +1,3 @@
+extensive.txt
 misc.txt
 reph.txt
diff --git a/test/shaping/texts/in-tree/shaper-indic/south-asian/MANIFEST 
b/test/shaping/texts/in-tree/shaper-indic/south-asian/MANIFEST
new file mode 100644
index 000..3ed6c85
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-indic/south-asian/MANIFEST
@@ -0,0 +1 @@
+script-tibetan
diff --git 

Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-26 Thread Harshula
[Resending with smaller attachments]

On Wed, 2012-07-25 at 16:21 -0700, Behdad Esfahbod wrote:
 src/hb-old.cc|   51 
 +--
  src/hb-old/harfbuzz-shaper.h |1 
  src/hb-uniscribe.cc  |5 ++--
  3 files changed, 44 insertions(+), 13 deletions(-)
 
 New commits:
 commit 91e721ea8693205f4f738bca97a5055ee75cf463
 Author: Behdad Esfahbod beh...@behdad.org
 Date:   Wed Jul 25 19:20:34 2012 -0400
 
 [hb-old] Fix clusters
 
 Unlike its documentation, hb-old's log_clusters are, well, indeed
 logical, not visual.  Fixup.  Adapted / copied from hb-uniscribe.

This commit seems to have broken Sinhala rendering with FreeSerif font
for the following file:
http://git.savannah.gnu.org/cgit/sinhala.git/plain/patches/icu-sinhala-rendering.txt

I have attached the output of both hb-view and hb-shape. hb-shape output
has not changed. hb-view output is very different. The aforementioned
patch actually does fix a rendering problem with the standalone
consonant ක (ka) when using the FreeSerif font. But breaks කො (ko), කෝ
(koo), කෞ (kau), ක්‍ර (kra), ක්‍ය (kya).

cya,
#


 diff --git a/src/hb-old.cc b/src/hb-old.cc
 index a3b5679..e828ca8 100644
 --- a/src/hb-old.cc
 +++ b/src/hb-old.cc
 @@ -251,6 +251,8 @@ _hb_old_shape (hb_font_t  *font,
  
buffer-guess_properties ();
  
 +  bool backward = HB_DIRECTION_IS_BACKWARD (buffer-props.direction);
 +
  #define FAIL(...) \
HB_STMT_START { \
  DEBUG_MSG (OLD, NULL, __VA_ARGS__); \
 @@ -285,23 +287,23 @@ retry:
pchars[chars_len++] = 0xDC00 + ((c - 0x1)  ((1  10) - 1));
  }
}
 -#undef utf16_index
  
 
  #define ALLOCATE_ARRAY(Type, name, len) \
name = (Type *) scratch; \
 -  scratch += len * sizeof (name[0]); \
 -  scratch_size -= len * sizeof (name[0]);
 +  scratch += (len) * sizeof ((name)[0]); \
 +  scratch_size -= (len) * sizeof ((name)[0]);
  
 
HB_ShaperItem item = {0};
  
ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
 +  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);
item.stringLength = chars_len;
item.item.pos = 0;
item.item.length = item.stringLength;
item.item.script = hb_old_script_from_script (buffer-props.script);
 -  item.item.bidiLevel = HB_DIRECTION_IS_FORWARD (buffer-props.direction) ? 
 0 : 1;
 +  item.item.bidiLevel = backward ? 1 : 0;
  
item.font = old_font;
item.face = old_face;
 @@ -314,14 +316,17 @@ retry:
   sizeof (HB_GlyphAttributes) +
   sizeof (HB_Fixed) +
   sizeof (HB_FixedPoint) +
 - sizeof (unsigned short));
 + sizeof (uint32_t));
  
item.num_glyphs = num_glyphs;
ALLOCATE_ARRAY (HB_Glyph, item.glyphs, num_glyphs);
ALLOCATE_ARRAY (HB_GlyphAttributes, item.attributes, num_glyphs);
ALLOCATE_ARRAY (HB_Fixed, item.advances, num_glyphs);
ALLOCATE_ARRAY (HB_FixedPoint, item.offsets, num_glyphs);
 -  ALLOCATE_ARRAY (unsigned short, item.log_clusters, num_glyphs);
 +  uint32_t *vis_clusters;
 +  ALLOCATE_ARRAY (uint32_t, vis_clusters, num_glyphs);
 +
 +#undef ALLOCATE_ARRAY
  
if (!HB_ShapeItem (item))
  return false;
 @@ -335,24 +340,48 @@ retry:
}
num_glyphs = item.num_glyphs;
  
 -#undef ALLOCATE_ARRAY
 +  /* Ok, we've got everything we need, now compose output buffer,
 +   * very, *very*, carefully! */
 +
 +  /* Calculate visual-clusters.  That's what we ship. */
 +  for (unsigned int i = 0; i  num_glyphs; i++)
 +vis_clusters[i] = -1;
 +  for (unsigned int i = 0; i  buffer-len; i++) {
 +uint32_t *p = 
 vis_clusters[item.log_clusters[buffer-info[i].utf16_index()]];
 +*p = MIN (*p, buffer-info[i].cluster);
 +  }
 +  if (!backward) {
 +for (unsigned int i = 1; i  num_glyphs; i++)
 +  if (vis_clusters[i] == -1)
 + vis_clusters[i] = vis_clusters[i - 1];
 +  } else {
 +for (int i = num_glyphs - 2; i = 0; i--)
 +  if (vis_clusters[i] == -1)
 + vis_clusters[i] = vis_clusters[i + 1];
 +  }
 +
 +#undef utf16_index
  
 +  buffer-ensure (num_glyphs);
 +  if (buffer-in_error)
 +FAIL (Buffer in error);
 +
 +
 +  buffer-len = num_glyphs;
hb_glyph_info_t *info = buffer-info;
for (unsigned int i = 0; i  num_glyphs; i++)
{
  info[i].codepoint = item.glyphs[i];
 -info[i].cluster = item.log_clusters[i];
 +info[i].cluster = vis_clusters[i];
  
  info[i].mask = item.advances[i];
  info[i].var1.u32 = item.offsets[i].x;
  info[i].var2.u32 = item.offsets[i].y;
}
 -  buffer-len = num_glyphs;
  
buffer-clear_positions ();
  
 -  unsigned int count = buffer-len;
 -  for (unsigned int i = 0; i  count; ++i) {
 +  for (unsigned int i = 0; i  num_glyphs; ++i) {
  hb_glyph_info_t *info = buffer-info[i];
  hb_glyph_position_t *pos = buffer-pos[i];
  
 diff --git 

Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-26 Thread Behdad Esfahbod
On 07/26/2012 09:17 AM, Harshula wrote:
  [hb-old] Fix clusters
  
  Unlike its documentation, hb-old's log_clusters are, well, indeed
  logical, not visual.  Fixup.  Adapted / copied from hb-uniscribe.
 This commit seems to have broken Sinhala rendering with FreeSerif font
 for the following file:

I have a hard time believing that that commit can break shaping at all.
Specially if you say hb-shape output is the same.

behdad
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-26 Thread Behdad Esfahbod
 src/hb-old/harfbuzz-global.h |   17 +++--
 src/hb-old/harfbuzz-impl.h   |6 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit fa2dfcd560444d8c54b6349ee106134d3536f79b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Jul 26 16:06:16 2012 -0400

Fix visibility warnings with MinGW32

diff --git a/src/hb-old/harfbuzz-global.h b/src/hb-old/harfbuzz-global.h
index c0f54d6..9ba5841 100644
--- a/src/hb-old/harfbuzz-global.h
+++ b/src/hb-old/harfbuzz-global.h
@@ -31,14 +31,19 @@
 #include stdlib.h
 #include string.h
 
-#define HB_BEGIN_VISIBILITY _Pragma (GCC visibility push(hidden))
-#define HB_END_VISIBILITY _Pragma (GCC visibility pop)
+#if defined(__GNUC__)  (__GNUC__ = 4)  !defined(__MINGW32__)
+# define HB_BEGIN_VISIBILITY _Pragma (GCC visibility push(hidden))
+# define HB_END_VISIBILITY _Pragma (GCC visibility pop)
+#else
+# define HB_BEGIN_VISIBILITY
+# define HB_END_VISIBILITY
+#endif
 #ifdef __cplusplus
-#define HB_BEGIN_HEADER  extern C { HB_BEGIN_VISIBILITY
-#define HB_END_HEADER  HB_END_VISIBILITY }
+# define HB_BEGIN_HEADER  extern C { HB_BEGIN_VISIBILITY
+# define HB_END_HEADER  HB_END_VISIBILITY }
 #else
-#define HB_BEGIN_HEADER  HB_BEGIN_VISIBILITY
-#define HB_END_HEADER  HB_END_VISIBILITY
+# define HB_BEGIN_HEADER  HB_BEGIN_VISIBILITY
+# define HB_END_HEADER  HB_END_VISIBILITY
 #endif
 
 HB_BEGIN_HEADER
diff --git a/src/hb-old/harfbuzz-impl.h b/src/hb-old/harfbuzz-impl.h
index 01865ca..3f370b6 100644
--- a/src/hb-old/harfbuzz-impl.h
+++ b/src/hb-old/harfbuzz-impl.h
@@ -33,7 +33,11 @@
 HB_BEGIN_HEADER
 
 #ifndef HB_INTERNAL
-# define HB_INTERNAL __attribute__((visibility(hidden)))
+# ifndef __MINGW32__
+#  define HB_INTERNAL __attribute__((__visibility__(hidden)))
+# else
+#  define HB_INTERNAL
+# endif
 #endif
 
 #ifndef NULL
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-25 Thread Behdad Esfahbod
 src/hb-unicode-private.hh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 35bdab3cf1f0836807160e3ce93766c321b32e8c
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 25 11:59:52 2012 -0400

Minor

diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index 0ba2fcc..1ce5adc 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -151,7 +151,7 @@ _hb_unicode_is_zero_width (hb_codepoint_t ch)
   return ((ch  ~0x007F) == 0x2000  (hb_in_rangeshb_codepoint_t (ch,
 0x200B, 
0x200F,
 0x202A, 
0x202E,
-0x2060, 
0x2063) ||
+0x2060, 
0x2064) ||
   (ch == 0x2028))) ||
  unlikely (ch == 0x0009 ||
ch == 0x00AD ||
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-25 Thread Behdad Esfahbod
 src/hb-ot-layout-gpos-table.hh |   10 +-
 src/hb-ot-layout-private.hh|   23 +--
 2 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit a3313e54008167e415b72c780ca7b9cda958d07e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 25 18:37:51 2012 -0400

[GPOS] Fix MarkMarkPos applied to results of MultipleSubst

This was broken as a result of 7b84c536c10ab90ed96a033d88e9ad232d46c5b8.
As Khaled reported, MarkMark positioning was broken with glyphs
resulting from a MultipleSubst.  Fixed.  Test with the ALLAH character
in Amiri.

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index e95aa3e..5b71407 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1169,11 +1169,11 @@ struct MarkMarkPosFormat1
 unsigned int j = skippy_iter.idx;
 
 /* Two marks match only if they belong to the same base, or same component
- * of the same ligature.  That is, the component numbers must match, and
- * if those are non-zero, the ligid number should also match. */
-if ((get_lig_comp (c-buffer-info[j]) != get_lig_comp (c-buffer-cur())) 
||
-   (get_lig_comp (c-buffer-info[j])  0 
-get_lig_id (c-buffer-info[j]) != get_lig_id (c-buffer-cur(
+ * of the same ligature.  That is, the lig_id numbers must match, and
+ * if those are non-zero, the lig_comp number should also match. */
+if ((get_lig_id (c-buffer-info[j]) != get_lig_id (c-buffer-cur())) ||
+   (get_lig_id (c-buffer-info[j])  0 
+get_lig_comp (c-buffer-info[j]) != get_lig_comp (c-buffer-cur(
   return TRACE_RETURN (false);
 
 unsigned int mark2_index = (this+mark2Coverage) 
(c-buffer-info[j].codepoint);
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 7a1c7e3..ba375aa 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -68,8 +68,27 @@ _hb_ot_layout_skip_mark (hb_face_t*face,
  * GSUB/GPOS
  */
 
-/* unique ligature id */
-/* component number in the ligature (0 = base) */
+/* lig_id / lig_comp
+ *
+ * When a ligature is formed:
+ *
+ *   - The ligature glyph and any marks in between all get a unique lig_id,
+ *   - The ligature glyph will get lig_comp = 0
+ *   - The marks get lig_comp  0, reflecting which component of the ligature
+ * they were applied to.
+ *   - This is used in GPOS to attach marks to the right component of a 
ligature
+ * in MarkLigPos.
+ *
+ * When a multiple-substitution is done:
+ *
+ *   - All resulting glyphs will have lig_id = 0,
+ *   - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively.
+ *   - This is used in GPOS to attack marks to the first component of a
+ * multiple substitution in MarkBasePos.
+ *
+ * The numbers are also used in GPOS to do mark-to-mark positioning only
+ * to marks that belong to the same component of a ligature in MarkMarPos.
+ */
 static inline void
 set_lig_props (hb_glyph_info_t info, unsigned int lig_id, unsigned int 
lig_comp)
 {
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-25 Thread Behdad Esfahbod
 src/hb-old.cc|   51 +--
 src/hb-old/harfbuzz-shaper.h |1 
 src/hb-uniscribe.cc  |5 ++--
 3 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit 91e721ea8693205f4f738bca97a5055ee75cf463
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 25 19:20:34 2012 -0400

[hb-old] Fix clusters

Unlike its documentation, hb-old's log_clusters are, well, indeed
logical, not visual.  Fixup.  Adapted / copied from hb-uniscribe.

diff --git a/src/hb-old.cc b/src/hb-old.cc
index a3b5679..e828ca8 100644
--- a/src/hb-old.cc
+++ b/src/hb-old.cc
@@ -251,6 +251,8 @@ _hb_old_shape (hb_font_t  *font,
 
   buffer-guess_properties ();
 
+  bool backward = HB_DIRECTION_IS_BACKWARD (buffer-props.direction);
+
 #define FAIL(...) \
   HB_STMT_START { \
 DEBUG_MSG (OLD, NULL, __VA_ARGS__); \
@@ -285,23 +287,23 @@ retry:
   pchars[chars_len++] = 0xDC00 + ((c - 0x1)  ((1  10) - 1));
 }
   }
-#undef utf16_index
 
 
 #define ALLOCATE_ARRAY(Type, name, len) \
   name = (Type *) scratch; \
-  scratch += len * sizeof (name[0]); \
-  scratch_size -= len * sizeof (name[0]);
+  scratch += (len) * sizeof ((name)[0]); \
+  scratch_size -= (len) * sizeof ((name)[0]);
 
 
   HB_ShaperItem item = {0};
 
   ALLOCATE_ARRAY (const HB_UChar16, item.string, chars_len);
+  ALLOCATE_ARRAY (unsigned short, item.log_clusters, chars_len + 2);
   item.stringLength = chars_len;
   item.item.pos = 0;
   item.item.length = item.stringLength;
   item.item.script = hb_old_script_from_script (buffer-props.script);
-  item.item.bidiLevel = HB_DIRECTION_IS_FORWARD (buffer-props.direction) ? 0 
: 1;
+  item.item.bidiLevel = backward ? 1 : 0;
 
   item.font = old_font;
   item.face = old_face;
@@ -314,14 +316,17 @@ retry:
sizeof (HB_GlyphAttributes) +
sizeof (HB_Fixed) +
sizeof (HB_FixedPoint) +
-   sizeof (unsigned short));
+   sizeof (uint32_t));
 
   item.num_glyphs = num_glyphs;
   ALLOCATE_ARRAY (HB_Glyph, item.glyphs, num_glyphs);
   ALLOCATE_ARRAY (HB_GlyphAttributes, item.attributes, num_glyphs);
   ALLOCATE_ARRAY (HB_Fixed, item.advances, num_glyphs);
   ALLOCATE_ARRAY (HB_FixedPoint, item.offsets, num_glyphs);
-  ALLOCATE_ARRAY (unsigned short, item.log_clusters, num_glyphs);
+  uint32_t *vis_clusters;
+  ALLOCATE_ARRAY (uint32_t, vis_clusters, num_glyphs);
+
+#undef ALLOCATE_ARRAY
 
   if (!HB_ShapeItem (item))
 return false;
@@ -335,24 +340,48 @@ retry:
   }
   num_glyphs = item.num_glyphs;
 
-#undef ALLOCATE_ARRAY
+  /* Ok, we've got everything we need, now compose output buffer,
+   * very, *very*, carefully! */
+
+  /* Calculate visual-clusters.  That's what we ship. */
+  for (unsigned int i = 0; i  num_glyphs; i++)
+vis_clusters[i] = -1;
+  for (unsigned int i = 0; i  buffer-len; i++) {
+uint32_t *p = 
vis_clusters[item.log_clusters[buffer-info[i].utf16_index()]];
+*p = MIN (*p, buffer-info[i].cluster);
+  }
+  if (!backward) {
+for (unsigned int i = 1; i  num_glyphs; i++)
+  if (vis_clusters[i] == -1)
+   vis_clusters[i] = vis_clusters[i - 1];
+  } else {
+for (int i = num_glyphs - 2; i = 0; i--)
+  if (vis_clusters[i] == -1)
+   vis_clusters[i] = vis_clusters[i + 1];
+  }
+
+#undef utf16_index
 
+  buffer-ensure (num_glyphs);
+  if (buffer-in_error)
+FAIL (Buffer in error);
+
+
+  buffer-len = num_glyphs;
   hb_glyph_info_t *info = buffer-info;
   for (unsigned int i = 0; i  num_glyphs; i++)
   {
 info[i].codepoint = item.glyphs[i];
-info[i].cluster = item.log_clusters[i];
+info[i].cluster = vis_clusters[i];
 
 info[i].mask = item.advances[i];
 info[i].var1.u32 = item.offsets[i].x;
 info[i].var2.u32 = item.offsets[i].y;
   }
-  buffer-len = num_glyphs;
 
   buffer-clear_positions ();
 
-  unsigned int count = buffer-len;
-  for (unsigned int i = 0; i  count; ++i) {
+  for (unsigned int i = 0; i  num_glyphs; ++i) {
 hb_glyph_info_t *info = buffer-info[i];
 hb_glyph_position_t *pos = buffer-pos[i];
 
diff --git a/src/hb-old/harfbuzz-shaper.h b/src/hb-old/harfbuzz-shaper.h
index 3f32d47..ab65004 100644
--- a/src/hb-old/harfbuzz-shaper.h
+++ b/src/hb-old/harfbuzz-shaper.h
@@ -251,6 +251,7 @@ struct HB_ShaperItem_ {
 HB_Fixed *advances; /* output: num_glyphs advances */
 HB_FixedPoint *offsets; /* output: num_glyphs offsets */
 unsigned short *log_clusters;   /* output: for each output glyph, 
the index in the input of the start of its logical cluster */
+/* XXX the discription for log_clusters is wrong.  It maps each input 
position to output glyph position! */
 
 /* internal */
 HB_Bool kerning_applied;/* output: true if kerning was 
applied by the shaper */

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

2012-07-25 Thread Behdad Esfahbod
 src/hb-old.cc  |   15 ---
 src/hb-old/harfbuzz-shaper.cpp |2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 2e7f223054d310695bdb3498b2b2b5d17b6cce78
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 25 19:30:15 2012 -0400

[hb-old] Fix Arabic cursive positioning

Backporting from upstream:

commit b847f24ce855d24f6822bcd9c0006905e81b94d8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 25 19:29:16 2012 -0400

[arabic] Fix Arabic cursive positioning

This was clearly broken in testing.  Who knows...  Fixes for me.
Test with a Nastaleeq font, or with Arabic Typesetting.

Backporting from Chromium.

diff --git a/src/hb-old/harfbuzz-shaper.cpp b/src/hb-old/harfbuzz-shaper.cpp
index 5baf971..62886f3 100644
--- a/src/hb-old/harfbuzz-shaper.cpp
+++ b/src/hb-old/harfbuzz-shaper.cpp
@@ -923,7 +923,7 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int 
availableGlyphs, HB_Bool do
 adjustment = HB_FIXED_ROUND(adjustment);
 
 if (positions[i].new_advance) {
-advances[i] = adjustment;
+; //advances[i] = adjustment;
 } else {
 advances[i] += adjustment;
 }
commit 9550a8c4e8b4e28be60d38c27d59253846ff9569
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 25 19:22:57 2012 -0400

[hb-old] Fixup not-enough-space handling

diff --git a/src/hb-old.cc b/src/hb-old.cc
index e828ca8..be0187f 100644
--- a/src/hb-old.cc
+++ b/src/hb-old.cc
@@ -329,14 +329,15 @@ retry:
 #undef ALLOCATE_ARRAY
 
   if (!HB_ShapeItem (item))
-return false;
-
-  if (unlikely (item.num_glyphs  num_glyphs))
   {
-buffer-ensure (buffer-allocated * 2);
-if (buffer-in_error)
-  FAIL (Buffer resize failed);
-goto retry;
+if (unlikely (item.num_glyphs  num_glyphs))
+{
+  buffer-ensure (buffer-allocated * 2);
+  if (buffer-in_error)
+   FAIL (Buffer resize failed);
+  goto retry;
+}
+return false;
   }
   num_glyphs = item.num_glyphs;
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master' - 21 commits

2012-07-24 Thread Behdad Esfahbod
 src/hb-ot-layout-gsubgpos-private.hh   
 |   27 -
 src/hb-ot-layout-private.hh
 |   35 ++
 src/hb-ot-shape-complex-indic-machine.rl   
 |6 
 src/hb-ot-shape-complex-indic-private.hh   
 |2 
 src/hb-ot-shape-complex-indic.cc   
 |  157 +++---
 src/hb-ot-shape.cc 
 |6 
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/reph.txt 
 |4 
 test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt   
 |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt 
 |7 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/misc.txt
 |6 
 10 files changed, 172 insertions(+), 79 deletions(-)

New commits:
commit 65c43accdc4d2082282d5cedba8514b8df0c18a2
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jul 24 03:36:47 2012 -0400

[Indic] Better position left-matra in Malayalam

Just put it before base, which is what's expected.

Malayalam failures down from 1559 to 1197 (0.114172%).

BENGALI: 353988 out of 354285 tests passed. 297 failed (0.0838308%)
DEVANAGARI: 693571 out of 693628 tests passed. 57 failed (0.00821766%)
GUJARATI: 366489 out of 366506 tests passed. 17 failed (0.0046384%)
GURMUKHI: 60750 out of 60809 tests passed. 59 failed (0.0970251%)
KANNADA: 950956 out of 951913 tests passed. 957 failed (0.100534%)
KHMER: 299094 out of 299124 tests passed. 30 failed (0.0100293%)
MALAYALAM: 1047219 out of 1048416 tests passed. 1197 failed (0.114172%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271699 out of 271847 tests passed. 148 failed (0.0544424%)
TAMIL: 1091837 out of 1091837 tests passed. 0 failed (0%)
TELUGU: 970524 out of 970573 tests passed. 49 failed (0.00504856%)

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index d90d238..d0c3c09 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -895,22 +895,37 @@ final_reordering_syllable (hb_buffer_t *buffer,
* halant, position is moved after it.
*/
 
-  if (start  base) /* Otherwise there can't be any pre-base matra characters. 
*/
+  if (start + 1  end  start  base) /* Otherwise there can't be any 
pre-base matra characters. */
   {
-unsigned int new_pos = base - 1;
-while (new_pos  start 
-  !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H) | FLAG 
(OT_Coeng)
-  new_pos--;
-/* If we found no Halant we are done (just need to update clusters).
- * Otherwise only proceed if the Halant does
- * not belong to the Matra itself! */
-if (is_halant_or_coeng (info[new_pos]) 
-   info[new_pos].indic_position() != POS_PRE_M)
+/* If we lost track of base, alas, position before last thingy. */
+unsigned int new_pos = base == end ? base - 2 : base - 1;
+
+/* Malayalam does not have half forms or explicit virama forms.
+ * The glyphs formed by 'half' are Chillus.  We want to position
+ * matra after them all.
+ */
+if (buffer-props.script != HB_SCRIPT_MALAYALAM)
 {
-  /* - If ZWJ or ZWNJ follow this halant, position is moved after it. */
-  if (new_pos + 1  end  is_joiner (info[new_pos + 1]))
-   new_pos++;
+  while (new_pos  start 
+!(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H) | FLAG 
(OT_Coeng)
+   new_pos--;
+
+  /* If we found no Halant we are done.
+   * Otherwise only proceed if the Halant does
+   * not belong to the Matra itself! */
+  if (is_halant_or_coeng (info[new_pos]) 
+ info[new_pos].indic_position() != POS_PRE_M)
+  {
+   /* - If ZWJ or ZWNJ follow this halant, position is moved after it. */
+   if (new_pos + 1  end  is_joiner (info[new_pos + 1]))
+ new_pos++;
+  }
+  else
+new_pos = start; /* No move. */
+}
 
+if (start  new_pos)
+{
   /* Now go see if there's actually any matras... */
   for (unsigned int i = new_pos; i  start; i--)
if (info[i - 1].indic_position () == POS_PRE_M)
diff --git 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
index 3072b0a..ffb408d 100644
--- 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
+++ 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
@@ -58,3 +58,4 @@
 ള്‍
 ള്യം
 ള്ള
+ല്‍പ്പേ
commit 88f413b56f2858d149e2fc067685aeecaea779ca
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jul 24 03:04:36 2012 -0400

[Indic] 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-24 Thread Behdad Esfahbod
 test/shaping/hb_test_tools.py| 
   1 +
 test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt | 
   2 ++
 2 files changed, 3 insertions(+)

New commits:
commit c3f769ba09df319fa69d04f68c57444f95eceee6
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jul 24 13:26:32 2012 -0400

[Indic] Ignore Uniscribe output containing two zero-width space glyphs

Uniscribe is buggy and sometimes /eats/ a mark next to a non-joiner.
Most of Malayalam failures where actually hitting this bug.

Ignore test output with two zero-width space glyphs.  This is a hack
until we build up the test suite infrastructure better.

Bengali went down by 9, Devanagari by 2, Kannada by 130, Malayalm down
from 1197 to 307, Sinhala down by 16, Telugu down by 26.  New stats:

BENGALI: 353996 out of 354285 tests passed. 289 failed (0.0815727%)
DEVANAGARI: 693573 out of 693628 tests passed. 55 failed (0.00792932%)
GUJARATI: 366489 out of 366506 tests passed. 17 failed (0.0046384%)
GURMUKHI: 60750 out of 60809 tests passed. 59 failed (0.0970251%)
KANNADA: 951086 out of 951913 tests passed. 827 failed (0.0868777%)
KHMER: 299094 out of 299124 tests passed. 30 failed (0.0100293%)
MALAYALAM: 1048109 out of 1048416 tests passed. 307 failed (0.0292823%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271715 out of 271847 tests passed. 132 failed (0.0485567%)
TAMIL: 1091837 out of 1091837 tests passed. 0 failed (0%)
TELUGU: 970550 out of 970573 tests passed. 23 failed (0.00236973%)

diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py
index a62f9c9..ce46588 100644
--- a/test/shaping/hb_test_tools.py
+++ b/test/shaping/hb_test_tools.py
@@ -295,6 +295,7 @@ class DiffHelpers:
def test_passed (lines):
lines = list (lines)
# XXX This is a hack, but does the job for now.
+   if any (l.find(space|space) = 0 for l in lines): return True
if any (l.find(uni25CC) = 0 for l in lines): return True
if any (l.find(dottedcircle) = 0 for l in lines): return True
return all (l[0] == ' ' for l in lines)
diff --git 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
index ffb408d..78fdeb8 100644
--- 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
+++ 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
@@ -59,3 +59,5 @@
 ള്യം
 ള്ള
 ല്‍പ്പേ
+ശിം‌
+കോം‌
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-24 Thread Behdad Esfahbod
 src/hb-shape.cc |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 97aa0b738a33b73a3f9763dd2950f2dd39f596ed
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jul 24 15:02:34 2012 -0400

Minor const correctness shuffling

diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 56c9046..60a2dce 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -68,13 +68,13 @@ static const struct hb_shaper_pair_t {
 
 /* Thread-safe, lock-free, shapers */
 
-static hb_shaper_pair_t *static_shapers;
+static const hb_shaper_pair_t *static_shapers;
 
 static
 void free_static_shapers (void)
 {
   if (unlikely (static_shapers != all_shapers))
-free (static_shapers);
+free ((void *) static_shapers);
 }
 
 static const hb_shaper_pair_t *
@@ -87,7 +87,7 @@ retry:
   {
 char *env = getenv (HB_SHAPER_LIST);
 if (!env || !*env) {
-  (void) hb_atomic_ptr_cmpexch (static_shapers, NULL, (const 
hb_shaper_pair_t *) all_shapers);
+  (void) hb_atomic_ptr_cmpexch (static_shapers, NULL, all_shapers[0]);
   return (const hb_shaper_pair_t *) all_shapers;
 }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-24 Thread Behdad Esfahbod
 configure.ac |   12 +
 src/Makefile.am  |7 
 src/hb-coretext-private.hh   |   42 
 src/hb-coretext.cc   |  323 +++
 src/hb-coretext.h|   43 
 src/hb-open-file-private.hh  |8 
 src/hb-ot-head-table.hh  |2 
 src/hb-ot-hhea-table.hh  |2 
 src/hb-ot-hmtx-table.hh  |2 
 src/hb-ot-layout-common-private.hh   |   14 -
 src/hb-ot-layout-gdef-table.hh   |   20 +-
 src/hb-ot-layout-gpos-table.hh   |   48 ++---
 src/hb-ot-layout-gsub-table.hh   |   30 +--
 src/hb-ot-layout-gsubgpos-private.hh |   32 +--
 src/hb-ot-maxp-table.hh  |2 
 src/hb-ot-name-table.hh  |2 
 src/hb-shape.cc  |6 
 17 files changed, 515 insertions(+), 80 deletions(-)

New commits:
commit aa6d849838d5231465ae1a25a4dd5ea1e9380ff9
Author: Jonathan Kew jfkth...@gmail.com
Date:   Tue Jul 24 15:52:32 2012 -0400

[CoreText] Add basic Core Text backend for comparison with our native 
shaping

Does not attempt to handle clusters in a Uniscribe- or HarfBuzz-compatible 
way;
just returns the original string indexes that CT maintains. These may even 
be
out-of-order in the case of reordrant glyphs.

diff --git a/configure.ac b/configure.ac
index cbabf83..030b04a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,18 @@ AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
 
 dnl ===
 
+AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, 
have_coretext=true, have_coretext=false)
+if $have_coretext; then
+   CORETEXT_CFLAGS=
+   CORETEXT_LIBS=
+   AC_SUBST(CORETEXT_CFLAGS)
+   AC_SUBST(CORETEXT_LIBS)
+   AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
+fi
+AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
+
+dnl ===
+
 AC_CACHE_CHECK([for Intel atomic primitives], 
hb_cv_have_intel_atomic_primitives, [
hb_cv_have_intel_atomic_primitives=false
AC_TRY_LINK([
diff --git a/src/Makefile.am b/src/Makefile.am
index 9fd135a..f2fce6e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -138,6 +138,13 @@ HBSOURCES += hb-uniscribe.cc hb-uniscribe-private.hh
 HBHEADERS += hb-uniscribe.h
 endif
 
+if HAVE_CORETEXT
+HBCFLAGS += $(CORETEXT_CFLAGS)
+HBLIBS   += $(CORETEXT_LIBS)
+HBSOURCES += hb-coretext.cc hb-coretext-private.hh
+HBHEADERS += hb-coretext.h
+endif
+
 # Use a C linker, not C++; Don't link to libstdc++
 libharfbuzz_la_LINK = $(LINK) $(libharfbuzz_la_LDFLAGS)
 libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
diff --git a/src/hb-coretext-private.hh b/src/hb-coretext-private.hh
new file mode 100644
index 000..153106c
--- /dev/null
+++ b/src/hb-coretext-private.hh
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2012  Mozilla Foundation.
+ *
+ *  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.
+ *
+ * Mozilla Author(s): Jonathan Kew
+ */
+
+#ifndef HB_CORETEXT_PRIVATE_HH
+#define HB_CORETEXT_PRIVATE_HH
+
+#include hb-private.hh
+
+#include hb-coretext.h
+
+
+HB_INTERNAL hb_bool_t
+_hb_coretext_shape (hb_font_t  *font,
+hb_buffer_t*buffer,
+const hb_feature_t *features,
+unsigned intnum_features);
+
+
+#endif /* HB_CORETEXT_PRIVATE_HH */
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
new file mode 100644
index 000..f49e76e
--- /dev/null
+++ b/src/hb-coretext.cc
@@ -0,0 +1,323 @@
+/*
+ * Copyright © 2012  Mozilla Foundation.
+ *
+ *  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 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-23 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic.cc |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2cc933aff97916e5d0fe42883f40f0879f848e25
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 23 08:22:55 2012 -0400

[Indic] Fix cluster formation with left-matras and conjunct forms

Test case was: U+0D15,U+0D4D,U+0D15,U+0D4A.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 2e0b88f..6ba9c16 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -882,11 +882,11 @@ final_reordering_syllable (hb_buffer_t *buffer,
  info[new_pos] = tmp;
  new_pos--;
}
-  buffer-merge_clusters (new_pos, base);
+  buffer-merge_clusters (new_pos, MIN (end, base + 1));
 } else {
   for (unsigned int i = start; i  base; i++)
if (info[i].indic_position () == POS_PRE_M) {
- buffer-merge_clusters (i, base);
+ buffer-merge_clusters (i, MIN (end, base + 1));
  break;
}
 }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-23 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-misc.cc |   49 
++
 src/hb-private.hh   |6 +
 src/hb-unicode.cc   |6 +
 test/shaping/texts/in-tree/shaper-thai/MANIFEST |1 
 test/shaping/texts/in-tree/shaper-thai/script-lao/MANIFEST  |1 
 test/shaping/texts/in-tree/shaper-thai/script-lao/misc/MANIFEST |1 
 test/shaping/texts/in-tree/shaper-thai/script-lao/misc/sara-am.txt  |   20 
 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST|1 
 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/phinthu.txt |   16 +++
 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/sara-am.txt |   18 +++
 10 files changed, 102 insertions(+), 17 deletions(-)

New commits:
commit 42848453bf260b456b46a07f066e31b8c3aac2f1
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 23 13:52:07 2012 -0400

[Thai] Reorder U+0E3A THAI VOWEL SIGN PHINTHU

Uniscribe reorders U+0E3A to be after U+0E38 and U+0E39.  We do that by
modifying the ccc for U+0E3A.

Fixes the two remaining Thai failures (see previous commit).

diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 17e2625..6852d47 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -132,6 +132,13 @@ _hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map 
HB_UNUSED,
* chattawa.
*
* Same for Lao.
+   *
+   * Note:
+   *
+   * Uniscribe also does so below-marks reordering.  Namely, it positions 
U+0E3A
+   * after U+0E38 and U+0E39.  We do that by modifying the ccc for U+0E3A.
+   * See _hb_unicode_modified_combining_class ().  Lao does NOT have a U+0E3A
+   * equivalent.
*/
 
 
diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc
index 140f382..3569b20 100644
--- a/src/hb-unicode.cc
+++ b/src/hb-unicode.cc
@@ -363,6 +363,12 @@ _hb_unicode_modified_combining_class (hb_unicode_funcs_t 
*ufuncs,
 };
 c = permuted_hebrew_classes[c - 10];
   }
+  else if (unlikely (unicode == 0x0E3A)) /* THAI VOWEL SIGN PHINTHU */
+  {
+/* Assign 104, so it reorders after the THAI ccc=103 marks.
+ * Uniscribe does this. */
+c = 104;
+  }
 
   return c;
 }
diff --git a/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST 
b/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST
index ffd16f1..6aa865b 100644
--- a/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST
@@ -1 +1,2 @@
+phinthu.txt
 sara-am.txt
diff --git 
a/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/phinthu.txt 
b/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/phinthu.txt
new file mode 100644
index 000..e304777
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-thai/script-thai/misc/phinthu.txt
@@ -0,0 +1,16 @@
+ป
+ปฺ
+ปุ
+ปู
+ปุู
+ปูุ
+ปฺุ
+ปฺุ
+ปฺู
+ปฺู
+ปฺุู
+ปฺุู
+ปฺุู
+ปฺูุ
+ปฺูุ
+ปฺูุ
commit 4a7f4f3e56f8f7640ae7337aa1b3324f31e0d4ab
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 23 13:15:33 2012 -0400

[Thai] Adjust SARA AM reordering to match Uniscribe

Adjust the list of marks before SARA AM that get the reordering
treatment.  Also adjust cluster formation to match Uniscribe.

With Wikipedia test data, now I see:

  - For Thai, with the Angsana New font from Win7, I see 54 failures out
of over 4M tests  (0.00129107%).  Of the 54, two are legitimate
reordering issues (fix coming soon), and the other 52 are simply
Uniscribe using a zero-width space char instead of an unknown
character for missing glyphs.  No idea why.  The missing-glyph
sequences include one that is a Thai character followed by an Arabic
Sokun.  Someone confused it with Nikhahit I assume!

  - For Lao, with the Dokchampa font from Win7, 33 tests fail out of
54k (0.0615167%).  All seem to be insignificant mark positioning
with two marks on a base.  Have to investigate.

diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 7a11876..17e2625 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -121,19 +121,20 @@ _hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map 
HB_UNUSED,
   /* The following is NOT specified in the MS OT Thai spec, however, it seems
* to be what Uniscribe and other engines implement.  According to Eric 
Muller:
*
-   * When you have a sara am, decompose it in nikhahit + sara a, *and* mode the
-   * nihka hit backwards over any *tone* mark (0E48-0E4B).
+   * When you have a SARA AM, decompose it in NIKHAHIT + SARA AA, *and* move 
the
+   * NIKHAHIT backwards over any tone mark (0E48-0E4B).
*
* 0E14, 0E4B, 0E33 - 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-07-23 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-misc.cc |6 +++---
 src/hb-private.hh   |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 093cd583263a5d427e3377b31585043fb55d2557
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 23 14:04:42 2012 -0400

[Thai] Fix SARA AM handling

Oops, thinko.

diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 6852d47..4578f0b 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -151,8 +151,8 @@ _hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map 
HB_UNUSED,
* Nikhahit: U+0E4D  U+0ECD
*
* Testing shows that Uniscribe reorder the following marks:
-   * Thai: 0E31..0E37,0E47..0E4E
-   * Lao:  0EB1..0EB7,0EC7..0ECE
+   * Thai: 0E31,0E34..0E37,0E47..0E4E
+   * Lao:  0EB1,0EB4..0EB7,0EC7..0ECE
*
* Note how the Lao versions are the same as Thai + 0x80.
*/
@@ -162,7 +162,7 @@ _hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map 
HB_UNUSED,
 #define IS_SARA_AM(x) (((x)  ~0x0080) == 0x0E33)
 #define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0xE33 + 0xE4D)
 #define SARA_AA_FROM_SARA_AM(x) ((x) - 1)
-#define IS_TONE_MARK(x) (hb_in_rangeshb_codepoint_t ((x)  ~0x0080, 0x0E31, 
0x0E37, 0x0E47, 0x0E4E))
+#define IS_TONE_MARK(x) (hb_in_rangeshb_codepoint_t ((x)  ~0x0080, 0x0E34, 
0x0E37, 0x0E47, 0x0E4E, 0x0E31, 0x0E31))
 
   buffer-clear_output ();
   unsigned int count = buffer-len;
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 0b9c4ef..ea3254c 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -730,9 +730,9 @@ hb_in_range (T u, T lo, T hi)
 }
 
 template typename T static inline bool
-hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2)
+hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
 {
-  return hb_in_range (u, lo1, hi1) || hb_in_range (u, lo2, hi2);
+  return hb_in_range (u, lo1, hi1) || hb_in_range (u, lo2, hi2) || hb_in_range 
(u, lo3, hi3);
 }
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-20 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic.cc |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 51e764de441072e7c9f67de23e8ed717b9b8957d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 20 10:30:24 2012 -0400

[Indic] Unbreak old scriptures

Brings down failures with Lohit-Telugu from 57% to 1.40%.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 43eaf83..42e0f70 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -123,8 +123,9 @@ consonant_position (hb_codepoint_t u, hb_ot_map_t *map, 
hb_font_t *font)
   if ((u  ~0x007F) == 0x0D80) virama = 0x0DCA; /* Sinahla */
   hb_codepoint_t glyphs[2];
 
-  hb_font_get_glyph (font, virama, 0, glyphs[0]);
-  hb_font_get_glyph (font, u,  0, glyphs[1]);
+  unsigned int virama_pos = IS_OLD_INDIC_TAG (map-get_chosen_script (0)) ? 1 
: 0;
+  hb_font_get_glyph (font, virama, 0, glyphs[virama_pos]);
+  hb_font_get_glyph (font, u,  0, glyphs[1-virama_pos]);
 
   hb_face_t *face = hb_font_get_face (font);
   if (would_substitute (glyphs, ARRAY_LENGTH (glyphs), 
HB_TAG('p','r','e','f'), map, face)) return POS_BELOW_C;
commit 900cf3d449bf36d4f8b1474590cae925fef48fc8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 20 10:18:23 2012 -0400

Minor

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 19ced2d..43eaf83 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -590,7 +590,7 @@ initial_reordering_consonant_syllable (const hb_ot_map_t 
*map, hb_buffer_t *buff
   /* Reorder characters */
 
   for (unsigned int i = start; i  base; i++)
-info[i].indic_position() = MIN ((unsigned int) POS_PRE_C, 
info[i].indic_position());
+info[i].indic_position() = MIN (POS_PRE_C, (indic_position_t) 
info[i].indic_position());
 
   if (base  end)
 info[base].indic_position() = POS_BASE_C;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master' - 21 commits

2012-07-20 Thread Behdad Esfahbod
 src/hb-ot-layout-gpos-table.hh |   
 4 
 src/hb-ot-shape-complex-indic-machine.rl   |   
 7 
 src/hb-ot-shape-complex-indic-private.hh   |   
 5 
 src/hb-ot-shape-complex-indic.cc   |  
126 +-
 src/hb-private.hh  |   
 1 
 src/hb-unicode.cc  |   
10 
 src/hb-uniscribe.cc|   
34 +-
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt |   
 1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-oriya/misc/MANIFEST   |   
 1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-oriya/misc/bindu.txt  |   
 2 
 10 files changed, 108 insertions(+), 83 deletions(-)

New commits:
commit 3d4c111b7a13700b2f7a0b087eb3992283295f21
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 20 19:34:39 2012 -0400

Add a test case

diff --git 
a/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt
index 843ee4f..35ce952 100644
--- a/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt
@@ -49,3 +49,4 @@
 অৗ
 ন্ত্র
 ত্যু
+চ্য্র
commit 92a1ad7bef9efb456ab87bd63818cfbed7da3f6f
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 20 18:38:27 2012 -0400

[Indic] Stop searching for base if a post form is found before below form

Improves Bengali and Gurmukhi.  Malayalam regressed a bit.  We will deal
with that later.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index b5ad4ae..ad55f77 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -505,6 +505,7 @@ initial_reordering_consonant_syllable (const hb_ot_map_t 
*map, hb_buffer_t *buff
 {
   /* - starting from the end of the syllable, move backwards */
   unsigned int i = end;
+  bool seen_below = false;
   do {
i--;
/* - until a consonant is found */
@@ -513,11 +514,13 @@ initial_reordering_consonant_syllable (const hb_ot_map_t 
*map, hb_buffer_t *buff
  /* - that does not have a below-base or post-base form
   * (post-base forms have to follow below-base forms), */
  if (info[i].indic_position() != POS_BELOW_C 
- info[i].indic_position() != POS_POST_C)
+ (info[i].indic_position() != POS_POST_C || seen_below))
  {
base = i;
break;
  }
+ if (info[i].indic_position() == POS_BELOW_C)
+   seen_below = true;
 
  /* - or that is not a pre-base reordering Ra,
   *
commit 4c450c703f8e4618c587bcd7ef46dcc1f2c7947b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 20 18:13:04 2012 -0400

[Indic] Recompose Bengali Ya,Nukta

This is a bunch of hacks for now.

Improves Bengali a bit.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0316691..b5ad4ae 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -407,7 +407,8 @@ hb_ot_shape_normalization_mode_t
 _hb_ot_shape_complex_normalization_preference_indic (void)
 {
   /* We want split matras decomposed by the common shaping logic. */
-  return HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED;
+  /* XXX sort this out after adding per-shaper normalizers. */
+  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
 
@@ -549,7 +550,6 @@ initial_reordering_consonant_syllable (const hb_ot_map_t 
*map, hb_buffer_t *buff
 if (base  start)
   base = start; /* Just in case... */
 
-
 /* - If the syllable starts with Ra + Halant (in a script that has Reph)
  *and has more than one consonant, Ra is excluded from candidates for
  *base consonants. */
diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc
index c527340..140f382 100644
--- a/src/hb-unicode.cc
+++ b/src/hb-unicode.cc
@@ -258,6 +258,14 @@ hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t *ab)
 {
   *ab = 0;
+  /* XXX, this belongs to indic normalizer. */
+  if ((FLAG (hb_unicode_general_category (ufuncs, a)) 
+   (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
+FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
+FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
+return false;
+  /* XXX, add composition-exclusion exceptions to Indic shaper. */
+  if (a == 0x09AF  b == 0x09BC) { *ab = 0x09DF; return true; }
   return ufuncs-func.compose (ufuncs, a, b, ab, ufuncs-user_data.compose);
 }
 
commit e9c0f152a38cb2e76650a3e43f7fdcda266af696
Author: Behdad Esfahbod beh...@behdad.org
Date:  

[HarfBuzz] harfbuzz-ng: Branch 'master' - 13 commits

2012-07-17 Thread Behdad Esfahbod
 src/hb-buffer.cc   
|   76 
 src/hb-buffer.h
|   13 
 src/hb-ot-shape-complex-indic-machine.rl   
|   48 +--
 src/hb-ot-shape-complex-indic-private.hh   
|9 
 src/hb-ot-shape-complex-indic.cc   
|  159 +++---
 src/hb-private.hh  
|   29 +
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt 
|2 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/MANIFEST
|2 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/misc.txt
|7 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/other-marks-invalid.txt
 |4 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/other-marks.txt
 |6 
 util/options.cc
|1 
 util/options.hh
|7 
 13 files changed, 287 insertions(+), 76 deletions(-)

New commits:
commit db8981f1e0e8625714568c6d0f11f0b317b11d0a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jul 17 18:17:30 2012 -0400

[Indic] Position Khmer Robat

It's a visual Repha.

Still not positioning logical Repha as occurs in Malayalam.

Another 200 Khmer failures fixed.  547 to go.  That's better than
Devanagari!

diff --git a/src/hb-ot-shape-complex-indic-machine.rl 
b/src/hb-ot-shape-complex-indic-machine.rl
index b87d2df..5f565b6 100644
--- a/src/hb-ot-shape-complex-indic-machine.rl
+++ b/src/hb-ot-shape-complex-indic-machine.rl
@@ -40,33 +40,35 @@
 # Same order as enum indic_category_t.  Not sure how to avoid duplication.
 X= 0;
 C= 1;
-Ra   = 2;
-V= 3;
-N= 4;
-H= 5;
-ZWNJ = 6;
-ZWJ  = 7;
-M= 8;
-SM   = 9;
-VD   = 10;
-A= 11;
-NBSP = 12;
-DOTTEDCIRCLE = 13;
-RS   = 14;
-Coeng = 15;
+V= 2;
+N= 3;
+H= 4;
+ZWNJ = 5;
+ZWJ  = 6;
+M= 7;
+SM   = 8;
+VD   = 9;
+A= 10;
+NBSP = 11;
+DOTTEDCIRCLE = 12;
+RS   = 13;
+Coeng = 14;
+Repha = 15;
+Ra= 16;
 
 c = C | Ra;# is_consonant
 n = (N.N? | ZWNJ?.RS); # is_consonant_modifier
 z = ZWJ|ZWNJ;  # is_joiner
 h = H | Coeng; # is_halant_or_coeng
+reph = (Ra H | Repha); # possible reph
 matra_group = M.N?.H?;
 syllable_tail = SM? (Coeng (c|V))? (VD VD?)?;
 place_holder = NBSP | DOTTEDCIRCLE;
 
 
-consonant_syllable =   (c.n? (h.z?|z.h))* c.n? A? (h.z? | matra_group*)? 
syllable_tail;
-vowel_syllable =   (Ra H)? V.n? (z?.h.c | ZWJ.c)* matra_group* 
syllable_tail;
-standalone_cluster =   (Ra H)? place_holder.n? (z? h c)* matra_group* 
syllable_tail;
+consonant_syllable =   Repha? (c.n? (h.z?|z.h))* c.n? A? (h.z? | 
matra_group*)? syllable_tail;
+vowel_syllable =   reph? V.n? (z?.h.c | ZWJ.c)* matra_group* syllable_tail;
+standalone_cluster =   reph? place_holder.n? (z? h c)* matra_group* 
syllable_tail;
 other =any;
 
 main := |*
diff --git a/src/hb-ot-shape-complex-indic-private.hh 
b/src/hb-ot-shape-complex-indic-private.hh
index 0541738..9637018 100644
--- a/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/hb-ot-shape-complex-indic-private.hh
@@ -47,7 +47,6 @@
 enum indic_category_t {
   OT_X = 0,
   OT_C,
-  OT_Ra, /* Not explicitly listed in the OT spec, but used in the grammar. */
   OT_V,
   OT_N,
   OT_H,
@@ -60,7 +59,9 @@ enum indic_category_t {
   OT_NBSP,
   OT_DOTTEDCIRCLE, /* Not in the spec, but special in Uniscribe. /Very very/ 
special! */
   OT_RS, /* Register Shifter, used in Khmer OT spec */
-  OT_Coeng
+  OT_Coeng,
+  OT_Repha,
+  OT_Ra /* Not explicitly listed in the OT spec, but used in the grammar. */
 };
 
 /* Visual positions in a syllable from left to right. */
@@ -92,7 +93,7 @@ enum indic_syllabic_category_t {
   INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL = OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER= OT_NBSP,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED  = OT_C,
-  INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA  = OT_C,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA  = OT_Repha,
   INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X,
   INDIC_SYLLABIC_CATEGORY_NUKTA= OT_N,
   INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_RS,
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 3c83ce6..bbf5024 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -282,6 +282,19 @@ 

[HarfBuzz] harfbuzz-ng: Branch 'master' - 22 commits

2012-07-16 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh   |2 
 src/hb-ot-layout-gsubgpos-private.hh |   20 ++-
 src/hb-ot-shape-complex-arabic.cc|6 
 src/hb-ot-shape-complex-indic-machine.rl |3 
 src/hb-ot-shape-complex-indic-private.hh |   13 +-
 src/hb-ot-shape-complex-indic.cc |  199 ---
 src/hb-ot-shape-complex-misc.cc  |   18 ++
 src/hb-ot-shape-complex-private.hh   |   30 
 src/hb-ot-shape.cc   |2 
 src/hb-unicode.cc|   22 +++
 10 files changed, 236 insertions(+), 79 deletions(-)

New commits:
commit af92b4cc90e4184d5bdd8037c551ed482700114f
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 16 20:31:24 2012 -0400

[Indic] Disable 'kern' in Uniscribe bug compatibility mode

Uniscribe does not apply 'kern' in the Indic module.  Some of the Khmer
fonts they ship have small adjustments in the 'kern' table.  Disable
'kern' in the Indic module under Uniscribe bug compatibility mode.

Fixes some 10% of the Khmer failures.  Remains under 3% (excluding
dotted-circle ones).

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index f8be98e..19bb75c 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -221,6 +221,9 @@ void
 _hb_ot_shape_complex_override_features_indic (hb_ot_map_builder_t *map,
  const hb_segment_properties_t 
*props HB_UNUSED)
 {
+  /* Uniscribe does not apply 'kern'. */
+  if (indic_options ().uniscribe_bug_compatible)
+map-add_feature (HB_TAG('k','e','r','n'), 0, true);
 }
 
 
commit d96838ef951ce6170eb2dc576ebcba2262cf7008
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 16 20:26:57 2012 -0400

Allow complex shapers overriding common features

In a new callback...  Currently unused by all complex shapers.

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 54460f0..75f5fe9 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -199,6 +199,12 @@ _hb_ot_shape_complex_collect_features_arabic 
(hb_ot_map_builder_t *map,
   map-add_bool_feature (HB_TAG('c','s','w','h'));
 }
 
+void
+_hb_ot_shape_complex_override_features_arabic (hb_ot_map_builder_t *map,
+  const hb_segment_properties_t 
*props)
+{
+}
+
 hb_ot_shape_normalization_mode_t
 _hb_ot_shape_complex_normalization_preference_arabic (void)
 {
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index d9087d6..f8be98e 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -217,6 +217,12 @@ _hb_ot_shape_complex_collect_features_indic 
(hb_ot_map_builder_t *map,
   }
 }
 
+void
+_hb_ot_shape_complex_override_features_indic (hb_ot_map_builder_t *map,
+ const hb_segment_properties_t 
*props HB_UNUSED)
+{
+}
+
 
 hb_ot_shape_normalization_mode_t
 _hb_ot_shape_complex_normalization_preference_indic (void)
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 52fbd6d..3cea734 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -42,6 +42,12 @@ _hb_ot_shape_complex_collect_features_default 
(hb_ot_map_builder_t *map HB_UNUSE
 {
 }
 
+void
+_hb_ot_shape_complex_override_features_default (hb_ot_map_builder_t *map 
HB_UNUSED,
+   const hb_segment_properties_t 
*props HB_UNUSED)
+{
+}
+
 hb_ot_shape_normalization_mode_t
 _hb_ot_shape_complex_normalization_preference_default (void)
 {
@@ -74,6 +80,12 @@ _hb_ot_shape_complex_collect_features_hangul 
(hb_ot_map_builder_t *map,
 map-add_bool_feature (hangul_features[i]);
 }
 
+void
+_hb_ot_shape_complex_override_features_hangul (hb_ot_map_builder_t *map,
+  const hb_segment_properties_t 
*props HB_UNUSED)
+{
+}
+
 hb_ot_shape_normalization_mode_t
 _hb_ot_shape_complex_normalization_preference_hangul (void)
 {
@@ -97,6 +109,12 @@ _hb_ot_shape_complex_collect_features_thai 
(hb_ot_map_builder_t *map HB_UNUSED,
 {
 }
 
+void
+_hb_ot_shape_complex_override_features_thai (hb_ot_map_builder_t *map 
HB_UNUSED,
+const hb_segment_properties_t 
*props HB_UNUSED)
+{
+}
+
 hb_ot_shape_normalization_mode_t
 _hb_ot_shape_complex_normalization_preference_thai (void)
 {
diff --git a/src/hb-ot-shape-complex-private.hh 
b/src/hb-ot-shape-complex-private.hh
index d2f7959..7f74e34 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -249,6 +249,36 @@ hb_ot_shape_complex_collect_features 
(hb_ot_complex_shaper_t shaper,
 
 
 /*
+ * override_features()
+ *
+ * Called during shape_plan().
+ *
+ * Shapers should use map to override features and add callbacks after
+ * common features are added.
+ */

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

2012-07-16 Thread Behdad Esfahbod
 src/hb-ot-layout.cc
  |4 ++--
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST 
 |1 +
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/mark-skipping.txt
 |   10 ++
 3 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 559f70667891a3ceeffb36f40de38a4f85868945
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 16 22:43:17 2012 -0400

Fix MarkAttachmentType matching

Fixes issue reported by Khaled Hosny with his Hussaini Nastaleeq font
and sequences like those added in the previous commit.

diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 7b48fa6..10811d0 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -123,7 +123,7 @@ _hb_ot_layout_match_properties_mark (hb_face_t  *face,
* ignore marks of attachment type different than
* the attachment type specified.
*/
-  if (lookup_props  LookupFlag::MarkAttachmentType  glyph_props  
LookupFlag::MarkAttachmentType)
+  if (lookup_props  LookupFlag::MarkAttachmentType)
 return (lookup_props  LookupFlag::MarkAttachmentType) == (glyph_props  
LookupFlag::MarkAttachmentType);
 
   return true;
commit 6de103547e4a7fb34c833861713ea373cd912261
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 16 22:46:06 2012 -0400

[test/arabic] Add Arabic tests for mark skipping

Expose a bug with Khaled's Hussaini Nastaleeq font.

diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
index df0e4b5..242b2a1 100644
--- 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
@@ -3,3 +3,4 @@ language-arabic.txt
 language-persian.txt
 language-urdu.txt
 ligature-diacritics.txt
+mark-skipping.txt
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/mark-skipping.txt
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/mark-skipping.txt
new file mode 100644
index 000..038c921
--- /dev/null
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/mark-skipping.txt
@@ -0,0 +1,10 @@
+تختة
+تخنة
+تخئة
+تخثة
+تخٹة
+تختّة
+تخنّة
+تخئّة
+تخثّة
+تخٹّة
commit ad4494759fa8bfd2497800c24fa414075ed1aa61
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 16 22:40:21 2012 -0400

Minor

diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 7a613b2..7b48fa6 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -173,7 +173,7 @@ _hb_ot_layout_skip_mark (hb_face_t*face,
   if (property_out)
 *property_out = property;
 
-  /* If it's a mark, skip it we don't accept it. */
+  /* If it's a mark, skip it if we don't accept it. */
   if (unlikely (property  HB_OT_LAYOUT_GLYPH_CLASS_MARK))
 return !_hb_ot_layout_match_properties (face, ginfo-codepoint, property, 
lookup_props);
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-14 Thread Behdad Esfahbod
 src/hb-atomic-private.hh |5 -
 src/hb-warning.cc|   29 +
 2 files changed, 5 insertions(+), 29 deletions(-)

New commits:
commit fa2bd9fb63d83b657373764d4b657084d8327fc9
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jul 14 12:15:54 2012 -0400

Further simplify atomic ops on Visual Studio

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index a833a6c..0f70641 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -46,12 +46,7 @@
 
 #include intrin.h
 /* On x86, _InterlockedCompareExchangePointer is a macro defined in concrt.h */
-#if defined(_M_IX86)
 #include concrt.h
-#pragma intrinsic(_InterlockedExchangeAdd)
-#else
-#pragma intrinsic(_InterlockedExchangeAdd, _InterlockedCompareExchangePointer)
-#endif
 
 typedef long hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   _InterlockedExchangeAdd ((AI), (V))
commit 0a492357016bc9a614d2a726f2006c10af68ca58
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 13 13:20:49 2012 -0400

Minor

diff --git a/src/hb-warning.cc b/src/hb-warning.cc
index 4f1f65f..8ff4d20 100644
--- a/src/hb-warning.cc
+++ b/src/hb-warning.cc
@@ -29,38 +29,19 @@
 
 
 #if defined(HB_ATOMIC_INT_NIL)
-#ifdef _MSC_VER
-#pragma message(Could not find any system to define atomic_int macros, 
library may NOT be thread-safe)
-#else
-#warning Could not find any system to define atomic_int macros, library may 
NOT be thread-safe
+#pragma message(Could not find any system to define atomic_int macros, 
library may NOT be thread-safe.)
 #endif
-#endif
-
 #if defined(HB_MUTEX_IMPL_NIL)
-#ifdef _MSC_VER
-#pragma message(Could not find any system to define mutex macros, library may 
NOT be thread-safe)
-#else
-#warning Could not find any system to define mutex macros, library may NOT be 
thread-safe
-#endif
+#pragma message(Could not find any system to define mutex macros, library may 
NOT be thread-safe.)
 #endif
-
 #if defined(HB_ATOMIC_INT_NIL) || defined(HB_MUTEX_IMPL_NIL)
-#ifdef _MSC_VER
-#pragma message(To suppress these warnings, define HB_NO_MT)
-#else
-#warning To suppress these warnings, define HB_NO_MT
-#endif
+#pragma message(To suppress these warnings, define HB_NO_MT.)
 #endif
 
 
 #include hb-unicode-private.hh
 
 #if !defined(HB_NO_UNICODE_FUNCS)  defined(HB_UNICODE_FUNCS_NIL)
-#ifdef _MSC_VER
-#pragma message(Could not find any Unicode functions implementation, you have 
to provide your own)
-#pragma message(To suppress this warnings, define HB_NO_UNICODE_FUNCS)
-#else
-#warning Could not find any Unicode functions implementation, you have to 
provide your own
-#warning To suppress this warning, define HB_NO_UNICODE_FUNCS
-#endif
+#pragma message(Could not find any Unicode functions implementation, you have 
to provide your own.)
+#pragma message(To suppress this warnings, define HB_NO_UNICODE_FUNCS.)
 #endif
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-07-11 Thread Behdad Esfahbod
 TODO | 
   2 
 git.mk   | 
  58 ++
 src/hb-ot-layout-gpos-table.hh   | 
  16 +-
 src/hb-ot-layout-gsub-table.hh   | 
  24 ++--
 src/hb-ot-layout-gsubgpos-private.hh | 
  33 +
 src/hb-unicode-private.hh| 
   1 
 src/hb-uniscribe.cc  | 
   2 
 src/hb-uniscribe.h   | 
   2 
 test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt | 
   1 
 test/shaping/texts/in-tree/shaper-thai/MANIFEST  | 
   2 
 test/shaping/texts/in-tree/shaper-thai/misc/MANIFEST | 
   1 
 test/shaping/texts/in-tree/shaper-thai/misc/misc.txt | 
   6 -
 test/shaping/texts/in-tree/shaper-thai/script-thai/MANIFEST  | 
   1 
 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST | 
   1 
 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/sara-am.txt  | 
   4 
 15 files changed, 106 insertions(+), 48 deletions(-)

New commits:
commit 552bf3a9f9651311084b7979805dbdc18c0335ca
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 11 16:44:51 2012 -0400

Bump WINNT version requested from 500 to 600

Since we use the OpenType versions of Uniscribe functions, we are
relying on that version of the WINNT API.  Otherwise, usp10.h will hide
those symbols.

diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index b71b00a..e5b98a8 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -24,7 +24,7 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0600
 
 #include hb-private.hh
 
diff --git a/src/hb-uniscribe.h b/src/hb-uniscribe.h
index 216610e..bb99f39 100644
--- a/src/hb-uniscribe.h
+++ b/src/hb-uniscribe.h
@@ -29,7 +29,7 @@
 
 #include hb.h
 
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0600
 #include windows.h
 
 HB_BEGIN_DECLS
commit 9a5b421a64db1bb23d5c6ebbc3bf3f3a5513dc36
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 11 16:35:04 2012 -0400

Fix build with no Unicode funcs implementations provided

diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index eaf151a..c781035 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -99,6 +99,7 @@ extern HB_INTERNAL const hb_unicode_funcs_t 
_hb_icu_unicode_funcs;
 #define _hb_unicode_funcs_default _hb_icu_unicode_funcs
 #else
 #define HB_UNICODE_FUNCS_NIL 1
+extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
 #define _hb_unicode_funcs_default _hb_unicode_funcs_nil
 #endif
 
commit 6efe1eca660135096f05987ac0ef9b635de6cdfd
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jul 11 15:30:08 2012 -0400

Update git.mk to upstream

diff --git a/git.mk b/git.mk
index ff5c0c3..4da8fe2 100644
--- a/git.mk
+++ b/git.mk
@@ -5,7 +5,7 @@
 # Written by Behdad Esfahbod
 #
 # Copying and distribution of this file, with or without modification,
-# are permitted in any medium without royalty provided the copyright
+# is permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.
 #
 # The canonical source for this file is https://github.com/behdad/git.mk.
@@ -42,8 +42,14 @@
 # build dir.
 #
 # This file knows how to handle autoconf, automake, libtool, gtk-doc,
-# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings.
+# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
 #
+# This makefile provides the following targets:
+#
+# - all: make all will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
 #
 # KNOWN ISSUES:
 #
@@ -97,25 +103,31 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
; do echo /$$x; done; \
fi; \
if test x$(DOC_MODULE)$(DOC_ID) = x -o x$(DOC_LINGUAS) = x; 
then :; else \
+   for lc in $(DOC_LINGUAS); do \
+   for x in \
+   $(if $(DOC_MODULE),$(DOC_MODULE).xml) \
+   $(DOC_PAGES) \
+   $(DOC_INCLUDES) \
+   ; do echo /$$lc/$$x; done; \
+   done; \
for x in \
-   $(_DOC_C_DOCS) \
-   $(_DOC_LC_DOCS) \
$(_DOC_OMF_ALL) \

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-26 Thread Behdad Esfahbod
 configure.ac |9 +
 src/hb-atomic-private.hh |2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 12f5c0a222a2f0aebe63c0d367937a0ff985474a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Jun 26 11:16:13 2012 -0400

Fix check for Intel atomic ops

diff --git a/configure.ac b/configure.ac
index 2eebc79..0e2bbf6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,11 +182,12 @@ dnl 
===
 
 AC_CACHE_CHECK([for Intel atomic primitives], 
hb_cv_have_intel_atomic_primitives, [
hb_cv_have_intel_atomic_primitives=false
-   AC_TRY_LINK([], [
+   AC_TRY_LINK([
void memory_barrier (void) { __sync_synchronize (); }
-   int atomic_add (int i) { return __sync_fetch_and_add (i, 1); }
-   int atomic_cmpxchg (int *i, int *j, int *k) { return 
__sync_bool_compare_and_swap (i, j, k); }
-   ], hb_cv_have_intel_atomic_primitives=true
+   int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
+   int mutex_trylock (int *m) { return __sync_lock_test_and_set 
(m, 1); }
+   void mutex_unlock (int *m) { __sync_lock_release (m); }
+   ], [], hb_cv_have_intel_atomic_primitives=true
)
 ])
 if $hb_cv_have_intel_atomic_primitives; then
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index c543a8d..918852d 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -65,7 +65,7 @@ typedef int32_t hb_atomic_int_t;
 #define hb_atomic_ptr_cmpexch(P,O,N)   OSAtomicCompareAndSwapPtrBarrier ((void 
*) (O), (void *) (N), (void **) (P))
 
 
-#elif !defined(HB_NO_MT)  defined(HAVE_INTEL_ATOMIC_PRIMITIVES)  
!defined(__MINGW32__)
+#elif !defined(HB_NO_MT)  defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
 
 typedef int hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   __sync_fetch_and_add ((AI), (V))
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-24 Thread Behdad Esfahbod
 configure.ac|2 +-
 src/Makefile.am |   42 +-
 2 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 8c0ea7bcb4409aaf8c96ad641f2db30003228ad0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Jun 24 13:20:56 2012 -0400

Disable introspection again

Until I figure out the build issues.  Sigh...

diff --git a/configure.ac b/configure.ac
index fc930e9..2eebc79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ m4_define([hb_libtool_current],
 HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
 
-GOBJECT_INTROSPECTION_CHECK([0.9.0])
+dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
 dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 
 # Functions and headers
diff --git a/src/Makefile.am b/src/Makefile.am
index 2326b40..f7cf593 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -209,26 +209,26 @@ TESTS_ENVIRONMENT = \
HBHEADERS=$(HBHEADERS) \
$(NULL)
 
--include $(INTROSPECTION_MAKEFILE)
-INTROSPECTION_GIRS = hb-1.0.gir
-INTROSPECTION_SCANNER_ARGS = -I$(srcdir) -n hb --identifier-prefix=hb_
-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
-
-if HAVE_INTROSPECTION
-
-hb-1.0.gir: libharfbuzz.la
-hb_1_0_gir_INCLUDES = GObject-2.0
-hb_1_0_gir_CFLAGS = $(INCLUDES) $(HBCFLAGS) -DHB_H -DHB_H_IN -DHB_OT_H 
-DHB_OT_H_IN
-hb_1_0_gir_LIBS = libharfbuzz.la
-hb_1_0_gir_FILES = $(HBHEADERS)
-
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(INTROSPECTION_GIRS)
-
-typelibdir = $(libdir)/girepository-1.0
-typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
-
-CLEANFILES += $(gir_DATA) $(typelib_DATA)
-endif
+#-include $(INTROSPECTION_MAKEFILE)
+#INTROSPECTION_GIRS = hb-1.0.gir
+#INTROSPECTION_SCANNER_ARGS = -I$(srcdir) -n hb --identifier-prefix=hb_
+#INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+#
+#if HAVE_INTROSPECTION
+#
+#hb-1.0.gir: libharfbuzz.la
+#hb_1_0_gir_INCLUDES = GObject-2.0
+#hb_1_0_gir_CFLAGS = $(INCLUDES) $(HBCFLAGS) -DHB_H -DHB_H_IN -DHB_OT_H 
-DHB_OT_H_IN
+#hb_1_0_gir_LIBS = libharfbuzz.la
+#hb_1_0_gir_FILES = $(HBHEADERS)
+#
+#girdir = $(datadir)/gir-1.0
+#gir_DATA = $(INTROSPECTION_GIRS)
+#
+#typelibdir = $(libdir)/girepository-1.0
+#typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+#
+#CLEANFILES += $(gir_DATA) $(typelib_DATA)
+#endif
 
 -include $(top_srcdir)/git.mk
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-19 Thread Behdad Esfahbod
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8c5f5e6f5ec2b6a219fbdfc955f6299325a0adde
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Jun 17 14:58:59 2012 -0400

Minor

diff --git a/configure.ac b/configure.ac
index 8911e25..fc930e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.64])
-AC_INIT([harfbuzz],
+AC_INIT([HarfBuzz],
 [0.9.0],
 [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
 [harfbuzz],
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-06-16 Thread Behdad Esfahbod
 TODO  |3 +++
 configure.ac  |1 +
 src/Makefile.am   |   23 +--
 src/hb-blob.cc|2 +-
 src/hb-blob.h |2 +-
 src/hb-buffer-private.hh  |4 ++--
 src/hb-buffer.h   |6 +++---
 src/hb-common.cc  |2 +-
 src/hb-common.h   |4 ++--
 src/hb-font-private.hh|6 +++---
 src/hb-font.cc|2 +-
 src/hb-font.h |8 
 src/hb-mutex-private.hh   |9 +
 src/hb-object-private.hh  |   32 ++--
 src/hb-set-private.hh |2 +-
 src/hb-set.h  |2 +-
 src/hb-shape.h|2 +-
 src/hb-unicode-private.hh |2 +-
 src/hb-unicode.h  |2 +-
 test/api/hb-test.h|2 ++
 20 files changed, 85 insertions(+), 31 deletions(-)

New commits:
commit 49f8e0cd9a5493ae26857c43bac0711cdf47c80d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jun 16 15:40:03 2012 -0400

GStaticMutex is deprecated

diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh
index f9bd679..8efd27e 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex-private.hh
@@ -67,12 +67,21 @@ typedef pthread_mutex_t hb_mutex_impl_t;
 #elif !defined(HB_NO_MT)  defined(HAVE_GLIB)
 
 #include glib.h
+#if !GLIB_CHECK_VERSION(2,32,0)
 typedef GStaticMutex hb_mutex_impl_t;
 #define HB_MUTEX_IMPL_INIT G_STATIC_MUTEX_INIT
 #define hb_mutex_impl_init(M)  g_static_mutex_init (M)
 #define hb_mutex_impl_lock(M)  g_static_mutex_lock (M)
 #define hb_mutex_impl_unlock(M)g_static_mutex_unlock (M)
 #define hb_mutex_impl_finish(M)g_static_mutex_free (M)
+#else
+typedef GMutex hb_mutex_impl_t;
+#define HB_MUTEX_IMPL_INIT {0}
+#define hb_mutex_impl_init(M)  g_mutex_init (M)
+#define hb_mutex_impl_lock(M)  g_mutex_lock (M)
+#define hb_mutex_impl_unlock(M)g_mutex_unlock (M)
+#define hb_mutex_impl_finish(M)g_mutex_clear (M)
+#endif
 
 
 #elif !defined(HB_NO_MT)  defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
commit 5e113a4b7921ced6af2d53460a7a2f1d0185c02a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jun 16 15:26:13 2012 -0400

g_thread_init() is deprecated

diff --git a/test/api/hb-test.h b/test/api/hb-test.h
index f36d53b..d569757 100644
--- a/test/api/hb-test.h
+++ b/test/api/hb-test.h
@@ -75,7 +75,9 @@ srcdir (void)
 static inline void
 hb_test_init (int *argc, char ***argv)
 {
+#if !GLIB_CHECK_VERSION(2,32,0)
   g_thread_init (NULL);
+#endif
   g_test_init (argc, argv, NULL);
 }
 
commit 1bc1cb3603167f5da309336f7018c8b0608ac104
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jun 16 15:21:55 2012 -0400

Make source more digestable for gobject-introspection

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 3cc2d9d..b6e696b 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -46,7 +46,7 @@
 #endif
 
 
-struct _hb_blob_t {
+struct hb_blob_t {
   hb_object_header_t header;
   ASSERT_POD ();
 
diff --git a/src/hb-blob.h b/src/hb-blob.h
index 360310b..1a93baa 100644
--- a/src/hb-blob.h
+++ b/src/hb-blob.h
@@ -43,7 +43,7 @@ typedef enum {
   HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE
 } hb_memory_mode_t;
 
-typedef struct _hb_blob_t hb_blob_t;
+typedef struct hb_blob_t hb_blob_t;
 
 hb_blob_t *
 hb_blob_create (const char*data,
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 39b6e5c..9bd80e0 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -40,7 +40,7 @@
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
 
-typedef struct _hb_segment_properties_t {
+typedef struct hb_segment_properties_t {
 hb_direction_t  direction;
 hb_script_t script;
 hb_language_t   language;
@@ -48,7 +48,7 @@ typedef struct _hb_segment_properties_t {
 } hb_segment_properties_t;
 
 
-struct _hb_buffer_t {
+struct hb_buffer_t {
   hb_object_header_t header;
   ASSERT_POD ();
 
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index fe53197..73adc2e 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -40,9 +40,9 @@
 HB_BEGIN_DECLS
 
 
-typedef struct _hb_buffer_t hb_buffer_t;
+typedef struct hb_buffer_t hb_buffer_t;
 
-typedef struct _hb_glyph_info_t {
+typedef struct hb_glyph_info_t {
   hb_codepoint_t codepoint;
   hb_mask_t  mask;
   uint32_t   cluster;
@@ -52,7 +52,7 @@ typedef struct _hb_glyph_info_t {
   hb_var_int_t   var2;
 } hb_glyph_info_t;
 
-typedef struct _hb_glyph_position_t {
+typedef struct hb_glyph_position_t {
   hb_position_t  x_advance;
   hb_position_t  y_advance;
   hb_position_t  x_offset;
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 331d255..baf5977 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -98,7 +98,7 @@ hb_direction_to_string (hb_direction_t direction)
 
 /* hb_language_t */
 
-struct _hb_language_t {
+struct hb_language_impl_t {
   const char s[1];
 };
 
diff --git a/src/hb-common.h 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-09 Thread Behdad Esfahbod
 util/shape-consumer.hh |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 6a5661f1e69c937083e8d976cb12429b99180d54
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jun 9 03:26:16 2012 -0400

Ugh

diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh
index 11e4cc3..220daa4 100644
--- a/util/shape-consumer.hh
+++ b/util/shape-consumer.hh
@@ -49,7 +49,6 @@ struct shape_consumer_t
   {
 output.new_line ();
 
-for (unsigned int i = 0; i  1; i++) {
 shaper.populate_buffer (buffer, text, text_len);
 output.consume_text (buffer, text, text_len, shaper.utf8_clusters);
 
@@ -59,7 +58,6 @@ struct shape_consumer_t
   output.shape_failed (buffer, text, text_len, shaper.utf8_clusters);
   return;
 }
-}
 
 output.consume_glyphs (buffer, text, text_len, shaper.utf8_clusters);
   }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-07 Thread Behdad Esfahbod
 src/hb-shape.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6095de1635441af16340c7b2c5a6b4c531ec242f
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Jun 7 15:48:18 2012 -0400

Fix clang warning with NO_MT path

diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 163a5bf..56c9046 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -87,7 +87,7 @@ retry:
   {
 char *env = getenv (HB_SHAPER_LIST);
 if (!env || !*env) {
-  hb_atomic_ptr_cmpexch (static_shapers, NULL, (const hb_shaper_pair_t *) 
all_shapers);
+  (void) hb_atomic_ptr_cmpexch (static_shapers, NULL, (const 
hb_shaper_pair_t *) all_shapers);
   return (const hb_shaper_pair_t *) all_shapers;
 }
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-06-07 Thread Behdad Esfahbod
 src/hb-buffer-private.hh |2 +-
 src/hb-buffer.cc |5 +++--
 src/hb-open-type-private.hh  |1 +
 src/hb-ot-layout-gsub-table.hh   |4 ++--
 src/hb-ot-layout-gsubgpos-private.hh |2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 0bb0f5d41976ae27c5c7a51cbb82144b48315a4b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Jun 7 17:42:48 2012 -0400

Add note re _NullPool

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 5d90e5b..5f097f0 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -130,6 +130,7 @@ inline Type StructAfter(TObject X)
  */
 
 /* Global nul-content Null pool.  Enlarge as necessary. */
+/* TODO This really should be a extern HB_INTERNAL and defined somewhere... */
 static const void *_NullPool[64 / sizeof (void *)];
 
 /* Generic nul-content Null objects. */
commit 2a3d911fe0ff5d6442659d3381d5b08c30ee2896
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Jun 7 17:31:46 2012 -0400

Fix alignment-requirement missmatch

Detected by clang and lots of cmdline options.

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index b539f26..4077bb3 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -112,7 +112,7 @@ struct _hb_buffer_t {
   HB_INTERNAL void clear_positions (void);
   HB_INTERNAL void replace_glyphs_be16 (unsigned int num_in,
unsigned int num_out,
-   const uint16_t *glyph_data_be);
+   const char *glyph_data_be);
   HB_INTERNAL void replace_glyphs (unsigned int num_in,
   unsigned int num_out,
   const hb_codepoint_t *glyph_data);
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index e2c34f1..9c9b32e 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -233,7 +233,7 @@ hb_buffer_t::swap_buffers (void)
 void
 hb_buffer_t::replace_glyphs_be16 (unsigned int num_in,
  unsigned int num_out,
- const uint16_t *glyph_data_be)
+ const char *glyph_data_be)
 {
   if (!make_room_for (num_in, num_out)) return;
 
@@ -245,10 +245,11 @@ hb_buffer_t::replace_glyphs_be16 (unsigned int num_in,
   }
 
   hb_glyph_info_t *pinfo = out_info[out_len];
+  const unsigned char *data = (const unsigned char *) glyph_data_be;
   for (unsigned int i = 0; i  num_out; i++)
   {
 *pinfo = orig_info;
-pinfo-codepoint = hb_be_uint16 (glyph_data_be[i]);
+pinfo-codepoint = (data[2*i]  8) | data[2*i+1];
 pinfo++;
   }
 
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index f6a7575..4229f32 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -213,7 +213,7 @@ struct Sequence
 if (unlikely (!substitute.len)) return TRACE_RETURN (false);
 
 unsigned int klass = c-property  HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? 
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0;
-c-replace_glyphs_be16 (1, substitute.len, (const uint16_t *) 
substitute.array, klass);
+c-replace_glyphs_be16 (1, substitute.len, (const char *) 
substitute.array, klass);
 
 return TRACE_RETURN (true);
   }
@@ -502,7 +502,7 @@ struct Ligature
 
 if (skippy_iter.idx  c-buffer-idx + count) /* No input glyphs skipped */
 {
-  c-replace_glyphs_be16 (count, 1, (const uint16_t *) ligGlyph, klass);
+  c-replace_glyphs_be16 (count, 1, (const char *) ligGlyph, klass);
 }
 else
 {
diff --git a/src/hb-ot-layout-gsubgpos-private.hh 
b/src/hb-ot-layout-gsubgpos-private.hh
index a2e4b2f..e590e39 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -230,7 +230,7 @@ struct hb_apply_context_t
   }
   inline void replace_glyphs_be16 (unsigned int num_in,
   unsigned int num_out,
-  const uint16_t *glyph_data_be,
+  const char *glyph_data_be,
   unsigned int klass = 0) const
   {
 buffer-cur().props_cache() = klass; /* XXX if has gdef? */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-06 Thread Behdad Esfahbod
 configure.ac |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 4282d2f3771d6510c27b62e54cc1254d6f2389b3
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jun 6 03:42:36 2012 -0400

Enabled ICU again

diff --git a/configure.ac b/configure.ac
index 51a3597..2fb058f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,7 +137,6 @@ PKG_CHECK_MODULES(ICU, icu, have_icu=true, [
AC_SUBST(ICU_LIBS)
fi
 ])
-have_icu=false
 if $have_icu; then
AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
 fi
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-06-06 Thread Behdad Esfahbod
 src/hb-private.hh |   34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)

New commits:
commit 73cb02de2dd28b09d4aa76230132248215cfe83d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jun 6 11:29:25 2012 -0400

Minor

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 07c9fb6..0cb049e 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -78,9 +78,9 @@ template typename Type static inline Type MAX (const Type 
a, const Type b) {
 #define HB_STMT_START do
 #define HB_STMT_END   while (0)
 
-#define _ASSERT_STATIC1(_line, _cond) typedef int 
_static_assert_on_line_##_line##_failed[(_cond)?1:-1]
-#define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
-#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
+#define _ASSERT_STATIC1(_line, _cond)  typedef int 
_static_assert_on_line_##_line##_failed[(_cond)?1:-1]
+#define _ASSERT_STATIC0(_line, _cond)  _ASSERT_STATIC1 (_line, (_cond))
+#define ASSERT_STATIC(_cond)   _ASSERT_STATIC0 (__LINE__, (_cond))
 
 #define ASSERT_STATIC_EXPR(_cond)((void) sizeof (char[(_cond) ? 1 : -1]))
 #define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * sizeof (char[(_cond) ? 1 : -1]))
@@ -107,9 +107,9 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4);
 
 /* We like our types POD */
 
-#define _ASSERT_TYPE_POD1(_line, _type) union 
_type_##_type##_on_line_##_line##_is_not_POD { _type instance; }
-#define _ASSERT_TYPE_POD0(_line, _type) _ASSERT_TYPE_POD1 (_line, _type)
-#define ASSERT_TYPE_POD(_type) _ASSERT_TYPE_POD0 (__LINE__, _type)
+#define _ASSERT_TYPE_POD1(_line, _type)union 
_type_##_type##_on_line_##_line##_is_not_POD { _type instance; }
+#define _ASSERT_TYPE_POD0(_line, _type)_ASSERT_TYPE_POD1 (_line, _type)
+#define ASSERT_TYPE_POD(_type) _ASSERT_TYPE_POD0 (__LINE__, _type)
 
 #ifdef __GNUC__
 # define _ASSERT_INSTANCE_POD1(_line, _instance) \
@@ -118,17 +118,17 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4);
_ASSERT_TYPE_POD1 (_line, _type_##_line); \
} HB_STMT_END
 #else
-# define _ASSERT_INSTANCE_POD1(_line, _instance) typedef int 
_assertion_on_line_##_line##_not_tested
+# define _ASSERT_INSTANCE_POD1(_line, _instance)   typedef int 
_assertion_on_line_##_line##_not_tested
 #endif
-# define _ASSERT_INSTANCE_POD0(_line, _instance) _ASSERT_INSTANCE_POD1 (_line, 
_instance)
-# define ASSERT_INSTANCE_POD(_instance) _ASSERT_INSTANCE_POD0 (__LINE__, 
_instance)
+# define _ASSERT_INSTANCE_POD0(_line, _instance)   _ASSERT_INSTANCE_POD1 
(_line, _instance)
+# define ASSERT_INSTANCE_POD(_instance)
_ASSERT_INSTANCE_POD0 (__LINE__, _instance)
 
 /* Check _assertion in a method environment */
 #define _ASSERT_POD1(_line) \
-  inline void _static_assertion_on_line_##_line (void) const \
-  { _ASSERT_INSTANCE_POD1 (_line, *this); /* Make sure it's POD. */ }
-# define _ASSERT_POD0(_line) _ASSERT_POD1 (_line)
-# define ASSERT_POD() _ASSERT_POD0 (__LINE__)
+   inline void _static_assertion_on_line_##_line (void) const \
+   { _ASSERT_INSTANCE_POD1 (_line, *this); /* Make sure it's POD. */ }
+# define _ASSERT_POD0(_line)   _ASSERT_POD1 (_line)
+# define ASSERT_POD()  _ASSERT_POD0 (__LINE__)
 
 
 
commit 79e2b4791fe95ede9a1e6b1c71ccc6e36c4fc0e5
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jun 6 11:27:17 2012 -0400

Fix ASSERT_POD on clang

As reported by bashi.  Not tested.

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 2ea0442..07c9fb6 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -82,7 +82,7 @@ template typename Type static inline Type MAX (const Type 
a, const Type b) {
 #define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
 #define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
 
-#define ASSERT_STATIC_EXPR(_cond) ((void) sizeof (char[(_cond) ? 1 : -1]))
+#define ASSERT_STATIC_EXPR(_cond)((void) sizeof (char[(_cond) ? 1 : -1]))
 #define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * sizeof (char[(_cond) ? 1 : -1]))
 
 #define _PASTE1(a,b) a##b
@@ -112,7 +112,11 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4);
 #define ASSERT_TYPE_POD(_type) _ASSERT_TYPE_POD0 (__LINE__, _type)
 
 #ifdef __GNUC__
-# define _ASSERT_INSTANCE_POD1(_line, _instance) union 
_type_of_instance_on_line_##_line##_is_not_POD { __typeof__(_instance) 
instance; }
+# define _ASSERT_INSTANCE_POD1(_line, _instance) \
+   HB_STMT_START { \
+   typedef __typeof__(_instance) _type_##_line; \
+   _ASSERT_TYPE_POD1 (_line, _type_##_line); \
+   } HB_STMT_END
 #else
 # define _ASSERT_INSTANCE_POD1(_line, _instance) typedef int 
_assertion_on_line_##_line##_not_tested
 #endif
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-04 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9fc7a11469113d31d8095757c4fc038c3427d44a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jun 4 08:28:19 2012 -0400

Remove comma at the end of enum

As reported by Jonathan Kew on the list.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0c5479e..53ce263 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -617,7 +617,7 @@ final_reordering_syllable (hb_buffer_t *buffer, hb_mask_t 
*mask_array,
REPH_BEFORE_SUBSCRIPT,
REPH_AFTER_SUBSCRIPT,
REPH_BEFORE_POSTSCRIPT,
-   REPH_AFTER_POSTSCRIPT,
+   REPH_AFTER_POSTSCRIPT
  } reph_pos;
 
  /* XXX Figure out old behavior too */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-02 Thread Behdad Esfahbod
 util/hb-ot-shape-closure.cc |3 ++
 util/hb-shape.cc|   36 --
 util/main-font-text.hh  |2 -
 util/options.cc |   34 ++--
 util/options.hh |   33 ++-
 util/shape-consumer.hh  |   17 +++---
 util/view-cairo.cc  |   47 ++-
 util/view-cairo.hh  |   52 ++--
 8 files changed, 143 insertions(+), 81 deletions(-)

New commits:
commit 5db0683a822f70c914468430cda6487cee740ae3
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jun 2 12:13:08 2012 -0400

[util] Make hb-shape continue shaping other lines if shapers failed

diff --git a/util/hb-ot-shape-closure.cc b/util/hb-ot-shape-closure.cc
index 2a4fdcf..6dce7a1 100644
--- a/util/hb-ot-shape-closure.cc
+++ b/util/hb-ot-shape-closure.cc
@@ -57,6 +57,7 @@ struct shape_closure_consumer_t : option_group_t
   {
 glyphs = hb_set_create ();
 font = hb_font_reference (font_opts-get_font ());
+failed = false;
   }
   void consume_line (hb_buffer_t  *buffer,
 const char   *text,
@@ -93,6 +94,8 @@ struct shape_closure_consumer_t : option_group_t
 glyphs = NULL;
   }
 
+  bool failed;
+
   protected:
   shape_options_t shaper;
   hb_bool_t show_glyph_names;
diff --git a/util/hb-shape.cc b/util/hb-shape.cc
index 3758be0..d459b89 100644
--- a/util/hb-shape.cc
+++ b/util/hb-shape.cc
@@ -28,28 +28,49 @@
 #include main-font-text.hh
 #include shape-consumer.hh
 
-struct output_buffer_t : output_options_t
+struct output_buffer_t
 {
   output_buffer_t (option_parser_t *parser)
- : output_options_t (parser),
+ : options (parser),
format (parser) {}
 
   void init (const font_options_t *font_opts)
   {
-get_file_handle ();
+options.get_file_handle ();
 gs = g_string_new (NULL);
 line_no = 0;
 font = hb_font_reference (font_opts-get_font ());
   }
-  void consume_line (hb_buffer_t  *buffer,
+  void new_line (void)
+  {
+line_no++;
+  }
+  void consume_text (hb_buffer_t  *buffer,
 const char   *text,
 unsigned int  text_len,
 hb_bool_t utf8_clusters)
   {
-line_no++;
 g_string_set_size (gs, 0);
-format.serialize_line (buffer, line_no, text, text_len, font, 
utf8_clusters, gs);
-fprintf (fp, %s, gs-str);
+format.serialize_buffer_of_text (buffer, line_no, text, text_len, font, 
utf8_clusters, gs);
+fprintf (options.fp, %s, gs-str);
+  }
+  void shape_failed (hb_buffer_t  *buffer,
+const char   *text,
+unsigned int  text_len,
+hb_bool_t utf8_clusters)
+  {
+g_string_set_size (gs, 0);
+format.serialize_message (line_no, msg: all shapers failed, gs);
+fprintf (options.fp, %s, gs-str);
+  }
+  void consume_glyphs (hb_buffer_t  *buffer,
+  const char   *text,
+  unsigned int  text_len,
+  hb_bool_t utf8_clusters)
+  {
+g_string_set_size (gs, 0);
+format.serialize_buffer_of_glyphs (buffer, line_no, text, text_len, font, 
utf8_clusters, gs);
+fprintf (options.fp, %s, gs-str);
   }
   void finish (const font_options_t *font_opts)
   {
@@ -60,6 +81,7 @@ struct output_buffer_t : output_options_t
   }
 
   protected:
+  output_options_t options;
   format_options_t format;
 
   GString *gs;
diff --git a/util/main-font-text.hh b/util/main-font-text.hh
index 1a9739f..1dbaaff 100644
--- a/util/main-font-text.hh
+++ b/util/main-font-text.hh
@@ -66,7 +66,7 @@ struct main_font_text_t
 
 consumer.finish (font_opts);
 
-return 0;
+return consumer.failed ? 1 : 0;
   }
 
   protected:
diff --git a/util/options.cc b/util/options.cc
index c404b8a..4cc8a86 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -772,13 +772,13 @@ format_options_t::serialize_line_no (unsigned int  
line_no,
 g_string_append_printf (gs, %d: , line_no);
 }
 void
-format_options_t::serialize_line (hb_buffer_t  *buffer,
- unsigned int  line_no,
- const char   *text,
- unsigned int  text_len,
- hb_font_t*font,
- hb_bool_t utf8_clusters,
- GString  *gs)
+format_options_t::serialize_buffer_of_text (hb_buffer_t  *buffer,
+   unsigned int  line_no,
+   const char   *text,
+   unsigned int  text_len,
+   hb_font_t*font,
+   hb_bool_t utf8_clusters,
+   GString  *gs)
 {
   if (show_text) {
 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-02 Thread Behdad Esfahbod
 util/options.cc|4 +---
 util/options.hh|   26 ++
 util/shape-consumer.hh |4 +++-
 3 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit ae62166519291057316a9d15cea3f1570fcb5eaf
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jun 2 12:21:19 2012 -0400

[util] Minor

diff --git a/util/options.cc b/util/options.cc
index 4cc8a86..109a0b4 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -790,9 +790,7 @@ format_options_t::serialize_buffer_of_text (hb_buffer_t  
*buffer,
 
   if (show_unicode) {
 serialize_line_no (line_no, gs);
-hb_buffer_reset (scratch);
-hb_buffer_add_utf8 (scratch, text, text_len, 0, -1);
-serialize_unicode (scratch, gs);
+serialize_unicode (buffer, gs);
 g_string_append_c (gs, '\n');
   }
 }
diff --git a/util/options.hh b/util/options.hh
index 849a046..2dcd331 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -141,7 +141,8 @@ struct view_options_t : option_group_t
 
 struct shape_options_t : option_group_t
 {
-  shape_options_t (option_parser_t *parser) {
+  shape_options_t (option_parser_t *parser)
+  {
 direction = language = script = NULL;
 features = NULL;
 num_features = 0;
@@ -150,21 +151,23 @@ struct shape_options_t : option_group_t
 
 add_options (parser);
   }
-  ~shape_options_t (void) {
+  ~shape_options_t (void)
+  {
 free (features);
 g_free (shapers);
   }
 
   void add_options (option_parser_t *parser);
 
-  void setup_buffer (hb_buffer_t *buffer) {
+  void setup_buffer (hb_buffer_t *buffer)
+  {
 hb_buffer_set_direction (buffer, hb_direction_from_string (direction, -1));
 hb_buffer_set_script (buffer, hb_script_from_string (script, -1));
 hb_buffer_set_language (buffer, hb_language_from_string (language, -1));
   }
 
-  hb_bool_t shape (const char *text, int text_len,
-  hb_font_t *font, hb_buffer_t *buffer) {
+  void populate_buffer (hb_buffer_t *buffer, const char *text, int text_len)
+  {
 hb_buffer_reset (buffer);
 hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len);
 
@@ -181,12 +184,17 @@ struct shape_options_t : option_group_t
 }
 
 setup_buffer (buffer);
+  }
+
+  hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer)
+  {
 return hb_shape_full (font, buffer, features, num_features, shapers);
   }
 
   void shape_closure (const char *text, int text_len,
  hb_font_t *font, hb_buffer_t *buffer,
- hb_set_t *glyphs) {
+ hb_set_t *glyphs)
+  {
 hb_buffer_reset (buffer);
 hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len);
 setup_buffer (buffer);
@@ -315,13 +323,9 @@ struct format_options_t : option_group_t
 show_text = false;
 show_unicode = false;
 show_line_num = false;
-scratch = hb_buffer_create ();
 
 add_options (parser);
   }
-  ~format_options_t (void) {
-hb_buffer_destroy (scratch);
-  }
 
   void add_options (option_parser_t *parser);
 
@@ -359,8 +363,6 @@ struct format_options_t : option_group_t
   hb_bool_t show_text;
   hb_bool_t show_unicode;
   hb_bool_t show_line_num;
-  private:
-  hb_buffer_t *scratch;
 };
 
 
diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh
index da14c61..220daa4 100644
--- a/util/shape-consumer.hh
+++ b/util/shape-consumer.hh
@@ -48,9 +48,11 @@ struct shape_consumer_t
 unsigned int  text_len)
   {
 output.new_line ();
+
+shaper.populate_buffer (buffer, text, text_len);
 output.consume_text (buffer, text, text_len, shaper.utf8_clusters);
 
-if (!shaper.shape (text, text_len, font, buffer)) {
+if (!shaper.shape (font, buffer)) {
   failed = true;
   hb_buffer_set_length (buffer, 0);
   output.shape_failed (buffer, text, text_len, shaper.utf8_clusters);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-06-01 Thread Behdad Esfahbod
 TODO   
   |1 
 src/hb-atomic-private.hh   
   |8 -
 src/hb-font-private.hh 
   |2 
 src/hb-font.cc 
   |   80 +++---
 src/hb-font.h  
   |   28 +++
 src/hb-ft.cc   
   |   52 +-
 src/hb-object-private.hh   
   |   12 -
 src/hb-unicode-private.hh  
   |4 
 src/hb-warning.cc  
   |   13 +
 test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt   
   |1 
 test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST  
   |1 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST
  |1 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST
 |1 
 
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt
 |1 
 util/hb-ot-shape-closure.cc
   |   11 -
 util/options.cc
   |   10 -
 16 files changed, 168 insertions(+), 58 deletions(-)

New commits:
commit 96a9ef0c9fca8d58d8dc6baf6b262d96587abee0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jun 1 13:46:26 2012 -0400

Remove tab character like other zero-width characters

Uniscribe does that, this make comparing results to Uniscribe
easier.

diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index 519fa0b..ddba1ac 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -149,7 +149,8 @@ _hb_unicode_is_zero_width (hb_codepoint_t ch)
  (ch = 0x202A  ch = 0x202E) ||
  (ch = 0x2060  ch = 0x2063) ||
  (ch == 0x2028)
-)) || unlikely (ch == 0x00AD
+)) || unlikely (ch == 0x0009
+ || ch == 0x00AD
  || ch == 0x034F
  || ch == 0xFEFF);
 }
commit cd6a5493411fea30a04466128e1a37b4d89c6a72
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jun 1 13:45:25 2012 -0400

Remove unused variable

diff --git a/util/hb-ot-shape-closure.cc b/util/hb-ot-shape-closure.cc
index 7bb8ae6..2a4fdcf 100644
--- a/util/hb-ot-shape-closure.cc
+++ b/util/hb-ot-shape-closure.cc
@@ -62,8 +62,6 @@ struct shape_closure_consumer_t : option_group_t
 const char   *text,
 unsigned int  text_len)
   {
-FT_Face ft_face = show_glyph_names ? hb_ft_font_get_face (font) : NULL;
-
 hb_set_clear (glyphs);
 shaper.shape_closure (text, text_len, font, buffer, glyphs);
 
commit 0558d55bac7fb9279aac859b465e7c0e3ad97492
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon May 28 10:46:47 2012 -0400

Remove hb_atomic_int_set/get()

We never use them in fact...

I'm just adjusting these as I better understand the requirements of
the code and the guarantees of each operation.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 458c984..d6bd1c9 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -47,8 +47,6 @@
 #include intrin.h
 typedef long hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   _InterlockedExchangeAdd ((AI), (V))
-#define hb_atomic_int_set(AI, V)   ((AI) = (V), MemoryBarrier ())
-#define hb_atomic_int_get(AI)  (MemoryBarrier (), (AI))
 
 
 #elif !defined(HB_NO_MT)  defined(__APPLE__)
@@ -56,8 +54,6 @@ typedef long hb_atomic_int_t;
 #include libkern/OSAtomic.h
 typedef int32_t hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   (OSAtomicAdd32Barrier ((V), (AI)) - 
(V))
-#define hb_atomic_int_set(AI, V)   ((AI) = (V), OSMemoryBarrier ())
-#define hb_atomic_int_get(AI)  (OSMemoryBarrier (), (AI))
 
 
 #elif !defined(HB_NO_MT)  defined(HAVE_GLIB)
@@ -69,8 +65,6 @@ typedef volatile int hb_atomic_int_t;
 #else
 #define hb_atomic_int_add(AI, V)   g_atomic_int_exchange_and_add ((AI), 
(V))
 #endif
-#define hb_atomic_int_set(AI, V)   g_atomic_int_set ((AI), (V))
-#define hb_atomic_int_get(AI)  g_atomic_int_get ((AI))
 
 
 #else
@@ -78,8 +72,6 @@ typedef volatile int hb_atomic_int_t;
 #define HB_ATOMIC_INT_NIL 1
 typedef volatile int hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   (((AI) += (V)) - (V))
-#define hb_atomic_int_set(AI, V)   ((void) ((AI) = (V)))
-#define hb_atomic_int_get(AI)  (AI)
 
 #endif
 
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index edd8921..2be20d3 100644
--- 

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

2012-05-27 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic-machine.rl |2 +-
 src/hb-ot-shape-complex-indic.cc |2 +-
 src/hb-set-private.hh|   31 ---
 src/hb-set.cc|   14 ++
 src/hb-set.h |   13 +
 util/hb-ot-shape-closure.cc  |8 +---
 util/helper-cairo.cc |2 +-
 util/options.cc  |6 +-
 8 files changed, 68 insertions(+), 10 deletions(-)

New commits:
commit 8f8956a55fff95e5ad529d2f124c9528d1f4f81d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri May 25 14:30:24 2012 -0400

[util] Add hidden --shaper that is equivalent of --shapers

diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index de45fb3..77fd1a6 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -297,7 +297,7 @@ helper_cairo_create_context (double w, double h,
 
 
   unsigned int fr, fg, fb, fa, br, bg, bb, ba;
-  br = bg = bb = ba = 255;
+  br = bg = bb = 0; ba = 255;
   sscanf (view_opts-back + (*view_opts-back=='#'), %2x%2x%2x%2x, br, bg, 
bb, ba);
   fr = fg = fb = 0; fa = 255;
   sscanf (view_opts-fore + (*view_opts-fore=='#'), %2x%2x%2x%2x, fr, fg, 
fb, fa);
diff --git a/util/options.cc b/util/options.cc
index 363a150..463daee 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2011  Google, Inc.
+ * Copyright © 2011,2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -178,6 +178,7 @@ parse_shapers (const char *name G_GNUC_UNUSED,
   GError**error G_GNUC_UNUSED)
 {
   shape_options_t *shape_opts = (shape_options_t *) data;
+  g_free (shape_opts-shapers);
   shape_opts-shapers = g_strsplit (arg, ,, 0);
   return TRUE;
 }
@@ -330,6 +331,7 @@ parse_features (const char *name G_GNUC_UNUSED,
   char *p;
 
   shape_opts-num_features = 0;
+  g_free (shape_opts-features);
   shape_opts-features = NULL;
 
   if (!*s)
@@ -387,6 +389,8 @@ shape_options_t::add_options (option_parser_t *parser)
   {
 {list-shapers,   0, G_OPTION_FLAG_NO_ARG,
  G_OPTION_ARG_CALLBACK,(gpointer) 
list_shapers,   List available shapers and quit,  NULL},
+{shaper, 0, G_OPTION_FLAG_HIDDEN,
+ G_OPTION_ARG_CALLBACK,(gpointer) 
parse_shapers,  Hidden duplicate of --shapers,NULL},
 {shapers,0, 0, G_OPTION_ARG_CALLBACK,(gpointer) 
parse_shapers,  Comma-separated list of shapers to try,list},
 {direction,  0, 0, G_OPTION_ARG_STRING,  this-direction,   
Set text direction (default: auto),   ltr/rtl/ttb/btt},
 {language,   0, 0, G_OPTION_ARG_STRING,  this-language,
Set text language (default: $LANG),   langstr},
commit 29ce446d3161b7ea5874352e5f8eb33cd59338c3
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri May 25 14:17:54 2012 -0400

Add set iterator

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index df96b99..9d8ba4a 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -32,6 +32,7 @@
 #include hb-object-private.hh
 
 
+/* TODO Make this faster and memmory efficient. */
 
 struct _hb_set_t
 {
@@ -51,6 +52,7 @@ struct _hb_set_t
   }
   inline void add (hb_codepoint_t g)
   {
+if (unlikely (g == SENTINEL)) return;
 if (unlikely (g  MAX_G)) return;
 elt (g) |= mask (g);
   }
@@ -107,6 +109,23 @@ struct _hb_set_t
 for (unsigned int i = 0; i  ELTS; i++)
   elts[i] ^= other-elts[i];
   }
+  inline bool next (hb_codepoint_t *codepoint)
+  {
+if (unlikely (*codepoint == SENTINEL)) {
+  hb_codepoint_t i = get_min ();
+  if (i != SENTINEL) {
+*codepoint = i;
+   return true;
+  } else
+return false;
+}
+for (hb_codepoint_t i = *codepoint + 1; i  MAX_G + 1; i++)
+  if (has (i)) {
+*codepoint = i;
+   return true;
+  }
+return false;
+  }
   inline hb_codepoint_t get_min (void) const
   {
 for (unsigned int i = 0; i  ELTS; i++)
@@ -114,7 +133,7 @@ struct _hb_set_t
for (unsigned int j = 0; i  BITS; j++)
  if (elts[i]  (1  j))
return i * BITS + j;
-return 0;
+return SENTINEL;
   }
   inline hb_codepoint_t get_max (void) const
   {
@@ -123,15 +142,16 @@ struct _hb_set_t
for (unsigned int j = BITS; j; j--)
  if (elts[i - 1]  (1  (j - 1)))
return (i - 1) * BITS + (j - 1);
-return 0;
+return SENTINEL;
   }
 
   typedef uint32_t elt_t;
-  static const unsigned int MAX_G = 65536 - 1;
+  static const unsigned int MAX_G = 65536 - 1; /* XXX Fix this... */
   static const unsigned int SHIFT = 5;
   static const unsigned int BITS = (1  SHIFT);
   static const unsigned int MASK = BITS - 1;
   static const unsigned int ELTS = (MAX_G + 1 + (BITS - 1)) / BITS;
+  static  const hb_codepoint_t SENTINEL = (hb_codepoint_t) -1;
 
   elt_t elt 

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

2012-05-27 Thread Behdad Esfahbod
 src/hb-atomic-private.hh |6 +++---
 src/hb-cache-private.hh  |8 
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit e4b6d503c5575ddbf49249e3fef693d75ae75170
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun May 27 10:11:13 2012 -0400

Don't use atomic ops in hb_cache_t

We don't care about linearizability, so unprotected int read/write
are enough, no need for expensive memory barriers.  It's a cache,
that's all.

diff --git a/src/hb-cache-private.hh b/src/hb-cache-private.hh
index 7394fbb..a0928a0 100644
--- a/src/hb-cache-private.hh
+++ b/src/hb-cache-private.hh
@@ -36,7 +36,7 @@ template unsigned int key_bits, unsigned int value_bits, 
unsigned int cache_bit
 struct hb_cache_t
 {
   ASSERT_STATIC (key_bits = cache_bits);
-  ASSERT_STATIC (key_bits + value_bits - cache_bits  8 * sizeof 
(hb_atomic_int_t));
+  ASSERT_STATIC (key_bits + value_bits - cache_bits  8 * sizeof (unsigned 
int));
 
   inline void clear (void)
   {
@@ -46,7 +46,7 @@ struct hb_cache_t
   inline bool get (unsigned int key, unsigned int *value)
   {
 unsigned int k = key  ((1cache_bits)-1);
-unsigned int v = hb_atomic_int_get (values[k]);
+unsigned int v = values[k];
 if ((v  value_bits) != (key  cache_bits))
   return false;
   }
@@ -57,12 +57,12 @@ struct hb_cache_t
   return false; /* Overflows */
 unsigned int k = key  ((1cache_bits)-1);
 unsigned int v = ((keycache_bits)value_bits) | value;
-hb_atomic_int_set (values[k], v);
+values[k] = v;
 return true;
   }
 
   private:
-  hb_atomic_int_t values[1cache_bits];
+  unsigned int values[1cache_bits];
 };
 
 typedef hb_cache_t21, 16, 8 hb_cmap_cache_t;
commit 819faa05307aa192015f4b43d8103a35e87d6cc7
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun May 27 10:09:18 2012 -0400

Minor

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index b587fde..ba52773 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -78,7 +78,7 @@ typedef volatile int hb_atomic_int_t;
 
 #define HB_ATOMIC_INT_NIL 1
 typedef volatile int hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V)   ((AI) += (V), (AI) - (V))
+#define hb_atomic_int_add(AI, V)   (((AI) += (V)) - (V))
 #define hb_atomic_int_set(AI, V)   ((void) ((AI) = (V)))
 #define hb_atomic_int_get(AI)  (AI)
 
commit 303d5850ec0516e198db241456b0cfc4899ef9c0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun May 27 10:01:13 2012 -0400

Fix Windows atomic get/set

According to:
http://msdn.microsoft.com/en-us/library/65tt87y8.aspx

MemoryBarrier() is the right macro to protect these, not _ReadBarrier()
and/or _WriteBarrier().

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 684e856..b587fde 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -47,8 +47,8 @@
 #include intrin.h
 typedef long hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   _InterlockedExchangeAdd ((AI), (V))
-#define hb_atomic_int_set(AI, V)   _InterlockedExchange ((AI), (V))
-#define hb_atomic_int_get(AI)  (_ReadBarrier (), (AI))
+#define hb_atomic_int_set(AI, V)   ((AI) = (V), MemoryBarrier ())
+#define hb_atomic_int_get(AI)  (MemoryBarrier (), (AI))
 
 
 #elif !defined(HB_NO_MT)  defined(__APPLE__)
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-05-24 Thread Jonathan Kew

This commit:


New commits:
commit 22afd66a30d01b6771405e76777306f600807bea
Author: Behdad Esfahbodbeh...@behdad.org
Date:   Thu May 17 21:23:49 2012 -0400

 Add hb_atomic_int_set() again


is slightly broken for the HB_NO_MT configuration...


@@ -73,6 +75,7 @@ typedef volatile int hb_atomic_int_t;
  #define HB_ATOMIC_INT_NIL 1
  typedef volatile int hb_atomic_int_t;
  #define hb_atomic_int_add(AI, V)  ((AI) += (V), (AI) - (V))
+#define hb_atomic_int_set(AI)  ((void) ((AI) = (V)))
  #define hb_atomic_int_get(AI) (AI)

  #endif


The hb_atomic_int_set macro needs two args, not just one.

JK
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-05-24 Thread Behdad Esfahbod
 TODO   
|   18 
 src/hb-atomic-private.hh   
|2 
 src/hb-ot-layout-gsub-table.hh 
|   10 
 src/hb-ot-layout-gsubgpos-private.hh   
|   23 
 test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST   
|2 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST 
   |5 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
|   28 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-arabic.txt
 |  695 ++
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-persian.txt
|   48 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-urdu.txt
   |  188 ++
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-diacritics.txt
 |1 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/ligature-diacritics.txt
|1 
 12 files changed, 993 insertions(+), 28 deletions(-)

New commits:
commit cde1c0114ba66a45d907e81a49bf625e0dc946b0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 24 10:46:39 2012 -0400

Fix hb_atomic_int_set() implementation for HB_NO_MT

As pointed out by Jonathan Kew.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 03d7df1..684e856 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -79,7 +79,7 @@ typedef volatile int hb_atomic_int_t;
 #define HB_ATOMIC_INT_NIL 1
 typedef volatile int hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   ((AI) += (V), (AI) - (V))
-#define hb_atomic_int_set(AI)  ((void) ((AI) = (V)))
+#define hb_atomic_int_set(AI, V)   ((void) ((AI) = (V)))
 #define hb_atomic_int_get(AI)  (AI)
 
 #endif
commit 3b9b7133bea787f787170beea073f185e36d2327
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed May 23 22:00:25 2012 -0400

Update TODO

diff --git a/TODO b/TODO
index 18d730c..168ff9a 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,8 @@
 General fixes:
 =
 
-- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode funcs
-  found / set.
+- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode / font
+  funcs found / set.
 
 - In hb_shape(), assert if direction is INVALID.
 
@@ -26,10 +26,24 @@ General fixes:
 
 - Synthetic GDEF.
 
+- Add Pango backend?
+
+- Add ICUlayout backend?
+
+- Add ICUlayout API?
+
+- Add Old HarfBuzz backend?
+
+- Add Old HarfBuzz API?
+
 
 API issues to fix before 1.0:
 
 
+- Add default font_funcs / Unicode funcs API and to utils.
+
+- Add init_func to font_funcs.  Adjust ft.
+
 - Add pkg-config files for glue codes (harfbuzz-glib, etc)
 
 - Figure out how many .so objects, how to link, etc
commit ff3524c21aabf5d0d6014d1ce1b3e12ca5f0990f
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed May 23 21:50:43 2012 -0400

Add Arabic diacritics tests

diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST
index ff8270e..0ac75c3 100644
--- a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST
@@ -1 +1 @@
-ligature-diacritics.txt
+diacritics
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
new file mode 100644
index 000..df0e4b5
--- /dev/null
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
@@ -0,0 +1,5 @@
+lam-alef.txt
+language-arabic.txt
+language-persian.txt
+language-urdu.txt
+ligature-diacritics.txt
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
new file mode 100644
index 000..26f6f7b
--- /dev/null
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
@@ -0,0 +1,28 @@
+لًا
+ـلًا
+لاً
+ـلاً
+لّا
+ـلّا
+لاّ
+ـلاّ
+لًّا
+ـلًّا
+لاًّ
+ـلاًّ
+لَّا
+ـلَّا
+لاَّ
+ـلاَّ
+لَا
+ـلَا
+لاَ
+ـلاَ
+لُا
+ـلُا
+لاُ
+ـلاُ
+لِا
+ـلِا
+لاِ
+ـلاِ
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-arabic.txt
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-arabic.txt
new file mode 100644
index 000..24eb0c9
--- /dev/null
+++ 

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

2012-05-17 Thread Behdad Esfahbod
 TODO |   12 --
 src/Makefile.am  |1 
 src/hb-atomic-private.hh |   84 +++
 src/hb-mutex-private.hh  |   25 +++--
 src/hb-object-private.hh |   52 +
 src/hb-set-private.hh|4 +-
 src/hb-set.cc|4 +-
 src/hb-tt-font.cc|3 +
 src/hb-warning.cc|2 -
 9 files changed, 116 insertions(+), 71 deletions(-)

New commits:
commit 22afd66a30d01b6771405e76777306f600807bea
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 17 21:23:49 2012 -0400

Add hb_atomic_int_set() again

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index f9050c3..60b319a 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -44,7 +44,8 @@
 
 #include intrin.h
 typedef long hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V)   _InterlockedExchangeAdd ((AI), V)
+#define hb_atomic_int_add(AI, V)   _InterlockedExchangeAdd ((AI), (V))
+#define hb_atomic_int_set(AI, V)   _InterlockedExchange ((AI), (V))
 #define hb_atomic_int_get(AI)  (_ReadBarrier (), (AI))
 
 
@@ -61,10 +62,11 @@ typedef int32_t hb_atomic_int_t;
 #include glib.h
 typedef volatile int hb_atomic_int_t;
 #if GLIB_CHECK_VERSION(2,29,5)
-#define hb_atomic_int_add(AI, V)   g_atomic_int_add ((AI), V)
+#define hb_atomic_int_add(AI, V)   g_atomic_int_add ((AI), (V))
 #else
-#define hb_atomic_int_add(AI, V)   g_atomic_int_exchange_and_add ((AI), V)
+#define hb_atomic_int_add(AI, V)   g_atomic_int_exchange_and_add ((AI), 
(V))
 #endif
+#define hb_atomic_int_set(AI, V)   g_atomic_int_set ((AI), (V))
 #define hb_atomic_int_get(AI)  g_atomic_int_get ((AI))
 
 
@@ -73,6 +75,7 @@ typedef volatile int hb_atomic_int_t;
 #define HB_ATOMIC_INT_NIL 1
 typedef volatile int hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   ((AI) += (V), (AI) - (V))
+#define hb_atomic_int_set(AI)  ((void) ((AI) = (V)))
 #define hb_atomic_int_get(AI)  (AI)
 
 #endif
commit 4aa7258cb16176a89e1547fee8f86571fdd98307
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 17 21:01:04 2012 -0400

Fix type conflicts on Windows without glib

diff --git a/src/hb-tt-font.cc b/src/hb-tt-font.cc
index ccd86e1..b2f24f6 100644
--- a/src/hb-tt-font.cc
+++ b/src/hb-tt-font.cc
@@ -24,12 +24,13 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#include hb-font-private.hh /* Shall be first since may include windows.h */
+
 #include hb-open-type-private.hh
 
 #include hb-ot-hhea-table.hh
 #include hb-ot-hmtx-table.hh
 
-#include hb-font-private.hh
 #include hb-blob.h
 
 #include string.h
commit f039e79d5438a8fc4a3ec11a387bbfc0f6b83024
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 17 20:55:12 2012 -0400

Don't use min/max as function names

They can be macros on some systems.  Eg. mingw32.

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 3a7eb81..717e530 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -102,7 +102,7 @@ struct _hb_set_t
 for (unsigned int i = 0; i  ELTS; i++)
   elts[i] = ~other-elts[i];
   }
-  inline hb_codepoint_t min (void) const
+  inline hb_codepoint_t get_min (void) const
   {
 for (unsigned int i = 0; i  ELTS; i++)
   if (elts[i])
@@ -111,7 +111,7 @@ struct _hb_set_t
return i * BITS + j;
 return 0;
   }
-  inline hb_codepoint_t max (void) const
+  inline hb_codepoint_t get_max (void) const
   {
 for (unsigned int i = ELTS; i; i--)
   if (elts[i - 1])
diff --git a/src/hb-set.cc b/src/hb-set.cc
index 9d013a1..0e8adde 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -167,11 +167,11 @@ hb_set_subtract (hb_set_t *set,
 hb_codepoint_t
 hb_set_min (hb_set_t *set)
 {
-  return set-min ();
+  return set-get_min ();
 }
 
 hb_codepoint_t
 hb_set_max (hb_set_t *set)
 {
-  return set-max ();
+  return set-get_max ();
 }
commit 34961e3198e27fa37fd4cfdad12ef86a2e9e51c2
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 17 20:50:38 2012 -0400

Prefer native atomic/mutex ops to glib's

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index c4dabe1..f9050c3 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -1,7 +1,7 @@
 /*
  * Copyright © 2007  Chris Wilson
  * Copyright © 2009,2010  Red Hat, Inc.
- * Copyright © 2011  Google, Inc.
+ * Copyright © 2011,2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -39,25 +39,15 @@
 
 /* We need external help for these */
 
-#if !defined(HB_NO_MT)  defined(HAVE_GLIB)
-
-#include glib.h
-typedef volatile int hb_atomic_int_t;
-#if GLIB_CHECK_VERSION(2,29,5)
-#define hb_atomic_int_add(AI, V)   g_atomic_int_add ((AI), V)
-#else
-#define hb_atomic_int_add(AI, V)   g_atomic_int_exchange_and_add ((AI), V)
-#endif
-#define hb_atomic_int_get(AI)  g_atomic_int_get ((AI))
 
-
-#elif !defined(HB_NO_MT)  defined(_MSC_VER)  _MSC_VER = 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-05-17 Thread Behdad Esfahbod
 src/hb-atomic-private.hh |4 +++-
 src/hb-mutex-private.hh  |4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 022a05ae90f30bcddff413022e0cd801809b5390
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 17 21:53:24 2012 -0400

Minor

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 60b319a..a348f95 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -39,8 +39,10 @@
 
 /* We need external help for these */
 
+#if 0
 
-#if !defined(HB_NO_MT)  defined(_MSC_VER)  _MSC_VER = 1600
+
+#elif !defined(HB_NO_MT)  defined(_MSC_VER)  _MSC_VER = 1600
 
 #include intrin.h
 typedef long hb_atomic_int_t;
diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh
index bdb438f..44b48df 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex-private.hh
@@ -39,8 +39,10 @@
 
 /* We need external help for these */
 
+#if 0
 
-#if !defined(HB_NO_MT)  defined(_MSC_VER) || defined(__MINGW32__)
+
+#elif !defined(HB_NO_MT)  defined(_MSC_VER) || defined(__MINGW32__)
 
 #include windows.h
 typedef CRITICAL_SECTION hb_mutex_impl_t;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-05-17 Thread Behdad Esfahbod
 src/hb-atomic-private.hh |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit bd908b4f102b5ae18a3ad4a8b137994cf74b86ce
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 17 22:02:08 2012 -0400

Implement hb_atomic_int_set() for OS X

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index a348f95..03d7df1 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -56,6 +56,8 @@ typedef long hb_atomic_int_t;
 #include libkern/OSAtomic.h
 typedef int32_t hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   (OSAtomicAdd32Barrier((V), (AI)), (AI) 
- (V))
+#define hb_atomic_int_set(AI, V)   \
+  do {} while (!OSAtomicCompareAndSwap32 (hb_atomic_int_get (AI), (V), 
((AI
 #define hb_atomic_int_get(AI)  OSAtomicAdd32Barrier(0, (AI))
 
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-05-16 Thread Khaled Hosny
On Wed, May 16, 2012 at 11:28:41PM -0400, Behdad Esfahbod wrote:
 On 05/16/2012 07:58 AM, Khaled Hosny wrote:
  On Tue, May 15, 2012 at 08:54:24PM -0700, Behdad Esfahbod wrote:
  [util] Add hb-ot-shape-closure tool
  
  Computes all the glyphs that may be generated given a font and
  set of Unicode characters.
  
  Cool!
  
  I was thinking in a similar, but slightly different tool that would be
  used to help subsetting fonts for small pieces of text, instead of
  returning all possible glyphs, it returns to set of glyphs: final glyphs
  that will be shown and any intermediate glyphs that were processed
  during OT layout, so I keep the final glyphs and put some dummy outlines
  in the intermediate ones and remove everything else. Not sure how easy
  is that, but just in case.
 
 So, from what I understand, you only care about:
 
   * Final glyphs, since they are to be displayed,

Right.

   * Initial, cmap glyphs, since they have to be in the font for fontconfig etc
 to consider it supported.
 
 You don't really care about intermediate glyphs if they are going to be
 replaced.  Right?  I'm ignoring GPOS contour attachment points, etc here.

I need to keep the intermediate glyphs (even if just empty) for GSUB
substitution to work. What I’m thinking about is a font subset to
display very few words and I want to cut the glyphs to the absolute
minimum without breaking glyph substitution. Lets say I want to subset a
font to display the word “خالد”, I’ll need three kinds of glyphs:

  * cmap glyphs ← dummy contour for fontconfig etc.
  * intermediate glyphs: khah.init, alef.fina, etc ← empty glyph to keep
GSUB layout working
  * final glyph: khah.init_preAlef, alef.fina_posKhah etc.

Without the intermediate glyphs the layout engine will not proceed to
the final glyphs. Of course the layout can be changed to alleviate the
need for them, but this will need a special subsetter, and I’m trying to
use existing ones.

Obtaining initial and final glyphs is easy with hb-shape, what is
missing is the intermediate ones.

 But I see where you are coming from.  I can add this one too.  It's a bit of a
 different design from what I have right now, but I can probably add it by
 adding a generic /observer/ pattern to the GSUB/GPOS machinery, which kinda
 would be useful otherwise too...

The current tool fits fine for general subsetting, which is pretty
useful (it arrived just in time actually, I need it to make language
subset of my fonts :), but I'm talking about optimising special subsets.

Regards,
 Khaled
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 86 commits

2012-05-13 Thread Tom Hacohen
Been trying to catch you on IRC to thank you personally, but we seem to 
be completely out of sync lately.


Thanks a lot! I'll start testing it soon. :)

--
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 86 commits

2012-05-12 Thread Khaled Hosny
Wow!
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 86 commits

2012-05-12 Thread Behdad Esfahbod
On 05/12/2012 12:00 PM, Khaled Hosny wrote:
 Wow!

:).  This was the result of three days of intense hacking with Jonathan Kew in
the Zurich Google office.  I'll try to write a short report soon, but for now,
enjoy browsing the Indic code :-).

Cheers,
behdad
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-05-09 Thread Behdad Esfahbod
 test/shaping/Makefile.am  |2 
 test/shaping/hb-diff-ngrams   |5 +
 test/shaping/hb-diff-stat |5 +
 test/shaping/hb_test_tools.py |  174 +++---
 4 files changed, 177 insertions(+), 9 deletions(-)

New commits:
commit 2214a03900d32710573a1b05c7665195b3129761
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed May 9 09:54:54 2012 +0200

Add hb-diff-ngrams

diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 81c9991..4fb762c 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -13,6 +13,7 @@ EXTRA_DIST += \
hb-diff \
hb-diff-colorize \
hb-diff-filter-failures \
+   hb-diff-ngrams \
hb-diff-stat \
hb-manifest-read \
hb-manifest-update \
diff --git a/test/shaping/hb-diff-ngrams b/test/shaping/hb-diff-ngrams
new file mode 100755
index 000..a496447
--- /dev/null
+++ b/test/shaping/hb-diff-ngrams
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+
+from hb_test_tools import *
+
+UtilMains.process_multiple_files (DiffSinks.print_ngrams)
diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py
index a38f067..3ff75b8 100644
--- a/test/shaping/hb_test_tools.py
+++ b/test/shaping/hb_test_tools.py
@@ -155,12 +155,60 @@ class DiffFilters:
if not DiffHelpers.test_passed (lines):
for l in lines: yield l
 
+class Stat:
+
+   def __init__ (self):
+   self.count = 0
+   self.freq = 0
+
+   def add (self, test):
+   self.count += 1
+   self.freq += test.freq
+
+class Stats:
+
+   def __init__ (self):
+   self.passed = Stat ()
+   self.failed = Stat ()
+   self.total  = Stat ()
+
+   def add (self, test):
+   self.total.add (test)
+   if test.passed:
+   self.passed.add (test)
+   else:
+   self.failed.add (test)
+
+   def mean (self):
+   return float (self.passed.count) / self.total.count
+
+   def variance (self):
+   return (float (self.passed.count) / self.total.count) * \
+  (float (self.failed.count) / self.total.count)
+
+   def stddev (self):
+   return self.variance () ** .5
+
+   def zscore (self, population):
+   Calculate the standard score.
+  Population is the Stats for population.
+  Self is Stats for sample.
+  Returns larger absolute value if sample is highly unlikely 
to be random.
+  Anything outside of -3..+3 is very unlikely to be random.
+  See: http://en.wikipedia.org/wiki/Standard_score;
+
+   return (self.mean () - population.mean ()) / population.stddev 
()
+
+
+
+
 class DiffSinks:
 
@staticmethod
def print_stat (f):
passed = 0
failed = 0
+   # XXX port to Stats, but that would really slow us down here
for key, lines in DiffHelpers.separate_test_cases (f):
if DiffHelpers.test_passed (lines):
passed += 1
@@ -172,21 +220,34 @@ class DiffSinks:
@staticmethod
def print_ngrams (f, ns=(1,2,3)):
gens = tuple (Ngram.generator (n) for n in ns)
+   allstats = Stats ()
+   allgrams = {}
for key, lines in DiffHelpers.separate_test_cases (f):
test = Test (lines)
-   unicodes = test.unicodes
-   del test
+   allstats.add (test)
 
for gen in gens:
-   print Printing %d-grams: % gen.n
-   for ngram in gen (unicodes):
-   print ngram
+   for ngram in gen (test.unicodes):
+   if ngram not in allgrams:
+   allgrams[ngram] = Stats ()
+   allgrams[ngram].add (test)
+
+   importantgrams = {}
+   for ngram, stats in allgrams.iteritems ():
+   if stats.failed.count = 30: # for statistical reasons
+   importantgrams[ngram] = stats
+   allgrams = importantgrams
+   del importantgrams
+
+   for ngram, stats in allgrams.iteritems ():
+   print zscore: %9f failed: %6d passed: %6d ngram: %s 
% (stats.zscore (allstats), stats.failed.count, stats.passed.count, ','.join 
(U+%04X % u for u in ngram))
 
 
 
 class Test:
 
def __init__ (self, lines):
+   self.freq = 1
self.passed = True
self.identifier = None
self.text = None
commit 

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

2012-05-08 Thread Behdad Esfahbod
 test/shaping/Makefile.am   |   
 1 
 test/shaping/hb-diff   |   
10 
 test/shaping/hb-diff-colorize  |   
 7 
 test/shaping/hb_test_tools.py  |  
192 ++
 test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST|   
 1 
 test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/poem.txt|   
 4 
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/MANIFEST |   
 1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/reph.txt |   
10 
 8 files changed, 143 insertions(+), 83 deletions(-)

New commits:
commit f1eb008cc727370e1bd0dc32fdf301f62d9ff981
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue May 8 23:41:41 2012 +0200

Add hb-diff-colorize

Accepts --format=html now.

diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 1694eca..f216c5d 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -11,6 +11,7 @@ manifests:
 
 EXTRA_DIST += \
hb-diff \
+   hb-diff-colorize \
hb-diff-filter-failures \
hb-manifest-read \
hb-manifest-update \
diff --git a/test/shaping/hb-diff b/test/shaping/hb-diff
index eac3ff6..6a13fa2 100755
--- a/test/shaping/hb-diff
+++ b/test/shaping/hb-diff
@@ -3,8 +3,8 @@
 from hb_test_tools import *
 import sys, os
 
-if len (sys.argv)  3:
-   print usage: %s file1 file2... % sys.argv[0]
+if len (sys.argv)  2:
+   print usage: %s FILES... % sys.argv[0]
sys.exit (1)
 
 ZipDiffer.diff_files (FileHelpers.open_file_or_stdin (f) for f in sys.argv[1:])
diff --git a/test/shaping/hb-diff-colorize b/test/shaping/hb-diff-colorize
new file mode 100755
index 000..4e045d2
--- /dev/null
+++ b/test/shaping/hb-diff-colorize
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+
+from hb_test_tools import *
+
+formatter = ColorFormatter.Auto (sys.argv)
+colorizer = DiffColorizer (formatter=formatter)
+UtilMains.process_multiple_files 
(FilterHelpers.filter_printer_function_no_newline (colorizer.colorize_diff))
diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py
index 65640bc..03a7710 100644
--- a/test/shaping/hb_test_tools.py
+++ b/test/shaping/hb_test_tools.py
@@ -1,65 +1,81 @@
 #!/usr/bin/python
 
-import sys, os, re, difflib, unicodedata, errno
+import sys, os, re, difflib, unicodedata, errno, cgi
 from itertools import *
 
 diff_symbols = -+=*^%$#@!~/
 diff_colors = ['red', 'green', 'blue']
 
-class Colors:
+class ColorFormatter:
+
class Null:
-   red = ''
-   green = ''
-   end = ''
+   @staticmethod
+   def start_color (c): return ''
+   @staticmethod
+   def end_color (): return ''
+   @staticmethod
+   def escape (s): return s
+   @staticmethod
+   def newline (): return '\n'
+
class ANSI:
-   red = '\033[41;37;1m'
-   green = '\033[42;37;1m'
-   end = '\033[m'
+   @staticmethod
+   def start_color (c):
+   return {
+   'red': '\033[41;37;1m',
+   'green': '\033[42;37;1m',
+   'blue': '\033[44;37;1m',
+   }[c]
+   @staticmethod
+   def end_color ():
+   return '\033[m'
+   @staticmethod
+   def escape (s): return s
+   @staticmethod
+   def newline (): return '\n'
+
class HTML:
-   red = 'span style=color:red'
-   green = 'span style=color:green'
-   end = '/span'
+   @staticmethod
+   def start_color (c):
+   return 'span style=background:%s' % c
+   @staticmethod
+   def end_color ():
+   return '/span'
+   @staticmethod
+   def escape (s): return cgi.escape (s)
+   @staticmethod
+   def newline (): return 'br/\n'
 
@staticmethod
def Auto (argv = [], out = sys.stdout):
-   if os.isatty (out.fileno ()):
-   color = Colors.ANSI
-   else:
-   color = Colors.Null
-   if --color in argv:
-   argv.remove (--color)
-   color = Colors.ANSI
-   if --color=ansi in argv:
-   argv.remove (--color=ansi)
-   color = Colors.ANSI
-   if --color=html in argv:
-   argv.remove (--color=html)
-   color = Colors.HTML
-   if --no-color in argv:
-   argv.remove (--no-color)
-   color = 

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

2012-05-05 Thread Behdad Esfahbod
 src/hb-ot-map-private.hh   |   
 7 +-
 src/hb-ot-shape-normalize.cc   |   
 1 
 src/hb-ot-shape.cc |   
35 ++
 src/hb-ot.h|   
 8 ++
 src/hb-set-private.hh  |   
 7 +-
 src/hb-set.cc  |   
 2 
 src/hb-unicode.cc  |   
 2 
 src/main.cc|   
 9 +-
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt |   
 1 
 9 files changed, 62 insertions(+), 10 deletions(-)

New commits:
commit 1a2a4a0078dda834443edd421037a4bcbad18c5e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat May 5 22:38:20 2012 +0200

Fix warning and build issues

As reported by Jonathan Kew on the list.

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index ee489d0..7dd19b9 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -136,7 +136,7 @@ struct _hb_set_t
   elt_t elts[ELTS]; /* 8kb */
 
   ASSERT_STATIC (sizeof (elt_t) * 8 == BITS);
-  ASSERT_STATIC (sizeof (elts) * 8  MAX_G);
+  ASSERT_STATIC (sizeof (elt_t) * 8 * ELTS  MAX_G);
 };
 
 
diff --git a/src/main.cc b/src/main.cc
index 442b1b9..03b6e6c 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -124,10 +124,11 @@ main (int argc, char **argv)
const LangSys langsys = n_langsys == -1
   ? script.get_default_lang_sys ()
   : script.get_lang_sys (n_langsys);
-   printf (n_langsys == -1
-  ?   Default Language System\n
-  :   Language System %2d of %2d: %.4s\n, n_langsys, 
num_langsys,
-   (const char *)script.get_lang_sys_tag (n_langsys));
+   if (n_langsys == -1)
+ printf (  Default Language System\n);
+   else
+ printf (  Language System %2d of %2d: %.4s\n, n_langsys, 
num_langsys,
+ (const char *)script.get_lang_sys_tag (n_langsys));
if (langsys.get_required_feature_index () == Index::NOT_FOUND_INDEX)
  printf (No required feature\n);
 
commit a5e39fed85e069ba1afbf90408349ad99ceb0e1d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 25 00:14:46 2012 -0400

Minor

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index c7f4aa0..ee489d0 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -38,6 +38,8 @@ struct _hb_set_t
   inline void init (void) {
 clear ();
   }
+  inline void fini (void) {
+  }
   inline void clear (void) {
 memset (elts, 0, sizeof elts);
   }
diff --git a/src/hb-set.cc b/src/hb-set.cc
index 3b1c5bd..0a0bc61 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -67,6 +67,8 @@ hb_set_destroy (hb_set_t *set)
 {
   if (!hb_object_destroy (set)) return;
 
+  set-fini ();
+
   free (set);
 }
 
commit 1827dc208c867e433a95237d1ed3fc7a73d1d9a7
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 24 16:56:37 2012 -0400

Add hb_ot_shape_glyphs_closure()

Experimental API for now.

diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index d5fc4ce..3811206 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -69,6 +69,10 @@ struct hb_ot_map_t
   inline void position (hb_font_t *font, hb_buffer_t *buffer) const
   { apply (1, (hb_ot_map_t::apply_lookup_func_t) hb_ot_layout_position_lookup, 
font, buffer); }
 
+  HB_INTERNAL void substitute_closure (hb_face_t *face,
+  hb_set_t *glyphs) const;
+
+
   inline void finish (void) {
 features.finish ();
 lookups[0].finish ();
@@ -125,9 +129,6 @@ struct hb_ot_map_t
  void *face_or_font,
  hb_buffer_t *buffer) const;
 
-  HB_INTERNAL void substitute_closure (hb_face_t *face,
-  hb_set_t *glyphs) const;
-
   hb_mask_t global_mask;
 
   hb_tag_t chosen_script[2];
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index b31cdc5..167b1d7 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -30,6 +30,7 @@
 #include hb-ot-shape-normalize-private.hh
 
 #include hb-font-private.hh
+#include hb-set-private.hh
 
 
 
@@ -478,3 +479,37 @@ _hb_ot_shape (hb_font_t  *font,
 
   return TRUE;
 }
+
+
+void
+hb_ot_shape_glyphs_closure (hb_font_t  *font,
+   hb_buffer_t*buffer,
+   const hb_feature_t *features,
+   unsigned intnum_features,
+   hb_set_t   *glyphs)
+{
+  hb_ot_shape_plan_t plan;
+
+  buffer-guess_properties ();
+
+  hb_ot_shape_plan_internal (plan, 

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

2012-04-24 Thread Behdad Esfahbod
On 04/17/2012 10:35 PM, John Daggett wrote:
 Just a note here that this will be problematic when rendering upright
 Latin text in vertical mode.  Frankly, I don't think there's a clear,
 consistent design model for OpenType features in the vertical case.
 There's clearly a need to distinguish more clearly vertical ligatures
 from horizontal ones, having 'f' and 'i' ligate in the upright
 vertical case doesn't make sense.  Kazuraki relies on the 'vert'
 feature to disambiguate horizontal and vertical ligatures but this
 won't work for fonts not designed with the vertical case in mind.

Nod.  That's exactly why I didn't have 'liga' for vertical before...

behdad


 So I think this change will need tweaking in the future, once there's
 a clearer definition of the OpenType feature model for vertical text.
 
 Cheers,
 
 John Daggett
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-17 Thread Behdad Esfahbod
 src/hb-graphite2.cc  |1 +
 test/shaping/texts/in-tree/shaper-thai/misc/misc.txt |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 4dc2449d92308f8dd366142831c0b85bd30ea5a9
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 17 11:39:48 2012 -0400

Fix leak in graphite

diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 64f22f7..cdf55f1 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -130,6 +130,7 @@ static void _hb_gr_font_data_destroy (void *data)
   hb_gr_font_data_t *f = (hb_gr_font_data_t *) data;
 
   gr_font_destroy (f-grfont);
+  free (f);
 }
 
 static hb_user_data_key_t hb_gr_data_key;
commit 0290bbf8611aa881daed907f22256a431250c90a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 17 10:28:21 2012 -0400

Add another Thai test

diff --git a/test/shaping/texts/in-tree/shaper-thai/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-thai/misc/misc.txt
index fc2dba9..51a47af 100644
--- a/test/shaping/texts/in-tree/shaper-thai/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-thai/misc/misc.txt
@@ -3,3 +3,4 @@
 ด๋ํา
 ดำ
 ำ
+กิ่
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-17 Thread Behdad Esfahbod
 src/hb-graphite2.cc |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 3cde23664fbbe9cd2ac1b8fd5eb2ea288309cc9c
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 17 11:44:49 2012 -0400

Minor note re Graphite

diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index cdf55f1..fa07ae9 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -221,6 +221,9 @@ _hb_graphite_shape (hb_font_t  *font,
 
   buffer-guess_properties ();
 
+  /* XXX We do a hell of a lot of stuff just to figure out this font
+   * is not graphite!  Shouldn't do. */
+
   hb_gr_font_data_t *data = _hb_gr_font_get_data (font);
   if (!data-grface) return FALSE;
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-17 Thread John Daggett
 commit a5f1834f57ea3fb254f5c7d372747de316fcc8f1
 Author: Behdad Esfahbod beh...@behdad.org
 Date:   Mon Apr 16 15:55:13 2012 -0400
 
 Apply 'liga' for vertical writing mode too
 
 Apparently that's what Kazuraki uses to form vertical ligatures,
 which suggests that it's what Adobe does.
 
 diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
 index d21559c..66b1461 100644
 --- a/src/hb-ot-shape.cc
 +++ b/src/hb-ot-shape.cc
 @@ -35,6 +35,7 @@
  
  hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'),
 +  HB_TAG('l','i','g','a'),
HB_TAG('l','o','c','l'),
HB_TAG('m','a','r','k'),
HB_TAG('m','k','m','k'),
 @@ -46,7 +47,6 @@ hb_tag_t horizontal_features[] = {
HB_TAG('c','l','i','g'),
HB_TAG('c','u','r','s'),
HB_TAG('k','e','r','n'),
 -  HB_TAG('l','i','g','a'),
  };

Just a note here that this will be problematic when rendering upright
Latin text in vertical mode.  Frankly, I don't think there's a clear,
consistent design model for OpenType features in the vertical case.
There's clearly a need to distinguish more clearly vertical ligatures
from horizontal ones, having 'f' and 'i' ligate in the upright
vertical case doesn't make sense.  Kazuraki relies on the 'vert'
feature to disambiguate horizontal and vertical ligatures but this
won't work for fonts not designed with the vertical case in mind.

So I think this change will need tweaking in the future, once there's
a clearer definition of the OpenType feature model for vertical text.

Cheers,

John Daggett
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-16 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic-machine.rl |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9ceca3aeb14cc096f5f87660cf7351bc35073084
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Apr 16 21:05:51 2012 -0400

Fix ragel regexp in vowel-based syllable

As reported by datao zhang on the mailing list.

diff --git a/src/hb-ot-shape-complex-indic-machine.rl 
b/src/hb-ot-shape-complex-indic-machine.rl
index 417880b..6406c24 100644
--- a/src/hb-ot-shape-complex-indic-machine.rl
+++ b/src/hb-ot-shape-complex-indic-machine.rl
@@ -67,7 +67,7 @@ action found_non_indic { found_non_indic (map, buffer, 
mask_array, last, p); }
 action next_syllable { buffer-merge_clusters (last, p); last = p; }
 
 consonant_syllable =   (c.N? (H.z?|z.H))* c.N? A? (H.z? | matra_group*)? 
syllable_tail %(found_consonant_syllable);
-vowel_syllable =   (Ra H)? V N? (z.H.c | ZWJ.c)? matra_group* 
syllable_tail %(found_vowel_syllable);
+vowel_syllable =   (Ra H)? V N? (z?.H.c | ZWJ.c)? matra_group* 
syllable_tail %(found_vowel_syllable);
 standalone_cluster =   (Ra H)? NBSP N? (z? H c)? matra_group* syllable_tail 
%(found_standalone_cluster);
 non_indic = X %(found_non_indic);
 
commit b870afcd1b436614af95db6dc297e54c8f03f0cd
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Apr 16 21:05:11 2012 -0400

Rewrite ragel expression to better match the one on MS spec

https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx

diff --git a/src/hb-ot-shape-complex-indic-machine.rl 
b/src/hb-ot-shape-complex-indic-machine.rl
index 7af23c1..417880b 100644
--- a/src/hb-ot-shape-complex-indic-machine.rl
+++ b/src/hb-ot-shape-complex-indic-machine.rl
@@ -66,7 +66,7 @@ action found_non_indic { found_non_indic (map, buffer, 
mask_array, last, p); }
 
 action next_syllable { buffer-merge_clusters (last, p); last = p; }
 
-consonant_syllable =   (c.N? (z.H|H.z?))* c.N? A? (H.z? | matra_group*)? 
syllable_tail %(found_consonant_syllable);
+consonant_syllable =   (c.N? (H.z?|z.H))* c.N? A? (H.z? | matra_group*)? 
syllable_tail %(found_consonant_syllable);
 vowel_syllable =   (Ra H)? V N? (z.H.c | ZWJ.c)? matra_group* 
syllable_tail %(found_vowel_syllable);
 standalone_cluster =   (Ra H)? NBSP N? (z? H c)? matra_group* syllable_tail 
%(found_standalone_cluster);
 non_indic = X %(found_non_indic);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-14 Thread Behdad Esfahbod
 TODO |8 +-
 src/hb-blob.h|2 -
 src/hb-common.cc |7 +++--
 src/hb-common.h  |   29 +++---
 src/hb-ot-layout-private.hh  |2 -
 src/hb-ot-shape-normalize.cc |   11 ++--
 src/hb-ot-shape-private.hh   |   49 -
 src/hb-ot-shape.cc   |   56 +++
 test/api/test-common.c   |   16 ++--
 9 files changed, 102 insertions(+), 78 deletions(-)

New commits:
commit 683b503f30bba29d57a93d7e8ac7138c2e7f49f1
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Apr 14 20:47:14 2012 -0400

Minor

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index f7b3547..b9834ca 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -68,12 +68,19 @@
  * matra for the Indic shaper.
  */
 
+static inline void
+set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
+{
+  info-general_category() = hb_unicode_general_category (unicode, 
info-codepoint);
+  info-combining_class() = _hb_unicode_modified_combining_class (unicode, 
info-codepoint);
+}
+
 static void
 output_glyph (hb_font_t *font, hb_buffer_t *buffer,
  hb_codepoint_t glyph)
 {
   buffer-output_glyph (glyph);
-  hb_glyph_info_set_unicode_props (buffer-out_info[buffer-out_len - 1], 
buffer-unicode);
+  set_unicode_props (buffer-out_info[buffer-out_len - 1], buffer-unicode);
 }
 
 static bool
@@ -262,7 +269,7 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t 
*buffer,
 {
   /* Composes. Modify starter and carry on. */
   buffer-out_info[starter].codepoint = composed;
-  hb_glyph_info_set_unicode_props (buffer-out_info[starter], 
buffer-unicode);
+  set_unicode_props (buffer-out_info[starter], buffer-unicode);
 
   buffer-skip_glyph ();
   continue;
diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh
index 8685ece..5fc69b1 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape-private.hh
@@ -47,19 +47,10 @@ struct hb_ot_shape_plan_t
 
 
 
-static inline void
-hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t 
*unicode)
-{
-  info-general_category() = hb_unicode_general_category (unicode, 
info-codepoint);
-  info-combining_class() = _hb_unicode_modified_combining_class (unicode, 
info-codepoint);
-}
-
 HB_INTERNAL hb_bool_t
 _hb_ot_shape (hb_font_t  *font,
  hb_buffer_t*buffer,
  const hb_feature_t *features,
  unsigned intnum_features);
 
-#include hb-ot-shape-complex-private.hh
-
 #endif /* HB_OT_SHAPE_PRIVATE_HH */
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index f5f9fd3..d21559c 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -169,12 +169,19 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
 
 /* Prepare */
 
+static inline void
+set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
+{
+  info-general_category() = hb_unicode_general_category (unicode, 
info-codepoint);
+  info-combining_class() = _hb_unicode_modified_combining_class (unicode, 
info-codepoint);
+}
+
 static void
 hb_set_unicode_props (hb_buffer_t *buffer)
 {
   unsigned int count = buffer-len;
   for (unsigned int i = 0; i  count; i++)
-hb_glyph_info_set_unicode_props (buffer-info[i], buffer-unicode);
+set_unicode_props (buffer-info[i], buffer-unicode);
 }
 
 static void
commit b9f199c8e38cc5ed0d73845568630f3bcbdd4374
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Apr 14 20:23:58 2012 -0400

Move code around

diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh
index 2ceb6f2..8685ece 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape-private.hh
@@ -31,13 +31,10 @@
 
 #include hb-ot-map-private.hh
 #include hb-ot-shape-complex-private.hh
-#include hb-ot-shape-normalize-private.hh
 
 
 struct hb_ot_shape_plan_t
 {
-  friend struct hb_ot_shape_planner_t;
-
   hb_ot_map_t map;
   hb_ot_complex_shaper_t shaper;
 
@@ -48,41 +45,6 @@ struct hb_ot_shape_plan_t
   NO_COPY (hb_ot_shape_plan_t);
 };
 
-struct hb_ot_shape_planner_t
-{
-  hb_ot_map_builder_t map;
-  hb_ot_complex_shaper_t shaper;
-
-  hb_ot_shape_planner_t (void) : map () {}
-  ~hb_ot_shape_planner_t (void) { map.finish (); }
-
-  inline void compile (hb_face_t *face,
-  const hb_segment_properties_t *props,
-  struct hb_ot_shape_plan_t plan)
-  {
-plan.shaper = shaper;
-map.compile (face, props, plan.map);
-  }
-
-  private:
-  NO_COPY (hb_ot_shape_planner_t);
-};
-
-
-struct hb_ot_shape_context_t
-{
-  /* Input to hb_ot_shape_execute() */
-  hb_ot_shape_plan_t *plan;
-  hb_font_t *font;
-  hb_face_t *face;
-  hb_buffer_t  *buffer;
-  const hb_feature_t *user_features;
-  unsigned intnum_user_features;
-
-  /* Transient stuff */
-  hb_direction_t target_direction;
-  hb_bool_t 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-12 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic.cc |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit c65662b71e6160f5adfb6226d97589ca457d98b9
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Apr 12 09:31:55 2012 -0400

Fix left-matra positioning in Indic

Fixes 200 failures out of previous 4290 cases in the OO.o Indic
dictionary (of ~16000 entries).

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index afac95b..3a57bb8 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -57,11 +57,11 @@ enum indic_category_t {
 
 /* Visual positions in a syllable from left to right. */
 enum indic_position_t {
-  POS_PRE,
-  POS_BASE,
-  POS_ABOVE,
-  POS_BELOW,
-  POS_POST
+  POS_PRE = 1,
+  POS_BASE = 3,
+  POS_ABOVE = 5,
+  POS_BELOW = 7,
+  POS_POST = 9
 };
 
 /* Categories used in IndicSyllabicCategory.txt from UCD */
@@ -95,7 +95,7 @@ enum indic_syllabic_category_t {
 enum indic_matra_category_t {
   INDIC_MATRA_CATEGORY_NOT_APPLICABLE  = POS_BASE,
 
-  INDIC_MATRA_CATEGORY_LEFT= POS_PRE,
+  INDIC_MATRA_CATEGORY_LEFT= POS_PRE - 1, /* Move *before* 
existing pre chars */
   INDIC_MATRA_CATEGORY_TOP = POS_ABOVE,
   INDIC_MATRA_CATEGORY_BOTTOM  = POS_BELOW,
   INDIC_MATRA_CATEGORY_RIGHT   = POS_POST,
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-12 Thread Behdad Esfahbod
 src/hb-ot-shape.cc  |2 
+-
 test/shaping/texts/in-tree/MANIFEST |1 
+
 test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST |1 
+
 test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt |3 
+++
 test/shaping/texts/in-tree/shaper-thai/MANIFEST |1 
+
 test/shaping/texts/in-tree/shaper-thai/misc/MANIFEST|1 
+
 6 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 0e3361464b00b76aa7375515163e0710a691db0c
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Apr 12 10:06:52 2012 -0400

Fix bug with not setting Unicode props of the first character

Fixes Mongolian shaping issue:
https://bugs.freedesktop.org/show_bug.cgi?id=45695

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 34c0d52..92481ed 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -136,7 +136,7 @@ void
 _hb_set_unicode_props (hb_buffer_t *buffer)
 {
   unsigned int count = buffer-len;
-  for (unsigned int i = 1; i  count; i++)
+  for (unsigned int i = 0; i  count; i++)
 hb_glyph_info_set_unicode_props (buffer-info[i], buffer-unicode);
 }
 
commit f9746b600a6e14dbe48aabfc17df8f12a5b46b11
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Apr 12 09:59:26 2012 -0400

Minor

diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt
index a99b58b..009112a 100644
--- a/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt
@@ -1,4 +1,3 @@
 ᠬᠦᠮᠦᠨ ᠮᠤᠩᠭᠣᠯ ᠪᠢᠴᠢᠭ᠌
 ᠪᠢᠴᠢᠭ᠌ ᠬᠦᠮᠦᠨ ᠮᠤᠩᠭᠣᠯ
 ᠮᠤᠩᠭᠣᠯ ᠪᠢᠴᠢᠭ᠌ ᠬᠦᠮᠦᠨ
-
commit 7470b0ff805e4ff59d23d7a180fafdf550eb
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Apr 12 09:44:27 2012 -0400

Add Mongolian test case

diff --git a/test/shaping/texts/in-tree/MANIFEST 
b/test/shaping/texts/in-tree/MANIFEST
index 0119909..41aa748 100644
--- a/test/shaping/texts/in-tree/MANIFEST
+++ b/test/shaping/texts/in-tree/MANIFEST
@@ -2,3 +2,4 @@ shaper-arabic
 shaper-default
 shaper-hangul
 shaper-indic
+shaper-thai
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST 
b/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST
index e69de29..29cfb2f 100644
--- a/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST
@@ -0,0 +1 @@
+misc.txt
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt
new file mode 100644
index 000..a99b58b
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/misc.txt
@@ -0,0 +1,4 @@
+ᠬᠦᠮᠦᠨ ᠮᠤᠩᠭᠣᠯ ᠪᠢᠴᠢᠭ᠌
+ᠪᠢᠴᠢᠭ᠌ ᠬᠦᠮᠦᠨ ᠮᠤᠩᠭᠣᠯ
+ᠮᠤᠩᠭᠣᠯ ᠪᠢᠴᠢᠭ᠌ ᠬᠦᠮᠦᠨ
+
diff --git a/test/shaping/texts/in-tree/shaper-thai/MANIFEST 
b/test/shaping/texts/in-tree/shaper-thai/MANIFEST
new file mode 100644
index 000..b8752e7
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-thai/MANIFEST
@@ -0,0 +1 @@
+misc
diff --git a/test/shaping/texts/in-tree/shaper-thai/misc/MANIFEST 
b/test/shaping/texts/in-tree/shaper-thai/misc/MANIFEST
new file mode 100644
index 000..29cfb2f
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-thai/misc/MANIFEST
@@ -0,0 +1 @@
+misc.txt
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-12 Thread Behdad Esfahbod
 configure.ac   |6 ++--
 src/Makefile.am|   11 +++-
 src/hb-blob.h  |6 +++-
 src/hb-buffer.h|4 +++
 src/hb-common.h|   10 +--
 src/hb-fallback-shape-private.hh   |9 +++
 src/hb-fallback-shape.cc   |9 +++
 src/hb-font.h  |4 +++
 src/hb-ft.cc   |2 +
 src/hb-ft.h|2 -
 src/hb-glib.h  |1 
 src/hb-gobject.h   |1 
 src/hb-graphite2-private.hh|   42 +
 src/hb-graphite2.cc|5 +--
 src/hb-graphite2.h |   10 +--
 src/hb-icu.h   |1 
 src/hb-ot-layout-common-private.hh |2 -
 src/hb-ot-layout-gdef-table.hh |2 -
 src/hb-ot-layout-gpos-table.hh |5 +--
 src/hb-ot-layout-gsub-table.hh |2 -
 src/hb-ot-layout-private.hh|2 -
 src/hb-ot-layout.h |8 +++---
 src/hb-ot-shape-private.hh |8 --
 src/hb-ot-shape.cc |   11 +++-
 src/hb-ot-shape.h  |   47 -
 src/hb-ot-tag.h|6 +++-
 src/hb-ot.h|3 +-
 src/hb-private.hh  |5 +++
 src/hb-shape.cc|   24 +++---
 src/hb-shape.h |5 +++
 src/hb-unicode.h   |4 +++
 src/hb-uniscribe-private.hh|   42 +
 src/hb-uniscribe.cc|9 +++
 src/hb-uniscribe.h |   10 ---
 src/hb-version.h.in|4 +++
 src/hb.h   |2 +
 util/helper-cairo.hh   |5 ++-
 util/options.hh|9 ++-
 util/view-cairo.cc |   31 
 util/view-cairo.hh |1 
 40 files changed, 222 insertions(+), 148 deletions(-)

New commits:
commit 69b84a8f6c789726815261c2e86692de7a65d6e8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Apr 12 15:50:40 2012 -0400

Fix hb-view surface size calc for vertical text

For some reason it doesn't quite work with IranianNastaliq, but
that looks like a font issue.

diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh
index 5edfc3a..bc3fe1d 100644
--- a/util/helper-cairo.hh
+++ b/util/helper-cairo.hh
@@ -64,8 +64,9 @@ struct helper_cairo_line_t {
   g_free (utf8);
   }
 
-  double get_width (void) {
-return glyphs[num_glyphs].x;
+  void get_advance (double *x_advance, double *y_advance) {
+*x_advance = glyphs[num_glyphs].x;
+*y_advance = glyphs[num_glyphs].y;
   }
 };
 
diff --git a/util/options.hh b/util/options.hh
index 165e7a1..da95017 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -48,6 +48,13 @@
 #include glib.h
 #include glib/gprintf.h
 
+#undef MIN
+template typename Type static inline Type MIN (const Type a, const Type b) 
{ return a  b ? a : b; }
+
+#undef MAX
+template typename Type static inline Type MAX (const Type a, const Type b) 
{ return a  b ? a : b; }
+
+
 void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN;
 
 
diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index f766a4f..ce578ed 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -38,6 +38,7 @@ view_cairo_t::consume_line (hb_buffer_t  *buffer,
const char   *text,
unsigned int  text_len)
 {
+  direction = hb_buffer_get_direction (buffer);
   helper_cairo_line_t l;
   helper_cairo_line_from_buffer (l, buffer, text, text_len, scale);
   g_array_append_val (lines, l);
@@ -63,14 +64,17 @@ view_cairo_t::get_surface_size (cairo_scaled_font_t 
*scaled_font,
 
   cairo_scaled_font_extents (scaled_font, font_extents);
 
-  *h = font_extents.ascent
- + font_extents.descent
- + ((int) lines-len - 1) * (font_extents.height + line_space);
-  *w = 0;
+  bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
+  (vertical ? *w : *h) = (int) lines-len * (font_extents.height + line_space) 
- line_space;
+  (vertical ? *h : *w) = 0;
   for (unsigned int i = 0; i  lines-len; i++) {
 helper_cairo_line_t line = g_array_index (lines, helper_cairo_line_t, i);
-double line_width = line.get_width ();
-*w = MAX (*w, line_width);
+double x_advance, y_advance;
+line.get_advance (x_advance, y_advance);
+if (vertical)
+  *h =  MAX (*h, y_advance);
+else
+  *w =  MAX (*w, x_advance);
   }
 
   *w += margin.l + margin.r;
@@ -97,17 +101,26 @@ view_cairo_t::draw (cairo_t *cr)
 {
   cairo_save (cr);
 
+  bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
+  int v = vertical ? 1 : 0;
+  int h = vertical ? 0 : 1;
   cairo_font_extents_t font_extents;
   cairo_font_extents (cr, font_extents);
   cairo_translate (cr, margin.l, 

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

2012-04-11 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-arabic.cc |9 ++---
 src/hb-ot-shape-complex-misc.cc   |7 ---
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 4a1e02ef7979d58fe0c726ee7c665b2420c42ddd
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 14:37:53 2012 -0400

Fix shape to presentation forms font check

As reported by Jonathan Kew on the list.

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 4b6f54d..a56d161 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -211,9 +211,12 @@ arabic_fallback_shape (hb_font_t *font, hb_buffer_t 
*buffer)
   hb_codepoint_t glyph;
 
   /* Shape to presentation forms */
-  for (unsigned int i = 0; i  count; i++)
-if (hb_font_get_glyph (font, buffer-info[i].codepoint, 0, glyph))
-  buffer-info[i].codepoint = get_arabic_shape (buffer-info[i].codepoint, 
buffer-info[i].arabic_shaping_action());
+  for (unsigned int i = 0; i  count; i++) {
+hb_codepoint_t u = buffer-info[i].codepoint;
+hb_codepoint_t shaped = get_arabic_shape (u, 
buffer-info[i].arabic_shaping_action());
+if (shaped != u  hb_font_get_glyph (font, shaped, 0, glyph))
+  buffer-info[i].codepoint = shaped;
+  }
 
   /* Mandatory ligatures */
   buffer-clear_output ();
commit 6062f5f01436b4044be729890ed00b9b62737824
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 14:19:55 2012 -0400

Fix build with some compilers

As reported by Jonathan Kew on the list.

diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 5880e32..99e54f6 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -132,14 +132,15 @@ _hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map, 
hb_buffer_t *buffer, hb
   unsigned int count = buffer-len;
   for (buffer-idx = 0; buffer-idx  count;)
   {
-if (likely (!IS_SARA_AM (buffer-info[buffer-idx].codepoint))) {
+hb_codepoint_t u = buffer-info[buffer-idx].codepoint;
+if (likely (!IS_SARA_AM (u))) {
   buffer-next_glyph ();
   continue;
 }
 
 /* Is SARA AM. Decompose and reorder. */
-uint16_t decomposed[2] = {NIKHAHIT_FROM_SARA_AM 
(buffer-info[buffer-idx].codepoint),
- SARA_AA_FROM_SARA_AM 
(buffer-info[buffer-idx].codepoint)};
+uint16_t decomposed[2] = {uint16_t (NIKHAHIT_FROM_SARA_AM (u)),
+ uint16_t (SARA_AA_FROM_SARA_AM (u))};
 buffer-replace_glyphs (1, 2, decomposed);
 if (unlikely (buffer-in_error))
   return;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-11 Thread Behdad Esfahbod
 src/hb-ot-layout-gpos-table.hh   |   24 ++--
 src/hb-ot-layout-gsub-table.hh   |   26 +++---
 src/hb-ot-layout-gsubgpos-private.hh |   22 ++
 3 files changed, 35 insertions(+), 37 deletions(-)

New commits:
commit 41ae674f6871f43d0a6e4ca67a747074d63ae576
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 17:11:05 2012 -0400

Don't create hb_apply_context_t per glyph!

I couldn't measure significant performance gains out of this; maybe
about 5% (with one million Malayalam strings).  Still, not bad.
But reminds me that optimizing this codebase without profiling first
is simply not going to work.  Oh well...

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 412850b..f843fa3 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1404,23 +1404,9 @@ struct PosLookup : Lookup
   inline const PosLookupSubTable get_subtable (unsigned int i) const
   { return this+CastROffsetArrayOfPosLookupSubTable  (subTable)[i]; }
 
-  inline bool apply_once (hb_font_t *font,
- hb_buffer_t *buffer,
- hb_mask_t lookup_mask,
- unsigned int context_length,
- unsigned int nesting_level_left) const
+  inline bool apply_once (hb_apply_context_t *c) const
   {
 unsigned int lookup_type = get_type ();
-hb_apply_context_t c[1] = {{0}};
-
-c-font = font;
-c-face = font-face;
-c-buffer = buffer;
-c-direction = buffer-props.direction;
-c-lookup_mask = lookup_mask;
-c-context_length = context_length;
-c-nesting_level_left = nesting_level_left;
-c-lookup_props = get_props ();
 
 if (!_hb_ot_layout_check_glyph_property (c-face, 
c-buffer-info[c-buffer-idx], c-lookup_props, c-property))
   return false;
@@ -1441,11 +1427,12 @@ struct PosLookup : Lookup
 if (unlikely (!buffer-len))
   return false;
 
+hb_apply_context_t c (font, font-face, buffer, mask, *this);
+
 buffer-idx = 0;
 while (buffer-idx  buffer-len)
 {
-  if ((buffer-info[buffer-idx].mask  mask) 
- apply_once (font, buffer, mask, NO_CONTEXT, MAX_NESTING_LEVEL))
+  if ((buffer-info[buffer-idx].mask  mask)  apply_once (c))
ret = true;
   else
buffer-idx++;
@@ -1598,7 +1585,8 @@ static inline bool position_lookup (hb_apply_context_t 
*c, unsigned int lookup_i
   if (unlikely (c-context_length  1))
 return false;
 
-  return l.apply_once (c-font, c-buffer, c-lookup_mask, c-context_length, 
c-nesting_level_left - 1);
+  hb_apply_context_t new_c (*c, l);
+  return l.apply_once (new_c);
 }
 
 
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index f7ec3cc..941c669 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -754,22 +754,9 @@ struct SubstLookup : Lookup
   }
 
 
-  inline bool apply_once (hb_face_t *face,
- hb_buffer_t *buffer,
- hb_mask_t lookup_mask,
- unsigned int context_length,
- unsigned int nesting_level_left) const
+  inline bool apply_once (hb_apply_context_t *c) const
   {
 unsigned int lookup_type = get_type ();
-hb_apply_context_t c[1] = {{0}};
-
-c-face = face;
-c-buffer = buffer;
-c-direction = buffer-props.direction;
-c-lookup_mask = lookup_mask;
-c-context_length = context_length;
-c-nesting_level_left = nesting_level_left;
-c-lookup_props = get_props ();
 
 if (!_hb_ot_layout_check_glyph_property (c-face, 
c-buffer-info[c-buffer-idx], c-lookup_props, c-property))
   return false;
@@ -805,6 +792,8 @@ struct SubstLookup : Lookup
 if (unlikely (!buffer-len))
   return false;
 
+hb_apply_context_t c (NULL, face, buffer, mask, *this);
+
 if (likely (!is_reverse ()))
 {
/* in/out forward substitution */
@@ -812,8 +801,7 @@ struct SubstLookup : Lookup
buffer-idx = 0;
while (buffer-idx  buffer-len)
{
- if ((buffer-info[buffer-idx].mask  mask) 
- apply_once (face, buffer, mask, NO_CONTEXT, MAX_NESTING_LEVEL))
+ if ((buffer-info[buffer-idx].mask  mask)  apply_once (c))
ret = true;
  else
buffer-next_glyph ();
@@ -828,8 +816,7 @@ struct SubstLookup : Lookup
buffer-idx = buffer-len - 1;
do
{
- if ((buffer-info[buffer-idx].mask  mask) 
- apply_once (face, buffer, mask, NO_CONTEXT, MAX_NESTING_LEVEL))
+ if ((buffer-info[buffer-idx].mask  mask)  apply_once (c))
ret = true;
  else
buffer-idx--;
@@ -936,7 +923,8 @@ static inline bool substitute_lookup (hb_apply_context_t 
*c, unsigned int lookup
   if (unlikely (c-context_length  1))
 return false;
 
-  return l.apply_once (c-face, c-buffer, c-lookup_mask, c-context_length, 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-11 Thread Behdad Esfahbod
 test/shaping/hb_test_tools.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e95d912b3b0af027c4384553f95236db822e5acc
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 17:33:02 2012 -0400

Fix diff tool

diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py
index aeecb45..94207f8 100644
--- a/test/shaping/hb_test_tools.py
+++ b/test/shaping/hb_test_tools.py
@@ -99,9 +99,9 @@ class FancyDiffer:
sys.stdout.writelines (FancyDiffer.diff_lines 
(l1, l2, colors))
# print out residues
for l in f1:
-   sys.stdout.writelines ([-, colors.red, l1, 
colors.end])
+   sys.stdout.writelines ([-, colors.red, l, 
colors.end])
for l in f1:
-   sys.stdout.writelines ([-, colors.green, l1, 
colors.end])
+   sys.stdout.writelines ([-, colors.green, l, 
colors.end])
except IOError as e:
if e.errno != errno.EPIPE:
print  sys.stderr, %s: %s: %s % 
(sys.argv[0], e.filename, e.strerror)
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-11 Thread Behdad Esfahbod
 test/shaping/texts/in-tree/shaper-hangul/script-hangul/misc/misc.txt |1 +
 1 file changed, 1 insertion(+)

New commits:
commit a4976447cd1a1feffdecd0d501a2690716b1cf4b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 17:48:40 2012 -0400

Add Hangul test

diff --git 
a/test/shaping/texts/in-tree/shaper-hangul/script-hangul/misc/misc.txt 
b/test/shaping/texts/in-tree/shaper-hangul/script-hangul/misc/misc.txt
index 9c374b9..5b6edcc 100644
--- a/test/shaping/texts/in-tree/shaper-hangul/script-hangul/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-hangul/script-hangul/misc/misc.txt
@@ -1,2 +1,3 @@
 휴가 가-- (오--)
 휴가 가-- (오--)
+ᄒᆞᆫ
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-11 Thread Behdad Esfahbod
 TODO|   28 +++-
 src/hb-ot-shape-complex-misc.cc |9 +
 2 files changed, 24 insertions(+), 13 deletions(-)

New commits:
commit 029a82d81d8ffa1b6771d19018d592fec1dbc934
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 22:00:46 2012 -0400

[hangul] Apply *jmo features to all Hangul chars

This is what old HB does.  Morever, fixes rendering with Win8 malgun
font.  The Win7 version doesn't compose with either Uniscribe nor HB,
but Win8 version works as expected, like Uniscribe, with this change.

Lets call Hangul done for now.

diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 99e54f6..76cb3a3 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -56,9 +56,18 @@ _hb_ot_shape_complex_setup_masks_default (hb_ot_map_t *map, 
hb_buffer_t *buffer,
 
 /* Hangul shaper */
 
+static const hb_tag_t hangul_features[] =
+{
+  HB_TAG('l','j','m','o'),
+  HB_TAG('v','j','m','o'),
+  HB_TAG('t','j','m','o'),
+};
+
 void
 _hb_ot_shape_complex_collect_features_hangul (hb_ot_map_builder_t *map, const 
hb_segment_properties_t  *props)
 {
+  for (unsigned int i = 0; i  ARRAY_LENGTH (hangul_features); i++)
+map-add_bool_feature (hangul_features[i]);
 }
 
 hb_ot_shape_normalization_mode_t
commit 3baae2440de69577d330209edb708e7d2bb2231d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 21:54:37 2012 -0400

Update TODO

diff --git a/TODO b/TODO
index 1436337..0c5bfaa 100644
--- a/TODO
+++ b/TODO
@@ -1,13 +1,9 @@
 General fixes:
 =
 
-- Move feature parsing from util into the library
-
-- 'const' for getter APIs? (use mutable internally)
-
 - Fix TT 'kern' on/off and GPOS interaction (move kerning before GPOS)
 
-- Do proper rounding when scaling from font space?
+- Do proper rounding when scaling from font space?  May be a non-issue.
 
 - Misc features:
   * init/medi/fina/isol for non-cursive scripts
@@ -19,26 +15,30 @@ General fixes:
 - Uniscribe backend needs to enforce one direction only, otherwise cluster
   values can confused the user.
 
+- GSUB ligation should call merge_clusters().
+
 
 API issues to fix before 1.0:
 
 
-- Rename all internal symbols (static ones even) to have _hb prefix?
-
 - Add pkg-config files for glue codes (harfbuzz-glib, etc)
 
 - Figure out how many .so objects, how to link, etc
 
+- 'const' for getter APIs? (use mutable internally)
+
+
+API additions
+=
+
+- Move feature parsing from util into the library
+
 - Add hb-cairo glue
 
 - Add sanitize API (and a cached version, that saves result on blob user-data)
 
 - Add glib GBoxedType stuff and introspection
 
-
-API to add (maybe after 1.0):
-
-
 - Add Uniscribe face / font get API
 
 - BCP 47 language handling / API (language_matches?)
@@ -47,7 +47,7 @@ API to add (maybe after 1.0):
 
 - Add hb_font_create_linear()?
 
-- Add hb_shape_plan()/hb_shape_execute()
+- Add hb_shape_plan()/hb_shape_planned()
 
 - Add query API for aalt-like features?
 
@@ -55,7 +55,9 @@ API to add (maybe after 1.0):
 
 - Add segmentation API
 
-- Add hb-fribidi?
+- Add hb-fribidi glue?
+
+- Add segmentation API
 
 
 hb-view / hb-shape enhancements:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-11 Thread Behdad Esfahbod
 TODO |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6d16403bfaa4d710d80c93298eca7211ecaa419f
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 11 22:04:42 2012 -0400

Adjust TODO

diff --git a/TODO b/TODO
index 0c5bfaa..a1ee9a8 100644
--- a/TODO
+++ b/TODO
@@ -7,7 +7,7 @@ General fixes:
 
 - Misc features:
   * init/medi/fina/isol for non-cursive scripts
-  * vkna,hkna etc for kana, *jmo for hangul, etc
+  * vkna,hkna etc for kana, etc
 
 - Move non-native direction and normalization handling to the generic non-OT
   layer, such that uniscribe and other backends can use.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-04-10 Thread Behdad Esfahbod
 src/Makefile.am |6 
 src/gen-arabic-table.py |  220 ++--
 src/gen-indic-table.py  |4 
 src/hb-ot-shape-complex-arabic-table.hh |  205 +
 src/hb-ot-shape-complex-arabic.cc   |   38 -
 5 files changed, 400 insertions(+), 73 deletions(-)

New commits:
commit b7d04eb606800100faa11100d2adf559e297a4ee
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 10 16:44:38 2012 -0400

Do Arabic fallback shaping

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 89d6b53..991f7cf 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -58,8 +58,6 @@ enum {
 
 static unsigned int get_joining_type (hb_codepoint_t u, 
hb_unicode_general_category_t gen_cat)
 {
-  /* TODO Macroize the magic bit operations */
-
   if (likely (hb_in_rangehb_codepoint_t (u, JOINING_TABLE_FIRST, 
JOINING_TABLE_LAST))) {
 unsigned int j_type = joining_table[u - JOINING_TABLE_FIRST];
 if (likely (j_type != JOINING_TYPE_X))
@@ -82,6 +80,12 @@ static unsigned int get_joining_type (hb_codepoint_t u, 
hb_unicode_general_categ
 JOINING_TYPE_T : JOINING_TYPE_U;
 }
 
+static hb_codepoint_t get_arabic_shape (hb_codepoint_t u, unsigned int shape)
+{
+  if (likely (hb_in_rangehb_codepoint_t (u, SHAPING_TABLE_FIRST, 
SHAPING_TABLE_LAST))  shape  4)
+return shaping_table[u - SHAPING_TABLE_FIRST][shape];
+  return u;
+}
 
 
 static const hb_tag_t arabic_syriac_features[] =
@@ -189,6 +193,15 @@ _hb_ot_shape_complex_normalization_preference_arabic (void)
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
+
+static void
+arabic_fallback_shape (hb_buffer_t *buffer)
+{
+  unsigned int count = buffer-len;
+  for (unsigned int i = 0; i  count; i++)
+buffer-info[i].codepoint = get_arabic_shape (buffer-info[i].codepoint, 
buffer-info[i].arabic_shaping_action());
+}
+
 void
 _hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer)
 {
@@ -218,12 +231,27 @@ _hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t 
*map, hb_buffer_t *buffer)
   }
 
   hb_mask_t mask_array[TOTAL_NUM_FEATURES + 1] = {0};
+  hb_mask_t total_masks = 0;
   unsigned int num_masks = buffer-props.script == HB_SCRIPT_SYRIAC ? 
SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
-  for (unsigned int i = 0; i  num_masks; i++)
+  for (unsigned int i = 0; i  num_masks; i++) {
 mask_array[i] = map-get_1_mask (arabic_syriac_features[i]);
+total_masks |= mask_array[i];
+  }
 
-  for (unsigned int i = 0; i  count; i++)
-buffer-info[i].mask |= 
mask_array[buffer-info[i].arabic_shaping_action()];
+  if (total_masks) {
+/* Has OpenType tables */
+for (unsigned int i = 0; i  count; i++)
+  buffer-info[i].mask |= 
mask_array[buffer-info[i].arabic_shaping_action()];
+  } else if (buffer-props.script == HB_SCRIPT_ARABIC) {
+/* Fallback Arabic shaping to Presentation Forms */
+/* Pitfalls:
+ * - This path fires if user force-set init/medi/fina/isol off,
+ * - If font does not declare script 'arab', well, what to do?
+ *   Most probably it's safe to assume that init/medi/fina/isol
+ *   still mean Arabic shaping, although they do not have to.
+ */
+arabic_fallback_shape (buffer);
+  }
 
   HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
 }
commit ae4a2b9365051c23c9a299cf76f3ab7e661999b1
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 10 16:25:08 2012 -0400

Generate fallback Arabic shaping table

Not hooked up yet.

diff --git a/src/Makefile.am b/src/Makefile.am
index d64efdf..27c69a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,12 +153,12 @@ unicode-tables: arabic-table indic-table
 
 indic-table: gen-indic-table.py IndicSyllabicCategory.txt 
IndicMatraCategory.txt Blocks.txt
$(AM_V_GEN) $(builddir)/$^  hb-ot-shape-complex-indic-table.hh.tmp  \
-   mv hb-ot-shape-complex-indic-table.hh.tmp 
hb-ot-shape-complex-indic-table.hh || \
+   mv hb-ot-shape-complex-indic-table.hh.tmp 
$(srcdir)/hb-ot-shape-complex-indic-table.hh || \
($(RM) hb-ot-shape-complex-indic-table.hh.tmp; false)
 
-arabic-table: gen-arabic-table.py ArabicShaping.txt
+arabic-table: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt
$(AM_V_GEN) $(builddir)/$^  hb-ot-shape-complex-arabic-table.hh.tmp  
\
-   mv hb-ot-shape-complex-arabic-table.hh.tmp 
hb-ot-shape-complex-arabic-table.hh || \
+   mv hb-ot-shape-complex-arabic-table.hh.tmp 
$(srcdir)/hb-ot-shape-complex-arabic-table.hh || \
($(RM) hb-ot-shape-complex-arabic-table.hh.tmp; false)
 
 
diff --git a/src/gen-arabic-table.py b/src/gen-arabic-table.py
index 32bf66c..6549cb4 100755
--- a/src/gen-arabic-table.py
+++ b/src/gen-arabic-table.py
@@ -1,89 +1,185 @@
 #!/usr/bin/python
 
 import sys
+import os.path
 
-if len (sys.argv)  2:
-   print sys.stderr, usage: ./gen-arabic-table.py 

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-10 Thread Behdad Esfahbod
 src/gen-arabic-table.py |   32 ++--
 src/hb-ot-shape-complex-arabic-table.hh |   28 +++-
 src/hb-ot-shape-complex-arabic.cc   |   31 +++
 src/hb-ot-shape-complex-misc.cc |4 ++--
 4 files changed, 74 insertions(+), 21 deletions(-)

New commits:
commit 939c010211b063f78874a3b72b032c1ed9a13b87
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 10 17:20:05 2012 -0400

Implement Arabic fallback shaping mandatory ligatures

diff --git a/src/gen-arabic-table.py b/src/gen-arabic-table.py
index 6549cb4..2d3c881 100755
--- a/src/gen-arabic-table.py
+++ b/src/gen-arabic-table.py
@@ -133,11 +133,7 @@ def print_shaping_table(f):
print #define SHAPING_TABLE_LAST   0x%04X % max_u
print
 
-   print
-   print static const uint16_t ligature_table[][3] =
-   print {
-
-   ligas = []
+   ligas = {}
for pair in ligatures.keys ():
for shape in ligatures[pair]:
c = ligatures[pair][shape]
@@ -147,11 +143,27 @@ def print_shaping_table(f):
liga = (shapes[pair[0]]['medial'], 
shapes[pair[1]]['final'])
else:
raise Exception (Unexpected shape, shape)
-   ligas.append (liga + (c,))
-   ligas.sort ()
-   for liga in ligas:
-   value = ', '.join (0x%04X % c for c in liga)
-   print   {%s}, /* U+%04X %s */ % (value, liga[2], 
names[liga[2]])
+   if liga[0] not in ligas:
+   ligas[liga[0]] = []
+   ligas[liga[0]].append ((liga[1], c))
+   max_i = max (len (ligas[l]) for l in ligas)
+   print
+   print static const struct {
+   print  uint16_t first;
+   print  struct {
+   printuint16_t second;
+   printuint16_t ligature;
+   print  } ligatures[%d]; % max_i
+   print } ligature_table[] =
+   print {
+   keys = ligas.keys ()
+   keys.sort ()
+   for first in keys:
+
+   print   { 0x%04X, { % (first)
+   for liga in ligas[first]:
+   print { 0x%04X, 0x%04X }, /* %s */ % (liga[0], 
liga[1], names[liga[1]])
+   print   }},
 
print };
print
diff --git a/src/hb-ot-shape-complex-arabic-table.hh 
b/src/hb-ot-shape-complex-arabic-table.hh
index e0b27f8..df85086 100644
--- a/src/hb-ot-shape-complex-arabic-table.hh
+++ b/src/hb-ot-shape-complex-arabic-table.hh
@@ -914,16 +914,26 @@ static const uint16_t shaping_table[][4] =
 #define SHAPING_TABLE_LAST 0x06D3
 
 
-static const uint16_t ligature_table[][3] =
+static const struct {
+ uint16_t first;
+ struct {
+   uint16_t second;
+   uint16_t ligature;
+ } ligatures[4];
+} ligature_table[] =
 {
-  {0xFEDF, 0xFE82, 0xFEF5}, /* U+FEF5 ARABIC LIGATURE LAM WITH ALEF WITH MADDA 
ABOVE ISOLATED FORM */
-  {0xFEDF, 0xFE84, 0xFEF7}, /* U+FEF7 ARABIC LIGATURE LAM WITH ALEF WITH HAMZA 
ABOVE ISOLATED FORM */
-  {0xFEDF, 0xFE88, 0xFEF9}, /* U+FEF9 ARABIC LIGATURE LAM WITH ALEF WITH HAMZA 
BELOW ISOLATED FORM */
-  {0xFEDF, 0xFE8E, 0xFEFB}, /* U+FEFB ARABIC LIGATURE LAM WITH ALEF ISOLATED 
FORM */
-  {0xFEE0, 0xFE82, 0xFEF6}, /* U+FEF6 ARABIC LIGATURE LAM WITH ALEF WITH MADDA 
ABOVE FINAL FORM */
-  {0xFEE0, 0xFE84, 0xFEF8}, /* U+FEF8 ARABIC LIGATURE LAM WITH ALEF WITH HAMZA 
ABOVE FINAL FORM */
-  {0xFEE0, 0xFE88, 0xFEFA}, /* U+FEFA ARABIC LIGATURE LAM WITH ALEF WITH HAMZA 
BELOW FINAL FORM */
-  {0xFEE0, 0xFE8E, 0xFEFC}, /* U+FEFC ARABIC LIGATURE LAM WITH ALEF FINAL FORM 
*/
+  { 0xFEDF, {
+{ 0xFE88, 0xFEF9 }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW 
ISOLATED FORM */
+{ 0xFE82, 0xFEF5 }, /* ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE 
ISOLATED FORM */
+{ 0xFE8E, 0xFEFB }, /* ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM */
+{ 0xFE84, 0xFEF7 }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE 
ISOLATED FORM */
+  }},
+  { 0xFEE0, {
+{ 0xFE88, 0xFEFA }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW 
FINAL FORM */
+{ 0xFE82, 0xFEF6 }, /* ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE 
FINAL FORM */
+{ 0xFE8E, 0xFEFC }, /* ARABIC LIGATURE LAM WITH ALEF FINAL FORM */
+{ 0xFE84, 0xFEF8 }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE 
FINAL FORM */
+  }},
 };
 
 
diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 991f7cf..c44c27c 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -87,6 +87,16 @@ static hb_codepoint_t get_arabic_shape (hb_codepoint_t u, 
unsigned int shape)
   return u;
 }
 
+static uint16_t get_ligature (hb_codepoint_t first, hb_codepoint_t second)
+{
+  if (unlikely (!second)) return 0;
+  for (unsigned i = 0; i  ARRAY_LENGTH (ligature_table); i++)
+if (ligature_table[i].first == first)
+  for (unsigned j = 0; j  

[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-04-10 Thread Behdad Esfahbod
 src/hb-ot-shape-private.hh |1 -
 src/hb-ot-shape.cc |   10 --
 2 files changed, 11 deletions(-)

New commits:
commit 7752aa73e72301a46c64c533c1e423ff5987cc05
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 10 17:22:14 2012 -0400

Minor

diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh
index 0e33dae..41afd68 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape-private.hh
@@ -83,7 +83,6 @@ struct hb_ot_shape_context_t
 
   /* Transient stuff */
   hb_direction_t target_direction;
-  hb_bool_t applied_substitute_complex;
   hb_bool_t applied_position_complex;
 };
 
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index d0d1850..8b3a334 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -236,7 +236,6 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
 {
   if (hb_ot_layout_has_substitution (c-face)) {
 c-plan-map.substitute (c-face, c-buffer);
-c-applied_substitute_complex = TRUE;
   }
 
   hb_ot_layout_substitute_finish (c-buffer);
@@ -244,12 +243,6 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
   return;
 }
 
-static void
-hb_substitute_complex_fallback (hb_ot_shape_context_t *c HB_UNUSED)
-{
-  /* TODO Arabic */
-}
-
 
 /* Position */
 
@@ -371,9 +364,6 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
 hb_substitute_default (c);
 
 hb_ot_substitute_complex (c);
-
-if (!c-applied_substitute_complex)
-  hb_substitute_complex_fallback (c);
   }
 
   /* POSITION */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master' - 8 commits

2012-04-07 Thread Behdad Esfahbod
 src/Makefile.am   |1 
 src/hb-ot-layout-common-private.hh|1 
 src/hb-ot-shape-complex-arabic.cc |6 
 src/hb-ot-shape-complex-indic.cc  |6 
 src/hb-ot-shape-complex-misc.cc   |   24 +
 src/hb-ot-shape-complex-private.hh|   28 +-
 src/hb-ot-shape-normalize-private.hh  |   46 
+++
 src/hb-ot-shape-normalize.cc  |  125 
--
 src/hb-ot-shape-private.hh|   68 
-
 src/hb-ot-shape.cc|4 
 src/hb-unicode-private.hh |   11 
 src/hb-unicode.cc |   55 

 test/shaping/texts/in-tree/shaper-default/MANIFEST|1 
 test/shaping/texts/in-tree/shaper-default/script-hangul/MANIFEST  |1 
 test/shaping/texts/in-tree/shaper-default/script-hangul/misc/MANIFEST |1 
 test/shaping/texts/in-tree/shaper-default/script-hangul/misc/misc.txt |2 
 16 files changed, 226 insertions(+), 154 deletions(-)

New commits:
commit c9a841f4452921c5361b8f5697bbff7736ce60cd
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Apr 7 15:06:55 2012 -0400

Add simple Hangul shaper that recomposes Jamo when feasible

Previously, we were NOT actually recomposing Hangul Jamo.  We do now.
The two lines in:

test/shaping/texts/in-tree/shaper-default/script-hangul/misc/misc.txt

Now render the same with the UnDotum.ttf font.  Previously the second
linle was rendering boxes.

We can also start applying OpenType Jamo features later.  At this time,
I have no idea how the 'ljmo', 'vjmo', 'tjmo' features are supposed to
work.  Maybe someone can explain them to me?

diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 98831fb..20e365b 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -53,3 +53,19 @@ _hb_ot_shape_complex_setup_masks_default (hb_ot_map_t *map, 
hb_buffer_t *buffer)
 }
 
 
+
+void
+_hb_ot_shape_complex_collect_features_hangul (hb_ot_map_builder_t *map, const 
hb_segment_properties_t  *props)
+{
+}
+
+hb_ot_shape_normalization_mode_t
+_hb_ot_shape_complex_normalization_preference_hangul (void)
+{
+  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+}
+
+void
+_hb_ot_shape_complex_setup_masks_hangul (hb_ot_map_t *map, hb_buffer_t *buffer)
+{
+}
diff --git a/src/hb-ot-shape-complex-private.hh 
b/src/hb-ot-shape-complex-private.hh
index ae01a3a..7c2c7a9 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -50,6 +50,7 @@
 #define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
   HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \
   HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
+  HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
   HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
   /* ^--- Add new shapers here */
 
@@ -69,6 +70,7 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t 
*props)
 default:
   return hb_ot_complex_shaper_default;
 
+
 /* Unicode-1.1 additions */
 case HB_SCRIPT_ARABIC:
 case HB_SCRIPT_MONGOLIAN:
@@ -82,6 +84,17 @@ hb_ot_shape_complex_categorize (const 
hb_segment_properties_t *props)
 
   return hb_ot_complex_shaper_arabic;
 
+
+/* Unicode-1.1 additions */
+case HB_SCRIPT_HANGUL:
+
+  return hb_ot_complex_shaper_hangul;
+
+
+
+/* ^--- Add new shapers here */
+
+
 #if 0
 /* Note:
  *
@@ -191,8 +204,6 @@ hb_ot_shape_complex_categorize (const 
hb_segment_properties_t *props)
 case HB_SCRIPT_TAKRI:
 
   return hb_ot_complex_shaper_indic;
-
-/* ^--- Add new shapers here */
   }
 }
 
commit 968318455304804dc53045e8ba0cd4d76800c02d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Apr 7 14:57:21 2012 -0400

Implement normalization mode HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL

In this mode we try composing CCC=0 with CCC=0 characters.  Useful for
Hangul.

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 02a90bf..f7b3547 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -198,7 +198,7 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t 
*buffer,
   buffer-swap_buffers ();
 
 
-  if (!has_multichar_clusters)
+  if (mode != HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL  
!has_multichar_clusters)
 return; /* Done! */
 
 
@@ -243,19 +243,21 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t 
*buffer,
   buffer-next_glyph ();
   while (buffer-idx  count)
   {
-if (buffer-info[buffer-idx].combining_class() == 0) {
-  starter = buffer-out_len;
-  buffer-next_glyph ();
-  

Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2012-03-07 Thread Khaled Hosny
On Tue, Mar 06, 2012 at 05:47:57PM -0800, Behdad Esfahbod wrote:
 + * knowledge too.  We need ot provide assistance to the itemizer.

There is a typo: s/ot/to/

Regards,
 Khaled
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-03-07 Thread Behdad Esfahbod
 src/hb-ot-shape-normalize.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e3b2e077f549b04779c08a9fedb1f35b9f11075c
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 10:21:24 2012 -0500

Typo

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index f255313..a754590 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -59,7 +59,7 @@
  *
  *   - When a font does not support a combining mark, but supports it 
precomposed
  * with previous base, use that.  This needs the itemizer to have this
- * knowledge too.  We need ot provide assistance to the itemizer.
+ * knowledge too.  We need to provide assistance to the itemizer.
  *
  *   - When a font does not support a character but supports its decomposition,
  * well, use the decomposition.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-03-07 Thread Behdad Esfahbod
 src/Makefile.am |   15 ++
 src/gen-indic-table.py  |   20 +--
 src/hb-ot-shape-complex-arabic-table.hh |   35 --
 src/hb-ot-shape-complex-indic-table.hh  |  178 +++-
 4 files changed, 134 insertions(+), 114 deletions(-)

New commits:
commit cdc8b491a8e7cec5082ca2ad0346c1f41fdd5c92
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 12:08:33 2012 -0500

Update Indic table to Unicode 6.1 data

diff --git a/src/Makefile.am b/src/Makefile.am
index d747895..c70e198 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -148,6 +148,21 @@ GENERATORS = \
 
 EXTRA_DIST += $(GENERATORS)
 
+unicode-tables: arabic-table indic-table
+
+indic-table: gen-indic-table.py IndicSyllabicCategory.txt 
IndicMatraCategory.txt Blocks.txt
+   $(AM_V_GEN) $(builddir)/$^  hb-ot-shape-complex-indic-table.hh.tmp  \
+   mv hb-ot-shape-complex-indic-table.hh.tmp 
hb-ot-shape-complex-indic-table.hh || \
+   ($(RM) hb-ot-shape-complex-indic-table.hh.tmp; false)
+
+arabic-table: gen-arabic-table.py ArabicShaping.txt
+   $(AM_V_GEN) $(builddir)/$^  hb-ot-shape-complex-arabic-table.hh.tmp  
\
+   mv hb-ot-shape-complex-arabic-table.hh.tmp 
hb-ot-shape-complex-arabic-table.hh || \
+   ($(RM) hb-ot-shape-complex-arabic-table.hh.tmp; false)
+
+
+.PHONY: unicode-tables arabic-table indic-table
+
 BUILT_SOURCES += hb-ot-shape-complex-indic-machine.hh
 EXTRA_DIST += hb-ot-shape-complex-indic-machine.rl
 hb-ot-shape-complex-indic-machine.hh: hb-ot-shape-complex-indic-machine.rl
diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py
index 78f164a..72e6aaa 100755
--- a/src/gen-indic-table.py
+++ b/src/gen-indic-table.py
@@ -120,6 +120,8 @@ print #define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, 
IMC_##M)
 print
 print
 
+total = 0
+used = 0
 def print_block (block, start, end, data):
print
print
@@ -134,14 +136,9 @@ def print_block (block, start, end, data):
d = data.get (u, defaults)
sys.stdout.write (%9s % (_(%s,%s), % (short[0][d[0]], 
short[1][d[1]])))
 
-   if num == 0:
-   # Filler block, don't check occupancy
-   return
-   total = end - start + 1
-   occupancy = num * 100. / total
-   # Maintain at least 30% occupancy in the table */
-   if occupancy  30:
-   raise Exception (Table too sparse, please investigate: , 
occupancy, block)
+   global total, used
+   total += end - start + 1
+   used += num
 
 uu = data.keys ()
 uu.sort ()
@@ -179,7 +176,8 @@ print
 print
 print #define indic_offset_total %d % offset
 print
-print };
+occupancy = used * 100. / total
+print }; /* Table occupancy: %d%% */ % occupancy
 
 print
 print static INDIC_TABLE_ELEMENT_TYPE
@@ -206,3 +204,7 @@ for i in range (2):
 print
 print
 print /* == End of generated table == */
+
+# Maintain at least 30% occupancy in the table */
+if occupancy  30:
+   raise Exception (Table too sparse, please investigate: , occupancy)
diff --git a/src/hb-ot-shape-complex-arabic-table.hh 
b/src/hb-ot-shape-complex-arabic-table.hh
index 5aa8716..e7ee226 100644
--- a/src/hb-ot-shape-complex-arabic-table.hh
+++ b/src/hb-ot-shape-complex-arabic-table.hh
@@ -1,35 +1,3 @@
-/*
- * Copyright © 2011  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_SHAPE_COMPLEX_ARABIC_TABLE_HH
-#define HB_OT_SHAPE_COMPLEX_ARABIC_TABLE_HH
-
-#include hb-private.hh
-
-
 /* == Start of generated table == */
 /*
  * The following table is generated by running:
@@ -753,6 +721,3 @@ static const uint8_t joining_table[] =
 #define JOINING_TABLE_LAST 0x08AC
 
 /* == End of generated table == */
-
-
-#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_TABLE_HH */
diff --git a/src/hb-ot-shape-complex-indic-table.hh 
b/src/hb-ot-shape-complex-indic-table.hh
index 5077e8a..40a7ae7 100644
--- a/src/hb-ot-shape-complex-indic-table.hh
+++ 

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

2012-03-07 Thread Behdad Esfahbod
 src/hb-common.cc   |6 +
 src/hb-common.h|  203 +++--
 src/hb-glib.cc |   11 +-
 src/hb-ot-shape-complex-private.hh |9 +
 4 files changed, 129 insertions(+), 100 deletions(-)

New commits:
commit f91136cb528e298651c4a8a8a1d6dc54136e09ce
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 12:56:22 2012 -0500

Route three Unicode 6.1 scripts through Indic shaper

diff --git a/src/hb-ot-shape-complex-private.hh 
b/src/hb-ot-shape-complex-private.hh
index 652d90a..52d0523 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -79,7 +79,9 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t 
*props)
 /* Note:
  *
  * These disabled scripts are listed in ucd/IndicSyllabicCategory.txt, but 
according
- * to Martin Hosken do not require complex shaping.
+ * to Martin Hosken and Jonathan Kew do not require complex shaping.
+ *
+ * TODO We should automate figuring out which scripts do not need complex 
shaping
  *
  * TODO We currently keep data for these scripts in our indic table.  Need 
to fix the
  * generator to not do that.
@@ -113,6 +115,7 @@ hb_ot_shape_complex_categorize (const 
hb_segment_properties_t *props)
 case HB_SCRIPT_BALINESE:
 case HB_SCRIPT_BENGALI:
 case HB_SCRIPT_BUGINESE:
+case HB_SCRIPT_CHAKMA:
 case HB_SCRIPT_CHAM:
 case HB_SCRIPT_DEVANAGARI:
 case HB_SCRIPT_GUJARATI:
@@ -127,9 +130,11 @@ hb_ot_shape_complex_categorize (const 
hb_segment_properties_t *props)
 case HB_SCRIPT_NEW_TAI_LUE:
 case HB_SCRIPT_ORIYA:
 case HB_SCRIPT_REJANG:
+case HB_SCRIPT_SHARADA:
 case HB_SCRIPT_SINHALA:
 case HB_SCRIPT_SUNDANESE:
 case HB_SCRIPT_TAI_THAM:
+case HB_SCRIPT_TAKRI:
 case HB_SCRIPT_TAMIL:
 case HB_SCRIPT_TELUGU:
   return hb_ot_complex_shaper_indic;
commit f32c0012ad794cd2df669dfc7b0438fafbe38b2d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 12:53:34 2012 -0500

Add Unicode 6.1.0 scripts

diff --git a/src/hb-common.h b/src/hb-common.h
index 75ae899..ca51c1f 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -285,6 +285,15 @@ typedef enum
   HB_SCRIPT_BRAHMI = HB_TAG ('B','r','a','h'),
   HB_SCRIPT_MANDAIC= HB_TAG ('M','a','n','d'),
 
+  /* Unicode-6.1 additions */
+  HB_SCRIPT_CHAKMA = HB_TAG ('C','a','k','m'),
+  HB_SCRIPT_MEROITIC_CURSIVE   = HB_TAG ('M','e','r','c'),
+  HB_SCRIPT_MEROITIC_HIEROGLYPHS   = HB_TAG ('M','e','r','o'),
+  HB_SCRIPT_MIAO   = HB_TAG ('P','l','r','d'),
+  HB_SCRIPT_SHARADA= HB_TAG ('S','h','r','d'),
+  HB_SCRIPT_SORA_SOMPENG   = HB_TAG ('S','o','r','a'),
+  HB_SCRIPT_TAKRI  = HB_TAG ('T','a','k','r'),
+
   /* No script set */
   HB_SCRIPT_INVALID= HB_TAG_NONE
 } hb_script_t;
diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index f990988..26d40a3 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -144,7 +144,16 @@ glib_script_to_script[] =
   /* Unicode-6.0 additions */
   HB_SCRIPT_BATAK,
   HB_SCRIPT_BRAHMI,
-  HB_SCRIPT_MANDAIC
+  HB_SCRIPT_MANDAIC,
+
+  /* Unicode-6.1 additions */
+  HB_SCRIPT_CHAKMA,
+  HB_SCRIPT_MEROITIC_CURSIVE,
+  HB_SCRIPT_MEROITIC_HIEROGLYPHS,
+  HB_SCRIPT_MIAO,
+  HB_SCRIPT_SHARADA,
+  HB_SCRIPT_SORA_SOMPENG,
+  HB_SCRIPT_TAKRI
 };
 #endif
 
commit 50e810cd0e55c25fddb0a2fd0861c51fbf65700e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 12:49:08 2012 -0500

Lydian and Kharoshthi are right-to-left

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 6093289..170b75f 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -274,10 +274,16 @@ hb_script_get_horizontal_direction (hb_script_t script)
 /* Unicode-4.0 additions */
 case HB_SCRIPT_CYPRIOT:
 
+/* Unicode-4.1 additions */
+case HB_SCRIPT_KHAROSHTHI:
+
 /* Unicode-5.0 additions */
 case HB_SCRIPT_PHOENICIAN:
 case HB_SCRIPT_NKO:
 
+/* Unicode-5.1 additions */
+case HB_SCRIPT_LYDIAN:
+
 /* Unicode-5.2 additions */
 case HB_SCRIPT_AVESTAN:
 case HB_SCRIPT_IMPERIAL_ARAMAIC:
commit a52835635e4a2a12715aff2febb561515a10cd5a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 12:38:39 2012 -0500

Whitespace

diff --git a/src/hb-common.h b/src/hb-common.h
index b7fef32..75ae899 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -176,117 +176,117 @@ typedef enum
 /* http://unicode.org/iso15924/ */
 typedef enum
 {
-  HB_SCRIPT_COMMON  = HB_TAG ('Z','y','y','y'),
-  HB_SCRIPT_INHERITED   = HB_TAG ('Z','i','n','h'),
-  HB_SCRIPT_ARABIC  = HB_TAG ('A','r','a','b'),
-  HB_SCRIPT_ARMENIAN= HB_TAG ('A','r','m','n'),
-  HB_SCRIPT_BENGALI = HB_TAG ('B','e','n','g'),
-  HB_SCRIPT_BOPOMOFO= HB_TAG 

  1   2   3   >