+ }
+
+ /* If we are here, it means that we have not found a separator
+ * to shorten the row. There is one case where we can do
+ * something: when we have one big string, maybe with some
+ * other things after it.
+ */
+ if (cit->breakAt(w - left_margin)) {
+ end_ = cit->endpos;
+ dim_.wid = left_margin + cit->dim.wid;
+ // If there are other elements, they should be removed.
+ elements_.erase(next(cit, 1), end);
+ }
+}
+
+
+void Row::reverseRTL(bool const rtl_par)
+{
+ pos_type i = 0;
+ pos_type const end = elements_.size();
+ while (i < end) {
+ // gather a sequence of elements with the same direction
+ bool const rtl = elements_[i].font.isVisibleRightToLeft();
+ pos_type j = i;
+ while (j < end && elements_[j].font.isVisibleRightToLeft() == rtl)
+ ++j;
+ // if the direction is not the same as the paragraph
+ // direction, the sequence has to be reverted.
+ if (rtl != rtl_par)
+ reverse(elements_.begin() + i, elements_.begin() + j);
+ i = j;
+ }
+ // If the paragraph itself is RTL, reverse everything
+ if (rtl_par)
+ reverse(elements_.begin(), elements_.end());