displayFont(pit, e.pos) : bufferfont;
MacroContext mc(&buffer, parPos);
MetricsInfo mi(bv_, font.fontInfo(), w, mc, e.pos == 0, tight_);
+ mi.base.outer_font = displayFont(pit, e.pos).fontInfo();
e.inset->metrics(mi, dim);
/* FIXME: This is a kind of hack. This allows InsetMathHull to
* state that it needs some elbow room beyond its width, in
// pile, or the place when we were in main row
Row::Element elt = *fcit;
Row::Elements tail;
- elt.splitAt(width - rows.back().width(), next_width, false, tail);
+ elt.splitAt(width - rows.back().width(), next_width, Row::FIT, tail);
Row & rb = rows.back();
if (elt.type == Row::MARGINSPACE)
elt.dim.wid = max(elt.dim.wid, leftMargin(bigrow.pit()) - rb.width());
// Last row in paragraph is flushed
rows.back().flushed(true);
cleanupRow(rows.back(), true);
+ // Is there an end-of-paragraph change?
+ if (bigrow.needsChangeBar())
+ rows.back().needsChangeBar(true);
}
return rows;
{
Paragraph const & par = text_->getPar(row.pit());
Layout const & layout = par.layout();
- double const spacing_val = layout.spacing.getValue() * text_->spacing(par);
+ // 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;
+ }
// Initial value for ascent (useful if row is empty).
Font const font = displayFont(row.pit(), row.pos());
FontMetrics const & fm = theFontMetrics(font);
- int maxasc = int(fm.maxAscent() * spacing_val);
- int maxdes = int(fm.maxDescent() * spacing_val);
+ int maxasc = int(fm.maxAscent()
+ // add leading space
+ + fm.maxHeight() * (spacing_val - 1));
+ int maxdes = int(fm.maxDescent());
// Take label string into account (useful if labelfont is large)
if (row.pos() == 0 && layout.labelIsInline()) {
FontInfo const labelfont = text_->labelFont(par);
FontMetrics const & lfm = theFontMetrics(labelfont);
- maxasc = max(maxasc, int(lfm.maxAscent() * spacing_val));
- maxdes = max(maxdes, int(lfm.maxDescent() * spacing_val));
+ maxasc = max(maxasc, int(lfm.maxAscent()
+ // add leading space
+ + lfm.maxHeight() * (spacing_val - 1)));
+ maxdes = max(maxdes, int(lfm.maxDescent()));
}
// Find the ascent/descent of the row contents
maxdes = max(maxdes, e.dim.descent());
} else {
FontMetrics const & fm2 = theFontMetrics(e.font);
- maxasc = max(maxasc, int(fm2.maxAscent() * spacing_val));
- maxdes = max(maxdes, int(fm2.maxDescent() * spacing_val));
+ maxasc = max(maxasc, int(fm2.maxAscent()
+ // add leading space
+ + fm2.maxHeight() * (spacing_val - 1)));
+ maxdes = max(maxdes, int(fm2.maxDescent()));
}
}