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

2012-08-09 Thread Behdad Esfahbod
 src/hb-ot-layout-common-private.hh   |1 
 src/hb-ot-layout-gsubgpos-private.hh |2 
 src/hb-ot-layout-private.hh  |6 
 src/hb-ot-shape-complex-arabic.cc|2 
 src/hb-ot-shape-complex-indic-private.hh |4 
 src/hb-ot-shape-complex-private.hh   |5 
 src/hb-ot-shape-fallback.cc  |   38 +
 src/hb-ot-shape-normalize-private.hh |2 
 src/hb-ot-shape-normalize.cc |   88 ++---
 src/hb-ot-shape-private.hh   |4 
 src/hb-ot-shape.cc   |  198 +++
 src/hb-unicode-private.hh|7 -
 src/hb-unicode.cc|2 
 13 files changed, 219 insertions(+), 140 deletions(-)

New commits:
commit b00321ea78793d9b3592b5173a9800e6322424fe
Author: Behdad Esfahbod 
Date:   Thu Aug 9 22:33:32 2012 -0400

[OT] Avoid calling get_glyph() twice

Essentially move the glyph mapping to normalization process.
The effect on Devanagari is small (but observable).  Should be more
observable in simple text, like ASCII.

diff --git a/src/hb-ot-shape-normalize-private.hh 
b/src/hb-ot-shape-normalize-private.hh
index f222c07..462b87d 100644
--- a/src/hb-ot-shape-normalize-private.hh
+++ b/src/hb-ot-shape-normalize-private.hh
@@ -32,6 +32,8 @@
 #include "hb-font.h"
 #include "hb-buffer.h"
 
+/* buffer var allocations, used during the normalization process */
+#define glyph_index()  var1.u32
 
 enum hb_ot_shape_normalization_mode_t {
   HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED,
diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index ccaf1d7..e6092d6 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -258,16 +258,25 @@ compose_func (hb_unicode_funcs_t *unicode,
   return found;
 }
 
+
+static inline void
+set_glyph (hb_glyph_info_t &info, hb_font_t *font)
+{
+  hb_font_get_glyph (font, info.codepoint, 0, &info.glyph_index());
+}
+
 static inline void
-output_char (hb_buffer_t *buffer, hb_codepoint_t unichar)
+output_char (hb_buffer_t *buffer, hb_codepoint_t unichar, hb_codepoint_t glyph)
 {
+  buffer->cur().glyph_index() = glyph;
   buffer->output_glyph (unichar);
   _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer->unicode);
 }
 
 static inline void
-next_char (hb_buffer_t *buffer)
+next_char (hb_buffer_t *buffer, hb_codepoint_t glyph)
 {
+  buffer->cur().glyph_index() = glyph;
   buffer->next_glyph ();
 }
 
@@ -282,31 +291,31 @@ decompose (hb_font_t *font, hb_buffer_t *buffer,
   bool shortest,
   hb_codepoint_t ab)
 {
-  hb_codepoint_t a, b, glyph;
+  hb_codepoint_t a, b, a_glyph, b_glyph;
 
   if (!decompose_func (buffer->unicode, ab, &a, &b) ||
-  (b && !font->get_glyph (b, 0, &glyph)))
+  (b && !font->get_glyph (b, 0, &b_glyph)))
 return false;
 
-  bool has_a = font->get_glyph (a, 0, &glyph);
+  bool has_a = font->get_glyph (a, 0, &a_glyph);
   if (shortest && has_a) {
 /* Output a and b */
-output_char (buffer, a);
+output_char (buffer, a, a_glyph);
 if (b)
-  output_char (buffer, b);
+  output_char (buffer, b, b_glyph);
 return true;
   }
 
   if (decompose (font, buffer, shortest, a)) {
 if (b)
-  output_char (buffer, b);
+  output_char (buffer, b, b_glyph);
 return true;
   }
 
   if (has_a) {
-output_char (buffer, a);
+output_char (buffer, a, a_glyph);
 if (b)
-  output_char (buffer, b);
+  output_char (buffer, b, b_glyph);
 return true;
   }
 
@@ -319,18 +328,18 @@ decompose_compatibility (hb_font_t *font, hb_buffer_t 
*buffer,
 {
   unsigned int len, i;
   hb_codepoint_t decomposed[HB_UNICODE_MAX_DECOMPOSITION_LEN];
+  hb_codepoint_t glyphs[HB_UNICODE_MAX_DECOMPOSITION_LEN];
 
   len = buffer->unicode->decompose_compatibility (u, decomposed);
   if (!len)
 return false;
 
-  hb_codepoint_t glyph;
   for (i = 0; i < len; i++)
-if (!font->get_glyph (decomposed[i], 0, &glyph))
+if (!font->get_glyph (decomposed[i], 0, &glyphs[i]))
   return false;
 
   for (i = 0; i < len; i++)
-output_char (buffer, decomposed[i]);
+output_char (buffer, decomposed[i], glyphs[i]);
 
   return true;
 }
@@ -343,15 +352,38 @@ decompose_current_character (hb_font_t *font, hb_buffer_t 
*buffer,
 
   /* Kind of a cute waterfall here... */
   if (shortest && font->get_glyph (buffer->cur().codepoint, 0, &glyph))
-next_char (buffer);
+next_char (buffer, glyph);
   else if (decompose (font, buffer, shortest, buffer->cur().codepoint))
 skip_char (buffer);
   else if (!shortest && font->get_glyph (buffer->cur().codepoint, 0, &glyph))
-next_char (buffer);
+next_char (buffer, glyph);
   else if (decompose_compatibility (font, buffer, buffer->cur().codepoint))
 skip_char (buffer);
-  else
-next_char (buffer);
+  else {
+/* A glyph-not-found case... */
+font->get_glyph (buffer->cur().codepoint, 0, &glyph);
+next_char (buffer, glyph);
+  }
+}
+
+st

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

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

New commits:
commit 0834d952017a04c6f4599e574cb75ecf3ca27d3b
Author: Behdad Esfahbod 
Date:   Wed Aug 1 00:21:09 2012 -0400

[hb-old] Adjust mark positioning parameters

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

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

[old] Implement fontMetrics

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

[GPOS] Adjust mark advance-width zeroing logic

If there is no GPOS, zero mark advances.

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

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

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

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

2012-05-12 Thread Behdad Esfahbod
 TODO | 
   2 
 configure.ac | 
   4 
 src/hb-ot-shape-complex-indic.cc | 
   7 
 src/hb-ot-shape-complex-private.hh   | 
   2 
 test/shaping/hb_test_tools.py| 
   9 
 test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt | 
  38 
 util/Makefile.am | 
   4 
 util/ansi-print.cc   | 
 411 ++
 util/ansi-print.hh   | 
  39 
 util/hb-view.hh  | 
   4 
 util/helper-cairo-ansi.cc| 
 102 ++
 util/helper-cairo-ansi.hh| 
  39 
 util/helper-cairo.cc | 
  70 +
 util/options.cc  | 
  12 
 util/options.hh  | 
   9 
 15 files changed, 725 insertions(+), 27 deletions(-)

New commits:
commit 52e7b1424a3613122e9ca30879298df42733acda
Author: Behdad Esfahbod 
Date:   Sun May 13 02:02:58 2012 +0200

[util] Make hb-view print out Unicode art if stdout is a terminal

diff --git a/configure.ac b/configure.ac
index 7617af2..6c5959a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,8 +52,8 @@ AC_SUBST(HB_LIBTOOL_VERSION_INFO)
 dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 
 # Functions and headers
-AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap _setmode)
-AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
+AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap _setmode isatty)
+AC_CHECK_HEADERS(unistd.h sys/mman.h io.h sys/ioctl.h)
 
 # Compiler flags
 AC_CANONICAL_HOST
diff --git a/util/Makefile.am b/util/Makefile.am
index cb91381..9b4b34a 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -28,10 +28,14 @@ if HAVE_CAIRO_FT
 hb_view_SOURCES = \
hb-view.cc \
hb-view.hh \
+   ansi-print.cc \
+   ansi-print.hh \
options.cc \
options.hh \
helper-cairo.cc \
helper-cairo.hh \
+   helper-cairo-ansi.cc \
+   helper-cairo-ansi.hh \
view-cairo.cc \
view-cairo.hh \
$(NULL)
diff --git a/util/ansi-print.cc b/util/ansi-print.cc
new file mode 100644
index 000..0ad9a7d
--- /dev/null
+++ b/util/ansi-print.cc
@@ -0,0 +1,411 @@
+/*
+ * Copyright © 2012  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ansi-print.hh"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#ifdef HAVE_UNISTD_H
+#include  /* for isatty() */
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include 
+#endif
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+#define CELL_W 8
+#define CELL_H (2 * CELL_W)
+
+struct color_diff_t
+{
+  int dot (const color_diff_t &o)
+  { return v[0]*o.v[0] + v[1]*o.v[1] + v[2]*o.v[2] + v[3]*o.v[3]; }
+
+  int v[4];
+};
+
+struct color_t
+{
+  static color_t from_ansi (unsigned int x)
+  {
+color_t c = {(0xFF<<24) | ((0xFF*(x&1))<<16) | ((0xFF*((x >> 1)&1))<<8) | 
(0xFF*((x >> 2)&1))};
+return c;
+  }
+  unsigned int to_ansi (void)
+  {
+return ((v >> 23) & 1) | ((v >> 14)&2) | ((v >> 5)&4);
+  }
+
+  color_diff_t diff (const color_t &o)
+  {
+color_diff_t d;
+for (unsigned int i = 0; i < 4; i++)
+  d.v[i] = (int) ((v >> (i*8))&0xFF) - (int) ((o.v >> (i*8))&0xFF);
+return d;
+  }
+
+  uint32_t v;
+};
+
+struct image_t
+{
+  public:
+
+  image_t (unsigned int width_,
+  unsi

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

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

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

New commits:
commit c9a841f4452921c5361b8f5697bbff7736ce60cd
Author: Behdad Esfahbod 
Date:   Sat Apr 7 15:06:55 2012 -0400

Add simple Hangul shaper that recomposes Jamo when feasible

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

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

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

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

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

Implement normalization mode HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL

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

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

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

2011-09-17 Thread Behdad Esfahbod
 TODO |6 ++
 configure.ac |2 +-
 src/hb-object-private.hh |   26 +++---
 src/hb-ot-shape-normalize.cc |4 ++--
 src/hb-private.hh|2 +-
 src/hb-unicode-private.hh|4 ++--
 src/test.cc  |4 ++--
 util/common.hh   |2 +-
 util/options.cc  |   12 ++--
 util/view-cairo.cc   |   37 +
 10 files changed, 65 insertions(+), 34 deletions(-)

New commits:
commit 0fe296019746689551d224a5f6fb7e0ebe1b91dc
Author: Behdad Esfahbod 
Date:   Sat Sep 17 09:59:58 2011 -0400

Fix Linux build when io.h is available

Bug 40953 - fail compile git: make[2]: *** [hb_view-options.o] Error 1

diff --git a/configure.ac b/configure.ac
index e1b6bf8..ac41742 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ AC_SUBST(HB_LIBTOOL_VERSION_INFO)
 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 
 # Functions and headers
-AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap)
+AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap _setmode)
 AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
 
 # Compiler flags
diff --git a/util/options.cc b/util/options.cc
index a923a98..fe2feaf 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -439,8 +439,8 @@ font_options_t::get_font (void) const
   /* read it */
   GString *gs = g_string_new (NULL);
   char buf[BUFSIZ];
-#ifdef HAVE_IO_H
-  _setmode (fileno (stdin), O_BINARY);
+#ifdef HAVE__SETMODE
+  _setmode (fileno (stdin), _O_BINARY);
 #endif
   while (!feof (stdin)) {
size_t ret = fread (buf, 1, sizeof (buf), stdin);
@@ -579,8 +579,8 @@ output_options_t::get_file_handle (void)
   if (output_file)
 fp = fopen (output_file, "wb");
   else {
-#ifdef HAVE_IO_H
-_setmode (fileno (stdout), O_BINARY);
+#ifdef HAVE__SETMODE
+_setmode (fileno (stdout), _O_BINARY);
 #endif
 fp = stdout;
   }
commit d2b3ab9ecebbf46cb9dac1f09c17379c50ea4575
Author: Behdad Esfahbod 
Date:   Fri Sep 16 16:59:17 2011 -0400

Fix "[util] Fix hb-view crash with bogus font."

diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index 33921e9..9ca44c8 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -207,7 +207,7 @@ view_cairo_t::create_scaled_font (const font_options_t 
*font_opts)
   FT_Face ft_face = hb_ft_font_get_face (font);
   if (!ft_face)
 /* This allows us to get some boxes at least... */
-cairo_face = cairo_toy_font_face_create ("sans",
+cairo_face = cairo_toy_font_face_create ("@cairo:sans",
 CAIRO_FONT_SLANT_NORMAL,
 CAIRO_FONT_WEIGHT_NORMAL);
   else
commit da4a2a1426ee3aa9d9678ec12c9ba4dfcba0bcf8
Author: Behdad Esfahbod 
Date:   Fri Sep 16 16:56:34 2011 -0400

Cosmetic

diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index a3618b0..33921e9 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -187,7 +187,9 @@ view_cairo_t::get_surface_size (cairo_scaled_font_t 
*scaled_font,
 
   cairo_scaled_font_extents (scaled_font, &font_extents);
 
-  *h = font_extents.ascent + font_extents.descent + ((int) lines->len - 1) * 
font_extents.height;
+  *h = font_extents.ascent
+ + font_extents.descent
+ + ((int) lines->len - 1) * font_extents.height;
   *w = 0;
   for (unsigned int i = 0; i < lines->len; i++)
 *w = MAX (*w, line_width (i));
@@ -205,25 +207,34 @@ view_cairo_t::create_scaled_font (const font_options_t 
*font_opts)
   FT_Face ft_face = hb_ft_font_get_face (font);
   if (!ft_face)
 /* This allows us to get some boxes at least... */
-cairo_face = cairo_toy_font_face_create ("sans", CAIRO_FONT_SLANT_NORMAL, 
CAIRO_FONT_WEIGHT_NORMAL);
+cairo_face = cairo_toy_font_face_create ("sans",
+CAIRO_FONT_SLANT_NORMAL,
+CAIRO_FONT_WEIGHT_NORMAL);
   else
 cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
   cairo_matrix_t ctm, font_matrix;
   cairo_font_options_t *font_options;
 
   cairo_matrix_init_identity (&ctm);
-  cairo_matrix_init_scale (&font_matrix, font_opts->font_size, 
font_opts->font_size);
+  cairo_matrix_init_scale (&font_matrix,
+  font_opts->font_size, font_opts->font_size);
   font_options = cairo_font_options_create ();
   cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
   cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
 
-  cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face, 
&font_matrix, &ctm, font_options);
+  cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face,
+  &font_matrix,
+  &ctm,
+  font_options);
 
   cairo_fo

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

2011-08-13 Thread Behdad Esfahbod
 src/hb-fallback-shape-private.hh |2 
 src/hb-fallback-shape.cc |2 
 src/hb-ft.cc |   15 +
 src/hb-ft.h  |2 
 src/hb-ot-shape.cc   |2 
 src/hb-ot-shape.h|2 
 src/hb-shape.cc  |   14 -
 src/hb-shape.h   |   12 -
 src/hb-uniscribe-shape.cc|   26 ++
 src/hb-uniscribe.h   |   10 +
 util/Makefile.am |   26 ++
 util/common.cc   |   40 
 util/common.hh   |   49 +
 util/hb-view.cc  |  350 +++
 util/options.cc  |  318 +++
 util/options.hh  |   86 +
 16 files changed, 607 insertions(+), 349 deletions(-)

New commits:
commit 3bb300ee78a40f9ded21ab19283863b733aeb677
Author: Behdad Esfahbod 
Date:   Thu Aug 11 11:54:31 2011 +0200

Refactor hb-view code

diff --git a/util/Makefile.am b/util/Makefile.am
index a3ae980..7939975 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -12,9 +12,29 @@ if HAVE_GLIB
 if HAVE_FREETYPE
 if HAVE_CAIRO_FT
 if HAVE_CAIRO_PNG
-hb_view_SOURCES = hb-view.cc
-hb_view_CPPFLAGS = -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS) 
$(FREETYPE_CFLAGS) $(CAIRO_FT_CFLAGS) $(CAIRO_PNG_CFLAGS)
-hb_view_LDADD = $(top_builddir)/src/libharfbuzz.la -lm $(GLIB_LIBS) 
$(FREETYPE_LIBS) $(CAIRO_FT_LIBS) $(CAIRO_PNG_LIBS)
+hb_view_SOURCES = \
+   hb-view.cc \
+   common.cc \
+   common.hh \
+   options.cc \
+   options.hh \
+   $(NULL)
+hb_view_CPPFLAGS = \
+   -I$(top_srcdir)/src/ \
+   -I$(top_builddir)/src/ \
+   $(GLIB_CFLAGS) \
+   $(FREETYPE_CFLAGS) \
+   $(CAIRO_FT_CFLAGS) \
+   $(CAIRO_PNG_CFLAGS) \
+   $(NULL)
+hb_view_LDADD = \
+   $(top_builddir)/src/libharfbuzz.la \
+   -lm \
+   $(GLIB_LIBS) \
+   $(FREETYPE_LIBS) \
+   $(CAIRO_FT_LIBS) \
+   $(CAIRO_PNG_LIBS) \
+   $(NULL)
 bin_PROGRAMS += hb-view
 endif
 endif
diff --git a/util/common.cc b/util/common.cc
new file mode 100644
index 000..7326b8c
--- /dev/null
+++ b/util/common.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2011  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "common.hh"
+
+void
+fail (const char *format, ...)
+{
+  const char *msg;
+
+  va_list vap;
+  va_start (vap, format);
+  msg = g_strdup_vprintf (format, vap);
+  g_printerr ("%s: %s\n", g_get_prgname (), msg);
+
+  exit (1);
+}
diff --git a/util/common.hh b/util/common.hh
new file mode 100644
index 000..5c8baab
--- /dev/null
+++ b/util/common.hh
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2011  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+
+#ifndef COMMON_HH
+#define COMMON_HH
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#i

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

2011-08-03 Thread Behdad Esfahbod
 TODO  |2 
 configure.ac  |   19 +-
 src/Makefile.am   |   11 +
 src/hb-buffer-private.hh  |2 
 src/hb-buffer.cc  |   10 +
 src/hb-font.cc|   10 +
 src/hb-font.h |3 
 src/hb-ot-shape.cc|8 -
 src/hb-private.hh |4 
 src/hb-uniscribe-shape.cc |  325 ++
 src/hb-uniscribe.h|   46 ++
 test/Makefile.am  |7 
 test/test-unicode.c   |4 
 13 files changed, 437 insertions(+), 14 deletions(-)

New commits:
commit 0fbb2dc83132a89201ad8b56c6909610437d2da0
Author: Behdad Esfahbod 
Date:   Wed Aug 3 19:55:04 2011 -0400

Add draft experimental Uniscribe backend

Not complete yet, font selection doesn't work.  But hey it shapes!

This is not supposed to be a production backend, more like a testing
backend.

diff --git a/configure.ac b/configure.ac
index a365d7c..125349e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,15 @@ AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
 
 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)
+fi
+AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
+
 AC_CONFIG_FILES([
 Makefile
 harfbuzz.pc
diff --git a/src/Makefile.am b/src/Makefile.am
index b812419..c4f35e9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,17 @@ HBHEADERS += \
$(NULL)
 endif
 
+if HAVE_UNISCRIBE
+HBCFLAGS += $(UNISCRIBE_CFLAGS)
+HBLIBS   += $(UNISCRIBE_LIBS)
+HBSOURCES += \
+   hb-uniscribe-shape.cc \
+   $(NULL)
+HBHEADERS += \
+   hb-uniscribe.h \
+   $(NULL)
+endif
+
 CXXLINK = $(LINK)
 libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
 libharfbuzz_la_CPPFLAGS = $(HBCFLAGS)
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 8612789..752bd24 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -507,7 +507,9 @@ _hb_debug_msg (const char *what,
   va_start (ap, message);
 
   (void) (_hb_debug (level, max_level) &&
- fprintf (stderr, "%s(%p): ", what, obj) &&
+ fprintf (stderr, "%s", what) &&
+ (obj && fprintf (stderr, "(%p)", obj), TRUE) &&
+ fprintf (stderr, ": ") &&
  (func && fprintf (stderr, "%s: ", func), TRUE) &&
  (indented && fprintf (stderr, "%-*d-> ", level + 1, level), TRUE) &&
  vfprintf (stderr, message, ap) &&
diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
new file mode 100644
index 000..ed50e14
--- /dev/null
+++ b/src/hb-uniscribe-shape.cc
@@ -0,0 +1,325 @@
+/*
+ * Copyright © 2011  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#define _WIN32_WINNT 0x0500
+
+#include "hb-private.hh"
+
+#include "hb-uniscribe.h"
+
+#include "hb-ot-tag.h"
+
+#include "hb-font-private.hh"
+
+#include "hb-buffer-private.hh"
+
+#include 
+#include 
+
+HB_BEGIN_DECLS
+
+
+#ifndef HB_DEBUG_UNISCRIBE
+#define HB_DEBUG_UNISCRIBE (HB_DEBUG+0)
+#endif
+
+
+/*
+DWORD GetFontData(
+  __in   HDC hdc,
+  __in   DWORD dwTable,
+  __in   DWORD dwOffset,
+  __out  LPVOID lpvBuffer,
+  __in   DWORD cbData
+);
+*/
+
+static void
+fallback_shape (hb_font_t   *font,
+   hb_buffer_t *buffer)
+{
+  DEBUG_MSG (UNISCRIBE, NULL, "Fallback shaper invoked");
+}
+
+static void
+populate_log_font (LOGFONTW  *lf,
+  HDChdc,
+  hb_font_t *font,
+  hb_blob_t *blob)
+{
+  memset (lf, 0, sizeof (*lf));
+  int dpi = GetDeviceCaps (hdc, LOGPIXELSY);
+  lf->lfHeight = MulDiv (font->x_scale, dpi, 72);
+
+  WCHAR family_name[] = {'n','a','z','l','i'};
+  for (unsigned int i = 0; family_name[i] && i < LF_FACESIZE - 1; i++)
+lf->lfFaceName[i] = fam

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

2011-05-30 Thread Behdad Esfahbod
 Makefile.am|   31 +-
 TODO   |2 
 src/Makefile.am|7 ++
 src/check-c-linkage-decls.sh   |6 +
 src/check-header-guards.sh |8 ++
 src/check-includes.sh  |   42 +
 src/check-internal-symbols.sh  |8 +-
 src/check-libstdc++.sh |7 +-
 src/hb-ot-layout-gpos-private.hh   |4 -
 src/hb-ot-map-private.hh   |  112 ++---
 src/hb-ot-map.cc   |   44 +-
 src/hb-ot-shape-complex-arabic.cc  |6 -
 src/hb-ot-shape-complex-private.hh |8 +-
 src/hb-ot-shape-private.hh |   22 +++
 src/hb-ot-shape.cc |   28 -
 src/hb-ot-shape.h  |1 
 src/hb-view.cc |2 
 17 files changed, 234 insertions(+), 104 deletions(-)

New commits:
commit 21deab2bdc58d8e9f1a3ba1f9c61c30a79e288a1
Author: Behdad Esfahbod 
Date:   Mon May 30 11:08:40 2011 -0400

Fixed inifinite loop introduced in 7403e055cd1463f

k is the index, not j.

Reported by Tom Hacohen.

diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index d51a2b0..59750ab 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1553,12 +1553,12 @@ fix_mark_attachment (hb_glyph_position_t *pos, unsigned 
int i, hb_direction_t di
   pos[i].y_offset += pos[j].y_offset;
 
   if (HB_DIRECTION_IS_FORWARD (direction))
-for (unsigned int k = j; k < i; j++) {
+for (unsigned int k = j; k < i; k++) {
   pos[i].x_offset -= pos[k].x_advance;
   pos[i].y_offset -= pos[k].y_advance;
 }
   else
-for (unsigned int k = j + 1; k < i + 1; j++) {
+for (unsigned int k = j + 1; k < i + 1; k++) {
   pos[i].x_offset += pos[k].x_advance;
   pos[i].y_offset += pos[k].y_advance;
 }
commit 51881a61ca96c3328e2d92927a5a61e60997a429
Author: Behdad Esfahbod 
Date:   Fri May 27 18:15:56 2011 -0400

Shrink code size

diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index 2c8b99f..07a321f 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -42,16 +42,7 @@ struct hb_ot_map_builder_t
 {
   public:
 
-  inline void add_feature (hb_tag_t tag, unsigned int value, bool global)
-  {
-feature_info_t *info = feature_infos.push();
-if (unlikely (!info)) return;
-info->tag = tag;
-info->seq = feature_infos.len;
-info->max_value = value;
-info->global = global;
-info->default_value = global ? value : 0;
-  }
+  HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, bool global);
 
   inline void add_bool_feature (hb_tag_t tag, bool global = true)
   { add_feature (tag, 1, global); }
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index f178bed..68e1321 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -64,6 +64,17 @@ hb_ot_map_t::add_lookups (hb_face_t*face,
 }
 
 
+void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, bool 
global)
+{
+  feature_info_t *info = feature_infos.push();
+  if (unlikely (!info)) return;
+  info->tag = tag;
+  info->seq = feature_infos.len;
+  info->max_value = value;
+  info->global = global;
+  info->default_value = global ? value : 0;
+}
+
 void
 hb_ot_map_builder_t::compile (hb_face_t *face,
  const hb_segment_properties_t *props,
commit 90645fb24bcbb78183576d3641a99560d87e49f2
Author: Behdad Esfahbod 
Date:   Fri May 27 18:13:31 2011 -0400

[OT] Separate map_builder from the actual map

Respectively, separate planner from the actual plan.

diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index 02f5a91..2c8b99f 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -38,7 +38,31 @@ HB_BEGIN_DECLS
 
 static const hb_tag_t table_tags[2] = {HB_OT_TAG_GSUB, HB_OT_TAG_GPOS};
 
-struct hb_ot_map_t {
+struct hb_ot_map_builder_t
+{
+  public:
+
+  inline void add_feature (hb_tag_t tag, unsigned int value, bool global)
+  {
+feature_info_t *info = feature_infos.push();
+if (unlikely (!info)) return;
+info->tag = tag;
+info->seq = feature_infos.len;
+info->max_value = value;
+info->global = global;
+info->default_value = global ? value : 0;
+  }
+
+  inline void add_bool_feature (hb_tag_t tag, bool global = true)
+  { add_feature (tag, 1, global); }
+
+  HB_INTERNAL void compile (hb_face_t *face,
+   const hb_segment_properties_t *props,
+   struct hb_ot_map_t &m);
+
+  inline void finish (void) {
+feature_infos.finish ();
+  }
 
   private:
 
@@ -53,90 +77,77 @@ struct hb_ot_map_t {
 { return (a->tag != b->tag) ?  (a->tag < b->tag ? -1 : 1) : (a->seq < 
b->seq ? -1 : 1); }
   };
 
-  struct feature_map_t {
-hb_tag_t tag; /* should be first for our bsearch to work */
-unsigned int index[2]; /* GSUB, GPOS */
-unsigned int shi

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

2011-05-12 Thread Behdad Esfahbod
On 05/12/11 04:34, Jjgod Jiang wrote:
> Hi,
> 
> On Tue, May 10, 2011 at 11:48 PM, Behdad Esfahbod
>  wrote:
>> +  uintptr_t pagesize = get_pagesize ();
>> +
>> +  data = mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | 
>> MAP_ANONYMOUS, -1, 0);
>> +  g_assert (data != (char *) -1);
>> +  memcpy ((char *) data, test_data, sizeof (test_data));
> 
> test-blob.c doesn't compile on OS X because MAP_ANONYMOUS is
> undeclared, use MAP_ANON
> instead.

Fixed.  Thanks.

behdad

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


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

2011-05-12 Thread Jjgod Jiang
Hi,

On Tue, May 10, 2011 at 11:48 PM, Behdad Esfahbod
 wrote:
> +      uintptr_t pagesize = get_pagesize ();
> +
> +      data = mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | 
> MAP_ANONYMOUS, -1, 0);
> +      g_assert (data != (char *) -1);
> +      memcpy ((char *) data, test_data, sizeof (test_data));

test-blob.c doesn't compile on OS X because MAP_ANONYMOUS is
undeclared, use MAP_ANON
instead.

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


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

2011-05-11 Thread Behdad Esfahbod
 src/hb-font.cc  |   24 ++---
 src/hb-font.h   |   24 ++---
 src/hb-ft.cc|   22 ++--
 src/test.cc |2 
 test/Makefile.am|1 
 test/test-buffer.c  |2 
 test/test-font.c|  237 
 test/test-object.c  |4 
 test/test-unicode.c |1 
 9 files changed, 278 insertions(+), 39 deletions(-)

New commits:
commit b46782780690e26a8221e2d63dd224159aebe413
Author: Behdad Esfahbod 
Date:   Wed May 11 23:25:28 2011 -0400

[API] Remove const from font user_data

diff --git a/src/hb-font.cc b/src/hb-font.cc
index c289f14..a0485a5 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -43,12 +43,12 @@ HB_BEGIN_DECLS
 
 static hb_bool_t
 hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
-  const void *font_data HB_UNUSED,
+  void *font_data HB_UNUSED,
   hb_codepoint_t glyph,
   unsigned int point_index,
   hb_position_t *x,
   hb_position_t *y,
-  const void *user_data HB_UNUSED)
+  void *user_data HB_UNUSED)
 {
   if (font->parent) {
 hb_bool_t ret;
@@ -66,11 +66,11 @@ 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,
-  const void *font_data HB_UNUSED,
+  void *font_data HB_UNUSED,
   hb_codepoint_t glyph,
   hb_position_t *x_advance,
   hb_position_t *y_advance,
-  const void *user_data HB_UNUSED)
+  void *user_data HB_UNUSED)
 {
   if (font->parent) {
 hb_font_get_glyph_advance (font->parent, glyph, x_advance, y_advance);
@@ -83,10 +83,10 @@ hb_font_get_glyph_advance_nil (hb_font_t *font HB_UNUSED,
 
 static void
 hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
-  const void *font_data HB_UNUSED,
+  void *font_data HB_UNUSED,
   hb_codepoint_t glyph,
   hb_glyph_extents_t *extents,
-  const void *user_data HB_UNUSED)
+  void *user_data HB_UNUSED)
 {
   if (font->parent) {
 hb_font_get_glyph_extents (font->parent, glyph, extents);
@@ -101,10 +101,10 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
 
 static hb_codepoint_t
 hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
-  const void *font_data HB_UNUSED,
+  void *font_data HB_UNUSED,
   hb_codepoint_t unicode,
   hb_codepoint_t variation_selector,
-  const void *user_data HB_UNUSED)
+  void *user_data HB_UNUSED)
 {
   if (font->parent)
 return hb_font_get_glyph (font->parent, unicode, variation_selector);
@@ -114,12 +114,12 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
 
 static void
 hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
-const void *font_data HB_UNUSED,
+void *font_data HB_UNUSED,
 hb_codepoint_t first_glyph,
 hb_codepoint_t second_glyph,
 hb_position_t *x_kern,
 hb_position_t *y_kern,
-const void *user_data HB_UNUSED)
+void *user_data HB_UNUSED)
 {
   if (font->parent) {
 hb_font_get_kerning (font->parent, first_glyph, second_glyph, x_kern, 
y_kern);
diff --git a/src/hb-font.h b/src/hb-font.h
index 17e7f91..bb53f8f 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -128,25 +128,25 @@ typedef struct _hb_glyph_extents_t
 } hb_glyph_extents_t;
 
 
-typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, const 
void *font_data,
+typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, void 
*font_data,
   hb_codepoint_t glyph, 
unsigned int point_index,
   hb_position_t *x, 
hb_position_t *y,
-  const void *user_data);
-typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, const void 
*font_data,
+  void *user_data);
+typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void 
*font_data,
  hb_codepoint_t glyph,
  hb_position_t *x_advance, 
hb_position_t *y_advance,
- const void *user_data);
-typedef void (*hb_font_get_glyph_extents_func_t) 

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

2011-05-10 Thread Behdad Esfahbod
 TODO|4 
 configure.ac|3 
 src/hb-blob.cc  |  218 +++-
 src/hb-blob.h   |   22 +--
 src/hb-common.cc|1 
 src/hb-font.cc  |2 
 src/hb-mutex-private.hh |4 
 src/hb-open-type-private.hh |   32 +++-
 src/hb-ot-layout.cc |7 -
 test/Makefile.am|1 
 test/test-blob.c|  298 
 test/test-buffer.c  |  149 +++---
 test/test-object.c  |2 
 13 files changed, 500 insertions(+), 243 deletions(-)

New commits:
commit f82c18630471216a04e4e3ad42396da4e6d74cba
Author: Behdad Esfahbod 
Date:   Tue May 10 17:48:34 2011 -0400

[test/blob] Fix bug in test

diff --git a/test/test-blob.c b/test/test-blob.c
index 91c1170..22d40b7 100644
--- a/test/test-blob.c
+++ b/test/test-blob.c
@@ -157,7 +157,8 @@ fixture_init (fixture_t *fixture, gconstpointer user_data)
   break;
 
 case HB_MEMORY_MODE_WRITABLE:
-  data = strndup (test_data, sizeof (test_data));
+  data = malloc (sizeof (test_data));
+  memcpy ((char *) data, test_data, sizeof (test_data));
   len = sizeof (test_data);
   free_func = (hb_destroy_func_t) free_up_free;
   break;
commit 785d23acd0ce72d399f9c5021bebc854872648af
Author: Behdad Esfahbod 
Date:   Tue May 10 17:41:44 2011 -0400

[test/blob] Add create_sub_blob()

diff --git a/test/test-blob.c b/test/test-blob.c
index 03962fb..91c1170 100644
--- a/test/test-blob.c
+++ b/test/test-blob.c
@@ -254,6 +254,22 @@ test_blob (fixture_t *fixture, gconstpointer user_data)
 g_assert ('\0' == data[i]);
 }
 
+static void
+test_blob_subblob (fixture_t *fixture, gconstpointer user_data)
+{
+  hb_blob_t *b = fixture->blob;
+
+  fixture->len -= 2;
+  fixture->data++;
+  fixture->blob = hb_blob_create_sub_blob (b, 1, fixture->len);
+  hb_blob_destroy (b);
+
+  test_blob (fixture, user_data);
+
+  fixture->data--;
+  fixture->len += 2;
+}
+
 
 int
 main (int argc, char **argv)
@@ -270,6 +286,7 @@ main (int argc, char **argv)
 const char *blob_name = blob_names[i];
 
 hb_test_add_fixture_flavor (fixture, blob_type, blob_name, test_blob);
+hb_test_add_fixture_flavor (fixture, blob_type, blob_name, 
test_blob_subblob);
   }
 
   /*
commit 0617b1558234673d3924f37541be01b04d36f05a
Author: Behdad Esfahbod 
Date:   Tue May 10 17:37:08 2011 -0400

[test] Test blob API

diff --git a/test/Makefile.am b/test/Makefile.am
index c744795..cc4519c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -12,6 +12,7 @@ check_PROGRAMS = $(TEST_PROGS)
 noinst_PROGRAMS = $(TEST_PROGS)
 
 TEST_PROGS += \
+   test-blob \
test-buffer \
test-common \
test-object \
diff --git a/test/test-blob.c b/test/test-blob.c
new file mode 100644
index 000..03962fb
--- /dev/null
+++ b/test/test-blob.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright © 2011  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-test.h"
+
+/* Unit tests for hb-blob.h */
+
+#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT)
+
+# define TEST_MMAP 1
+
+#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_UNISTD_H
+#include 
+#endif /* HAVE_UNISTD_H */
+#include 
+#endif /* HAVE_SYS_MMAN_H */
+
+#endif
+
+
+static void
+test_blob_empty (void)
+{
+  hb_blob_t *blob;
+  unsigned int len;
+  const char *data;
+  char *data_writable;
+
+  g_assert (hb_blob_is_immutable (hb_blob_get_empty ()));
+  g_assert (hb_blob_get_empty () != NULL);
+
+  blob = hb_blob_get_empty ();
+  g_assert (blob == hb_blob_get_empty ());
+
+  len = hb_blob_get_length (blob);
+  g_assert_cmpint (len, ==, 0);
+
+  data = hb_blob_get_data (blob, NULL);
+  g_assert (data == NULL);
+
+  data = hb_blob_get_data (blob, &len);
+  g_assert (data == NULL);
+  g_assert_cmpint (len, ==, 0);
+
+  data_writable = hb_blob_get_data_writable (blob, NULL);
+  g_assert (data == 

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

2010-05-03 Thread Behdad Esfahbod
 src/hb-buffer.c  |   14 +++
 src/hb-font.cc   |6 +--
 src/hb-ft.c  |   14 +++
 src/hb-language.c|2 -
 src/hb-object-private.h  |   12 +++---
 src/hb-open-file-private.hh  |   21 ++-
 src/hb-open-type-private.hh  |   57 +++
 src/hb-ot-layout-common-private.hh   |   16 
 src/hb-ot-layout-gdef-private.hh |2 -
 src/hb-ot-layout-gpos-private.hh |   64 +--
 src/hb-ot-layout-gsub-private.hh |   52 ++--
 src/hb-ot-layout-gsubgpos-private.hh |   40 ++---
 src/hb-ot-layout.cc  |   12 +++---
 src/hb-ot-tag.c  |2 -
 src/hb-private.h |   12 +++---
 src/hb-shape.c   |   10 ++---
 src/hb-unicode.c |2 -
 17 files changed, 170 insertions(+), 168 deletions(-)

New commits:
commit 710500a93ecc2a0c595045602aa367073485ff91
Author: Behdad Esfahbod 
Date:   Mon May 3 23:11:16 2010 -0400

Comment new SFNT tags

diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh
index e9891be..f25522e 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file-private.hh
@@ -190,11 +190,11 @@ struct TTCHeader
 
 struct OpenTypeFontFile
 {
-  static const hb_tag_t CFFTag = HB_TAG ('O','T','T','O');
-  static const hb_tag_t TrueTypeTag= HB_TAG ( 0 , 1 , 0 , 0 );
-  static const hb_tag_t TTCTag = HB_TAG ('t','t','c','f');
-  static const hb_tag_t TrueTag= HB_TAG ('t','r','u','e');
-  static const hb_tag_t Typ1Tag= HB_TAG ('t','y','p','1');
+  static const hb_tag_t CFFTag = HB_TAG ('O','T','T','O'); /* OpenType 
with Postscript outlines */
+  static const hb_tag_t TrueTypeTag= HB_TAG ( 0 , 1 , 0 , 0 ); /* OpenType 
with TrueType outlines */
+  static const hb_tag_t TTCTag = HB_TAG ('t','t','c','f'); /* TrueType 
Collection */
+  static const hb_tag_t TrueTag= HB_TAG ('t','r','u','e'); /* 
Apple obsolete tag */
+  static const hb_tag_t Typ1Tag= HB_TAG ('t','y','p','1'); /* 
Apple obsolete tag */
 
   inline hb_tag_t get_tag (void) const { return u.tag; }
 
commit 64d3fc8d0dada673245cc8c0b1c12cd849b30997
Author: Behdad Esfahbod 
Date:   Mon May 3 22:51:19 2010 -0400

Cosmetic: Rename HB_LIKELY/HB_UNLIKELY to likely/unlikely

diff --git a/src/hb-buffer.c b/src/hb-buffer.c
index f169c35..adec7c1 100644
--- a/src/hb-buffer.c
+++ b/src/hb-buffer.c
@@ -258,7 +258,7 @@ hb_buffer_clear_positions (hb_buffer_t *buffer)
   buffer->have_output = FALSE;
   buffer->have_positions = TRUE;
 
-  if (HB_UNLIKELY (!buffer->positions))
+  if (unlikely (!buffer->positions))
   {
 buffer->positions = calloc (buffer->allocated, sizeof 
(buffer->positions[0]));
 return;
@@ -510,7 +510,7 @@ reverse_range (hb_buffer_t *buffer,
 void
 hb_buffer_reverse (hb_buffer_t *buffer)
 {
-  if (HB_UNLIKELY (!buffer->in_length))
+  if (unlikely (!buffer->in_length))
 return;
 
   reverse_range (buffer, 0, buffer->in_length);
@@ -521,7 +521,7 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer)
 {
   unsigned int i, start, count, last_cluster;
 
-  if (HB_UNLIKELY (!buffer->in_length))
+  if (unlikely (!buffer->in_length))
 return;
 
   hb_buffer_reverse (buffer);
@@ -569,7 +569,7 @@ hb_utf8_next (const uint8_t *text,
   unsigned int mask, len;
 
   UTF8_COMPUTE (c, mask, len);
-  if (HB_UNLIKELY (!len || (unsigned int) (end - text) < len)) {
+  if (unlikely (!len || (unsigned int) (end - text) < len)) {
 *unicode = -1;
 return text + 1;
   } else {
@@ -578,7 +578,7 @@ hb_utf8_next (const uint8_t *text,
 result = c & mask;
 for (i = 1; i < len; i++)
   {
-   if (HB_UNLIKELY ((text[i] & 0xc0) != 0x80))
+   if (unlikely ((text[i] & 0xc0) != 0x80))
  {
*unicode = -1;
return text + 1;
@@ -610,10 +610,10 @@ hb_utf16_next (const uint16_t *text,
 {
   uint16_t c = *text++;
 
-  if (HB_UNLIKELY (c >= 0xd800 && c < 0xdc00)) {
+  if (unlikely (c >= 0xd800 && c < 0xdc00)) {
 /* high surrogate */
 uint16_t l;
-if (text < end && ((l = *text), HB_UNLIKELY (l >= 0xdc00 && l < 0xe000))) {
+if (text < end && ((l = *text), unlikely (l >= 0xdc00 && l < 0xe000))) {
   /* low surrogate */
   *unicode = ((hb_codepoint_t) ((c) - 0xd800) * 0x400 + (l) - 0xdc00 + 
0x1);
text++;
diff --git a/src/hb-font.cc b/src/hb-font.cc
index a17cab5..b8b151b 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -274,7 +274,7 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned 
int index)
   hb_face_for_data_closure_t *closure;
 
   closure = (hb_face_for_data_closure_t *) malloc (sizeof 
(hb_face_for_data_closure_t));
-  if (HB_UNLIKELY (!closure))
+  if (unlikely (!closure))
 return &_hb_face_for_data_closure_nil;
 

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

2009-12-20 Thread Behdad Esfahbod
 src/Makefile.am |9 --
 src/hb-buffer-private.h |3 +-
 src/hb-buffer.c |   30 +++-
 src/hb-common.h |2 +
 src/hb-font.cc  |3 ++
 src/hb-shape.c  |   71 
 src/hb-unicode.c|   37 +
 src/hb-unicode.h|   21 ++
 8 files changed, 142 insertions(+), 34 deletions(-)

New commits:
commit 001fc2d2aa22f14302739fe4ca45f7535855e0fb
Author: Behdad Esfahbod 
Date:   Sun Dec 20 17:24:05 2009 +0100

Add TrueType kern support

diff --git a/src/hb-shape.c b/src/hb-shape.c
index 2ad9457..e641df4 100644
--- a/src/hb-shape.c
+++ b/src/hb-shape.c
@@ -49,6 +49,37 @@ hb_form_clusters (hb_buffer_t *buffer)
   IN_CLUSTER (buffer->in_pos) = IN_CLUSTER (buffer->in_pos - 1);
 }
 
+static hb_direction_t
+hb_ensure_native_direction (hb_buffer_t *buffer)
+{
+  hb_direction_t original_direction = buffer->direction;
+
+  /* TODO vertical */
+  if (HB_DIRECTION_IS_HORIZONTAL (original_direction) &&
+  original_direction != _hb_script_get_horizontal_direction 
(buffer->script))
+  {
+hb_buffer_reverse_clusters (buffer);
+buffer->direction ^=  1;
+  }
+
+  return original_direction;
+}
+
+static void
+hb_mirror_chars (hb_buffer_t *buffer)
+{
+  unsigned int count;
+  hb_unicode_get_mirroring_func_t get_mirroring = 
buffer->unicode->get_mirroring;
+
+  if (HB_DIRECTION_IS_FORWARD (buffer->direction))
+return;
+
+  count = buffer->in_length;
+  for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
+  IN_CURGLYPH() = get_mirroring (IN_CURGLYPH());
+  }
+}
+
 static void
 hb_map_glyphs (hb_font_t*font,
   hb_face_t*face,
@@ -86,39 +117,25 @@ hb_position_default (hb_font_t*font,
   }
 }
 
-
-static hb_direction_t
-hb_ensure_native_direction (hb_buffer_t *buffer)
-{
-  hb_direction_t original_direction = buffer->direction;
-
-  /* TODO vertical */
-  if (HB_DIRECTION_IS_HORIZONTAL (original_direction) &&
-  original_direction != _hb_script_get_horizontal_direction 
(buffer->script))
-  {
-hb_buffer_reverse_clusters (buffer);
-buffer->direction ^=  1;
-  }
-
-  return original_direction;
-}
-
 static void
-hb_mirror_chars (hb_buffer_t *buffer)
+hb_truetype_kern (hb_font_t*font,
+ hb_face_t*face,
+ hb_buffer_t  *buffer)
 {
   unsigned int count;
-  hb_unicode_get_mirroring_func_t get_mirroring = 
buffer->unicode->get_mirroring;
-
-  if (HB_DIRECTION_IS_FORWARD (buffer->direction))
-return;
 
   count = buffer->in_length;
-  for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
-  IN_CURGLYPH() = get_mirroring (IN_CURGLYPH());
+  for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++) {
+hb_position_t kern, kern1, kern2;
+kern = hb_font_get_kerning (font, face, IN_GLYPH(buffer->in_pos - 1), 
IN_CURGLYPH());
+kern1 = kern >> 1;
+kern2 = kern - kern1;
+POSITION(buffer->in_pos - 1)->x_advance += kern1;
+CURPOSITION()->x_advance += kern2;
+CURPOSITION()->x_offset += kern2;
   }
 }
 
-
 void
 hb_shape (hb_font_t*font,
  hb_face_t*face,
@@ -127,6 +144,7 @@ hb_shape (hb_font_t*font,
  unsigned int  num_features)
 {
   hb_direction_t original_direction;
+  hb_bool_t complex_positioning_applied;
 
   hb_form_clusters (buffer);
   original_direction = hb_ensure_native_direction (buffer);
@@ -144,10 +162,14 @@ hb_shape (hb_font_t*font,
 
   hb_position_default (font, face, buffer);
 
-  /* GPOS / kern */
+  /* GPOS */
+  complex_positioning_applied = FALSE;
 
   if (HB_DIRECTION_IS_BACKWARD (buffer->direction))
 hb_buffer_reverse (buffer);
 
+  if (!complex_positioning_applied)
+hb_truetype_kern (font, face, buffer);
+
   buffer->direction = original_direction;
 }
commit 2c1b85cf66e5ecb7521b6018b76f0e161fb68967
Author: Behdad Esfahbod 
Date:   Sun Dec 20 16:29:17 2009 +0100

Direct unicode->get_mirroring directly

diff --git a/src/hb-shape.c b/src/hb-shape.c
index 74cab9e..2ad9457 100644
--- a/src/hb-shape.c
+++ b/src/hb-shape.c
@@ -107,14 +107,14 @@ static void
 hb_mirror_chars (hb_buffer_t *buffer)
 {
   unsigned int count;
-  hb_unicode_funcs_t *unicode = buffer->unicode;
+  hb_unicode_get_mirroring_func_t get_mirroring = 
buffer->unicode->get_mirroring;
 
   if (HB_DIRECTION_IS_FORWARD (buffer->direction))
 return;
 
   count = buffer->in_length;
   for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
-  IN_CURGLYPH() = hb_unicode_get_mirroring (unicode, IN_CURGLYPH());
+  IN_CURGLYPH() = get_mirroring (IN_CURGLYPH());
   }
 }
 
commit 6a2ef5aa5459def232708af30ef8a484906b868b
Author: Behdad Esfahbod 
Date:   Sun Dec 20 16:28:01 2009 +0100

Do mirroring

diff --git a/src/hb-shape.c b/src/hb-shape.c
index 2605af6..74cab9e 100644
--- a/src/hb-shape.c
+++ b/src/hb-shape.c
@@ -103,6 +103,21 @@ hb_ensure_native_direction (hb_buffer_t *buffe