+ // leading space (line spacing) factor based on current paragraph
+ double spacing_val = layout.spacing.getValue() * text_->spacing(par);
+
+ // if this is the first row but not the first paragraph, take into
+ // account the spacing of the previous paragraph.
+ if (row.pos() == 0 && row.pit() > 0) {
+ // for the first row in the paragraph,
+ // use previous paragraphs line spacing if it is larger
+ Paragraph const & previousPar = text_->getPar(row.pit() - 1);
+ Layout const & previousLayout = previousPar.layout();
+ // leading space factor based on previous paragraph
+ double const previous_spacing_val
+ = previousLayout.spacing.getValue() * text_->spacing(previousPar);
+ if (previous_spacing_val > spacing_val)
+ spacing_val = previous_spacing_val;
+ }