- // is it a bottom line?
- if (row.endpos() >= par.size() && topBottomSpace) {
- // add the layout spaces, for example before and after
- // a section, or between the items of a itemize or enumerate
- // environment
- pit_type nextpit = pit + 1;
- if (nextpit != pit_type(pars.size())) {
- pit_type cpit = pit;
-
- if (pars[cpit].getDepth() > pars[nextpit].getDepth()) {
- double usual = pars[cpit].layout().bottomsep * dh;
- double unusual = 0;
- cpit = text_->depthHook(cpit, pars[nextpit].getDepth());
- if (pars[cpit].layout() != pars[nextpit].layout()
- || pars[nextpit].getLabelWidthString() != pars[cpit].getLabelWidthString())
- unusual = pars[cpit].layout().bottomsep * dh;
- layoutdesc = max(unusual, usual);
- } else if (pars[cpit].getDepth() == pars[nextpit].getDepth()) {
- if (pars[cpit].layout() != pars[nextpit].layout()
- || pars[nextpit].getLabelWidthString() != pars[cpit].getLabelWidthString())
- layoutdesc = int(pars[cpit].layout().bottomsep * dh);
- }
+ // Find the ascent/descent of the row contents
+ Row::const_iterator cit = row.begin();
+ Row::const_iterator cend = row.end();
+ for ( ; cit != cend; ++cit) {
+ if (cit->inset) {
+ maxasc = max(maxasc, cit->dim.ascent());
+ maxdes = max(maxdes, cit->dim.descent());
+ } else {
+ FontMetrics const & fm = theFontMetrics(cit->font);
+ maxasc = max(maxasc, int(fm.maxAscent() * spacing_val));
+ maxdes = max(maxdes, int(fm.maxDescent() * spacing_val));