void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const { bool really_change_font = isTextFont(from_ascii(mi.base.fontname)); FontSetChanger dummy(mi.base, "mathnormal", really_change_font); cell(0).metrics(mi, dim); metricsMarkers(dim); }
void InsetMathLefteqn::metrics(MetricsInfo & mi, Dimension & dim) const { cell(0).metrics(mi, dim); dim.asc += 2; dim.des += 2; dim.wid = 4; metricsMarkers(dim); }
void InsetMathSqrt::metrics(MetricsInfo & mi, Dimension & dim) const { cell(0).metrics(mi, dim); dim.asc += 4; dim.des += 2; dim.wid += 12; metricsMarkers(dim); }
void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const { Dimension dim0; cell(0).metrics(mi, dim0); FontInfo font = mi.base.font; augmentFont(font, from_ascii("mathnormal")); Dimension t = theFontMetrics(font).dimension('{'); dim.asc = max(dim0.asc, t.asc); dim.des = max(dim0.des, t.des); dim.wid = dim0.width() + 2 * t.wid; metricsMarkers(dim); }
void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const { ScriptChanger dummy(mi.base); Dimension dim0; cell(0).metrics(mi, dim0); Dimension dim1; cell(1).metrics(mi, dim1); dim.wid = max(dim0.width(), dim1.width()) + 10; dim.asc = dim0.height() + 10; dim.des = dim1.height(); metricsMarkers(dim); }
void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const { Dimension dim1; cell(1).metrics(mi, dim1); FracChanger dummy(mi.base); Dimension dim0; cell(0).metrics(mi, dim0); dim.wid = max(dim0.width(), dim1.width()) + 4; dim.asc = dim1.ascent(); dim.des = dim1.descent() + dim0.height() + 4; metricsMarkers(dim); }
void InsetMathComment::metrics(MetricsInfo & mi, Dimension & dim) const { cell(0).metrics(mi, dim); metricsMarkers(dim); }
void InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const { StyleChanger dummy(mi.base, style_); cell(0).metrics(mi, dim); metricsMarkers(dim); }
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, UP_SHAPE); 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, dim0); ShapeChanger dummy2(mi.base.font, UP_SHAPE); cell(1).metrics(mi, dim1); dim.wid = dim0.width() + dim1.wid + 5; dim.asc = max(dim0.asc, dim1.asc); dim.des = max(dim0.des, dim1.des); } else { cell(2).metrics(mi, dim2); ShapeChanger dummy2(mi.base.font, UP_SHAPE); FracChanger dummy(mi.base); cell(0).metrics(mi, dim0); cell(1).metrics(mi, dim1); dim.wid = dim0.width() + dim1.wid + dim2.wid + 10; dim.asc = max(dim2.asc, dim0.height() + 5); dim.des = max(dim2.des, dim1.height() - 5); } } else { // general cell metrics used for \frac FracChanger dummy(mi.base); cell(0).metrics(mi, dim0); cell(1).metrics(mi, dim1); if (nargs() == 3) cell(2).metrics(mi, dim2); // metrics for special fraction types if (kind_ == NICEFRAC) { 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, UP_SHAPE); dim.wid = dim0.width() + dim1.wid + 5; dim.asc = dim0.height() + 5; dim.des = dim1.height() - 5; } else { if (kind_ == CFRAC || kind_ == CFRACLEFT || kind_ == CFRACRIGHT || kind_ == DFRAC) { // \cfrac and \dfrac are always in display size StyleChanger dummy2(mi.base, LM_ST_DISPLAY); cell(0).metrics(mi, dim0); cell(1).metrics(mi, dim1); } else if (kind_ == TFRAC) { // tfrac is in always in text size StyleChanger dummy2(mi.base, LM_ST_SCRIPT); cell(0).metrics(mi, dim0); cell(1).metrics(mi, dim1); } dim.wid = max(dim0.wid, dim1.wid) + 2; dim.asc = dim0.height() + 2 + 5; dim.des = dim1.height() + 2 - 5; } } metricsMarkers(dim); }