]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFont.cpp
Revert "Make math autocorrrect work with more than 2 chars"
[lyx.git] / src / mathed / InsetMathFont.cpp
index b7b3dfb3558a67279693b4976bf048470c9d7205..987612361e788e547b3c7faa36f421ae578a2ccc 100644 (file)
@@ -64,20 +64,35 @@ bool InsetMathFont::lockedMode() const
 }
 
 
+void InsetMathFont::write(WriteStream & os) const
+{
+       // Close the mode changing command inserted during export if
+       // we are going to output another mode changing command that
+       // actually doesn't change mode. This avoids exporting things
+       // such as \ensuremath{a\mathit{b}} or \textit{a\text{b}} and
+       // produce instead \ensuremath{a}\mathit{b} and \textit{a}\text{b}.
+       if (os.pendingBrace()
+           && ((currentMode() == TEXT_MODE && os.textMode())
+                   || (currentMode() == MATH_MODE && !os.textMode()))) {
+               os.os() << '}';
+               os.pendingBrace(false);
+               os.textMode(!os.textMode());
+       }
+       InsetMathNest::write(os);
+}
+
+
 void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        Changer dummy = mi.base.changeFontSet(font());
        cell(0).metrics(mi, dim);
-       metricsMarkers(dim);
 }
 
 
 void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
 {
        Changer dummy = pi.base.changeFontSet(font());
-       cell(0).draw(pi, x + 1, y);
-       drawMarkers(pi, x, y);
-       setPosCache(pi, x, y);
+       cell(0).draw(pi, x, y);
 }
 
 
@@ -203,9 +218,15 @@ void InsetMathFont::mathmlize(MathStream & os) const
        // no support at present for textipa, textsc, noun
 
        if (!variant.empty()) {
-               os << MTag("mstyle", "mathvariant='" + variant + "'")
-                  << cell(0)
-                  << ETag("mstyle");
+               if (tag == "mathbb") {
+                       os << MTag("mstyle", "class='mathbb' mathvariant='" + variant + "'")
+                          << cell(0)
+                          << ETag("mstyle");
+               } else {
+                       os << MTag("mstyle", "mathvariant='" + variant + "'")
+                                << cell(0)
+                                << ETag("mstyle");
+               }
        } else
                os << cell(0);
 }