mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
MathML: should display "Text" MathFont using proper <mtext> tag
Fixes bug 12397 Contributed by lynx
This commit is contained in:
parent
962785cb0f
commit
5b405426f1
@ -198,22 +198,18 @@ void InsetMathFont::mathmlize(MathMLStream & ms) const
|
||||
// the fonts already in effect.
|
||||
std::string variant;
|
||||
docstring const & tag = key_->name;
|
||||
if (tag == "mathnormal" || tag == "mathrm"
|
||||
|| tag == "text" || tag == "textnormal"
|
||||
|| tag == "textrm" || tag == "textup"
|
||||
|| tag == "textmd")
|
||||
if (tag == "mathnormal" || tag == "mathrm")
|
||||
variant = "normal";
|
||||
else if (tag == "frak" || tag == "mathfrak")
|
||||
variant = "fraktur";
|
||||
else if (tag == "mathbf" || tag == "textbf")
|
||||
variant = "bold";
|
||||
else if (tag == "mathbb" || tag == "mathbbm"
|
||||
|| tag == "mathds")
|
||||
else if (tag == "mathbb" || tag == "mathbbm" || tag == "mathds")
|
||||
variant = "double-struck";
|
||||
else if (tag == "mathcal")
|
||||
variant = "script";
|
||||
else if (tag == "mathit" || tag == "textsl"
|
||||
|| tag == "emph" || tag == "textit")
|
||||
else if (tag == "mathit" || tag == "textsl" || tag == "emph" ||
|
||||
tag == "textit")
|
||||
variant = "italic";
|
||||
else if (tag == "mathsf" || tag == "textsf")
|
||||
variant = "sans-serif";
|
||||
@ -221,12 +217,19 @@ void InsetMathFont::mathmlize(MathMLStream & ms) const
|
||||
variant = "monospace";
|
||||
// no support at present for textipa, textsc, noun
|
||||
|
||||
if (!variant.empty())
|
||||
ms << MTag("mstyle", "mathvariant='" + variant + "'")
|
||||
<< cell(0)
|
||||
<< ETag("mstyle");
|
||||
else
|
||||
if (tag == "text" || tag == "textnormal" || tag == "textrm" ||
|
||||
tag == "textup" || tag == "textmd") {
|
||||
SetMode textmode(ms, true);
|
||||
ms << MTagInline("mtext");
|
||||
ms << cell(0);
|
||||
ms << ETagInline("mtext");
|
||||
} else if (!variant.empty()) {
|
||||
ms << MTag("mstyle", "mathvariant='" + variant + "'");
|
||||
ms << cell(0);
|
||||
ms << ETag("mstyle");
|
||||
} else {
|
||||
ms << cell(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1594,15 +1594,18 @@ void mathmlize(MathData const & dat, MathMLStream & ms)
|
||||
{
|
||||
MathData ar = dat;
|
||||
extractStructure(ar, MATHML);
|
||||
if (ar.empty())
|
||||
ms << CTag("mrow");
|
||||
else if (ar.size() == 1)
|
||||
if (ar.empty()) {
|
||||
if (!ms.inText())
|
||||
ms << CTag("mrow");
|
||||
} else if (ar.size() == 1) {
|
||||
ms << ar.front();
|
||||
else {
|
||||
ms << MTag("mrow");
|
||||
} else {
|
||||
if (!ms.inText())
|
||||
ms << MTag("mrow");
|
||||
for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
|
||||
(*it)->mathmlize(ms);
|
||||
ms << ETag("mrow");
|
||||
if (!ms.inText())
|
||||
ms << ETag("mrow");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user