]> git.lyx.org Git - lyx.git/blobdiff - src/MetricsInfo.cpp
DocBook: for MathML, mrow removal from decoration, script, frac
[lyx.git] / src / MetricsInfo.cpp
index c4caa75644a26e2a6c19d1096d2f338f4f9d37aa..9bab1a32c9b4c2e642696b49a21b226aeaa4b146 100644 (file)
 
 #include <config.h>
 
-#include "BufferView.h"
-#include "ColorSet.h"
-#include "LyXRC.h"
 #include "MetricsInfo.h"
 
+#include "LyXRC.h"
+
 #include "insets/Inset.h"
 
 #include "mathed/MathSupport.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
-#include "support/docstring.h"
-#include "support/lassert.h"
-#include "support/RefChanger.h"
-
 using namespace std;
 
 
@@ -70,7 +65,13 @@ Changer MetricsBase::changeFontSet(string const & name)
        augmentFont(font, name);
        font.setSize(rc->old.font.size());
        font.setStyle(rc->old.font.style());
-       if (name != "lyxtex"
+       if (name == "emph") {
+               font.setColor(oldcolor);
+               if (rc->old.font.shape() != UP_SHAPE)
+                       font.setShape(UP_SHAPE);
+               else
+                       font.setShape(ITALIC_SHAPE);
+       } else if (name != "lyxtex"
            && ((isTextFont(oldname) && oldcolor != Color_foreground)
                || (isMathFont(oldname) && oldcolor != Color_math)))
                font.setColor(oldcolor);
@@ -86,16 +87,16 @@ Changer MetricsBase::changeEnsureMath(Inset::mode_type mode)
 {
        switch (mode) {
        case Inset::UNDECIDED_MODE:
-               return Changer();
+               return noChange();
        case Inset::TEXT_MODE:
-               return isMathFont(fontname) ? changeFontSet("textnormal") : Changer();
+               return isMathFont(fontname) ? changeFontSet("textnormal") : noChange();
        case Inset::MATH_MODE:
                // FIXME:
                //   \textit{\ensuremath{\text{a}}}
                // should appear in italics
-               return isTextFont(fontname) ? changeFontSet("mathnormal"): Changer();
+               return isTextFont(fontname) ? changeFontSet("mathnormal"): noChange();
        }
-       return Changer();
+       return noChange();
 }
 
 
@@ -199,10 +200,10 @@ Changer MetricsBase::changeScript()
                return font.changeStyle(SCRIPTSCRIPT_STYLE);
        case INHERIT_STYLE:
        case IGNORE_STYLE:
-               return Changer();
+               return noChange();
        }
        //remove Warning
-       return Changer();
+       return noChange();
 }
 
 
@@ -218,10 +219,10 @@ Changer MetricsBase::changeFrac()
                return font.changeStyle(SCRIPTSCRIPT_STYLE);
        case INHERIT_STYLE:
        case IGNORE_STYLE:
-               return Changer();
+               return noChange();
        }
        //remove Warning
-       return Changer();
+       return noChange();
 }
 
 
@@ -230,7 +231,7 @@ Changer MetricsBase::changeArray(bool small)
        if (small)
                return font.changeStyle(SCRIPT_STYLE);
        return (font.style() == DISPLAY_STYLE) ? font.changeStyle(TEXT_STYLE)
-               : Changer();
+               : noChange();
 }