- 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;
- metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
+ Changer dummy = mi.base.changeEnsureMath();
+ Dimension dim0;
+ {
+ Changer script = mi.base.font.changeStyle(LM_ST_SCRIPTSCRIPT);
+ cell(0).metrics(mi, dim0);
+ // make sure that the dim is high enough for any character
+ Dimension fontDim;
+ math_font_max_dim(mi.base.font, fontDim.asc, fontDim.des);
+ dim0 += fontDim;
+ }
+
+ Dimension dim1;
+ cell(1).metrics(mi, dim1);
+ // make sure that the dim is high enough for any character
+ Dimension fontDim;
+ math_font_max_dim(mi.base.font, fontDim.asc, fontDim.des);
+ dim1 += fontDim;
+
+ dim.asc = max(dim0.ascent() + 5, dim1.ascent()) + 1;
+ dim.des = max(dim0.descent() - 5, dim1.descent());
+ dim.wid = dim0.width() + dim1.width() + 4;