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


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


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


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

2012-03-07 Thread Behdad Esfahbod
 src/gen-arabic-table.py |   11 +++---
 src/gen-indic-table.py  |9 +++--
 src/hb-common.cc|8 
 src/hb-common.h |   52 +---
 src/hb-ot-shape-complex-arabic-table.hh |6 +++
 src/hb-ot-shape-complex-indic-table.hh  |4 ++
 6 files changed, 58 insertions(+), 32 deletions(-)

New commits:
commit fa2673c1ee954ddbbfbfca7cced7b839d7776fc0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Mar 7 15:52:02 2012 -0500

More Unicode script age annotation, and a couple more RTL scripts

Cross-checked with Mark Davis's spreadsheet at http://goo.gl/x9ilM

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 170b75f..e003c09 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -264,10 +264,14 @@ hb_script_to_iso15924_tag (hb_script_t script)
 hb_direction_t
 hb_script_get_horizontal_direction (hb_script_t script)
 {
+  /* http://goo.gl/x9ilM */
   switch ((hb_tag_t) script)
   {
+/* Unicode-1.1 additions */
 case HB_SCRIPT_ARABIC:
 case HB_SCRIPT_HEBREW:
+
+/* Unicode-3.0 additions */
 case HB_SCRIPT_SYRIAC:
 case HB_SCRIPT_THAANA:
 
@@ -296,6 +300,10 @@ hb_script_get_horizontal_direction (hb_script_t script)
 /* Unicode-6.0 additions */
 case HB_SCRIPT_MANDAIC:
 
+/* Unicode-6.1 additions */
+case HB_SCRIPT_MEROITIC_CURSIVE:
+case HB_SCRIPT_MEROITIC_HIEROGLYPHS:
+
   return HB_DIRECTION_RTL;
   }
 
diff --git a/src/hb-common.h b/src/hb-common.h
index 96093e4..b6a9279 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -174,48 +174,54 @@ typedef enum
 /* hb_script_t */
 
 /* http://unicode.org/iso15924/ */
+/* http://goo.gl/x9ilM */
 typedef enum
 {
+  /* Unicode-1.1 additions */
   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 ('B','o','p','o'),
+  HB_SCRIPT_CANADIAN_ABORIGINAL= HB_TAG ('C','a','n','s'),
   HB_SCRIPT_CHEROKEE   = HB_TAG ('C','h','e','r'),
   HB_SCRIPT_COPTIC = HB_TAG ('C','o','p','t'),
   HB_SCRIPT_CYRILLIC   = HB_TAG ('C','y','r','l'),
   HB_SCRIPT_DEVANAGARI = HB_TAG ('D','e','v','a'),
-  HB_SCRIPT_ETHIOPIC   = HB_TAG ('E','t','h','i'),
   HB_SCRIPT_GEORGIAN   = HB_TAG ('G','e','o','r'),
   HB_SCRIPT_GREEK  = HB_TAG ('G','r','e','k'),
   HB_SCRIPT_GUJARATI   = HB_TAG ('G','u','j','r'),
   HB_SCRIPT_GURMUKHI   = HB_TAG ('G','u','r','u'),
-  HB_SCRIPT_HAN= HB_TAG ('H','a','n','i'),
   HB_SCRIPT_HANGUL = HB_TAG ('H','a','n','g'),
+  HB_SCRIPT_HAN= HB_TAG ('H','a','n','i'),
   HB_SCRIPT_HEBREW = HB_TAG ('H','e','b','r'),
   HB_SCRIPT_HIRAGANA   = HB_TAG ('H','i','r','a'),
+  HB_SCRIPT_INHERITED  = HB_TAG ('Z','i','n','h'),
   HB_SCRIPT_KANNADA= HB_TAG ('K','n','d','a'),
   HB_SCRIPT_KATAKANA   = HB_TAG ('K','a','n','a'),
-  HB_SCRIPT_KHMER  = HB_TAG ('K','h','m','r'),
   HB_SCRIPT_LAO= HB_TAG ('L','a','o','o'),
   HB_SCRIPT_LATIN  = HB_TAG ('L','a','t','n'),
   HB_SCRIPT_MALAYALAM  = HB_TAG ('M','l','y','m'),
   HB_SCRIPT_MONGOLIAN  = HB_TAG ('M','o','n','g'),
-  HB_SCRIPT_MYANMAR= HB_TAG ('M','y','m','r'),
   HB_SCRIPT_OGHAM  = HB_TAG ('O','g','a','m'),
   HB_SCRIPT_ORIYA  = HB_TAG ('O','r','y','a'),
   HB_SCRIPT_RUNIC  = HB_TAG ('R','u','n','r'),
-  HB_SCRIPT_SINHALA= HB_TAG ('S','i','n','h'),
   HB_SCRIPT_SYRIAC = HB_TAG ('S','y','r','c'),
   HB_SCRIPT_TAMIL  = HB_TAG ('T','a','m','l'),
   HB_SCRIPT_TELUGU = HB_TAG ('T','e','l','u'),
-  HB_SCRIPT_THAANA = HB_TAG ('T','h','a','a'),
   HB_SCRIPT_THAI   = HB_TAG ('T','h','a','i'),
-  HB_SCRIPT_TIBETAN= HB_TAG ('T','i','b','t'),
-  HB_SCRIPT_CANADIAN_ABORIGINAL= HB_TAG ('C','a','n','s'),
   HB_SCRIPT_YI = HB_TAG ('Y','i','i','i'),
 
+  /* Unicode-2.0 additions */
+  HB_SCRIPT_TIBETAN= HB_TAG ('T','i','b','t'),
+
+  /* Unicode-3.0 additions */
+  HB_SCRIPT_ETHIOPIC   = HB_TAG ('E','t','h','i'),
+  HB_SCRIPT_KHMER  = HB_TAG ('K','h','m','r'),
+  HB_SCRIPT_MYANMAR= 

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

2012-01-18 Thread Behdad Esfahbod
 src/hb-ot-layout-gsub-table.hh   |2 +-
 src/hb-ot-layout-gsubgpos-private.hh |   13 +
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 03408ce73d003ed4e58e3f8472f9445e72b86bee
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jan 18 21:28:34 2012 -0500

Fix more possible buffer overruns

I have this function, but can't clean up it to my satisfaction.

diff --git a/src/hb-ot-layout-gsubgpos-private.hh 
b/src/hb-ot-layout-gsubgpos-private.hh
index f1d03dc..13386c2 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -317,12 +317,14 @@ static inline bool apply_lookup (hb_apply_context_t *c,
*/
   for (unsigned int i = 0; i  count; /* NOP */)
   {
+if (unlikely (c-buffer-idx == end))
+  return true;
 while (c-should_mark_skip_current_glyph ())
 {
-  if (unlikely (c-buffer-idx == end))
-   return true;
   /* No lookup applied for this index */
   c-buffer-next_glyph ();
+  if (unlikely (c-buffer-idx == end))
+   return true;
 }
 
 if (lookupCount  i == lookupRecord-sequenceIndex)
commit 7d479900cd11bc88148cd601ee43bc5492ce5843
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jan 18 21:19:32 2012 -0500

Refactor the two remaining uses of _hb_ot_layout_skip_mark()

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 77f4400..f7ec3cc 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -392,7 +392,7 @@ struct Ligature
 
   for (unsigned int i = 1; i  count; i++)
   {
-   while (_hb_ot_layout_skip_mark (c-face, 
c-buffer-info[c-buffer-idx], c-lookup_props, NULL))
+   while (c-should_mark_skip_current_glyph ())
{
  c-buffer-info[c-buffer-idx].lig_comp() = i;
  c-buffer-info[c-buffer-idx].lig_id() = lig_id;
diff --git a/src/hb-ot-layout-gsubgpos-private.hh 
b/src/hb-ot-layout-gsubgpos-private.hh
index 211f0f4..f1d03dc 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -67,7 +67,6 @@ struct hb_apply_context_t
   unsigned int lookup_props;
   unsigned int property; /* propety of first glyph */
 
-
   struct mark_skipping_forward_iterator_t
   {
 inline mark_skipping_forward_iterator_t (hb_apply_context_t *c_,
@@ -146,6 +145,10 @@ struct hb_apply_context_t
 unsigned int num_items;
   };
 
+  inline bool should_mark_skip_current_glyph (void) const
+  {
+return _hb_ot_layout_skip_mark (face, buffer-info[buffer-idx], 
lookup_props, NULL);
+  }
 
 
 
@@ -314,7 +317,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
*/
   for (unsigned int i = 0; i  count; /* NOP */)
   {
-while (_hb_ot_layout_skip_mark (c-face, c-buffer-info[c-buffer-idx], 
c-lookup_props, NULL))
+while (c-should_mark_skip_current_glyph ())
 {
   if (unlikely (c-buffer-idx == end))
return true;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-01-18 Thread Behdad Esfahbod
 src/hb-icu.cc   |8 +++-
 test/test-unicode.c |2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 36a4f4a482456ee816dcb59befa0b0538ba487df
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jan 18 22:16:49 2012 -0500

Replace u_strlen() with u_countChar32()

The latter is what I meant.

diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index cc551d3..5cf09b2 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -36,7 +36,7 @@
 #include unicode/uversion.h
 #include unicode/uchar.h
 #include unicode/unorm.h
-#include unicode/unistr.h
+#include unicode/ustring.h
 
 
 
@@ -190,8 +190,7 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
   len = unorm_normalize (utf16, len, UNORM_NFC, 0, normalized, ARRAY_LENGTH 
(normalized), icu_err);
   if (icu_err)
 return FALSE;
-  normalized[len] = 0;
-  if (u_strlen (normalized) == 1) {
+  if (u_countChar32 (normalized, len) == 1) {
 U16_GET_UNSAFE (normalized, 0, *ab);
 ret = TRUE;
   } else {
@@ -227,8 +226,7 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs 
HB_UNUSED,
   if (icu_err)
 return FALSE;
 
-  normalized[len] = 0;
-  len = u_strlen (normalized);
+  len = u_countChar32 (normalized, len);
 
   if (len == 1) {
 U16_GET_UNSAFE (normalized, 0, *a);
commit 055fb24d03ae518fa0aa6c2860a03f3cb6a5ef0d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Jan 18 21:58:34 2012 -0500

Add test for bug in ICU decompose

As reported by Kenichi Ishibashi on 2011-10-28.

diff --git a/test/test-unicode.c b/test/test-unicode.c
index 3482a05..a420bf3 100644
--- a/test/test-unicode.c
+++ b/test/test-unicode.c
@@ -781,7 +781,6 @@ test_unicode_script_roundtrip (gconstpointer user_data)
 }
 
 
-/* TODO test compose() and decompose() */
 static void
 test_unicode_normalization (gconstpointer user_data)
 {
@@ -826,6 +825,7 @@ test_unicode_normalization (gconstpointer user_data)
   /* Not decomposable */
   g_assert (!hb_unicode_decompose (uf, 0x0041, a, b)  a == 0x0041  b == 
0);
   g_assert (!hb_unicode_decompose (uf, 0xFB01, a, b)  a == 0xFB01  b == 
0);
+  g_assert (!hb_unicode_decompose (uf, 0x1F1EF, a, b)  a == 0x1F1EF  b 
== 0);
 
   /* Singletons */
   g_assert (hb_unicode_decompose (uf, 0x212B, a, b)  a == 0x00C5  b == 
0);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2012-01-14 Thread Behdad Esfahbod
 src/hb-object-private.hh |2 +-
 util/options.cc  |2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit a097043f9a81e6c20caf69a5dabdf9e00438d79b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Jan 14 17:55:51 2012 -0500

Allow space in one more place when parsing features

diff --git a/util/options.cc b/util/options.cc
index a3da825..2f201c5 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -269,6 +269,8 @@ parse_feature_tag (char **pp, hb_feature_t *feature)
 static hb_bool_t
 parse_feature_indices (char **pp, hb_feature_t *feature)
 {
+  parse_space (pp);
+
   hb_bool_t has_start;
 
   feature-start = 0;
commit af92135424b994062648f4fb7e26af0bd970a4b1
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Oct 21 09:18:43 2011 -0700

Minor

diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index 6a2f83d..2e4a385 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -63,7 +63,7 @@ typedef volatile int hb_atomic_int_t;
 #define hb_atomic_int_set(AI, V)   g_atomic_int_set ((AI), V)
 
 
-#elif _MSC_VER = 1600
+#elif defined(_MSC_VER)  _MSC_VER = 1600
 
 #include intrin.h
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2011-10-17 Thread Behdad Esfahbod
 src/hb-object-private.hh |6 +-
 src/hb-ot-shape-normalize.cc |5 -
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 89d89646e8163b6c0874b9a3c14d4da974ea8219
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Oct 17 11:50:54 2011 -0700

Fix intrin.h b0rkage with older MSVC

Reported by Jonathan Kew.

diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index 72ed8ba..6a2f83d 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -63,7 +63,7 @@ typedef volatile int hb_atomic_int_t;
 #define hb_atomic_int_set(AI, V)   g_atomic_int_set ((AI), V)
 
 
-#elif defined(_MSC_VER)
+#elif _MSC_VER = 1600
 
 #include intrin.h
 
@@ -75,7 +75,11 @@ typedef long hb_atomic_int_t;
 
 #else
 
+#ifdef _MSC_VER
+#pragma message(Could not find any system to define atomic_int macros, 
library will NOT be thread-safe)
+#else
 #warning Could not find any system to define atomic_int macros, library will 
NOT be thread-safe
+#endif
 
 typedef volatile int hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)   ((AI) += (V), (AI) - (V))
commit af913c5788e600e36d29f44fe4e77db84cf8c442
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Oct 17 11:39:28 2011 -0700

Fix infinite loop in normalization code with variation selectors

Reported by Jonathan Kew.

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 6d516c5..eb9f32a 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -143,8 +143,11 @@ decompose_multi_char_cluster (hb_ot_shape_context_t *c,
 {
   /* TODO Currently if there's a variation-selector we give-up, it's just too 
hard. */
   for (unsigned int i = c-buffer-idx; i  end; i++)
-if (unlikely (is_variation_selector (c-buffer-info[i].codepoint)))
+if (unlikely (is_variation_selector (c-buffer-info[i].codepoint))) {
+  while (c-buffer-idx  end)
+   c-buffer-next_glyph ();
   return;
+}
 
   while (c-buffer-idx  end)
 decompose_current_glyph (c, FALSE);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2011-09-20 Thread Behdad Esfahbod
 src/gen-arabic-table.py |2 +-
 src/gen-indic-table.py  |2 +-
 util/helper-cairo.cc|2 +-
 util/options.cc |3 ++-
 util/options.hh |   14 +++---
 5 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 088c1e27c0fc0cdef999cf1f567e4d5eb2cfb2e4
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Sep 20 14:43:55 2011 -0400

[util] Fix option parsing

Wow, who knew bool is one byte and I was using it as a 4byte int?!

C++ auto casts fails you in mysterious ways...

diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index 3a6d913..abb8c15 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -346,7 +346,7 @@ helper_cairo_line_from_buffer (helper_cairo_line_t *l,
 
   if (l-num_clusters) {
 memset ((void *) l-clusters, 0, l-num_clusters * sizeof 
(l-clusters[0]));
-bool backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction 
(buffer));
+hb_bool_t backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction 
(buffer));
 l-cluster_flags = backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : 
(cairo_text_cluster_flags_t) 0;
 unsigned int cluster = 0;
 l-clusters[cluster].num_glyphs++;
diff --git a/util/options.cc b/util/options.cc
index 97be635..4429e85 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -48,7 +48,7 @@ fail (hb_bool_t suggest_help, const char *format, ...)
 }
 
 
-bool debug = FALSE;
+hb_bool_t debug = FALSE;
 
 static gchar *
 shapers_to_string (void)
@@ -644,6 +644,7 @@ format_options_t::serialize (hb_buffer_t *buffer,
   {
 if (i)
   g_string_append_c (gs, '|');
+
 char glyph_name[30];
 if (show_glyph_names  !FT_Get_Glyph_Name (ft_face, info-codepoint, 
glyph_name, sizeof (glyph_name)))
   g_string_append_printf (gs, %s, glyph_name);
diff --git a/util/options.hh b/util/options.hh
index 171fbe6..fbf5f36 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -51,7 +51,7 @@
 void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN;
 
 
-extern bool debug;
+extern hb_bool_t debug;
 
 struct option_group_t
 {
@@ -115,7 +115,7 @@ struct view_options_t : option_group_t
 
   void add_options (option_parser_t *parser);
 
-  bool annotate;
+  hb_bool_t annotate;
   const char *fore;
   const char *back;
   double line_space;
@@ -149,8 +149,8 @@ struct shape_options_t : option_group_t
 hb_buffer_set_language (buffer, hb_language_from_string (language, -1));
   }
 
-  bool shape (const char *text, int text_len,
- hb_font_t *font, hb_buffer_t *buffer) {
+  hb_bool_t shape (const char *text, int text_len,
+  hb_font_t *font, hb_buffer_t *buffer) {
 hb_buffer_reset (buffer);
 hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len);
 setup_buffer (buffer);
@@ -296,9 +296,9 @@ struct format_options_t : option_group_t
  GString *gs);
 
   protected:
-  bool show_glyph_names;
-  bool show_positions;
-  bool show_clusters;
+  hb_bool_t show_glyph_names;
+  hb_bool_t show_positions;
+  hb_bool_t show_clusters;
 };
 
 
commit d606daa4cca323c8977b2e52e6863dc0f1b72fa9
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Sep 20 14:34:06 2011 -0400

Whitespace

diff --git a/src/gen-arabic-table.py b/src/gen-arabic-table.py
index 10fb22d..8744fab 100755
--- a/src/gen-arabic-table.py
+++ b/src/gen-arabic-table.py
@@ -35,7 +35,7 @@ num = 0
 last = -1
 block = ''
 for line in f:
-   
+
if line[0] == '#':
if line.find ( characters):
block = line[2:].strip ()
diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py
index f4fdb83..78f164a 100755
--- a/src/gen-indic-table.py
+++ b/src/gen-indic-table.py
@@ -19,7 +19,7 @@ for i, f in enumerate (files):
j = line.find ('#')
if j = 0:
line = line[:j]
-   
+
fields = [x.strip () for x in line.split (';')]
if len (fields) == 1:
continue
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2011-09-19 Thread Behdad Esfahbod
 configure.ac|   26 +++---
 src/hb-graphite2.cc |8 
 2 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 880c1f0e4ede65890592d28dfb38bb06f5b57500
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Sep 19 23:10:22 2011 -0400

Rewrite ICU detection code with in-house macros

At least works for cross-compiling now...

diff --git a/configure.ac b/configure.ac
index 2c5e728..856fb98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,17 +112,21 @@ AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
 dnl ==
 
 PKG_CHECK_MODULES(ICU, icu, have_icu=true, [
-   if test $cross_compiling == no; then
-   AC_CHECK_PROG([have_icu], [icu-config], [true], [false])
-   if $have_icu; then
-   ICU_CFLAGS=`icu-config --cppflags`
-   ICU_LIBS=`icu-config --ldflags-libsonly`
-   ICU_CFLAGS=`echo $ICU_CFLAGS | sed s@ -I/usr/include 
@ @`
-   AC_SUBST(ICU_CFLAGS)
-   AC_SUBST(ICU_LIBS)
-   fi
-   else
-   have_icu=false
+   have_icu=true
+   AC_CHECK_HEADERS(unicode/uchar.h,, have_icu=false)
+   AC_MSG_CHECKING([for libicuuc])
+   LIBS_old=$LIBS
+   LIBS=$LIBS -licuuc
+   AC_TRY_LINK([#include unicode/uchar.h],
+   [u_getIntPropertyValue (0, (UProperty)0);],
+   AC_MSG_RESULT(yes),
+   AC_MSG_RESULT(no);have_icu=false)
+   LIBS=$LIBS_old
+   if $have_icu; then
+   ICU_CFLAGS=-D_REENTRANT
+   ICU_LIBS=-licuuc
+   AC_SUBST(ICU_CFLAGS)
+   AC_SUBST(ICU_LIBS)
fi
 ])
 if $have_icu; then
commit f83f0f4836691b04306c2ef80979f2e1d76a2f28
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Sep 19 18:51:48 2011 -0400

[graphite] Add note about graphite shaker brokenness

diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index a3dc1b4..0675759 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -329,6 +329,14 @@ hb_graphite_shape (hb_font_t  *font,
 curradvy += pPos-y_advance;
   }
   pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx;
+
+  /* TODO(behdad):
+   * This shaper is badly broken with RTL text.  It returns glyphs
+   * in the logical order!
+   */
+//  if (HB_DIRECTION_IS_BACKWARD (buffer-props.direction))
+//hb_buffer_reverse (buffer);
+
   success = 1;
 
 dieout:
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2011-09-16 Thread Behdad Esfahbod
 util/options.cc|  101 ++---
 util/options.hh|   36 +-
 util/view-cairo.cc |6 ++-
 3 files changed, 89 insertions(+), 54 deletions(-)

New commits:
commit 55aeb0490454cc1ba93a42f307ed1230f59dee4b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Sep 16 02:08:36 2011 -0400

Fix reading text from stdin

diff --git a/util/options.cc b/util/options.cc
index ff596d0..582e437 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -509,40 +509,64 @@ font_options_t::get_font (void) const
 const char *
 text_options_t::get_line (unsigned int *len)
 {
-  if (!text) {
+  if (text) {
+if (text_len == (unsigned int) -1)
+  text_len = strlen (text);
+
+if (!text_len) {
+  *len = 0;
+  return NULL;
+}
+
+const char *ret = text;
+const char *p = (const char *) memchr (text, '\n', text_len);
+unsigned int ret_len;
+if (!p) {
+  ret_len = text_len;
+  text += ret_len;
+  text_len = 0;
+} else {
+  ret_len = p - ret;
+  text += ret_len + 1;
+  text_len -= ret_len + 1;
+}
+
+*len = ret_len;
+return ret;
+  }
+
+  if (!fp) {
 if (!text_file)
   fail (TRUE, At least one of text or text-file must be set);
 
-GMappedFile *mf = g_mapped_file_new (text_file, FALSE, NULL);
-if (!mf)
-  fail (FALSE, Failed opening text file `%s', g_filename_display_name 
(text_file));
-text = g_mapped_file_get_contents (mf);
-text_len = g_mapped_file_get_length (mf);
-  }
+if (0 != strcmp (text_file, -))
+  fp = fopen (text_file, r);
+else
+  fp = stdin;
 
-  if (text_len == (unsigned int) -1)
-text_len = strlen (text);
+if (!fp)
+  fail (FALSE, Failed opening text file `%s': %s,
+   text_file, strerror (errno));
 
-  if (!text_len) {
-*len = 0;
-return NULL;
+gs = g_string_new (NULL);
   }
 
-  const char *ret = text;
-  const char *p = (const char *) memchr (text, '\n', text_len);
-  unsigned int ret_len;
-  if (!p) {
-ret_len = text_len;
-text += ret_len;
-text_len = 0;
-  } else {
-ret_len = p - ret;
-text += ret_len + 1;
-text_len -= ret_len + 1;
+  g_string_set_size (gs, 0);
+  char buf[BUFSIZ];
+  while (fgets (buf, sizeof (buf), fp)) {
+unsigned int bytes = strlen (buf);
+if (buf[bytes - 1] == '\n') {
+  bytes--;
+  g_string_append_len (gs, buf, bytes);
+  break;
+}
+  g_string_append_len (gs, buf, bytes);
   }
-
-  *len = ret_len;
-  return ret;
+  if (ferror (fp))
+fail (FALSE, Failed reading text: %s,
+ strerror (errno));
+  *len = gs-len;
+  return !*len  feof (fp) ? NULL : gs-str;
 }
 
 
diff --git a/util/options.hh b/util/options.hh
index c521e75..a101f7d 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -178,14 +178,17 @@ struct text_options_t : option_group_t
 text = NULL;
 text_file = NULL;
 
-file = NULL;
+fp = NULL;
+gs = NULL;
 text_len = (unsigned int) -1;
 
 add_options (parser);
   }
   ~text_options_t (void) {
-if (file)
-  g_mapped_file_unref (file);
+if (gs)
+  g_string_free (gs, TRUE);
+if (fp)
+  fclose (fp);
   }
 
   void add_options (option_parser_t *parser);
@@ -204,8 +207,9 @@ struct text_options_t : option_group_t
   const char *text_file;
 
   private:
-  mutable GMappedFile *file;
-  mutable unsigned int text_len;
+  FILE *fp;
+  GString *gs;
+  unsigned int text_len;
 };
 
 struct output_options_t : option_group_t
@@ -219,7 +223,7 @@ struct output_options_t : option_group_t
 add_options (parser);
   }
   ~output_options_t (void) {
-if (fp  fp != stdout)
+if (fp)
   fclose (fp);
   }
 
diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index daa202d..c639abd 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -96,7 +96,7 @@ view_cairo_t::consume_line (hb_buffer_t  *buffer,
   l.glyphs = cairo_glyph_allocate (l.num_glyphs + 1);
   l.utf8 = g_strndup (text, text_len);
   l.utf8_len = text_len;
-  l.num_clusters = 1;
+  l.num_clusters = l.num_glyphs ? 1 : 0;
   for (unsigned int i = 1; i  l.num_glyphs; i++)
 if (hb_glyph[i].cluster != hb_glyph[i-1].cluster)
   l.num_clusters++;
@@ -129,8 +129,9 @@ view_cairo_t::consume_line (hb_buffer_t  *buffer,
   memset ((void *) l.clusters, 0, l.num_clusters * sizeof (l.clusters[0]));
   bool backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer));
   l.cluster_flags = backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : 
(cairo_text_cluster_flags_t) 0;
-  g_assert (l.num_glyphs);
   unsigned int cluster = 0;
+  if (!l.num_glyphs)
+goto done;
   l.clusters[cluster].num_glyphs++;
   if (backward) {
 for (i = l.num_glyphs - 2; i = 0; i--) {
@@ -154,6 +155,7 @@ view_cairo_t::consume_line (hb_buffer_t  *buffer,
 l.clusters[cluster].num_bytes += text_len - hb_glyph[i - 1].cluster;
   }
 
+done:
   g_array_append_val (lines, l);
 }
 
commit a75c1b125159f6cfb6b652a9ec40803f7c7e3f71

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

2011-08-04 Thread Behdad Esfahbod
 TODO |2 
 configure.ac |9 ++
 src/Makefile.am  |   14 ++--
 src/hb-buffer-private.hh |1 
 src/hb-buffer.cc |   35 ++
 src/hb-buffer.h  |3 
 src/hb-fallback-shape-private.hh |   48 +
 src/hb-fallback-shape.cc |   43 
 src/hb-ot-shape.cc   |9 ++
 src/hb-ot-shape.h|5 -
 src/hb-shape.cc  |  135 +++
 src/hb-shape.h   |   13 ++-
 src/hb-uniscribe-shape.cc|   52 ++-
 src/hb-uniscribe.h   |5 -
 src/hb-view.cc   |2 
 src/test.cc  |   37 +-
 test/test-shape.c|2 
 17 files changed, 306 insertions(+), 109 deletions(-)

New commits:
commit 02aeca985b570763342c35e99af90025bfa088d5
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Aug 4 22:31:05 2011 -0400

[API] Changes to main shape API

hb_shape() now accepts a shaper_options and a shaper_list argument.
Both can be set to NULL to emulate previous API.  And in most situations
they are expected to be set to NULL.

hb_shape() also returns a boolean for now.  If shaper_list is NULL, the
return value can be ignored.

shaper_options is ignored for now, but otherwise it should be a
NULL-terminated list of strings.

shaper_list is a NULL-terminated list of strings.  Currently recognized
strings are ot for native OpenType Layout implementation, uniscribe
for the Uniscribe backend, and fallback for the non-complex backend
(that will be implemented shortly).  The fallback backend never fails.

The env var HB_SHAPER_LIST is also parsed and honored.  It's a
colon-separated list of shaper names.  The fallback shaper is invoked if
none of the env-listed shapers succeed.

New API hb_buffer_guess_properties() added.

diff --git a/TODO b/TODO
index ef8f413..577843f 100644
--- a/TODO
+++ b/TODO
@@ -23,8 +23,6 @@ API issues to fix before 1.0:
 
 - Add sanitize API (and a cached version, that saves result on blob user-data)
 
-- hb_shape() currently does a bit more than hb_ot_shape().  Shouldn't.
-
 - Add glib GBoxedType stuff and introspection
 
 
diff --git a/configure.ac b/configure.ac
index 3a6e528..3f13c43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,12 +138,21 @@ AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
 
 dnl ===
 
+have_ot=true;
+if $have_ot; then
+   AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
+fi
+AM_CONDITIONAL(HAVE_OT, $have_ot)
+
+dnl ===
+
 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true, have_uniscribe=false)
 if $have_uniscribe; then
UNISCRIBE_CFLAGS=
UNISCRIBE_LIBS=-lusp10 -lgdi32
AC_SUBST(UNISCRIBE_CFLAGS)
AC_SUBST(UNISCRIBE_LIBS)
+   AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
 fi
 AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index c4f35e9..ff5a6d2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,8 @@ HBSOURCES =  \
hb-buffer-private.hh \
hb-buffer.cc \
hb-common.cc \
+   hb-fallback-shape-private.hh \
+   hb-fallback-shape.cc \
hb-font-private.hh \
hb-font.cc \
hb-mutex-private.hh \
@@ -30,6 +32,7 @@ HBSOURCES =  \
hb-shape.cc \
hb-unicode-private.hh \
hb-unicode.cc \
+   hb-ot-tag.cc \
$(NULL)
 HBHEADERS = \
hb.h \
@@ -42,6 +45,11 @@ HBHEADERS = \
hb-version.h \
$(NULL)
 
+MAINTAINERCLEANFILES += \
+   $(srcdir)/hb-version.h \
+   $(NULL)
+
+if HAVE_OT
 HBSOURCES += \
hb-ot-layout.cc \
hb-ot-layout-common-private.hh \
@@ -62,7 +70,6 @@ HBSOURCES += \
hb-ot-shape-complex-private.hh \
hb-ot-shape-normalize.cc \
hb-ot-shape-private.hh \
-   hb-ot-tag.cc \
$(NULL)
 HBHEADERS += \
hb-ot.h \
@@ -70,10 +77,7 @@ HBHEADERS += \
hb-ot-shape.h \
hb-ot-tag.h \
$(NULL)
-
-MAINTAINERCLEANFILES += \
-   $(srcdir)/hb-version.h \
-   $(NULL)
+endif
 
 if HAVE_GLIB
 HBCFLAGS += $(GLIB_CFLAGS)
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 1a4a423..f3f3ab0 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -94,6 +94,7 @@ struct _hb_buffer_t {
   HB_INTERNAL void reverse_range (unsigned int start, unsigned int end);
   HB_INTERNAL void reverse (void);
   HB_INTERNAL void reverse_clusters (void);
+  HB_INTERNAL void guess_properties (void);
 
   HB_INTERNAL void swap_buffers (void);
   HB_INTERNAL void clear_output (void);
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 

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

2011-07-28 Thread Behdad Esfahbod
 src/hb-buffer-private.hh   |   26 ++--
 src/hb-buffer.cc   |   42 -
 src/hb-ot-layout-gpos-private.hh   |   21 +---
 src/hb-ot-layout-gsub-private.hh   |   21 
 src/hb-ot-layout.cc|8 +---
 src/hb-ot-shape-complex-arabic.cc  |6 +++
 src/hb-ot-shape-complex-indic.cc   |4 +-
 src/hb-ot-shape-complex-private.hh |   10 +-
 src/hb-ot-shape.cc |   60 ++---
 src/hb-private.hh  |1 
 10 files changed, 142 insertions(+), 57 deletions(-)

New commits:
commit b65c06025d2b54a44f716e030d4b10072c65bea8
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu Jul 28 16:48:43 2011 -0400

Formalize buffer var allocations

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index df8e7ee..8f2095a 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -84,26 +84,10 @@ struct _hb_buffer_t {
   { return have_output? out_len : idx; }
   inline unsigned int next_serial (void) { return serial++; }
 
-
   HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, 
const char *owner);
   HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, 
const char *owner);
   HB_INTERNAL void deallocate_var_all (void);
 
-  inline void allocate_var_8 (unsigned int var_num, unsigned int i, const char 
*owner)
-  { assert (var_num  2  i  4); allocate_var (var_num * 4 + i, 1, owner); }
-  inline void allocate_var_16 (unsigned int var_num, unsigned int i, const 
char *owner)
-  { assert (var_num  2  i  2); allocate_var (var_num * 4 + i * 2, 2, 
owner); }
-  inline void allocate_var_32 (unsigned int var_num, const char *owner)
-  { assert (var_num  2); allocate_var (var_num * 4, 4, owner); }
-
-  inline void deallocate_var_8 (unsigned int var_num, unsigned int i, const 
char *owner)
-  { assert (var_num  2  i  4); deallocate_var (var_num * 4 + i, 1, owner); 
}
-  inline void deallocate_var_16 (unsigned int var_num, unsigned int i, const 
char *owner)
-  { assert (var_num  2  i  2); deallocate_var (var_num * 4 + i * 2, 2, 
owner); }
-  inline void deallocate_var_32 (unsigned int var_num, const char *owner)
-  { assert (var_num  2); deallocate_var (var_num * 4, 4, owner); }
-
-
   HB_INTERNAL void add (hb_codepoint_t  codepoint,
hb_mask_t   mask,
unsigned intcluster);
@@ -154,6 +138,15 @@ struct _hb_buffer_t {
 };
 
 
+#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
+  b-func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
+  sizeof (b-info[0].var), owner)
+#define HB_BUFFER_ALLOCATE_VAR(b, var) \
+   HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
+#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
+   HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
+
+
 HB_END_DECLS
 
 #endif /* HB_BUFFER_PRIVATE_HH */
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index a587089..ea05307 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -398,7 +398,7 @@ dump_var_allocation (const hb_buffer_t *buffer)
 {
   char buf[80];
   for (unsigned int i = 0; i  8; i++)
-buf[i] = '0' + buffer-allocated_var_bytes[i];
+buf[i] = '0' + buffer-allocated_var_bytes[7 - i];
   buf[8] = '\0';
   DEBUG_MSG (BUFFER, buffer,
 Current var allocation: %s,
@@ -407,7 +407,7 @@ dump_var_allocation (const hb_buffer_t *buffer)
 
 void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const 
char *owner)
 {
-  assert (byte_i  8  byte_i + count  8);
+  assert (byte_i  8  byte_i + count = 8);
 
   if (DEBUG (BUFFER))
 dump_var_allocation (this);
@@ -424,18 +424,19 @@ void hb_buffer_t::allocate_var (unsigned int byte_i, 
unsigned int count, const c
 
 void hb_buffer_t::deallocate_var (unsigned int byte_i, unsigned int count, 
const char *owner)
 {
+  if (DEBUG (BUFFER))
+dump_var_allocation (this);
+
   DEBUG_MSG (BUFFER, this,
 Deallocating var bytes %d..%d for %s,
 byte_i, byte_i + count - 1, owner);
 
-  assert (byte_i  8  byte_i + count  8);
+  assert (byte_i  8  byte_i + count = 8);
   for (unsigned int i = byte_i; i  byte_i + count; i++) {
-assert (allocated_var_bytes[i]  allocated_var_owner[i] == owner);
+assert (allocated_var_bytes[i]);
+assert (0 == strcmp (allocated_var_owner[i], owner));
 allocated_var_bytes[i]--;
   }
-
-  if (DEBUG (BUFFER))
-dump_var_allocation (this);
 }
 
 void hb_buffer_t::deallocate_var_all (void)
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 6e1757a..e5edb3c 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -34,7 +34,7 @@
 HB_BEGIN_DECLS
 
 
-/* buffer var allocations */
+/* buffer **position** var allocations */
 #define attach_lookback() var.u16[0] /* number of glyphs to go back to attach 
this glyph to its base */
 #define cursive_chain() 

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

2011-05-12 Thread Behdad Esfahbod
 test/Makefile.am |1 +
 test/test-blob.c |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c098c3acc8c48b4b6883c50c9a87e81dbe98ba24
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 12 10:49:30 2011 -0400

[test/blob] Use MAP_ANON instead of MAP_ANONYMOUS

More portable.

diff --git a/test/test-blob.c b/test/test-blob.c
index beb23a5..f3f7a86 100644
--- a/test/test-blob.c
+++ b/test/test-blob.c
@@ -169,7 +169,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data)
 {
   uintptr_t pagesize = get_pagesize ();
 
-  data = mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | 
MAP_ANONYMOUS, -1, 0);
+  data = mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | 
MAP_ANON, -1, 0);
   g_assert (data != (char *) -1);
   memcpy ((char *) data, test_data, sizeof (test_data));
   mprotect ((char *) data, pagesize, PROT_READ);
commit 8329eb7c6ca39e162228733a2210e643b1a1019d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 12 01:39:17 2011 -0400

[test/shape] Add simplest test for hb_shape()

diff --git a/test/Makefile.am b/test/Makefile.am
index 6956bba..f2eaff0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -17,6 +17,7 @@ TEST_PROGS += \
test-common \
test-font \
test-object \
+   test-shape \
test-unicode \
$(NULL)
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2011-04-20 Thread Behdad Esfahbod
 src/hb-ot-tag.c |4 ++--
 src/hb-view.c   |1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 440a76b630a36a7336c93e8b05d988c6407b085e
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 20 14:20:00 2011 -0400

[OT] Fix script to ot-script-tag conversion

diff --git a/src/hb-ot-tag.c b/src/hb-ot-tag.c
index ecc1882..f7e8c95 100644
--- a/src/hb-ot-tag.c
+++ b/src/hb-ot-tag.c
@@ -52,7 +52,7 @@ hb_ot_old_tag_from_script (hb_script_t script)
   }
 
   /* Else, just change first char to lowercase and return */
-  return ((hb_tag_t) script) | 0x0200;
+  return ((hb_tag_t) script) | 0x2000;
 }
 
 static hb_script_t
@@ -73,7 +73,7 @@ hb_ot_old_tag_to_script (hb_tag_t tag)
   }
 
   /* Else, just change first char to uppercase and return */
-  return (hb_script_t) (tag  ~0x0200);
+  return (hb_script_t) (tag  ~0x2000);
 }
 
 static hb_tag_t
commit a3036a3e97b14c8eb1df208aed944207f9b6cc0b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Apr 20 14:13:23 2011 -0400

Minor

diff --git a/src/hb-view.c b/src/hb-view.c
index 4e61ee7..60097b9 100644
--- a/src/hb-view.c
+++ b/src/hb-view.c
@@ -37,7 +37,6 @@
 #include math.h
 #include locale.h
 
-#include glib.h
 #include hb-glib.h
 
 #include cairo-ft.h
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2011-04-18 Thread Behdad Esfahbod
 src/hb-buffer.cc |   16 
 src/hb-buffer.h  |   10 ++
 src/hb-ot-layout-gpos-private.hh |4 ++--
 src/hb-view.c|4 ++--
 test/test-buffer.c   |7 ++-
 5 files changed, 24 insertions(+), 17 deletions(-)

New commits:
commit 02a534b23f2d1e7475109563b9f61221ed020e8b
Author: Ryan Lortie de...@desrt.ca
Date:   Fri Apr 15 18:34:45 2011 -0400

[API] Rename hb_buffer_ensure() to hb_buffer_pre_allocate()

The new name is self-documenting.

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 596d38c..11639ef 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -255,7 +255,7 @@ hb_buffer_reset (hb_buffer_t *buffer)
 }
 
 hb_bool_t
-hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
+hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size)
 {
   return _hb_buffer_ensure (buffer, size);
 }
@@ -453,7 +453,7 @@ hb_bool_t
 hb_buffer_set_length (hb_buffer_t  *buffer,
  unsigned int  length)
 {
-  if (!hb_buffer_ensure (buffer, length))
+  if (!_hb_buffer_ensure (buffer, length))
 return FALSE;
 
   /* Wipe the new space */
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index 3c0a442..0c3ef3a 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -107,8 +107,8 @@ void
 hb_buffer_reset (hb_buffer_t *buffer);
 
 hb_bool_t
-hb_buffer_ensure (hb_buffer_t  *buffer,
- unsigned int  size);
+hb_buffer_pre_allocate (hb_buffer_t  *buffer,
+   unsigned int  size);
 
 void
 hb_buffer_reverse (hb_buffer_t *buffer);
commit 70566befc59cfa8b9c43ac682749c40ea783b1dd
Author: Ryan Lortie de...@desrt.ca
Date:   Fri Apr 15 18:32:36 2011 -0400

[API} hb_buffer_get_glyph_{infos,positions}: Add length out parameter

Return the length, whenever we return an array.  Makes it easier on the
language bindings.

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index b71aa57..596d38c 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -475,18 +475,26 @@ hb_buffer_get_length (hb_buffer_t *buffer)
 
 /* Return value valid as long as buffer not modified */
 hb_glyph_info_t *
-hb_buffer_get_glyph_infos (hb_buffer_t *buffer)
+hb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
+   unsigned int *length)
 {
+  if (length)
+*length = buffer-len;
+
   return (hb_glyph_info_t *) buffer-info;
 }
 
 /* Return value valid as long as buffer not modified */
 hb_glyph_position_t *
-hb_buffer_get_glyph_positions (hb_buffer_t *buffer)
+hb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
+   unsigned int *length)
 {
   if (!buffer-have_positions)
 _hb_buffer_clear_positions (buffer);
 
+  if (length)
+*length = buffer-len;
+
   return (hb_glyph_position_t *) buffer-pos;
 }
 
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index 293ec82..3c0a442 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -160,11 +160,13 @@ hb_buffer_get_length (hb_buffer_t *buffer);
 
 /* Return value valid as long as buffer not modified */
 hb_glyph_info_t *
-hb_buffer_get_glyph_infos (hb_buffer_t *buffer);
+hb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
+   unsigned int *length);
 
 /* Return value valid as long as buffer not modified */
 hb_glyph_position_t *
-hb_buffer_get_glyph_positions (hb_buffer_t *buffer);
+hb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
+   unsigned int *length);
 
 
 HB_END_DECLS
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 11bb286..36acf89 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1493,8 +1493,8 @@ void
 GPOS::position_finish (hb_buffer_t *buffer)
 {
   unsigned int i, j;
-  unsigned int len = hb_buffer_get_length (buffer);
-  hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer);
+  unsigned int len;
+  hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, len);
   hb_direction_t direction = buffer-props.direction;
 
   /* Handle cursive connections:
diff --git a/src/hb-view.c b/src/hb-view.c
index d7e41fd..4e61ee7 100644
--- a/src/hb-view.c
+++ b/src/hb-view.c
@@ -361,8 +361,8 @@ _hb_cr_text_glyphs (cairo_t *cr,
   hb_shape (hb_font, hb_face, hb_buffer, features, num_features);
 
   num_glyphs = hb_buffer_get_length (hb_buffer);
-  hb_glyph = hb_buffer_get_glyph_infos (hb_buffer);
-  hb_position = hb_buffer_get_glyph_positions (hb_buffer);
+  hb_glyph = hb_buffer_get_glyph_infos (hb_buffer, NULL);
+  hb_position = hb_buffer_get_glyph_positions (hb_buffer, NULL);
   cairo_glyphs = cairo_glyph_allocate (num_glyphs + 1);
   x = 0;
   for (i = 0; i  num_glyphs; i++)
diff --git a/test/test-buffer.c b/test/test-buffer.c
index dad2eac..c2b199b 100644
--- a/test/test-buffer.c
+++ b/test/test-buffer.c
@@ -126,11 +126,9 @@ test_buffer_contents (Fixture *fixture, gconstpointer 
user_data)
 return;
   }
 
-  len = hb_buffer_get_length 

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

2011-04-18 Thread Behdad Esfahbod
 src/hb-buffer.cc   |   16 +++-
 src/hb-buffer.h|   14 ++
 test/test-buffer.c |4 ++--
 3 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit f85faee9b3cb841ea977403945e2c877ab32b97a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 19 00:38:01 2011 -0400

[API] Rename hb_buffer_add_glyph() to hb_buffer_add()

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 68ef594..2f7a173 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -267,10 +267,10 @@ hb_buffer_allocation_successful (hb_buffer_t  *buffer)
 }
 
 void
-hb_buffer_add_glyph (hb_buffer_t*buffer,
-hb_codepoint_t  codepoint,
-hb_mask_t   mask,
-unsigned intcluster)
+hb_buffer_add (hb_buffer_t*buffer,
+  hb_codepoint_t  codepoint,
+  hb_mask_t   mask,
+  unsigned intcluster)
 {
   hb_glyph_info_t *glyph;
 
@@ -572,7 +572,7 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer)
hb_codepoint_t u; \
const T *old_next = next; \
next = UTF_NEXT (next, end, u); \
-   hb_buffer_add_glyph (buffer, u, 1,  old_next - (const T *) text); \
+   hb_buffer_add (buffer, u, 1,  old_next - (const T *) text); \
  } \
} HB_STMT_END
 
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index c22e31d..d12faf8 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -126,10 +126,10 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer);
 /* Filling the buffer in */
 
 void
-hb_buffer_add_glyph (hb_buffer_t*buffer,
-hb_codepoint_t  codepoint,
-hb_mask_t   mask,
-unsigned intcluster);
+hb_buffer_add (hb_buffer_t*buffer,
+  hb_codepoint_t  codepoint,
+  hb_mask_t   mask,
+  unsigned intcluster);
 
 void
 hb_buffer_add_utf8 (hb_buffer_t  *buffer,
diff --git a/test/test-buffer.c b/test/test-buffer.c
index 9522515..464ec89 100644
--- a/test/test-buffer.c
+++ b/test/test-buffer.c
@@ -68,7 +68,7 @@ fixture_init (Fixture *fixture, gconstpointer user_data)
 
 case BUFFER_ONE_BY_ONE:
   for (i = 1; i  G_N_ELEMENTS (utf32) - 1; i++)
-   hb_buffer_add_glyph (fixture-b, utf32[i], 1, i);
+   hb_buffer_add (fixture-b, utf32[i], 1, i);
   break;
 
 case BUFFER_UTF32:
commit aab0de50e23727b69fa8c3d4e05c50c114c62835
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Apr 19 00:32:19 2011 -0400

[API] Add hb_buffer_allocation_successful()

Returns the error status of the buffer.

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 11639ef..68ef594 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -260,6 +260,12 @@ hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int 
size)
   return _hb_buffer_ensure (buffer, size);
 }
 
+hb_bool_t
+hb_buffer_allocation_successful (hb_buffer_t  *buffer)
+{
+  return !buffer-in_error;
+}
+
 void
 hb_buffer_add_glyph (hb_buffer_t*buffer,
 hb_codepoint_t  codepoint,
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index 0c3ef3a..c22e31d 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -106,10 +106,16 @@ hb_buffer_get_language (hb_buffer_t *buffer);
 void
 hb_buffer_reset (hb_buffer_t *buffer);
 
+/* Returns FALSE if allocation failed */
 hb_bool_t
 hb_buffer_pre_allocate (hb_buffer_t  *buffer,
unsigned int  size);
 
+
+/* Returns FALSE if allocation has failed before */
+hb_bool_t
+hb_buffer_allocation_successful (hb_buffer_t  *buffer);
+
 void
 hb_buffer_reverse (hb_buffer_t *buffer);
 
diff --git a/test/test-buffer.c b/test/test-buffer.c
index c2b199b..9522515 100644
--- a/test/test-buffer.c
+++ b/test/test-buffer.c
@@ -185,7 +185,7 @@ main (int argc, char **argv)
 
   /* XXX test invalid UTF-8 / UTF-16 text input (also overlong sequences) */
   /* XXX test reverse() and reverse_clusters() */
-  /* XXX test ensure() and memory management */
+  /* XXX test pre_allocate(), allocation_successful(), and memory management */
   /* XXX test buffer reset */
   /* XXX test buffer set length */
 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2010-12-21 Thread Behdad Esfahbod
 src/gen-arabic-joining-table.py|   93 -
 src/hb-ot-shape-complex-arabic-table.h |   24 +++-
 src/hb-ot-shape-complex-private.hh |1 
 3 files changed, 81 insertions(+), 37 deletions(-)

New commits:
commit b0e7378fa9a4fc6fc74d9b3c27d927602eaacc5b
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Dec 21 14:19:32 2010 -0500

Reroute Mandaic shaping through the Arabic shaper

We added Mandaic joining data to the Arabic shaper a while ago, but
were not actually using the Arabic shaper for Mandaic.  Fixed.

diff --git a/src/hb-ot-shape-complex-private.hh 
b/src/hb-ot-shape-complex-private.hh
index a3796b4..788d18a 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -41,6 +41,7 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t 
*props)
 case HB_SCRIPT_ARABIC:
 case HB_SCRIPT_NKO:
 case HB_SCRIPT_SYRIAC:
+case HB_SCRIPT_MANDAIC:
   return hb_ot_complex_shaper_arabic;
 
 default:
commit 88e7f37488e4e8590619d815b975232a0c9d2ea0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue Dec 21 14:18:24 2010 -0500

Annotate the Arabic joining table with block information

diff --git a/src/gen-arabic-joining-table.py b/src/gen-arabic-joining-table.py
index 75ea733..08e54db 100755
--- a/src/gen-arabic-joining-table.py
+++ b/src/gen-arabic-joining-table.py
@@ -2,29 +2,10 @@
 
 import sys
 
-header = sys.stdin.readline(), sys.stdin.readline()
-dic = dict()
-for line in sys.stdin:
-   if line[:1] != '0':
-   continue
-
-   fields = [x.strip() for x in line.split(';')]
-   u = int(fields[0], 16)
+header = sys.stdin.readline (), sys.stdin.readline ()
+while sys.stdin.readline ().find ('##')  0:
+   pass
 
-   if u == 0x200C or u == 0x200D:
-   continue
-   if u  0x0600:
-   raise Exception (Ooops, unexpected unicode character: , 
fields)
-   dic[u] = fields
-
-v = dic.keys()
-v.sort()
-min_u, max_u = v[0], v[-1]
-occupancy = len(v) * 100 / (max_u - min_u + 1)
-
-# Maintain at least 40% occupancy in the table */
-if occupancy  40:
-   raise Exception (Table too sparse, please investigate: , occupancy)
 
 print /* == Start of generated table == */
 print /*
@@ -38,21 +19,65 @@ for line in header:
print  * %s % (line.strip())
 print  */
 
-print #define JOINING_TABLE_FIRST 0x%04x % min_u
-print #define JOINING_TABLE_LAST  0x%04x % max_u
-print static const uint8_t 
joining_table[JOINING_TABLE_LAST-JOINING_TABLE_FIRST+2] =
+print static const uint8_t joining_table[] =
 print {
 
-for i in range(min_u, max_u + 1):
-   if i not in dic:
-   print   JOINING_TYPE_X, /* %04X */ % i
+
+min_u = 0x11
+max_u = 0
+num = 0
+last = -1
+block = ''
+for line in sys.stdin:
+   
+   if line[0] == '#':
+   if line.find ( characters):
+   block = line[2:].strip ()
+   continue
+
+   fields = [x.strip () for x in line.split (';')]
+   if len (fields) == 1:
+   continue
+
+   u = int (fields[0], 16)
+   if u == 0x200C or u == 0x200D:
+   continue
+   if u  last:
+   raise Exception (Input data character not sorted, u)
+   min_u = min (min_u, u)
+   max_u = max (max_u, u)
+   num += 1
+
+   if block:
+   print \n  /* %s */\n % block
+   block = ''
+
+   if last != -1:
+   last += 1
+   while last  u:
+   print   JOINING_TYPE_X, /* %04X */ % last
+   last += 1
+   else:
+   last = u
+
+   if fields[3] in [ALAPH, DALATH RISH]:
+   value = JOINING_GROUP_ + fields[3].replace(' ', '_')
else:
-   entry = dic[i]
-   if entry[3] in [ALAPH, DALATH RISH]:
-   value = JOINING_GROUP_ + entry[3].replace(' ', '_')
-   else:
-   value = JOINING_TYPE_ + entry[2]
-   print   %s, /* %s */ % (value, '; '.join(entry))
+   value = JOINING_TYPE_ + fields[2]
+   print   %s, /* %s */ % (value, '; '.join(fields))
+
+print
 print   JOINING_TYPE_X  /* dummy */
 print };
+print
+
+print #define JOINING_TABLE_FIRST 0x%04x % min_u
+print #define JOINING_TABLE_LAST  0x%04x % max_u
+print
+
 print /* == End of generated table == */
+
+occupancy = num * 100 / (max_u - min_u + 1)
+# Maintain at least 40% occupancy in the table */
+if occupancy  40:
+   raise Exception (Table too sparse, please investigate: , occupancy)
diff --git a/src/hb-ot-shape-complex-arabic-table.h 
b/src/hb-ot-shape-complex-arabic-table.h
index 861c6d0..523fc84 100644
--- a/src/hb-ot-shape-complex-arabic-table.h
+++ b/src/hb-ot-shape-complex-arabic-table.h
@@ -42,10 +42,11 @@ HB_BEGIN_DECLS
  * # ArabicShaping-6.1.0.txt
  * # Date: 2010-11-09, 12:10:00 PST [KW]
  */
-#define 

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

2010-11-28 Thread Behdad Esfahbod
 contrib/python/lib/harfbuzz.pyx|7 --
 src/hb-ot-shape-complex-arabic-table.h |   37 +
 2 files changed, 42 insertions(+), 2 deletions(-)

New commits:
commit 3c48982be6b2286088541ee55cac78b0f2b6e771
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Nov 28 19:39:47 2010 -0500

Adjust pyx files to reflect change from int to hb_var_int_t

Patch from Thomas Hunger.

diff --git a/contrib/python/lib/harfbuzz.pyx b/contrib/python/lib/harfbuzz.pyx
index 4d71ead..f483fd6 100644
--- a/contrib/python/lib/harfbuzz.pyx
+++ b/contrib/python/lib/harfbuzz.pyx
@@ -52,12 +52,15 @@ cdef extern from hb-buffer.h :
 hb_mask_t mask
 unsigned long cluster
 
+ctypedef union hb_var_int_t:
+unsigned long u32
+
 ctypedef struct hb_glyph_position_t :
 hb_position_t x_advance
 hb_position_t y_advance
 hb_position_t x_offset
 hb_position_t y_offset
-unsigned long internal
+hb_var_int_t  var
 
 hb_buffer_t *hb_buffer_create(unsigned int size)
 hb_buffer_t *hb_buffer_reference(hb_buffer_t *buffer)
@@ -156,7 +159,7 @@ cdef class buffer :
 infos = hb_buffer_get_glyph_infos(self.buffer)
 positions = hb_buffer_get_glyph_positions(self.buffer)
 for 0 = i  num :
-temp = glyphinfo(infos[i].codepoint, infos[i].cluster, 
(positions[i].x_advance / scale, positions[i].y_advance / scale), 
(positions[i].x_offset / scale, positions[i].y_offset / scale), 
positions[i].internal)
+temp = glyphinfo(infos[i].codepoint, infos[i].cluster, 
(positions[i].x_advance / scale, positions[i].y_advance / scale), 
(positions[i].x_offset / scale, positions[i].y_offset / scale), 
positions[i].var.u32)
 res.append(temp)
 return res
 
commit 4f9e4a40bc248aeb1364ed6f4aa7f392aa364497
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Nov 22 11:30:32 2010 -0500

Fix failing checks

diff --git a/src/hb-ot-shape-complex-arabic-table.h 
b/src/hb-ot-shape-complex-arabic-table.h
index f5cd0fe..861c6d0 100644
--- a/src/hb-ot-shape-complex-arabic-table.h
+++ b/src/hb-ot-shape-complex-arabic-table.h
@@ -1,3 +1,36 @@
+/*
+ * Copyright (C) 2010  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_H
+#define HB_OT_SHAPE_COMPLEX_ARABIC_TABLE_H
+
+#include hb-private.h
+
+HB_BEGIN_DECLS
+
 /* == Start of generated table == */
 /*
  * The following table is generated by running:
@@ -617,3 +650,7 @@ static const uint8_t 
joining_table[JOINING_TABLE_LAST-JOINING_TABLE_FIRST+2] =
   JOINING_TYPE_X  /* dummy */
 };
 /* == End of generated table == */
+
+HB_END_DECLS
+
+#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_TABLE_H */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2010-10-26 Thread Behdad Esfahbod
 configure.ac  |2 -
 src/hb-font-private.h |3 +
 src/hb-font.cc|   96 ++
 src/hb-font.h |   61 +++
 src/hb-ft.c   |   72 ++---
 src/hb-ot-shape.cc|9 +---
 6 files changed, 154 insertions(+), 89 deletions(-)

New commits:
commit 248e3c2ba47889c247959e44166644872aed59ba
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Oct 27 01:23:14 2010 -0400

Oops, remove extra mask setting that broke complex shaping

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 91ed400..5770cbf 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -88,8 +88,6 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
 
   hb_ot_shape_complex_setup_masks (c);
 
-  c-buffer-reset_masks (global_mask);
-
   for (unsigned int i = 0; i  c-num_user_features; i++)
   {
 const hb_feature_t *feature = c-user_features[i];
commit 502f4cba3e0bcd625d31f8fd295b8b18e2d02a5a
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed Oct 27 01:13:56 2010 -0400

Divide get_metrics into get_advance and get_extents

Graphite module not updated.
Bump version to 0.3.

diff --git a/configure.ac b/configure.ac
index e74dd67..bda299a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
-AC_INIT(harfbuzz, 0.2, 
[http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz])
+AC_INIT(harfbuzz, 0.3, 
[http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz])
 AC_CONFIG_SRCDIR([harfbuzz.pc.in])
 AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([1.9.6 gnu dist-bzip2 no-dist-gzip -Wall no-define])
diff --git a/src/hb-font-private.h b/src/hb-font-private.h
index f91da83..b147bce 100644
--- a/src/hb-font-private.h
+++ b/src/hb-font-private.h
@@ -45,8 +45,9 @@ struct _hb_font_funcs_t {
 
   struct {
 hb_font_get_glyph_func_t   get_glyph;
+hb_font_get_glyph_advance_func_t   get_glyph_advance;
+hb_font_get_glyph_extents_func_t   get_glyph_extents;
 hb_font_get_contour_point_func_t   get_contour_point;
-hb_font_get_glyph_metrics_func_t   get_glyph_metrics;
 hb_font_get_kerning_func_t get_kerning;
   } v;
 };
diff --git a/src/hb-font.cc b/src/hb-font.cc
index bd55681..63631a9 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -49,24 +49,33 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
   hb_codepoint_t variation_selector HB_UNUSED)
 { return 0; }
 
-static hb_bool_t
-hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
+static void
+hb_font_get_glyph_advance_nil (hb_font_t *font HB_UNUSED,
   hb_face_t *face HB_UNUSED,
   const void *user_data HB_UNUSED,
-  unsigned int point_index HB_UNUSED,
   hb_codepoint_t glyph HB_UNUSED,
-  hb_position_t *x HB_UNUSED,
-  hb_position_t *y HB_UNUSED)
-{ return false; }
+  hb_position_t *x_advance HB_UNUSED,
+  hb_position_t *y_advance HB_UNUSED)
+{ }
 
 static void
-hb_font_get_glyph_metrics_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
   hb_face_t *face HB_UNUSED,
   const void *user_data HB_UNUSED,
   hb_codepoint_t glyph HB_UNUSED,
-  hb_glyph_metrics_t *metrics HB_UNUSED)
+  hb_glyph_extents_t *extents HB_UNUSED)
 { }
 
+static hb_bool_t
+hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
+  hb_face_t *face HB_UNUSED,
+  const void *user_data HB_UNUSED,
+  unsigned int point_index HB_UNUSED,
+  hb_codepoint_t glyph HB_UNUSED,
+  hb_position_t *x HB_UNUSED,
+  hb_position_t *y HB_UNUSED)
+{ return false; }
+
 static hb_position_t
 hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
 hb_face_t *face HB_UNUSED,
@@ -80,8 +89,9 @@ hb_font_funcs_t _hb_font_funcs_nil = {
   TRUE,  /* immutable */
   {
 hb_font_get_glyph_nil,
+hb_font_get_glyph_advance_nil,
+hb_font_get_glyph_extents_nil,
 hb_font_get_contour_point_nil,
-hb_font_get_glyph_metrics_nil,
 hb_font_get_kerning_nil
   }
 };
@@ -159,23 +169,33 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
 }
 
 void
-hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
- hb_font_get_contour_point_func_t 
contour_point_func)
+hb_font_funcs_set_glyph_advance_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_glyph_advance_func_t 
glyph_advance_func)
 {
   if (ffuncs-immutable)
 return;
 
-  

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

2010-10-01 Thread Behdad Esfahbod
 src/hb-open-type-private.hh|   12 ++--
 src/hb-ot-head-private.hh  |7 +++
 src/hb-ot-layout-common-private.hh |2 +-
 src/hb-ot-layout-gdef-private.hh   |   10 +-
 src/hb-ot-layout-gpos-private.hh   |6 +++---
 src/hb-ot-layout-private.hh|6 +++---
 6 files changed, 25 insertions(+), 18 deletions(-)

New commits:
commit ac0c1663fa6e93a5a94c88fc7497bc11ca17f0a1
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Oct 1 19:09:23 2010 -0400

Avoid div-by-zero, validate upem

diff --git a/src/hb-ot-head-private.hh b/src/hb-ot-head-private.hh
index a3e87a9..56a5861 100644
--- a/src/hb-ot-head-private.hh
+++ b/src/hb-ot-head-private.hh
@@ -42,12 +42,19 @@ struct head
 {
   static const hb_tag_t Tag= HB_OT_TAG_head;
 
+  inline unsigned int get_upem (void) const {
+unsigned int upem = unitsPerEm;
+/* If no valid head table found, assume 1000, which matches typicaly Type1 
usage. */
+return 16 = upem  upem = 16384 ? upem : 1000;
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
 TRACE_SANITIZE ();
 /* Shall we check for magicNumber here?  Who cares? */
 return c-check_struct (this)  likely (version.major == 1);
   }
 
+  private:
   FixedVersion version;/* Version of the head table--currently
 * 0x0001 for version 1.0. */
   FixedVersion fontRevision;   /* Set by font manufacturer. */
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 8e041ba..c1ae99f 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -77,9 +77,9 @@ struct hb_ot_layout_context_t
   } info;
 
   /* Convert from font-space to user-space */
-  /* XXX div-by-zero / speed up */
-  inline hb_position_t scale_x (int16_t v) { return (int64_t) 
this-font-x_scale * v / this-face-head_table-unitsPerEm; }
-  inline hb_position_t scale_y (int16_t v) { return (int64_t) 
this-font-y_scale * v / this-face-head_table-unitsPerEm; }
+  /* XXX speed up */
+  inline hb_position_t scale_x (int16_t v) { return (int64_t) 
this-font-x_scale * v / this-face-head_table-get_upem (); }
+  inline hb_position_t scale_y (int16_t v) { return (int64_t) 
this-font-y_scale * v / this-face-head_table-get_upem (); }
 };
 
 
commit 7f97d2cd904ea999c099c73c52187c5d65aeec67
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Oct 1 18:58:50 2010 -0400

Pedantic

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 62a7c88..b83a2e3 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -126,7 +126,7 @@ static const void *_NullPool[64 / sizeof (void *)];
 
 /* Generic nul-content Null objects. */
 template typename Type
-static inline const Type Null () {
+static inline const Type Null (void) {
   ASSERT_STATIC (Type::min_size = sizeof (_NullPool));
   return *CastPType (_NullPool);
 }
@@ -135,7 +135,7 @@ static inline const Type Null () {
 #define DEFINE_NULL_DATA(Type, data) \
 static const char _Null##Type[Type::min_size + 1] = data; /* +1 is for 
nul-termination in data */ \
 template  \
-inline const Type NullType () { \
+inline const Type NullType (void) { \
   return *CastPType (_Null##Type); \
 } /* The following line really exists such that we end in a place needing 
semicolon */ \
 ASSERT_STATIC (Type::min_size + 1 = sizeof (_Null##Type))
@@ -373,7 +373,7 @@ class BEIntType, 2
 {
   public:
   inline void set (Type i) { hb_be_uint16_put (v,i); }
-  inline operator Type () const { return hb_be_uint16_get (v); }
+  inline operator Type (void) const { return hb_be_uint16_get (v); }
   inline bool operator == (const BEIntType, 2 o) const { return 
hb_be_uint16_cmp (v, o.v); }
   inline bool operator != (const BEIntType, 2 o) const { return !(*this == 
o); }
   private: uint8_t v[2];
@@ -383,7 +383,7 @@ class BEIntType, 4
 {
   public:
   inline void set (Type i) { hb_be_uint32_put (v,i); }
-  inline operator Type () const { return hb_be_uint32_get (v); }
+  inline operator Type (void) const { return hb_be_uint32_get (v); }
   inline bool operator == (const BEIntType, 4 o) const { return 
hb_be_uint32_cmp (v, o.v); }
   inline bool operator != (const BEIntType, 4 o) const { return !(*this == 
o); }
   private: uint8_t v[4];
@@ -571,7 +571,7 @@ struct GenericArrayOf
 if (unlikely (i = len)) return Null(Type);
 return array[i];
   }
-  inline unsigned int get_size () const
+  inline unsigned int get_size (void) const
   { return len.static_size + len * Type::static_size; }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
@@ -677,7 +677,7 @@ struct HeadlessArrayOf
 if (unlikely (i = len || !i)) return Null(Type);
 return array[i-1];
   }
-  inline unsigned int get_size () const
+  inline unsigned int get_size (void) const
   { return len.static_size + (len ? len - 1 : 0) * Type::static_size; }
 
   inline bool sanitize_shallow (hb_sanitize_context_t *c) {
diff --git 

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

2010-05-28 Thread Behdad Esfahbod
 src/hb-ot-shape.cc |   54 -
 1 file changed, 25 insertions(+), 29 deletions(-)

New commits:
commit 8af45fda475d075c5a285002463a00a0423d3926
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri May 28 20:41:20 2010 -0400

Fix global feature handling

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index a3cb89b..87cdf47 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -168,8 +168,12 @@ struct hb_mask_allocator_t {
   if (infos[i].tag != infos[j].tag)
infos[++j] = infos[i];
   else {
-   if (!infos[j].global)
+   if (infos[i].global)
+ infos[j] = infos[i];
+   else {
+ infos[j].global = infos[j].global  (infos[j].value == 
infos[i].value);
  infos[j].value = MAX (infos[j].value, infos[i].value);
+   }
   }
 count = j + 1;
 
commit e04685ee7be01695ec437fab50f919f1b7423c57
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri May 28 20:37:06 2010 -0400

Simplify mask allocation

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 2944d31..a3cb89b 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -136,35 +136,20 @@ struct hb_mask_allocator_t {
   hb_mask_allocator_t (hb_face_t *face,
   hb_tag_t table_tag,
   unsigned int script_index,
-  unsigned int language_index,
-  const hb_feature_t *features,
-  unsigned int num_features) :
+  unsigned int language_index) :
 face (face),
 table_tag (table_tag),
 script_index (script_index),
 language_index (language_index),
-count (0)
-  {
-if (!num_features)
-  return;
-
-/* Add features in reverse order */
-for (unsigned int i = num_features - 1, count = 0; count  num_features; 
i--, count++) {
-  const hb_feature_t *feature = features[i];
-  feature_info_t *info = infos[count];
+count (0) {}
 
-  info-tag = feature-tag;
-  info-value = feature-value;
-  info-global = (feature-start == 0  feature-end == (unsigned int) 
-1);
-}
-  }
-
-  void add_binary_feature (hb_tag_t tag,
-  bool global)
+  void add_feature (hb_tag_t tag,
+   unsigned int value,
+   bool global)
   {
 feature_info_t *info = infos[count++];
 info-tag = tag;
-info-value = 1;
+info-value = value;
 info-global = global;
   }
 
@@ -278,17 +263,17 @@ setup_lookups (hb_face_t*face,
 add_feature (face, table_tag, feature_index, 1, lookups, num_lookups, 
room_lookups);
 
 
-  hb_mask_allocator_t allocator (face, table_tag, script_index, 
language_index, features, num_features);
+  hb_mask_allocator_t allocator (face, table_tag, script_index, 
language_index);
 
   switch (original_direction) {
 case HB_DIRECTION_LTR:
-  allocator.add_binary_feature (HB_TAG ('l','t','r','a'), true);
-  allocator.add_binary_feature (HB_TAG ('l','t','r','m'), true);
+  allocator.add_feature (HB_TAG ('l','t','r','a'), 1, true);
+  allocator.add_feature (HB_TAG ('l','t','r','m'), 1, true);
   break;
 case HB_DIRECTION_RTL:
-  allocator.add_binary_feature (HB_TAG ('r','t','l','a'), true);
-  //allocator.add_binary_feature (HB_TAG ('r','t','l','m'), false);
-  allocator.add_binary_feature (HB_TAG ('r','t','l','m'), true);
+  allocator.add_feature (HB_TAG ('r','t','l','a'), 1, true);
+  //allocator.add_feature (HB_TAG ('r','t','l','m'), false);
+  allocator.add_feature (HB_TAG ('r','t','l','m'), 1, true);
   break;
 case HB_DIRECTION_TTB:
 case HB_DIRECTION_BTT:
@@ -297,7 +282,14 @@ setup_lookups (hb_face_t*face,
   }
 
   for (i = 0; i  ARRAY_LENGTH (default_features); i++)
-allocator.add_binary_feature (default_features[i], true);
+allocator.add_feature (default_features[i], 1, true);
+
+  /* XXX complex-shaper features go here */
+
+  for (unsigned int i = 0; i  num_features; i++) {
+const hb_feature_t *feature = features[i];
+allocator.add_feature (feature-tag, feature-value, (feature-start == 0 
 feature-end == (unsigned int) -1));
+  }
 
 
   /* Compile features */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2010-05-10 Thread Behdad Esfahbod
 src/hb-open-type-private.hh  |   14 +-
 src/hb-ot-layout-gpos-private.hh |   14 +++---
 src/hb-ot-layout-gsub-private.hh |   14 +++---
 src/hb-ot-layout-gsubgpos-private.hh |3 +--
 4 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit fe9bc070e1d545b0df2ea548eebf5a1fc4c92ddc
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon May 10 21:39:24 2010 -0400

Fix awful confusion between lookup format and subtable format

As reported by John Daggett.

diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index bbb0dca..c814893 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1458,10 +1458,10 @@ struct PosLookupSubTable
 }
   }
 
-  inline bool sanitize (hb_sanitize_context_t *context) {
+  inline bool sanitize (hb_sanitize_context_t *context, unsigned int 
lookup_type) {
 TRACE_SANITIZE ();
-if (!u.format.sanitize (context)) return false;
-switch (u.format) {
+if (!u.sub_format.sanitize (context)) return false;
+switch (lookup_type) {
 case Single:   return u.single.sanitize (context);
 case Pair: return u.pair.sanitize (context);
 case Cursive:  return u.cursive.sanitize (context);
@@ -1477,7 +1477,7 @@ struct PosLookupSubTable
 
   private:
   union {
-  USHORT   format;
+  USHORT   sub_format;
   SinglePossingle;
   PairPos  pair;
   CursivePos   cursive;
@@ -1489,7 +1489,7 @@ struct PosLookupSubTable
   ExtensionPos extension;
   } u;
   public:
-  DEFINE_SIZE_UNION (2, format);
+  DEFINE_SIZE_UNION (2, sub_format);
 };
 
 
@@ -1563,7 +1563,7 @@ struct PosLookup : Lookup
 TRACE_SANITIZE ();
 if (unlikely (!Lookup::sanitize (context))) return false;
 OffsetArrayOfPosLookupSubTable list = 
CastROffsetArrayOfPosLookupSubTable  (subTable);
-return list.sanitize (context, this);
+return list.sanitize (context, this, get_type ());
   }
 };
 
@@ -1611,7 +1611,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t 
*context)
   if (unlikely (!Extension::sanitize (context))) return false;
   unsigned int offset = get_offset ();
   if (unlikely (!offset)) return true;
-  return StructAtOffsetPosLookupSubTable (this, offset).sanitize (context);
+  return StructAtOffsetPosLookupSubTable (this, offset).sanitize (context, 
get_type ());
 }
 
 static inline bool position_lookup (hb_apply_context_t *context, unsigned int 
lookup_index)
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 513913e..494e2de 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -730,10 +730,10 @@ struct SubstLookupSubTable
 }
   }
 
-  inline bool sanitize (hb_sanitize_context_t *context) {
+  inline bool sanitize (hb_sanitize_context_t *context, unsigned int 
lookup_type) {
 TRACE_SANITIZE ();
-if (!u.format.sanitize (context)) return false;
-switch (u.format) {
+if (!u.sub_format.sanitize (context)) return false;
+switch (lookup_type) {
 case Single:   return u.single.sanitize (context);
 case Multiple: return u.multiple.sanitize (context);
 case Alternate:return u.alternate.sanitize (context);
@@ -748,7 +748,7 @@ struct SubstLookupSubTable
 
   private:
   union {
-  USHORT   format;
+  USHORT   sub_format;
   SingleSubst  single;
   MultipleSubstmultiple;
   AlternateSubst   alternate;
@@ -759,7 +759,7 @@ struct SubstLookupSubTable
   ReverseChainSingleSubst  reverseChainContextSingle;
   } u;
   public:
-  DEFINE_SIZE_UNION (2, format);
+  DEFINE_SIZE_UNION (2, sub_format);
 };
 
 
@@ -870,7 +870,7 @@ struct SubstLookup : Lookup
 TRACE_SANITIZE ();
 if (unlikely (!Lookup::sanitize (context))) return false;
 OffsetArrayOfSubstLookupSubTable list = 
CastROffsetArrayOfSubstLookupSubTable  (subTable);
-return list.sanitize (context, this);
+return list.sanitize (context, this, get_type ());
   }
 };
 
@@ -918,7 +918,7 @@ inline bool ExtensionSubst::sanitize (hb_sanitize_context_t 
*context)
   if (unlikely (!Extension::sanitize (context))) return false;
   unsigned int offset = get_offset ();
   if (unlikely (!offset)) return true;
-  return StructAtOffsetSubstLookupSubTable (this, offset).sanitize (context);
+  return StructAtOffsetSubstLookupSubTable (this, offset).sanitize (context, 
get_type ());
 }
 
 inline bool ExtensionSubst::is_reverse (void) const
commit 458ecbb60bb7e8e32aca62a562586d921d5396aa
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon May 10 21:11:35 2010 -0400

Fix tracing order

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index c7b087e..eabe1b8 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ 

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

2009-12-20 Thread Behdad Esfahbod
 src/hb-shape.c |   89 -
 1 file changed, 76 insertions(+), 13 deletions(-)

New commits:
commit 51f141a7f38a73f671b23f58cadf97a72c43b625
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Dec 20 18:22:28 2009 +0100

Avoid overflow

diff --git a/src/hb-shape.c b/src/hb-shape.c
index 0ee6fa8..e3f35ee 100644
--- a/src/hb-shape.c
+++ b/src/hb-shape.c
@@ -93,6 +93,8 @@ hb_map_glyphs (hb_font_t*font,
 {
   unsigned int count;
 
+  if (HB_UNLIKELY (!buffer-in_length))
+return;
   count = buffer-in_length - 1;
   for (buffer-in_pos = 0; buffer-in_pos  count; buffer-in_pos++) {
 if (HB_UNLIKELY (is_variation_selector (IN_NEXTGLYPH( {
commit 26d7a75752631b2596a5bcb7e645b34cc3d139ab
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sun Dec 20 17:58:25 2009 +0100

Refactor hb_shape a bit

diff --git a/src/hb-shape.c b/src/hb-shape.c
index e641df4..0ee6fa8 100644
--- a/src/hb-shape.c
+++ b/src/hb-shape.c
@@ -30,6 +30,9 @@
 
 #include hb-buffer-private.h
 
+
+/* Prepare */
+
 static inline hb_bool_t
 is_variation_selector (hb_codepoint_t unicode)
 {
@@ -65,6 +68,9 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
   return original_direction;
 }
 
+
+/* Substitute */
+
 static void
 hb_mirror_chars (hb_buffer_t *buffer)
 {
@@ -100,6 +106,35 @@ hb_map_glyphs (hb_font_t*font,
 }
 
 static void
+hb_substitute_default (hb_font_t*font,
+  hb_face_t*face,
+  hb_buffer_t  *buffer)
+{
+  hb_mirror_chars (buffer);
+  hb_map_glyphs (font, face, buffer);
+}
+
+static gboolean
+hb_substitute_complex (hb_font_t*font,
+  hb_face_t*face,
+  hb_buffer_t  *buffer)
+{
+  /* TODO GSUB */
+ return FALSE;
+}
+
+static void
+hb_substitute_fallback (hb_font_t*font,
+   hb_face_t*face,
+   hb_buffer_t  *buffer)
+{
+  /* TODO Arabic */
+}
+
+
+/* Position */
+
+static void
 hb_position_default (hb_font_t*font,
 hb_face_t*face,
 hb_buffer_t  *buffer)
@@ -117,6 +152,23 @@ hb_position_default (hb_font_t*font,
   }
 }
 
+static gboolean
+hb_position_complex (hb_font_t*font,
+hb_face_t*face,
+hb_buffer_t  *buffer)
+{
+  /* TODO GPOS */
+  return FALSE;
+}
+
+static void
+hb_position_fallback (hb_font_t*font,
+ hb_face_t*face,
+ hb_buffer_t  *buffer)
+{
+  /* TODO Mark pos */
+}
+
 static void
 hb_truetype_kern (hb_font_t*font,
  hb_face_t*face,
@@ -136,6 +188,17 @@ hb_truetype_kern (hb_font_t*font,
   }
 }
 
+static void
+hb_position_fallback_visual (hb_font_t*font,
+hb_face_t*face,
+hb_buffer_t  *buffer)
+{
+  hb_truetype_kern (font, face, buffer);
+}
+
+
+/* Shape */
+
 void
 hb_shape (hb_font_t*font,
  hb_face_t*face,
@@ -144,32 +207,30 @@ hb_shape (hb_font_t*font,
  unsigned int  num_features)
 {
   hb_direction_t original_direction;
-  hb_bool_t complex_positioning_applied;
+  hb_bool_t substitute_fallback, position_fallback;
 
   hb_form_clusters (buffer);
   original_direction = hb_ensure_native_direction (buffer);
 
-  hb_mirror_chars (buffer);
+  hb_substitute_default (font, face, buffer);
 
-  /* OT preprocess */
+  substitute_fallback = !hb_substitute_complex (font, face, buffer);
 
-  hb_map_glyphs (font, face, buffer);
-  /* ccmp+... */
-
-  /* script-specific */
-
-  /* GSUB */
+  if (substitute_fallback)
+hb_substitute_fallback (font, face, buffer);
 
   hb_position_default (font, face, buffer);
 
-  /* GPOS */
-  complex_positioning_applied = FALSE;
+  position_fallback = !hb_position_complex (font, face, buffer);
+
+  if (position_fallback)
+hb_position_fallback (font, face, buffer);
 
   if (HB_DIRECTION_IS_BACKWARD (buffer-direction))
 hb_buffer_reverse (buffer);
 
-  if (!complex_positioning_applied)
-hb_truetype_kern (font, face, buffer);
+  if (position_fallback)
+hb_position_fallback_visual (font, face, buffer);
 
   buffer-direction = original_direction;
 }
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz