From: Guillaume Munch Date: Tue, 22 Nov 2016 10:26:15 +0000 (+0100) Subject: InsetMath: match the screen display with the EnsureMath behaviour in output X-Git-Tag: 2.3.0alpha1~717 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=eadc55b8b38a489202e2e168521578dae119fd59;p=features.git InsetMath: match the screen display with the EnsureMath behaviour in output --- diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 3f2b13bc6d..ef9803d831 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -77,6 +77,15 @@ Changer MetricsBase::changeFontSet(string const & name) } +Changer MetricsBase::changeEnsureMath() +{ + // FIXME: + // \textit{\ensuremath{\text{a}}} + // should appear in italics + return isTextFont(fontname) ? changeFontSet("mathnormal") : Changer(); +} + + ///////////////////////////////////////////////////////////////////////// // // MetricsInfo diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h index b350747b4b..1dbeae249a 100644 --- a/src/MetricsInfo.h +++ b/src/MetricsInfo.h @@ -54,6 +54,8 @@ public: /// Temporarily change a full font. Changer changeFontSet(std::string const & font); + /// Temporarily change the font to math if needed. + Changer changeEnsureMath(); // Temporarily change to the style suitable for use in fractions Changer changeFrac(); // Temporarily change to the style suitable for use in arrays diff --git a/src/mathed/InsetMathAMSArray.cpp b/src/mathed/InsetMathAMSArray.cpp index 24a1fef7de..9a9a3495bc 100644 --- a/src/mathed/InsetMathAMSArray.cpp +++ b/src/mathed/InsetMathAMSArray.cpp @@ -85,6 +85,7 @@ char const * InsetMathAMSArray::name_right() const void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.changeArray(); InsetMathGrid::metrics(mi, dim); } @@ -92,6 +93,7 @@ void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); int const yy = y - dim.ascent(); // Drawing the deco after changeStyle does not work diff --git a/src/mathed/InsetMathArray.cpp b/src/mathed/InsetMathArray.cpp index ad476ae17f..eb8676d164 100644 --- a/src/mathed/InsetMathArray.cpp +++ b/src/mathed/InsetMathArray.cpp @@ -74,6 +74,7 @@ Inset * InsetMathArray::clone() const void InsetMathArray::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.changeArray(); InsetMathGrid::metrics(mi, dim); } @@ -82,6 +83,7 @@ void InsetMathArray::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathArray::draw(PainterInfo & pi, int x, int y) const { setPosCache(pi, x, y); + Changer dummy2 = pi.base.changeEnsureMath(); Changer dummy = pi.base.changeArray(); InsetMathGrid::draw(pi, x, y); } diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index 9c2f3bff5b..ff3765aed2 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -69,6 +69,7 @@ double InsetMathBig::increase() const void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); double const h = theFontMetrics(mi.base.font).ascent('I'); double const f = increase(); dim.wid = 6; @@ -79,6 +80,7 @@ void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathBig::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); // mathed_draw_deco does not use the leading backslash, so remove it // (but don't use ltrim if this is the backslash delimiter). diff --git a/src/mathed/InsetMathBoldSymbol.cpp b/src/mathed/InsetMathBoldSymbol.cpp index ade29f7de1..d820519884 100644 --- a/src/mathed/InsetMathBoldSymbol.cpp +++ b/src/mathed/InsetMathBoldSymbol.cpp @@ -14,6 +14,7 @@ #include "MathStream.h" #include "MathData.h" +#include "MetricsInfo.h" #include "LaTeXFeatures.h" #include @@ -49,6 +50,7 @@ docstring InsetMathBoldSymbol::name() const void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); //Changer dummy = mi.base.changeFontSet("mathbf"); cell(0).metrics(mi, dim); metricsMarkers(mi, dim); @@ -58,6 +60,7 @@ void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathBoldSymbol::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); //Changer dummy = pi.base.changeFontSet("mathbf"); cell(0).draw(pi, x + 1, y); cell(0).draw(pi, x + 2, y); diff --git a/src/mathed/InsetMathCancel.cpp b/src/mathed/InsetMathCancel.cpp index 0a8aad90fa..0e91575d8d 100644 --- a/src/mathed/InsetMathCancel.cpp +++ b/src/mathed/InsetMathCancel.cpp @@ -37,6 +37,7 @@ Inset * InsetMathCancel::clone() const void InsetMathCancel::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); metricsMarkers(mi, dim); } @@ -44,6 +45,7 @@ void InsetMathCancel::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathCancel::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); // We first draw the text and then an arrow ColorCode const origcol = pi.base.font.color(); cell(0).draw(pi, x + 1, y); diff --git a/src/mathed/InsetMathCancelto.cpp b/src/mathed/InsetMathCancelto.cpp index 6170cbd6fa..283a97157d 100644 --- a/src/mathed/InsetMathCancelto.cpp +++ b/src/mathed/InsetMathCancelto.cpp @@ -41,6 +41,7 @@ Inset * InsetMathCancelto::clone() const void InsetMathCancelto::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); InsetMathNest::metrics(mi); Dimension const & dim0 = cell(0).dimension(*mi.base.bv); Dimension const & dim1 = cell(1).dimension(*mi.base.bv); @@ -53,6 +54,7 @@ void InsetMathCancelto::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathCancelto::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); ColorCode const origcol = pi.base.font.color(); // We first draw the text and then an arrow diff --git a/src/mathed/InsetMathCases.cpp b/src/mathed/InsetMathCases.cpp index f510278708..4a7b151244 100644 --- a/src/mathed/InsetMathCases.cpp +++ b/src/mathed/InsetMathCases.cpp @@ -45,12 +45,14 @@ Inset * InsetMathCases::clone() const void InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); InsetMathGrid::metrics(mi, dim); } void InsetMathCases::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); mathed_draw_deco(pi, x + 1, y - dim.ascent(), 6, dim.height(), from_ascii("{")); InsetMathGrid::draw(pi, x, y); diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp index e152efe6b1..7a0cfb09c1 100644 --- a/src/mathed/InsetMathDecoration.cpp +++ b/src/mathed/InsetMathDecoration.cpp @@ -105,9 +105,9 @@ InsetMath::mode_type InsetMathDecoration::currentMode() const void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const { - bool really_change_font = currentMode() == TEXT_MODE - && isMathFont(mi.base.fontname); - Changer dummy = really_change_font ? mi.base.changeFontSet("textnormal") + Changer dummy = + (currentMode() == MATH_MODE) ? mi.base.changeEnsureMath() : + (isMathFont(mi.base.fontname)) ? mi.base.changeFontSet("textnormal") : Changer(); cell(0).metrics(mi, dim); @@ -129,9 +129,9 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const { - bool really_change_font = currentMode() == TEXT_MODE - && isMathFont(pi.base.fontname); - Changer dummy = really_change_font ? pi.base.changeFontSet("textnormal") + Changer dummy = + (currentMode() == MATH_MODE) ? pi.base.changeEnsureMath() : + (isMathFont(pi.base.fontname)) ? pi.base.changeFontSet("textnormal") : Changer(); cell(0).draw(pi, x + 1, y); diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp index 4ab179e7b2..d2b284f190 100644 --- a/src/mathed/InsetMathDelim.cpp +++ b/src/mathed/InsetMathDelim.cpp @@ -104,6 +104,7 @@ void InsetMathDelim::normalize(NormalStream & os) const void InsetMathDelim::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); Dimension dim0; cell(0).metrics(mi, dim0); Dimension t = theFontMetrics(mi.base.font).dimension('I'); @@ -123,6 +124,7 @@ void InsetMathDelim::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathDelim::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); int const b = y - dim.asc; cell(0).draw(pi, x + dw_, y); diff --git a/src/mathed/InsetMathDiagram.cpp b/src/mathed/InsetMathDiagram.cpp index 9031b40d5e..6b12949b9e 100644 --- a/src/mathed/InsetMathDiagram.cpp +++ b/src/mathed/InsetMathDiagram.cpp @@ -48,6 +48,7 @@ int InsetMathDiagram::rowsep() const void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); FontInfo & f = mi.base.font; Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT) : Changer(); @@ -58,6 +59,7 @@ void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const { setPosCache(pi, x, y); + Changer dummy2 = pi.base.changeEnsureMath(); FontInfo & f = pi.base.font; Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT) : Changer(); diff --git a/src/mathed/InsetMathEnsureMath.cpp b/src/mathed/InsetMathEnsureMath.cpp index d73a1cb359..1897781aa6 100644 --- a/src/mathed/InsetMathEnsureMath.cpp +++ b/src/mathed/InsetMathEnsureMath.cpp @@ -38,9 +38,7 @@ Inset * InsetMathEnsureMath::clone() const void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const { - bool really_change_font = isTextFont(mi.base.fontname); - Changer dummy = really_change_font ? mi.base.changeFontSet("mathnormal") - : Changer(); + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); metricsMarkers(mi, dim); } @@ -48,9 +46,7 @@ void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const { - bool really_change_font = isTextFont(pi.base.fontname); - Changer dummy = really_change_font ? pi.base.changeFontSet("mathnormal") - : Changer(); + Changer dummy = pi.base.changeEnsureMath(); cell(0).draw(pi, x, y); drawMarkers(pi, x, y); } diff --git a/src/mathed/InsetMathEnv.cpp b/src/mathed/InsetMathEnv.cpp index 7582201e61..41263562cd 100644 --- a/src/mathed/InsetMathEnv.cpp +++ b/src/mathed/InsetMathEnv.cpp @@ -16,6 +16,8 @@ #include "MathStream.h" #include "MathStream.h" +#include "MetricsInfo.h" + #include "support/gettext.h" #include "support/lstrings.h" @@ -38,6 +40,7 @@ Inset * InsetMathEnv::clone() const void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); metricsMarkers(mi, dim); } @@ -45,6 +48,7 @@ void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); cell(0).draw(pi, x + 1, y); drawMarkers(pi, x, y); } diff --git a/src/mathed/InsetMathFrac.cpp b/src/mathed/InsetMathFrac.cpp index 4c7c462fde..2362495d77 100644 --- a/src/mathed/InsetMathFrac.cpp +++ b/src/mathed/InsetMathFrac.cpp @@ -186,6 +186,7 @@ latexkeys const * slash_symbol() void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const { Dimension dim0, dim1, dim2; + Changer dummy3 = mi.base.changeEnsureMath(); switch (kind_) { case UNIT: { @@ -259,6 +260,7 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const || kind_ == DFRAC) ? mi.base.font.changeStyle(LM_ST_DISPLAY) : // all others mi.base.changeFrac(); + Changer dummy2 = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim0); cell(1).metrics(mi, dim1); dim.wid = max(dim0.wid, dim1.wid) + 2; @@ -274,6 +276,7 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const { setPosCache(pi, x, y); + Changer dummy3 = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); Dimension const dim0 = cell(0).dimension(*pi.base.bv); switch (kind_) { @@ -654,6 +657,7 @@ int InsetMathBinom::dw(int height) const void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Dimension dim0, dim1; int const dy = dy_for_frac(mi.base); Changer dummy = @@ -671,6 +675,7 @@ void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); 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); diff --git a/src/mathed/InsetMathOverset.cpp b/src/mathed/InsetMathOverset.cpp index b791c2482f..b903662d94 100644 --- a/src/mathed/InsetMathOverset.cpp +++ b/src/mathed/InsetMathOverset.cpp @@ -31,6 +31,7 @@ Inset * InsetMathOverset::clone() const void InsetMathOverset::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Dimension dim1; cell(1).metrics(mi, dim1); Changer dummy = mi.base.changeFrac(); @@ -45,6 +46,7 @@ void InsetMathOverset::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathOverset::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); 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); diff --git a/src/mathed/InsetMathPhantom.cpp b/src/mathed/InsetMathPhantom.cpp index 6d0b88df78..1ae8eee07b 100644 --- a/src/mathed/InsetMathPhantom.cpp +++ b/src/mathed/InsetMathPhantom.cpp @@ -38,6 +38,7 @@ Inset * InsetMathPhantom::clone() const void InsetMathPhantom::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); metricsMarkers(mi, dim); } @@ -45,6 +46,7 @@ void InsetMathPhantom::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathPhantom::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); static int const arrow_size = 4; // We first draw the text and then an arrow diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp index aa0a81bce1..8c4d1fa5ac 100644 --- a/src/mathed/InsetMathRoot.cpp +++ b/src/mathed/InsetMathRoot.cpp @@ -41,6 +41,7 @@ Inset * InsetMathRoot::clone() const void InsetMathRoot::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); InsetMathNest::metrics(mi); Dimension const & dim0 = cell(0).dimension(*mi.base.bv); Dimension const & dim1 = cell(1).dimension(*mi.base.bv); @@ -53,6 +54,7 @@ void InsetMathRoot::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); Dimension const & dim0 = cell(0).dimension(*pi.base.bv); int const w = dim0.width(); // the "exponent" diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp index 7363c88554..22a226d6ad 100644 --- a/src/mathed/InsetMathScript.cpp +++ b/src/mathed/InsetMathScript.cpp @@ -288,6 +288,7 @@ MathClass InsetMathScript::mathClass() const void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Dimension dim0; Dimension dim1; Dimension dim2; @@ -339,6 +340,7 @@ void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathScript::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); BufferView & bv = *pi.base.bv; if (!nuc().empty()) nuc().draw(pi, x + dxx(bv), y); diff --git a/src/mathed/InsetMathSideset.cpp b/src/mathed/InsetMathSideset.cpp index b04eca7730..02ac4badd6 100644 --- a/src/mathed/InsetMathSideset.cpp +++ b/src/mathed/InsetMathSideset.cpp @@ -185,6 +185,7 @@ int InsetMathSideset::nker(BufferView const * bv) const void InsetMathSideset::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Dimension dimn; Dimension dimbl; Dimension dimtl; @@ -227,6 +228,7 @@ void InsetMathSideset::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathSideset::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); BufferView & bv = *pi.base.bv; nuc().draw(pi, x + dxn(bv), y); if (!scriptl_) diff --git a/src/mathed/InsetMathSize.cpp b/src/mathed/InsetMathSize.cpp index ef48d0b525..534010b688 100644 --- a/src/mathed/InsetMathSize.cpp +++ b/src/mathed/InsetMathSize.cpp @@ -44,6 +44,7 @@ Inset * InsetMathSize::clone() const void InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.font.changeStyle(style_); cell(0).metrics(mi, dim); metricsMarkers(mi, dim); @@ -52,6 +53,7 @@ void InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathSize::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); Changer dummy = pi.base.font.changeStyle(style_); cell(0).draw(pi, x + 1, y); drawMarkers(pi, x, y); diff --git a/src/mathed/InsetMathSpace.cpp b/src/mathed/InsetMathSpace.cpp index 4cf1b944f8..39f3147bf1 100644 --- a/src/mathed/InsetMathSpace.cpp +++ b/src/mathed/InsetMathSpace.cpp @@ -121,6 +121,7 @@ Inset * InsetMathSpace::clone() const void InsetMathSpace::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); dim.asc = 4; dim.des = 0; if (space_info[space_].custom) @@ -132,6 +133,7 @@ void InsetMathSpace::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathSpace::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); // Sadly, HP-UX CC can't handle that kind of initialization. // XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}}; if (!space_info[space_].visible) diff --git a/src/mathed/InsetMathSplit.cpp b/src/mathed/InsetMathSplit.cpp index fb2ecbe083..5008a8d336 100644 --- a/src/mathed/InsetMathSplit.cpp +++ b/src/mathed/InsetMathSplit.cpp @@ -20,6 +20,7 @@ #include "FuncStatus.h" #include "support/gettext.h" #include "LaTeXFeatures.h" +#include "MetricsInfo.h" #include "support/lstrings.h" @@ -93,8 +94,17 @@ int InsetMathSplit::displayColSpace(col_type col) const +void InsetMathSplit::metrics(MetricsInfo & mi, Dimension & dim) const +{ + Changer dummy = mi.base.changeEnsureMath(); + InsetMathGrid::metrics(mi, dim); +} + + + void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); InsetMathGrid::draw(pi, x, y); setPosCache(pi, x, y); } diff --git a/src/mathed/InsetMathSplit.h b/src/mathed/InsetMathSplit.h index 122653459f..8893e7fe1d 100644 --- a/src/mathed/InsetMathSplit.h +++ b/src/mathed/InsetMathSplit.h @@ -24,6 +24,8 @@ public: explicit InsetMathSplit(Buffer * buf, docstring const & name, char valign = 'c', bool numbered = false); /// + void metrics(MetricsInfo & mi, Dimension & dim) const; + /// void draw(PainterInfo & pi, int x, int y) const; /// bool getStatus(Cursor & cur, FuncRequest const & cmd, diff --git a/src/mathed/InsetMathSqrt.cpp b/src/mathed/InsetMathSqrt.cpp index 3e49abccb2..1f58dce4db 100644 --- a/src/mathed/InsetMathSqrt.cpp +++ b/src/mathed/InsetMathSqrt.cpp @@ -37,6 +37,7 @@ Inset * InsetMathSqrt::clone() const void InsetMathSqrt::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); dim.asc += 4; dim.des += 2; @@ -47,6 +48,7 @@ void InsetMathSqrt::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathSqrt::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); cell(0).draw(pi, x + 10, y); Dimension const dim = dimension(*pi.base.bv); int const a = dim.ascent(); diff --git a/src/mathed/InsetMathStackrel.cpp b/src/mathed/InsetMathStackrel.cpp index e34448a419..4efcfe4443 100644 --- a/src/mathed/InsetMathStackrel.cpp +++ b/src/mathed/InsetMathStackrel.cpp @@ -61,6 +61,7 @@ MathClass InsetMathStackrel::mathClass() const void InsetMathStackrel::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Dimension dim1; cell(1).metrics(mi, dim1); Changer dummy = mi.base.changeFrac(); @@ -83,6 +84,7 @@ void InsetMathStackrel::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathStackrel::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); 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); diff --git a/src/mathed/InsetMathSubstack.cpp b/src/mathed/InsetMathSubstack.cpp index 4bcc7c539c..fb29077067 100644 --- a/src/mathed/InsetMathSubstack.cpp +++ b/src/mathed/InsetMathSubstack.cpp @@ -45,6 +45,7 @@ Inset * InsetMathSubstack::clone() const void InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.changeArray(); InsetMathGrid::metrics(mi, dim); } @@ -52,6 +53,7 @@ void InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathSubstack::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); Changer dummy = pi.base.changeArray(); InsetMathGrid::draw(pi, x + 1, y); } diff --git a/src/mathed/InsetMathUnderset.cpp b/src/mathed/InsetMathUnderset.cpp index 2027cf2337..f31ebae75c 100644 --- a/src/mathed/InsetMathUnderset.cpp +++ b/src/mathed/InsetMathUnderset.cpp @@ -32,6 +32,7 @@ Inset * InsetMathUnderset::clone() const void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Dimension dim1; cell(1).metrics(mi, dim1); Changer dummy = mi.base.changeFrac(); @@ -46,6 +47,7 @@ void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathUnderset::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); 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); diff --git a/src/mathed/InsetMathXArrow.cpp b/src/mathed/InsetMathXArrow.cpp index a4c1c12c75..d2121d6dfe 100644 --- a/src/mathed/InsetMathXArrow.cpp +++ b/src/mathed/InsetMathXArrow.cpp @@ -43,6 +43,7 @@ Inset * InsetMathXArrow::clone() const void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.changeScript(); Dimension dim0; cell(0).metrics(mi, dim0); @@ -57,6 +58,7 @@ void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathXArrow::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); Changer dummy = pi.base.changeScript(); Dimension const dim = dimension(*pi.base.bv); Dimension const & dim0 = cell(0).dimension(*pi.base.bv); diff --git a/src/mathed/InsetMathXYMatrix.cpp b/src/mathed/InsetMathXYMatrix.cpp index 5e3bdb5057..ab5cb834a3 100644 --- a/src/mathed/InsetMathXYMatrix.cpp +++ b/src/mathed/InsetMathXYMatrix.cpp @@ -49,6 +49,7 @@ int InsetMathXYMatrix::rowsep() const void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const { + Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.changeArray(); InsetMathGrid::metrics(mi, dim); } @@ -57,6 +58,7 @@ void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathXYMatrix::draw(PainterInfo & pi, int x, int y) const { setPosCache(pi, x, y); + Changer dummy2 = pi.base.changeEnsureMath(); Changer dummy = pi.base.changeArray(); InsetMathGrid::draw(pi, x, y); }