[pango/harfbuzz-ng] [GPOS] Fix more brokenness



commit ac8ad1e1c8958246add90cf6d7b6da4ad2a2ea87
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed May 20 04:16:35 2009 -0400

    [GPOS] Fix more brokenness
---
 pango/opentype/Makefile.am                 |    2 +-
 pango/opentype/hb-ot-layout-gpos-private.h |   37 +++++++++++++++-------------
 pango/opentype/hb-ot-layout.cc             |    7 +++++
 pango/opentype/hb-ot-layout.h              |    5 ++++
 pango/pango-ot-info.c                      |    2 +
 5 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/pango/opentype/Makefile.am b/pango/opentype/Makefile.am
index e5ea114..e04419e 100644
--- a/pango/opentype/Makefile.am
+++ b/pango/opentype/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = 					\
 	-I $(srcdir)				\
 	$(FREETYPE_CFLAGS)			\
 	$(GLIB_CFLAGS)
-CXX = gcc $(GCCOPTS) -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align
+CXX = gcc $(GCCOPTS) -g -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align
 
 noinst_LTLIBRARIES = libharfbuzz-1.la
 
diff --git a/pango/opentype/hb-ot-layout-gpos-private.h b/pango/opentype/hb-ot-layout-gpos-private.h
index 0373a59..600ef96 100644
--- a/pango/opentype/hb-ot-layout-gpos-private.h
+++ b/pango/opentype/hb-ot-layout-gpos-private.h
@@ -551,18 +551,6 @@ struct CursivePosFormat1
   private:
   inline bool apply (APPLY_ARG_DEF) const
   {
-    struct hb_ot_layout_t::gpos_info_t *gpi = &layout->gpos_info;
-    hb_codepoint_t last_pos = gpi->last;
-    gpi->last = 0xFFFF;
-
-    /* We don't handle mark glyphs here. */
-    if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
-      return false;
-
-    unsigned int index = (this+coverage) (IN_CURGLYPH ());
-    if (HB_LIKELY (index == NOT_COVERED))
-      return false;
-
     /* Now comes the messiest part of the whole OpenType
        specification.  At first glance, cursive connections seem easy
        to understand, but there are pitfalls!  The reason is that
@@ -680,6 +668,18 @@ struct CursivePosFormat1
        Since horizontal advance widths or vertical advance heights
        can be used alone but not together, no ambiguity occurs.        */
 
+    struct hb_ot_layout_t::gpos_info_t *gpi = &layout->gpos_info;
+    hb_codepoint_t last_pos = gpi->last;
+    gpi->last = 0xFFFF;
+
+    /* We don't handle mark glyphs here. */
+    if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+      return false;
+
+    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    if (HB_LIKELY (index == NOT_COVERED))
+      return false;
+
     const EntryExitRecord &record = entryExitRecord[index];
 
     hb_position_t entry_x, entry_y, exit_x, exit_y;
@@ -696,24 +696,27 @@ struct CursivePosFormat1
     }
     else
     {
-      POSITION (gpi->last)->x_advance   = gpi->anchor_x - entry_x;
-      POSITION (gpi->last)->new_advance = TRUE;
+      POSITION (last_pos)->x_advance   = gpi->anchor_x - entry_x;
+      POSITION (last_pos)->new_advance = TRUE;
     }
 
     if  (lookup_flag & LookupFlag::RightToLeft)
     {
-      POSITION (gpi->last)->cursive_chain = gpi->last - buffer->in_pos;
-      POSITION (gpi->last)->y_pos = entry_y - gpi->anchor_y;
+      POSITION (last_pos)->cursive_chain = last_pos - buffer->in_pos;
+      POSITION (last_pos)->y_pos = entry_y - gpi->anchor_y;
     }
     else
     {
-      POSITION (buffer->in_pos)->cursive_chain = buffer->in_pos - gpi->last;
+      POSITION (buffer->in_pos)->cursive_chain = buffer->in_pos - last_pos;
       POSITION (buffer->in_pos)->y_pos = gpi->anchor_y - entry_y;
     }
 
   end:
     if (record.exitAnchor)
+    {
+      gpi->last = buffer->in_pos;
       (this+record.exitAnchor).get_anchor (layout, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
+    }
 
     buffer->in_pos++;
     return true;
diff --git a/pango/opentype/hb-ot-layout.cc b/pango/opentype/hb-ot-layout.cc
index 4bb2eb5..ced7c95 100644
--- a/pango/opentype/hb-ot-layout.cc
+++ b/pango/opentype/hb-ot-layout.cc
@@ -82,6 +82,13 @@ hb_ot_layout_destroy (hb_ot_layout_t *layout)
   free (layout);
 }
 
+void
+hb_ot_layout_set_direction (hb_ot_layout_t *layout,
+			    hb_bool_t r2l)
+{
+  layout->gpos_info.r2l = !!r2l;
+}
+
 /*
  * GDEF
  */
diff --git a/pango/opentype/hb-ot-layout.h b/pango/opentype/hb-ot-layout.h
index f907b65..3e83c36 100644
--- a/pango/opentype/hb-ot-layout.h
+++ b/pango/opentype/hb-ot-layout.h
@@ -47,6 +47,11 @@ hb_ot_layout_create_for_data (const char *font_data,
 void
 hb_ot_layout_destroy (hb_ot_layout_t *layout);
 
+/* XXX */
+void
+hb_ot_layout_set_direction (hb_ot_layout_t *layout,
+			    hb_bool_t r2l);
+
 /* TODO sanitizing API/constructor (make_writable_func_t) */
 /* TODO get_table_func_t constructor */
 
diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c
index d0e7ac8..de21154 100644
--- a/pango/pango-ot-info.c
+++ b/pango/pango-ot-info.c
@@ -556,6 +556,8 @@ _pango_ot_info_position    (const PangoOTInfo    *info,
   unsigned int i;
 
   _hb_buffer_clear_positions (buffer->buffer);
+  _hb_buffer_clear_positions (buffer->buffer);
+  hb_ot_layout_set_direction (info->layout, buffer->rtl);
 
   for (i = 0; i < ruleset->rules->len; i++)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]