void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
{
ScriptChanger dummy(mi.base);
- cell(0).metrics(mi);
- cell(1).metrics(mi);
- dim.asc = cell(0).height() + 4 + 5;
- dim.des = cell(1).height() + 4 - 5;
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 2 * dw(dim.height()) + 4;
+ Dimension dim0, dim1;
+ cell(0).metrics(mi, dim0);
+ cell(1).metrics(mi, dim1);
+ dim.asc = dim0.height() + 4 + 5;
+ dim.des = dim1.height() + 4 - 5;
+ dim.wid = std::max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
metricsMarkers2(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const
{
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
int m = x + dim.width() / 2;
ScriptChanger dummy(pi.base);
- cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 3 - 5);
- cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 3 - 5);
+ cell(0).draw(pi, m - dim0.width() / 2, y - dim0.des - 3 - 5);
+ cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc + 3 - 5);
mathed_draw_deco(pi, x, y - dim.ascent(), dw(dim.height()), dim.height(), from_ascii("("));
mathed_draw_deco(pi, x + dim.width() - dw(dim.height()), y - dim.ascent(),
dw(dim.height()), dim.height(), from_ascii(")"));
void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
{
- cell(0).metrics(mi);
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
Dimension t = theFontMetrics(mi.base.font).dimension('{');
- dim.asc = std::max(cell(0).ascent(), t.asc);
- dim.des = std::max(cell(0).descent(), t.des);
- dim.wid = cell(0).width() + 2 * t.wid;
+ dim.asc = std::max(dim0.asc, t.asc);
+ dim.des = std::max(dim0.des, t.des);
+ dim.wid = dim0.width() + 2 * t.wid;
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
Dimension t = theFontMetrics(font).dimension('{');
pi.pain.text(x, y, '{', font);
cell(0).draw(pi, x + t.wid, y);
- pi.pain.text(x + t.wid + cell(0).width(), y, '}', font);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ pi.pain.text(x + t.wid + dim0.width(), y, '}', font);
drawMarkers(pi, x, y);
}
void InsetMathDFrac::metrics(MetricsInfo & mi, Dimension & dim) const
{
- cell(0).metrics(mi);
- cell(1).metrics(mi);
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 2;
- dim.asc = cell(0).height() + 2 + 5;
- dim.des = cell(1).height() + 2 - 5;
+ Dimension dim0, dim1;
+ cell(0).metrics(mi, dim0);
+ cell(1).metrics(mi, dim1);
+ dim.wid = std::max(dim0.wid, dim1.wid) + 2;
+ dim.asc = dim0.height() + 2 + 5;
+ dim.des = dim1.height() + 2 - 5;
// Cache the inset dimension.
setDimCache(mi, dim);
}
void InsetMathDFrac::draw(PainterInfo & pi, int x, int y) const
{
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
int m = x + dim.wid / 2;
- cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5);
- cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 2 - 5);
+ cell(0).draw(pi, m - dim0.wid / 2, y - dim0.des - 2 - 5);
+ cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc + 2 - 5);
pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color::math);
setPosCache(pi, x, y);
}
void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const
{
cell(0).draw(pi, x + 1, y);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
if (wide())
- mathed_draw_deco(pi, x + 1, y + dy_, cell(0).width(), dh_, key_->name);
+ mathed_draw_deco(pi, x + 1, y + dy_, dim0.wid, dh_, key_->name);
else
- mathed_draw_deco(pi, x + 1 + (cell(0).width() - dw_) / 2,
+ mathed_draw_deco(pi, x + 1 + (dim0.wid - dw_) / 2,
y + dy_, dw_, dh_, key_->name);
drawMarkers(pi, x, y);
setPosCache(pi, x, y);
void InsetMathDelim::metrics(MetricsInfo & mi, Dimension & dim) const
{
using std::max;
- cell(0).metrics(mi);
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
Dimension t = theFontMetrics(mi.base.font).dimension('I');
int h0 = (t.asc + t.des) / 2;
- int a0 = max(cell(0).ascent(), t.asc) - h0;
- int d0 = max(cell(0).descent(), t.des) + h0;
- dw_ = cell(0).height() / 5;
+ int a0 = max(dim0.asc, t.asc) - h0;
+ int d0 = max(dim0.des, t.des) + h0;
+ dw_ = dim0.height() / 5;
if (dw_ > 8)
dw_ = 8;
if (dw_ < 4)
dw_ = 4;
- dim.wid = cell(0).width() + 2 * dw_ + 8;
+ dim.wid = dim0.width() + 2 * dw_ + 8;
dim.asc = max(a0, d0) + h0;
dim.des = max(a0, d0) - h0;
// Cache the inset dimension.
void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
{
+ Dimension dim0, dim1, dim2;
+
if (kind_ == UNIT || (kind_ == UNITFRAC && nargs() == 3)) {
if (nargs() == 1) {
ShapeChanger dummy2(mi.base.font, Font::UP_SHAPE);
- cell(0).metrics(mi);
- dim.wid = cell(0).width()+ 3;
- dim.asc = cell(0).ascent();
- dim.des = cell(0).descent();
+ cell(0).metrics(mi, dim0);
+ dim.wid = dim0.width()+ 3;
+ dim.asc = dim0.asc;
+ dim.des = dim0.des;
} else if (nargs() == 2) {
- cell(0).metrics(mi);
+ cell(0).metrics(mi, dim0);
ShapeChanger dummy2(mi.base.font, Font::UP_SHAPE);
- cell(1).metrics(mi);
- dim.wid = cell(0).width() + cell(1).width() + 5;
- dim.asc = std::max(cell(0).ascent(), cell(1).ascent());
- dim.des = std::max(cell(0).descent(), cell(1).descent());
+ cell(1).metrics(mi, dim1);
+ dim.wid = dim0.width() + dim1.wid + 5;
+ dim.asc = std::max(dim0.asc, dim1.asc);
+ dim.des = std::max(dim0.des, dim1.des);
} else {
- cell(2).metrics(mi);
+ cell(2).metrics(mi, dim2);
ShapeChanger dummy2(mi.base.font, Font::UP_SHAPE);
FracChanger dummy(mi.base);
- cell(0).metrics(mi);
- cell(1).metrics(mi);
- dim.wid = cell(0).width() + cell(1).width() + cell(2).width() + 10;
- dim.asc = std::max(cell(2).ascent(), cell(0).height() + 5);
- dim.des = std::max(cell(2).descent(), cell(1).height() - 5);
+ cell(0).metrics(mi, dim0);
+ cell(1).metrics(mi, dim1);
+ dim.wid = dim0.width() + dim1.wid + dim2.wid + 10;
+ dim.asc = std::max(dim2.asc, dim0.height() + 5);
+ dim.des = std::max(dim2.des, dim1.height() - 5);
}
} else {
FracChanger dummy(mi.base);
- cell(0).metrics(mi);
- cell(1).metrics(mi);
+ cell(0).metrics(mi, dim0);
+ cell(1).metrics(mi, dim1);
if (kind_ == NICEFRAC) {
- dim.wid = cell(0).width() + cell(1).width() + 5;
- dim.asc = cell(0).height() + 5;
- dim.des = cell(1).height() - 5;
+ dim.wid = dim0.width() + dim1.wid + 5;
+ dim.asc = dim0.height() + 5;
+ dim.des = dim1.height() - 5;
} else if (kind_ == UNITFRAC) {
ShapeChanger dummy2(mi.base.font, Font::UP_SHAPE);
- dim.wid = cell(0).width() + cell(1).width() + 5;
- dim.asc = cell(0).height() + 5;
- dim.des = cell(1).height() - 5;
+ dim.wid = dim0.width() + dim1.wid + 5;
+ dim.asc = dim0.height() + 5;
+ dim.des = dim1.height() - 5;
} else {
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 2;
- dim.asc = cell(0).height() + 2 + 5;
- dim.des = cell(1).height() + 2 - 5;
+ dim.wid = std::max(dim0.width(), dim1.wid) + 2;
+ dim.asc = dim0.height() + 2 + 5;
+ dim.des = dim1.height() + 2 - 5;
}
}
metricsMarkers(dim);
{
setPosCache(pi, x, y);
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const dim1 = cell(1).dimension(*pi.base.bv);
+ Dimension const dim2 = cell(0).dimension(*pi.base.bv);
int m = x + dim.wid / 2;
if (kind_ == UNIT || (kind_ == UNITFRAC && nargs() == 3)) {
if (nargs() == 1) {
} else if (nargs() == 2) {
cell(0).draw(pi, x + 1, y);
ShapeChanger dummy2(pi.base.font, Font::UP_SHAPE);
- cell(1).draw(pi, x + cell(0).width() + 5, y);
+ cell(1).draw(pi, x + dim0.width() + 5, y);
} else {
cell(2).draw(pi, x + 1, y);
ShapeChanger dummy2(pi.base.font, Font::UP_SHAPE);
FracChanger dummy(pi.base);
- int xx = x + cell(2).width() + 5;
+ int xx = x + dim2.wid + 5;
cell(0).draw(pi, xx + 2,
- y - cell(0).descent() - 5);
- cell(1).draw(pi, xx + cell(0).width() + 5,
- y + cell(1).ascent() / 2);
+ y - dim0.des - 5);
+ cell(1).draw(pi, xx + dim0.width() + 5,
+ y + dim1.asc / 2);
}
} else {
FracChanger dummy(pi.base);
if (kind_ == NICEFRAC) {
cell(0).draw(pi, x + 2,
- y - cell(0).descent() - 5);
- cell(1).draw(pi, x + cell(0).width() + 5,
- y + cell(1).ascent() / 2);
+ y - dim0.des - 5);
+ cell(1).draw(pi, x + dim0.width() + 5,
+ y + dim1.asc / 2);
} else if (kind_ == UNITFRAC) {
ShapeChanger dummy2(pi.base.font, Font::UP_SHAPE);
cell(0).draw(pi, x + 2,
- y - cell(0).descent() - 5);
- cell(1).draw(pi, x + cell(0).width() + 5,
- y + cell(1).ascent() / 2);
+ y - dim0.des - 5);
+ cell(1).draw(pi, x + dim0.width() + 5,
+ y + dim1.asc / 2);
} else {
// Classical fraction
- cell(0).draw(pi, m - cell(0).width() / 2,
- y - cell(0).descent() - 2 - 5);
- cell(1).draw(pi, m - cell(1).width() / 2,
- y + cell(1).ascent() + 2 - 5);
+ cell(0).draw(pi, m - dim0.width() / 2,
+ y - dim0.des - 2 - 5);
+ cell(1).draw(pi, m - dim1.wid / 2,
+ y + dim1.asc + 2 - 5);
}
}
if (kind_ == NICEFRAC || kind_ == UNITFRAC) {
// Diag line:
int xx = x;
if (nargs() == 3)
- xx += cell(2).width() + 5;
- pi.pain.line(xx + cell(0).width(),
+ xx += dim2.wid + 5;
+ pi.pain.line(xx + dim0.wid,
y + dim.des - 2,
- xx + cell(0).width() + 5,
+ xx + dim0.wid + 5,
y - dim.asc + 2, Color::math);
}
if (kind_ == FRAC || kind_ == OVER)
void InsetMathFrac::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
- cell(0).metricsT(mi, dim);
- cell(1).metricsT(mi, dim);
- dim.wid = std::max(cell(0).width(), cell(1).width());
- dim.asc = cell(0).height() + 1;
- dim.des = cell(1).height();
+ Dimension dim0, dim1;
+ cell(0).metricsT(mi, dim0);
+ cell(1).metricsT(mi, dim1);
+ dim.wid = std::max(dim0.width(), dim1.wid);
+ dim.asc = dim0.height() + 1;
+ dim.des = dim1.height();
}
void InsetMathFrac::drawT(TextPainter & pain, int x, int y) const
{
// FIXME: BROKEN!
+ /*
Dimension dim;
int m = x + dim.width() / 2;
- cell(0).drawT(pain, m - cell(0).width() / 2, y - cell(0).descent() - 1);
- cell(1).drawT(pain, m - cell(1).width() / 2, y + cell(1).ascent());
+ cell(0).drawT(pain, m - dim0.width() / 2, y - dim0.des - 1);
+ cell(1).drawT(pain, m - dim1.wid / 2, y + dim1.asc);
// ASCII art: ignore niceties
if (kind_ == FRAC || kind_ == OVER || kind_ == NICEFRAC || kind_ == UNITFRAC)
pain.horizontalLine(x, y, dim.width());
+ */
}
FontSetChanger dummy(mi.base, "textnormal");
w_ = mathed_char_width(mi.base.font, '[');
InsetMathNest::metrics(mi);
- dim = cell(0).dim();
- dim += cell(1).dim();
- dim += cell(2).dim();
+ dim = cell(0).dimension(*mi.base.bv);
+ dim += cell(1).dimension(*mi.base.bv);
+ dim += cell(2).dimension(*mi.base.bv);
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
dim.width() - 2, dim.height() - 2, Color::foreground);
x += 5;
+ BufferView const & bv = *pi.base.bv;
drawStrBlack(pi, x, y, from_ascii("["));
x += w_;
cell(0).draw(pi, x, y);
- x += cell(0).width();
+ x += cell(0).dimension(bv).wid;
drawStrBlack(pi, x, y, from_ascii("]"));
x += w_ + 4;
drawStrBlack(pi, x, y, from_ascii("["));
x += w_;
cell(1).draw(pi, x, y);
- x += cell(1).width();
+ x += cell(1).dimension(bv).wid;
drawStrBlack(pi, x, y, from_ascii("]"));
x += w_ + 4;
// let the cells adjust themselves
InsetMathNest::metrics(mi);
+ BufferView & bv = *mi.base.bv;
+
// compute absolute sizes of vertical structure
for (row_type row = 0; row < nrows(); ++row) {
int asc = 0;
int desc = 0;
for (col_type col = 0; col < ncols(); ++col) {
- MathData const & c = cell(index(row, col));
- asc = max(asc, c.ascent());
- desc = max(desc, c.descent());
+ Dimension const & dimc = cell(index(row, col)).dimension(bv);
+ asc = max(asc, dimc.asc);
+ desc = max(desc, dimc.des);
}
rowinfo_[row].ascent_ = asc;
rowinfo_[row].descent_ = desc;
for (col_type col = 0; col < ncols(); ++col) {
int wid = 0;
for (row_type row = 0; row < nrows(); ++row)
- wid = max(wid, cell(index(row, col)).width());
+ wid = max(wid, cell(index(row, col)).dimension(bv).wid);
colinfo_[col].width_ = wid;
}
colinfo_[ncols()].width_ = 0;
int lmargin, int rmargin) const
{
Dimension const dim = dimension(*pi.base.bv);
+ BufferView const & bv = *pi.base.bv;
for (idx_type idx = 0; idx < nargs(); ++idx)
- cell(idx).draw(pi, x + lmargin + cellXOffset(idx),
+ cell(idx).draw(pi, x + lmargin + cellXOffset(bv, idx),
y + cellYOffset(idx));
for (row_type row = 0; row <= nrows(); ++row)
int asc = 0;
int desc = 0;
for (col_type col = 0; col < ncols(); ++col) {
- MathData const & c = cell(index(row, col));
- asc = max(asc, c.ascent());
- desc = max(desc, c.descent());
+ //MathData const & c = cell(index(row, col));
+ // FIXME: BROKEN!
+ Dimension dimc;
+ asc = max(asc, dimc.ascent());
+ desc = max(desc, dimc.descent());
}
rowinfo_[row].ascent_ = asc;
rowinfo_[row].descent_ = desc;
// compute absolute sizes of horizontal structure
for (col_type col = 0; col < ncols(); ++col) {
int wid = 0;
- for (row_type row = 0; row < nrows(); ++row)
- wid = max(wid, cell(index(row, col)).width());
+ for (row_type row = 0; row < nrows(); ++row) {
+ // FIXME: BROKEN!
+ //wid = max(wid, cell(index(row, col)).width());
+ }
colinfo_[col].width_ = wid;
}
colinfo_[ncols()].width_ = 0;
void InsetMathGrid::drawT(TextPainter & pain, int x, int y) const
{
- for (idx_type idx = 0; idx < nargs(); ++idx)
- cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
+// for (idx_type idx = 0; idx < nargs(); ++idx)
+// cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
}
}
-int InsetMathGrid::cellXOffset(idx_type idx) const
+int InsetMathGrid::cellXOffset(BufferView const & bv, idx_type idx) const
{
col_type c = col(idx);
int x = colinfo_[c].offset_;
char align = colinfo_[c].align_;
+ Dimension const & celldim = cell(idx).dimension(bv);
if (align == 'r' || align == 'R')
- x += colinfo_[c].width_ - cell(idx).width();
+ x += colinfo_[c].width_ - celldim.wid;
if (align == 'c' || align == 'C')
- x += (colinfo_[c].width_ - cell(idx).width()) / 2;
+ x += (colinfo_[c].width_ - celldim.wid) / 2;
return x;
}
bool getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const;
/// returns x offset of cell compared to inset
- int cellXOffset(idx_type idx) const;
+ int cellXOffset(BufferView const &, idx_type idx) const;
/// returns y offset of cell compared to inset
int cellYOffset(idx_type idx) const;
/// returns proper 'end of line' code for LaTeX
FontSetChanger dummy(mi.base, from_ascii("textnormal"));
w_ = mathed_char_width(mi.base.font, '[');
InsetMathNest::metrics(mi);
- dim = cell(0).dim();
- dim += cell(1).dim();
- dim += cell(2).dim();
+ dim = cell(0).dimension(*mi.base.bv);
+ dim += cell(1).dimension(*mi.base.bv);
+ dim += cell(2).dimension(*mi.base.bv);
dim.wid += 4 * w_ + 4;
metricsMarkers(dim);
// Cache the inset dimension.
drawStrBlack(pi, x, y, from_ascii("["));
x += w_;
cell(0).draw(pi, x, y);
- x += cell(0).width();
+ x += cell(0).dimension(*pi.base.bv).width();
drawStrBlack(pi, x, y, from_ascii("]"));
x += w_ + 2;
drawStrBlack(pi, x, y, from_ascii("["));
x += w_;
cell(1).draw(pi, x, y);
- x += cell(1).width();
+ x += cell(1).dimension(*pi.base.bv).wid;
drawStrBlack(pi, x, y, from_ascii("]"));
x += w_ + 2;
void InsetMathNest::metrics(MetricsInfo const & mi) const
{
MetricsInfo m = mi;
- for (idx_type i = 0, n = nargs(); i != n; ++i)
- cell(i).metrics(m);
+ for (idx_type i = 0, n = nargs(); i != n; ++i) {
+ Dimension dim;
+ cell(i).metrics(m, dim);
+ }
}
// << " s1: " << s1 << " s2: " << s2 << endl;
if (s1.idx() == s2.idx()) {
MathData const & c = cell(s1.idx());
- int x1 = c.xo(bv) + c.pos2x(s1.pos());
- int y1 = c.yo(bv) - c.ascent();
- int x2 = c.xo(bv) + c.pos2x(s2.pos());
- int y2 = c.yo(bv) + c.descent();
+ Geometry const & g = bv.coordCache().getArrays().geometry(&c);
+ int x1 = g.pos.x_ + c.pos2x(s1.pos());
+ int y1 = g.pos.y_ - g.dim.ascent();
+ int x2 = g.pos.x_ + c.pos2x(s2.pos());
+ int y2 = g.pos.y_ + g.dim.descent();
pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection);
//lyxerr << "InsetMathNest::drawing selection 3: "
// << " x1: " << x1 << " x2: " << x2
for (idx_type i = 0; i < nargs(); ++i) {
if (idxBetween(i, s1.idx(), s2.idx())) {
MathData const & c = cell(i);
- int x1 = c.xo(bv);
- int y1 = c.yo(bv) - c.ascent();
- int x2 = c.xo(bv) + c.width();
- int y2 = c.yo(bv) + c.descent();
+ Geometry const & g = bv.coordCache().getArrays().geometry(&c);
+ int x1 = g.pos.x_;
+ int y1 = g.pos.y_ - g.dim.ascent();
+ int x2 = g.pos.x_ + g.dim.width();
+ int y2 = g.pos.y_ + g.dim.descent();
pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection);
}
}
void InsetMathOverset::metrics(MetricsInfo & mi, Dimension & dim) const
{
- cell(1).metrics(mi);
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
FracChanger dummy(mi.base);
- cell(0).metrics(mi);
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 4;
- dim.asc = cell(1).ascent() + cell(0).height() + 4;
- dim.des = cell(1).descent();
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
+ dim.wid = std::max(dim0.width(), dim1.wid) + 4;
+ dim.asc = dim1.asc + dim0.height() + 4;
+ dim.des = dim1.des;
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
void InsetMathOverset::draw(PainterInfo & pi, int x, int y) const
{
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
int m = x + dim.wid / 2;
- int yo = y - cell(1).ascent() - cell(0).descent() - 1;
- cell(1).draw(pi, m - cell(1).width() / 2, y);
+ int yo = y - dim1.asc - dim0.des - 1;
+ cell(1).draw(pi, m - dim1.wid / 2, y);
FracChanger dummy(pi.base);
- cell(0).draw(pi, m - cell(0).width() / 2, yo);
+ cell(0).draw(pi, m - dim0.width() / 2, yo);
drawMarkers(pi, x, y);
}
{
using std::max;
InsetMathNest::metrics(mi);
- dim.asc = max(cell(0).ascent() + 5, cell(1).ascent()) + 2;
- dim.des = max(cell(0).descent() - 5, cell(1).descent()) + 2;
- dim.wid = cell(0).width() + cell(1).width() + 10;
+ Dimension const & dim0 = cell(0).dimension(*mi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*mi.base.bv);
+ dim.asc = max(dim0.ascent() + 5, dim1.ascent()) + 2;
+ dim.des = max(dim0.descent() - 5, dim1.descent()) + 2;
+ dim.wid = dim0.width() + dim1.width() + 10;
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const
{
- int const w = cell(0).width();
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ int const w = dim0.width();
// the "exponent"
- cell(0).draw(pi, x, y - 5 - cell(0).descent());
+ cell(0).draw(pi, x, y - 5 - dim0.descent());
// the "base"
cell(1).draw(pi, x + w + 8, y);
Dimension const dim = dimension(*pi.base.bv);
} // namespace anon
-int InsetMathScript::dy01(int asc, int des, int what) const
+int InsetMathScript::dy01(BufferView const & bv, int asc, int des, int what) const
{
int dasc = 0;
int slevel = 0;
bool isCharBox = nuc().size() ? isAlphaSymbol(nuc().back()) : false;
if (hasDown()) {
- dasc = down().ascent();
+ Dimension const & dimdown = down().dimension(bv);
+ dasc = dimdown.ascent();
slevel = nuc().slevel();
int ascdrop = dasc - slevel;
int desdrop = isCharBox ? 0 : des + nuc().sshift();
des = max(mindes, des);
}
if (hasUp()) {
+ Dimension const & dimup = up().dimension(bv);
int minasc = nuc().minasc();
int ascdrop = isCharBox ? 0 : asc - up().mindes();
- int udes = up().descent();
+ int udes = dimup.descent();
asc = udes + nuc().sshift();
asc = max(ascdrop, asc);
asc = max(minasc, asc);
}
-int InsetMathScript::dy0() const
+int InsetMathScript::dy0(BufferView const & bv) const
{
- int nd = ndes();
+ int nd = ndes(bv);
if (!hasDown())
return nd;
- int des = down().ascent();
+ int des = down().dimension(bv).ascent();
if (hasLimits())
des += nd + 2;
else {
- int na = nasc();
- des = dy01(na, nd, 0);
+ int na = nasc(bv);
+ des = dy01(bv, na, nd, 0);
}
return des;
}
-int InsetMathScript::dy1() const
+int InsetMathScript::dy1(BufferView const & bv) const
{
- int na = nasc();
+ int na = nasc(bv);
if (!hasUp())
return na;
- int asc = up().descent();
+ int asc = up().dimension(bv).descent();
if (hasLimits())
asc += na + 2;
else {
- int nd = ndes();
- asc = dy01(na, nd, 1);
+ int nd = ndes(bv);
+ asc = dy01(bv, na, nd, 1);
}
asc = max(asc, 5);
return asc;
{
BOOST_ASSERT(hasDown());
Dimension const dim = dimension(bv);
- return hasLimits() ? (dim.wid - down().width()) / 2 : nwid();
+ return hasLimits() ? (dim.wid - down().dimension(bv).width()) / 2 : nwid(bv);
}
{
BOOST_ASSERT(hasUp());
Dimension const dim = dimension(bv);
- return hasLimits() ? (dim.wid - up().width()) / 2 : nwid() + nker();
+ return hasLimits() ? (dim.wid - up().dimension(bv).width()) / 2 : nwid(bv) + nker();
}
int InsetMathScript::dxx(BufferView const & bv) const
{
Dimension const dim = dimension(bv);
- return hasLimits() ? (dim.wid - nwid()) / 2 : 0;
+ return hasLimits() ? (dim.wid - nwid(bv)) / 2 : 0;
}
-int InsetMathScript::nwid() const
+int InsetMathScript::nwid(BufferView const & bv) const
{
- return nuc().size() ? nuc().width() : 2;
+ return nuc().size() ? nuc().dimension(bv).width() : 2;
}
-int InsetMathScript::nasc() const
+int InsetMathScript::nasc(BufferView const & bv) const
{
- return nuc().size() ? nuc().ascent() : 5;
+ return nuc().size() ? nuc().dimension(bv).ascent() : 5;
}
-int InsetMathScript::ndes() const
+int InsetMathScript::ndes(BufferView const & bv) const
{
- return nuc().size() ? nuc().descent() : 0;
+ return nuc().size() ? nuc().dimension(bv).descent() : 0;
}
void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const
{
- cell(0).metrics(mi);
+ Dimension dim0;
+ Dimension dim1;
+ Dimension dim2;
+ cell(0).metrics(mi, dim0);
ScriptChanger dummy(mi.base);
if (nargs() > 1)
- cell(1).metrics(mi);
+ cell(1).metrics(mi, dim1);
if (nargs() > 2)
- cell(2).metrics(mi);
+ cell(2).metrics(mi, dim2);
+
dim.wid = 0;
+ BufferView & bv = *mi.base.bv;
+ // FIXME: data copying... not very efficient.
+ Dimension dimup;
+ Dimension dimdown;
+ if (hasUp())
+ dimup = up().dimension(bv);
+ if (hasDown())
+ dimdown = down().dimension(bv);
+
if (hasLimits()) {
- dim.wid = nwid();
+ dim.wid = nwid(bv);
if (hasUp())
- dim.wid = max(dim.wid, up().width());
+ dim.wid = max(dim.wid, dimup.width());
if (hasDown())
- dim.wid = max(dim.wid, down().width());
+ dim.wid = max(dim.wid, dimdown.width());
} else {
if (hasUp())
- dim.wid = max(dim.wid, nker() + up().width());
+ dim.wid = max(dim.wid, nker() + dimup.width());
if (hasDown())
- dim.wid = max(dim.wid, down().width());
- dim.wid += nwid();
+ dim.wid = max(dim.wid, dimdown.width());
+ dim.wid += nwid(bv);
}
- int na = nasc();
+ int na = nasc(bv);
if (hasUp()) {
- int asc = dy1() + up().ascent();
+ int asc = dy1(bv) + dimup.ascent();
dim.asc = max(na, asc);
} else
dim.asc = na;
- int nd = ndes();
+ int nd = ndes(bv);
if (hasDown()) {
- int des = dy0() + down().descent();
+ int des = dy0(bv) + dimdown.descent();
dim.des = max(nd, des);
} else
dim.des = nd;
void InsetMathScript::draw(PainterInfo & pi, int x, int y) const
{
+ BufferView & bv = *pi.base.bv;
if (nuc().size())
- nuc().draw(pi, x + dxx(*pi.base.bv), y);
+ nuc().draw(pi, x + dxx(bv), y);
else {
- nuc().setXY(*pi.base.bv, x + dxx(*pi.base.bv), y);
- if (editing(pi.base.bv))
- pi.draw(x + dxx(*pi.base.bv), y, char_type('.'));
+ nuc().setXY(bv, x + dxx(bv), y);
+ if (editing(&bv))
+ pi.draw(x + dxx(bv), y, char_type('.'));
}
ScriptChanger dummy(pi.base);
if (hasUp())
- up().draw(pi, x + dx1(*pi.base.bv), y - dy1());
+ up().draw(pi, x + dx1(bv), y - dy1(bv));
if (hasDown())
- down().draw(pi, x + dx0(*pi.base.bv), y + dy0());
+ down().draw(pi, x + dx0(bv), y + dy0(bv));
drawMarkers(pi, x, y);
}
void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
{
+ // FIXME: BROKEN
if (nuc().size())
nuc().drawT(pain, x + 1, y);
if (hasUp())
- up().drawT(pain, x + 1, y - dy1());
+ up().drawT(pain, x + 1, y - 1 /*dy1()*/);
if (hasDown())
- down().drawT(pain, x + 1, y + dy0());
+ down().drawT(pain, x + 1, y + 1 /*dy0()*/);
}
/// returns x offset for main part
int dxx(BufferView const & bv) const;
/// returns width of nucleus if any
- int nwid() const;
+ int nwid(BufferView const &) const;
/// returns y offset for either superscript or subscript
- int dy01(int asc, int des, int what) const;
+ int dy01(BufferView const &, int asc, int des, int what) const;
/// returns y offset for superscript
- int dy0() const;
+ int dy0(BufferView const &) const;
/// returns y offset for subscript
- int dy1() const;
+ int dy1(BufferView const &) const;
/// returns x offset for superscript
int dx0(BufferView const & bv) const;
/// returns x offset for subscript
int dx1(BufferView const & bv) const;
/// returns ascent of nucleus if any
- int nasc() const;
+ int nasc(BufferView const &) const;
/// returns descent of nucleus if any
- int ndes() const;
+ int ndes(BufferView const &) const;
/// returns superscript kerning of nucleus if any
int nker() const;
/// where do we have to draw the scripts?
void InsetMathSqrt::drawT(TextPainter & pain, int x, int y) const
{
+ /*
cell(0).drawT(pain, x + 2, y);
- pain.horizontalLine(x + 2, y - cell(0).ascent(), cell(0).width(), '_');
- pain.verticalLine (x + 1, y - cell(0).ascent() + 1, cell(0).height());
- pain.draw(x, y + cell(0).descent(), '\\');
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ pain.horizontalLine(x + 2, y - dim0.ascent(), dim0.width(), '_');
+ pain.verticalLine (x + 1, y - dim0.ascent() + 1, dim0.height());
+ pain.draw(x, y + dim0.descent(), '\\');
+ */
}
void InsetMathStackrel::metrics(MetricsInfo & mi, Dimension & dim) const
{
- cell(1).metrics(mi);
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
FracChanger dummy(mi.base);
- cell(0).metrics(mi);
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 4;
- dim.asc = cell(1).ascent() + cell(0).height() + 4;
- dim.des = cell(1).descent();
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
+ dim.wid = std::max(dim0.width(), dim1.width()) + 4;
+ dim.asc = dim1.ascent() + dim0.height() + 4;
+ dim.des = dim1.descent();
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
void InsetMathStackrel::draw(PainterInfo & pi, int x, int y) const
{
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
int m = x + dim.width() / 2;
- int yo = y - cell(1).ascent() - cell(0).descent() - 1;
- cell(1).draw(pi, m - cell(1).width() / 2, y);
+ int yo = y - dim1.ascent() - dim0.descent() - 1;
+ cell(1).draw(pi, m - dim1.width() / 2, y);
FracChanger dummy(pi.base);
- cell(0).draw(pi, m - cell(0).width() / 2, yo);
+ cell(0).draw(pi, m - dim0.width() / 2, yo);
drawMarkers(pi, x, y);
}
void InsetMathTFrac::metrics(MetricsInfo & mi, Dimension & dim) const
{
StyleChanger dummy(mi.base, LM_ST_SCRIPT);
- cell(0).metrics(mi);
- cell(1).metrics(mi);
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 2;
- dim.asc = cell(0).height() + 2 + 5;
- dim.des = cell(1).height() + 2 - 5;
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
+ dim.wid = std::max(dim0.width(), dim1.width()) + 2;
+ dim.asc = dim0.height() + 2 + 5;
+ dim.des = dim1.height() + 2 - 5;
// Cache the inset dimension.
setDimCache(mi, dim);
}
{
StyleChanger dummy(pi.base, LM_ST_SCRIPT);
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
int m = x + dim.wid / 2;
- cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5);
- cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 2 - 5);
+ cell(0).draw(pi, m - dim0.width() / 2, y - dim0.descent() - 2 - 5);
+ cell(1).draw(pi, m - dim1.width() / 2, y + dim1.ascent() + 2 - 5);
pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color::math);
setPosCache(pi, x, y);
}
void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const
{
- cell(1).metrics(mi);
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
FracChanger dummy(mi.base);
- cell(0).metrics(mi);
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 4;
- dim.asc = cell(1).ascent();
- dim.des = cell(1).descent() + cell(0).height() + 4;
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
+ dim.wid = std::max(dim0.width(), dim1.width()) + 4;
+ dim.asc = dim1.ascent();
+ dim.des = dim1.descent() + dim0.height() + 4;
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
void InsetMathUnderset::draw(PainterInfo & pi, int x, int y) const
{
Dimension const dim = dimension(*pi.base.bv);
+ Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
int m = x + dim.wid / 2;
- int yo = y + cell(1).descent() + cell(0).ascent() + 1;
- cell(1).draw(pi, m - cell(1).width() / 2, y);
+ int yo = y + dim1.descent() + dim0.ascent() + 1;
+ cell(1).draw(pi, m - dim1.width() / 2, y);
FracChanger dummy(pi.base);
- cell(0).draw(pi, m - cell(0).width() / 2, yo);
+ cell(0).draw(pi, m - dim0.width() / 2, yo);
drawMarkers(pi, x, y);
}
void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const
{
ScriptChanger dummy(mi.base);
- cell(0).metrics(mi);
- cell(1).metrics(mi);
- dim.wid = std::max(cell(0).width(), cell(1).width()) + 10;
- dim.asc = cell(0).height() + 10;
- dim.des = cell(1).height();
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
+ dim.wid = std::max(dim0.width(), dim1.width()) + 10;
+ dim.asc = dim0.height() + 10;
+ dim.des = dim1.height();
metricsMarkers(dim);
// Cache the inset dimension.
setDimCache(mi, dim);
{
ScriptChanger dummy(pi.base);
cell(0).draw(pi, x + 5, y - 10);
- cell(1).draw(pi, x + 5, y + cell(1).height());
+ Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
+ cell(1).draw(pi, x + 5, y + dim1.height());
Dimension const dim = dimension(*pi.base.bv);
mathed_draw_deco(pi, x + 1, y - 7, dim.wid - 2, 5, name_);
drawMarkers(pi, x, y);
if (editing()) {
int w = mathed_string_width(mi.base.font, from_ascii("target: "));
- width_ = w + max(cell(0).width(), cell(1).width());
- ascent_ = cell(0).ascent();
- descent_ = cell(0).descent() + cell(1).height() + 10;
+ width_ = w + max(dim0.width(), dim1.wid);
+ ascent_ = dim0.asc;
+ descent_ = dim0.des + dim1.height() + 10;
} else {
width_ = 0;
ascent_ = 0;
cell(0).draw(pi, x + lwid, y);
pi.base.text(x + 3, y, "target");
- y += max(cell(0).descent(), ldes) + 5;
+ y += max(dim0.des, ldes) + 5;
- y += max(cell(1).ascent(), lasc) + 5;
+ y += max(dim1.asc, lasc) + 5;
cell(1).draw(pi, x + lwid, y);
pi.base.text(x + 3, y, "label");
}
-void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
-{
- metrics(mi);
- dim = dim_;
-}
-
-
namespace {
bool isInside(DocIterator const & it, MathData const & ar,
-void MathData::metrics(MetricsInfo & mi) const
+void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
{
frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
- dim_ = fm.dimension('I');
+ dim = fm.dimension('I');
int xascent = fm.dimension('x').ascent();
- if (xascent >= dim_.asc)
- xascent = (2 * dim_.asc) / 3;
+ if (xascent >= dim.asc)
+ xascent = (2 * dim.asc) / 3;
minasc_ = xascent;
mindes_ = (3 * xascent) / 4;
slevel_ = (4 * xascent) / 5;
if (empty())
return;
- dim_.asc = 0;
- dim_.wid = 0;
+ dim.asc = 0;
+ dim.wid = 0;
Dimension d;
atom_dims_.clear();
//BufferView & bv = *mi.base.bv;
tmpl.expand(args, exp);
mac->setExpansion(exp, args);
mac->metricsExpanded(mi, d);
- dim_.wid += mac->widthExpanded();
+ dim.wid += mac->widthExpanded();
i += numargs;
continue;
}
#endif
at->metrics(mi, d);
atom_dims_.push_back(d);
- dim_ += d;
+ dim += d;
if (i == n - 1)
kerning_ = at->kerning();
}
+ // Cache the dimension.
+ mi.base.bv->coordCache().arrays().add(this, dim);
}
BufferView & bv = *pi.base.bv;
setXY(bv, x, y);
+ Dimension const & dim = bv.coordCache().getArrays().dim(this);
+
if (empty()) {
- pi.pain.rectangle(x, y - ascent(), width(), height(), Color::mathline);
+ pi.pain.rectangle(x, y - dim.ascent(), dim.width(), dim.height(), Color::mathline);
return;
}
// don't draw outside the workarea
- if (y + descent() <= 0
- || y - ascent() >= bv.workHeight()
- || x + width() <= 0
+ if (y + dim.descent() <= 0
+ || y - dim.ascent() >= bv.workHeight()
+ || x + dim.width() <= 0
|| x >= bv. workWidth())
return;
int MathData::dist(BufferView const & bv, int x, int y) const
{
- int xx = 0;
- int yy = 0;
+ return bv.coordCache().getArrays().squareDistance(this, x, y);
+}
- const int xo_ = xo(bv);
- const int yo_ = yo(bv);
- if (x < xo_)
- xx = xo_ - x;
- else if (x > xo_ + width())
- xx = x - xo_ - width();
+void MathData::setXY(BufferView & bv, int x, int y) const
+{
+ //lyxerr << "setting position cache for MathData " << this << std::endl;
+ bv.coordCache().arrays().add(this, x, y);
+}
- if (y < yo_ - ascent())
- yy = yo_ - ascent() - y;
- else if (y > yo_ + descent())
- yy = y - yo_ - descent();
- return xx + yy;
+Dimension const & MathData::dimension(BufferView const & bv) const
+{
+ if (empty()) {
+ static Dimension dummy;
+ return dummy;
+ }
+
+ return bv.coordCache().getArrays().dim(this);
}
-void MathData::setXY(BufferView & bv, int x, int y) const
+int MathData::xm(BufferView const & bv) const
{
- //lyxerr << "setting position cache for MathData " << this << std::endl;
- bv.coordCache().arrays().add(this, x, y);
+ Geometry const & g = bv.coordCache().getArrays().geometry(this);
+
+ return g.pos.x_ + g.dim.wid / 2;
+}
+
+
+int MathData::ym(BufferView const & bv) const
+{
+ Geometry const & g = bv.coordCache().getArrays().geometry(this);
+
+ return g.pos.y_ + (g.dim.des - g.dim.asc) / 2;
}
/// checked read access
MathAtom const & operator[](pos_type) const;
/// rebuild cached metrics information
- void metrics(MetricsInfo & mi) const;
- /// rebuild cached metrics information
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
- Dimension const & dimension(BufferView const &) const { return dim_; };
+ Dimension const & dimension(BufferView const &) const;
/// redraw cell using cache metrics information
void draw(PainterInfo & pi, int x, int y) const;
/// access to cached y coordinate of last drawing
int yo(BufferView const & bv) const;
/// access to cached x coordinate of mid point of last drawing
- int xm(BufferView const & bv) const { return xo(bv) + dim_.wid / 2; }
+ int xm(BufferView const & bv) const;
/// access to cached y coordinate of mid point of last drawing
- int ym(BufferView const & bv) const { return yo(bv) + (dim_.des - dim_.asc) / 2; }
+ int ym(BufferView const & bv) const;
/// write access to coordinate;
void setXY(BufferView & bv, int x, int y) const;
/// returns x coordinate of given position in the array
// assumes valid position and size cache
int dist(BufferView const & bv, int x, int y) const;
- /// ascent of this cell above the baseline
- int ascent() const { return dim_.asc; }
- /// descent of this cell below the baseline
- int descent() const { return dim_.des; }
- /// height of the cell
- int height() const { return dim_.asc + dim_.des; }
- /// width of this cell
- int width() const { return dim_.wid; }
- /// dimensions of cell
- Dimension const & dim() const { return dim_; }
- /// dimensions of cell
- void setDim(Dimension const & d) const { dim_ = d; }
/// minimum ascent offset for superscript
int minasc() const { return minasc_; }
/// minimum descent offset for subscript
void swap(MathData & ar) { base_type::swap(ar); }
protected:
- /// cached dimensions of cell
- mutable Dimension dim_;
/// cached values for super/subscript placement
mutable int minasc_;
mutable int mindes_;
int ww = mathed_string_width(font, from_ascii("#1: "));
for (idx_type i = 0; i < nargs(); ++i) {
MathData const & c = cell(i);
- c.metrics(mi);
- dim.wid = max(dim.wid, c.width() + ww);
- dim.des += c.height() + 10;
+ Dimension dimc;
+ c.metrics(mi, dimc);
+ dim.wid = max(dim.wid, dimc.width() + ww);
+ dim.des += dimc.height() + 10;
}
editing_ = true;
} else {
Font font = pi.base.font;
augmentFont(font, from_ascii("lyxtex"));
Dimension const dim = dimension(*pi.base.bv);
- int h = y - dim.ascent() + 2 + tmpl_.ascent();
+ Dimension const & dim_tmpl = tmpl_.dimension(*pi.base.bv);
+ int h = y - dim.ascent() + 2 + dim_tmpl.ascent();
pi.pain.text(x + 3, h, name(), font);
int const w = mathed_string_width(font, name());
tmpl_.draw(pi, x + w + 12, h);
- h += tmpl_.descent();
+ h += dim_tmpl.descent();
Dimension ldim;
docstring t = from_ascii("#1: ");
mathed_string_dim(font, t, ldim);
for (idx_type i = 0; i < nargs(); ++i) {
MathData const & c = cell(i);
- h += max(c.ascent(), ldim.asc) + 5;
+ Dimension const & dimc = c.dimension(*pi.base.bv);
+ h += max(dimc.ascent(), ldim.asc) + 5;
c.draw(pi, x + ldim.wid, h);
char_type str[] = { '#', '1', ':', '\0' };
str[1] += static_cast<char_type>(i);
pi.pain.text(x + 3, h, str, font);
- h += max(c.descent(), ldim.des) + 5;
+ h += max(dimc.descent(), ldim.des) + 5;
}
} else {
macro.lock();
if (lockMacro)
MacroTable::globalMacros().get(name_).lock();
- cell(0).metrics(mi);
- cell(1).metrics(mi);
+ Dimension dim0;
+ cell(0).metrics(mi, dim0);
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
docstring dp = prefix();
- dim.wid = cell(0).width() + cell(1).width() + 20
+ dim.wid = dim0.width() + dim1.width() + 20
+ theFontMetrics(mi.base.font).width(dp);
- dim.asc = std::max(cell(0).ascent(), cell(1).ascent()) + 7;
- dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
+ dim.asc = std::max(dim0.ascent(), dim1.ascent()) + 7;
+ dim.des = std::max(dim0.descent(), dim1.descent()) + 7;
if (lockMacro)
MacroTable::globalMacros().get(name_).unlock();
// FIXME: Painter text should retain the drawn text width
x += theFontMetrics(font).width(dp) + 6;
- int const w0 = cell(0).width();
- int const w1 = cell(1).width();
+ int const w0 = cell(0).dimension(*pi.base.bv).width();
+ int const w1 = cell(1).dimension(*pi.base.bv).width();
cell(0).draw(pi, x + 2, y + 1);
pi.pain.rectangle(x, y - dim.ascent() + 3,
w0 + 4, dim.height() - 6, Color::mathline);