Dear Behdad,
The enclosed patch reenables the graphite integration and also fixes the rtl
problems.
Yours,
Martin
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 64f22f7..4a7643a 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -212,7 +212,7 @@ _hb_gr_font_get_data (hb_font_t *font)
hb_bool_t
-_hb_graphite_shape (hb_font_t *font,
+_hb_graphite2_shape (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features)
@@ -315,26 +315,33 @@ _hb_graphite_shape (hb_font_t *font,
buffer->swap_buffers ();
hb_glyph_position_t *pPos;
+
+ if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
+ curradvx = gr_seg_advance_X(seg);
+
for (pPos = hb_buffer_get_glyph_positions (buffer, NULL), is = gr_seg_first_slot (seg);
is; pPos++, is = gr_slot_next_in_segment (is))
{
- pPos->x_offset = gr_slot_origin_X(is) - curradvx;
- pPos->y_offset = gr_slot_origin_Y(is) - curradvy;
pPos->x_advance = gr_slot_advance_X(is, data->grface, data->grfont);
pPos->y_advance = gr_slot_advance_Y(is, data->grface, data->grfont);
-// if (pPos->x_advance < 0 && gr_slot_attached_to(is))
-// pPos->x_advance = 0;
- curradvx += pPos->x_advance;
+ if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
+ curradvx -= pPos->x_advance;
+ pPos->x_offset = gr_slot_origin_X(is) - curradvx;
+ if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
+ curradvx += pPos->x_advance;
+
+ pPos->y_offset = gr_slot_origin_Y(is) - curradvy;
curradvy += pPos->y_advance;
}
- pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx;
+ if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
+ 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);
+ if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
+ hb_buffer_reverse_clusters(buffer);
success = 1;
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 3d5f56c..deaf977 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -30,7 +30,7 @@
#include "hb-buffer-private.hh"
-#ifdef HAVE_GRAPHITE
+#ifdef HAVE_GRAPHITE2
#include "hb-graphite2-private.hh"
#endif
#ifdef HAVE_UNISCRIBE
@@ -52,7 +52,7 @@ static struct hb_shaper_pair_t {
hb_shape_func_t func;
} shapers[] = {
/* v--- Add new shapers in the right place here */
-#ifdef HAVE_GRAPHITE
+#ifdef HAVE_GRAPHITE2
HB_SHAPER_IMPLEMENT (graphite2),
#endif
#ifdef HAVE_UNISCRIBE
_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz