]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroTemplate.C
make it compile again (hopefully)
[lyx.git] / src / mathed / MathMacroTemplate.C
index 32e7bc885bb2192d8f397f9a258335d93f5cff4d..b133375411767a99a7500ee556fe888ec048cedc 100644 (file)
@@ -21,8 +21,6 @@
 #include "lyxlex.h"
 #include "LColor.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -119,7 +117,7 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
        cell(1).metrics(mi);
        docstring dp = prefix();
        dim.wid = cell(0).width() + cell(1).width() + 20
-               + theApp->fontLoader().metrics(mi.base.font).width(dp);
+               + theFontMetrics(mi.base.font).width(dp);
        dim.asc = std::max(cell(0).ascent(),  cell(1).ascent())  + 7;
        dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
        dim_ = dim;
@@ -158,7 +156,7 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const
        docstring dp = prefix();
        pi.pain.text(x + 2, y, dp, font);
        // FIXME: Painter text should retain the drawn text width
-       x += theApp->fontLoader().metrics(font).width(dp) + 6;
+       x += theFontMetrics(font).width(dp) + 6;
 
        int const w0 = cell(0).width();
        int const w1 = cell(1).width();
@@ -185,9 +183,11 @@ void MathMacroTemplate::read(Buffer const &, LyXLex & lex)
 
 void MathMacroTemplate::write(Buffer const &, std::ostream & os) const
 {
-       WriteStream wi(os, false, false);
-       os << "FormulaMacro\n";
+       lyx::odocstringstream oss;
+       WriteStream wi(oss, false, false);
+       oss << "FormulaMacro\n";
        write(wi);
+       os << lyx::to_utf8(oss.str());
 }