+ tabular.cellInfo(cell).width = dim.wid + 2 * WIDTH_OF_LINE
+ + tabular.interColumnSpace(cell);
+
+ // FIXME(?): do we need a second metrics call?
+ TextMetrics const & tm =
+ mi.base.bv->textMetrics(tabular.cellInset(cell)->getText(0));
+
+ // determine horiz offset because of decimal align (if necessary)
+ int decimal_hoffset = 0;
+ int decimal_width = 0;
+ if (tabular.getAlignment(cell) == LYX_ALIGN_DECIMAL) {
+ // make a copy which we will split in 2
+ InsetTableCell head = InsetTableCell(*tabular.cellInset(cell).get());
+ head.getText(0)->setMacrocontextPosition(
+ tabular.cellInset(cell)->getText(0)->macrocontextPosition());
+ head.setBuffer(tabular.buffer());
+ // split in 2 and calculate width of each part
+ bool hassep = false;
+ InsetTableCell tail =
+ splitCell(head, tabular.column_info[c].decimal_point, hassep);
+ Dimension dim1;
+ head.metrics(m, dim1);
+ decimal_hoffset = dim1.width();
+ if (hassep) {
+ tail.metrics(m, dim1);
+ decimal_width = dim1.width();
+ }
+ }
+ tabular.cell_info[r][c].decimal_hoffset = decimal_hoffset;
+ tabular.cell_info[r][c].decimal_width = decimal_width;
+
+ // with LYX_VALIGN_BOTTOM the descent is relative to the last par
+ // = descent of text in last par + TEXT_TO_INSET_OFFSET:
+ int const lastpardes = tm.last().second->descent()
+ + TEXT_TO_INSET_OFFSET;
+ int offset = 0;
+ switch (tabular.getVAlignment(cell)) {
+ case Tabular::LYX_VALIGN_TOP:
+ break;
+ case Tabular::LYX_VALIGN_MIDDLE:
+ offset = -(dim.des - lastpardes)/2;
+ break;
+ case Tabular::LYX_VALIGN_BOTTOM:
+ offset = -(dim.des - lastpardes);
+ break;
+ }
+ tabular.cell_info[r][c].voffset = offset;
+ maxasc = max(maxasc, dim.asc - offset);
+ maxdes = max(maxdes, dim.des + offset);