]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathSupport.cpp
Only set buffer if it is not null.
[lyx.git] / src / mathed / MathSupport.cpp
index f5278b15d031cc5ca1fe8d3f1f1b9cd667dab7fa..acc952324366a88a45f471f925dd07c4f7b83ac5 100644 (file)
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
+#include "support/Changer.h"
 #include "support/debug.h"
 #include "support/docstream.h"
 #include "support/lassert.h"
 #include "support/Length.h"
-#include "support/lyxlib.h"
 
 #include <map>
 #include <algorithm>
@@ -577,11 +577,9 @@ void mathed_string_dim(FontInfo const & font,
        frontend::FontMetrics const & fm = theFontMetrics(font);
        dim.asc = 0;
        dim.des = 0;
-       for (docstring::const_iterator it = s.begin();
-            it != s.end();
-            ++it) {
-               dim.asc = max(dim.asc, fm.ascent(*it));
-               dim.des = max(dim.des, fm.descent(*it));
+       for (char_type const c : s) {
+               dim.asc = max(dim.asc, fm.ascent(c));
+               dim.des = max(dim.des, fm.descent(c));
        }
        dim.wid = fm.width(s);
 }
@@ -698,7 +696,7 @@ int mathedSymbolDim(MetricsBase & mb, Dimension & dim, latexkeys const * sym)
                                 mb.fontname != "mathfrak" &&
                                 mb.fontname != "mathcal" &&
                                 mb.fontname != "mathscr");
-       Changer dummy = change_font ? mb.changeFontSet(font) : Changer();
+       Changer dummy = change_font ? mb.changeFontSet(font) : noChange();
        mathed_string_dim(mb.font, mathedSymbol(mb, sym), dim);
        return mathed_char_kerning(mb.font, mathedSymbol(mb, sym).back());
 }
@@ -722,7 +720,7 @@ void mathedSymbolDraw(PainterInfo & pi, int x, int y, latexkeys const * sym)
                                 pi.base.fontname != "mathfrak" &&
                                 pi.base.fontname != "mathcal" &&
                                 pi.base.fontname != "mathscr");
-       Changer dummy = change_font ? pi.base.changeFontSet(font) : Changer();
+       Changer dummy = change_font ? pi.base.changeFontSet(font) : noChange();
        pi.draw(x, y, mathedSymbol(pi.base, sym));
 }