+ Direction text_dir = RIGHT;
+ for (GList *p = items; p; p = p->next)
+ {
+ PangoItem *item = (PangoItem *) p->data;
+ if (item->analysis.level == PANGO_DIRECTION_RTL)
+ text_dir = LEFT;
+ }
+
+ for (GList *ptr = items; ptr; ptr = ptr->next)
+ {
+ PangoItem *item = (PangoItem *) ptr->data;
+
+ Stencil item_stencil = pango_item_string_stencil (item, str);
+
+ if (text_dir == RIGHT)
+ {
+ item_stencil.translate_axis (last_x, X_AXIS);
+ last_x = item_stencil.extent (X_AXIS)[RIGHT];
+ }
+ else if (text_dir == LEFT)
+ {
+ dest.translate_axis (item_stencil.extent (X_AXIS)[RIGHT], X_AXIS);
+ }
+
+#if 0 /* Check extents. */
+ if (!item_stencil.extent_box ()[X_AXIS].is_empty ())
+ {
+ Stencil frame = Lookup::frame (item_stencil.extent_box (), 0.1, 0.1);
+ Box empty;
+ empty.set_empty ();
+ Stencil dimless_frame (empty, frame.expr ());
+ dest.add_stencil (frame);
+ }
+#endif
+