]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathEnsureMath.cpp
Simplify Changers interface
[lyx.git] / src / mathed / InsetMathEnsureMath.cpp
index cab5e7730e053d8ca2b853cd46d5788accde2fbc..d73a1cb35991e49e8c553d95ccaba20f1f1ad27e 100644 (file)
 
 #include "InsetMathEnsureMath.h"
 
-#include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
+
 #include <ostream>
 
 
@@ -36,17 +38,19 @@ Inset * InsetMathEnsureMath::clone() const
 
 void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       bool really_change_font = isTextFont(from_ascii(mi.base.fontname));
-       FontSetChanger dummy(mi.base, "mathnormal", really_change_font);
+       bool really_change_font = isTextFont(mi.base.fontname);
+       Changer dummy = really_change_font ? mi.base.changeFontSet("mathnormal")
+               : Changer();
        cell(0).metrics(mi, dim);
-       metricsMarkers(dim);
+       metricsMarkers(mi, dim);
 }
 
 
 void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const
 {
-       bool really_change_font = isTextFont(from_ascii(pi.base.fontname));
-       FontSetChanger dummy(pi.base, "mathnormal", really_change_font);
+       bool really_change_font = isTextFont(pi.base.fontname);
+       Changer dummy = really_change_font ? pi.base.changeFontSet("mathnormal")
+               : Changer();
        cell(0).draw(pi, x, y);
        drawMarkers(pi, x, y);
 }