diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 862ae8b..2c35423 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -5167,6 +5167,10 @@ static void
 justify_clusters (PangoLayoutLine *line,
 		  ParaBreakState  *state)
 {
+  const gchar *text = line->layout->text;
+  const PangoLogAttr *log_attrs = line->layout->log_attrs;
+
+  int offset;
   int total_remaining_width, total_gaps = 0;
   int added_so_far, gaps_so_far;
   gboolean is_hinted;
@@ -5188,19 +5192,29 @@ justify_clusters (PangoLayoutLine *line,
       added_so_far = 0;
       gaps_so_far = 0;
 
+      offset = state->line_start_offset;
       for (run_iter = line->runs; run_iter; run_iter = run_iter->next)
 	{
 	  PangoLayoutRun *run = run_iter->data;
 	  PangoGlyphString *glyphs = run->glyphs;
 	  gboolean is_first_gap = TRUE;
+	  PangoGlyphItemIter cluster_iter;
+	  gboolean have_cluster;
 
+	  for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter, run, text);
+	       have_cluster;
+	       have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
+	    {
 	      int i;
+	      int dir;
 
-	  for (i = 0; i < glyphs->num_glyphs; i++)
-	    {
-	      if (!glyphs->glyphs[i].attr.is_cluster_start)
+              /* don't expand in the middle of graphemes */
+	      if (!log_attrs[offset + cluster_iter.start_char].is_cursor_position)
 		continue;
 
+	      dir = (cluster_iter.start_glyph < cluster_iter.end_glyph) ? 1 : -1;
+	      for (i = cluster_iter.start_glyph; i != cluster_iter.end_glyph; i += dir)
+		{
 	          /* also don't expand zero-width spaces at the end of runs */
 	          if (glyphs->glyphs[i].geometry.width == 0)
 	            {
@@ -5237,6 +5251,7 @@ justify_clusters (PangoLayoutLine *line,
 		    }
                 }
             }
+	}
 
       if (mode == MEASURE)
 	{
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 51404f0..6279b65 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -342,6 +342,7 @@ _pango_fc_shape (PangoFont           *font,
   hb_buffer_set_direction (hb_buffer, hb_direction);
   hb_buffer_set_script (hb_buffer, hb_glib_script_to_script (analysis->script));
   hb_buffer_set_language (hb_buffer, hb_language_from_string (pango_language_to_string (analysis->language), -1));
+  hb_buffer_set_cluster_level (hb_buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
   hb_buffer_set_flags (hb_buffer,
 		       (item_offset == 0 ? HB_BUFFER_FLAG_BOT : 0) |
 		       (item_offset + item_length == paragraph_length ? HB_BUFFER_FLAG_EOT : 0));
