X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathBig.cpp;h=76efc571dbf853dcc03a56e10cc2568a1346a8da;hb=02e82157ec583c3900e359de86be79fac6512387;hp=5d9f58ac4f319193d8e69a08f1bf86e57b0afe7a;hpb=e224ef029b58de61fead592a6134775dbd9a97b8;p=lyx.git diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index 5d9f58ac4f..76efc571db 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -12,6 +12,9 @@ #include "InsetMathBig.h" +#include "Dimension.h" +#include "LaTeXFeatures.h" + #include "MathSupport.h" #include "MathStream.h" #include "MetricsInfo.h" @@ -46,9 +49,11 @@ InsetMathBig::size_type InsetMathBig::size() const { // order: big Big bigg Bigg biggg Biggg // 0 1 2 3 4 5 + char_type const c = name_[name_.size() - 1]; + int const base_size = (c == 'l' || c == 'm' || c == 'r') ? 4 : 3; return name_[0] == 'B' ? - 2 * (name_.size() - 4) + 1: - 2 * (name_.size() - 4); + 2 * (name_.size() - base_size) + 1: + 2 * (name_.size() - base_size); } @@ -64,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; @@ -74,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). @@ -83,7 +90,6 @@ void InsetMathBig::draw(PainterInfo & pi, int x, int y) const (delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\"); mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(), delim); - setPosCache(pi, x, y); } @@ -102,6 +108,29 @@ void InsetMathBig::normalize(NormalStream & os) const } +void InsetMathBig::mathmlize(MathStream & os) const +{ + os << "" + << convertDelimToXMLEscape(delim_) + << ""; +} + + +void InsetMathBig::htmlize(HtmlStream & os) const +{ + std::string name; + switch (size()) { + case 0: case 1: name = "big"; break; + case 2: case 3: name = "bigg"; break; + case 4: case 5: name = "biggg"; break; + default: name = "big"; break; + } + os << MTag("span", "class='" + name + "symbol'") + << convertDelimToXMLEscape(delim_) + << ETag("span"); +} + + void InsetMathBig::infoize2(odocstream & os) const { os << name_; @@ -114,7 +143,7 @@ bool InsetMathBig::isBigInsetDelim(docstring const & delim) static char const * const delimiters[] = { "(", ")", "\\{", "\\}", "\\lbrace", "\\rbrace", "[", "]", "|", "/", "\\slash", "\\|", "\\vert", "\\Vert", "'", - "\\\\", "\\backslash", + "<", ">", "\\\\", "\\backslash", "\\langle", "\\lceil", "\\lfloor", "\\rangle", "\\rceil", "\\rfloor", "\\downarrow", "\\Downarrow", @@ -125,4 +154,14 @@ bool InsetMathBig::isBigInsetDelim(docstring const & delim) } +void InsetMathBig::validate(LaTeXFeatures & features) const +{ + if (features.runparams().math_flavor == OutputParams::MathAsHTML) + features.addCSSSnippet( + "span.bigsymbol{font-size: 150%;}\n" + "span.biggsymbol{font-size: 200%;}\n" + "span.bigggsymbol{font-size: 225%;}"); +} + + } // namespace lyx