]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathData.cpp
Fix display and export of some latex macros
[lyx.git] / src / mathed / MathData.cpp
index 01da6085d113890660938c07b2fed5ffc41e433d..bd4d53ead2f91a4bacfdbf0eb0bc37d64dc84dad 100644 (file)
@@ -285,7 +285,7 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
                        continue;
 
                FontInfo font = mi.base.font;
-               augmentFont(font, from_ascii("mathnormal"));
+               augmentFont(font, "mathnormal");
                dim.wid += mathed_string_width(font, completion);
        }
        // Cache the dimension.
@@ -334,7 +334,7 @@ void MathData::draw(PainterInfo & pi, int x, int y) const
                if (completion.length() == 0)
                        continue;
                FontInfo f = pi.base.font;
-               augmentFont(f, from_ascii("mathnormal"));
+               augmentFont(f, "mathnormal");
 
                // draw the unique and the non-unique completion part
                // Note: this is not time-critical as it is
@@ -527,7 +527,9 @@ void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos
        // optional arguments to be put back?
        pos_type p = macroPos + 1;
        size_t j = 0;
-       // WARNING: do not use macroInset below, the insert() call in the lopp will invalidate it!
+       // We do not want to use macroInset below, the insert() call in
+       // the loop will invalidate it.
+       macroInset = 0;
        for (; j < detachedArgs.size() && j < optionals; ++j) {
                // another non-empty parameter follows?
                bool canDropEmptyOptional = j >= lastNonEmptyOptional;
@@ -844,20 +846,12 @@ void MathData::collectParameters(Cursor * cur,
 
 
 int MathData::pos2x(BufferView const * bv, size_type pos) const
-{
-       return pos2x(bv, pos, 0);
-}
-
-
-int MathData::pos2x(BufferView const * bv, size_type pos, int glue) const
 {
        int x = 0;
        size_type target = min(pos, size());
        CoordCache::Insets const & coords = bv->coordCache().getInsets();
        for (size_type i = 0; i < target; ++i) {
                const_iterator it = begin() + i;
-               if ((*it)->getChar() == ' ')
-                       x += glue;
                //lyxerr << "char: " << (*it)->getChar()
                //      << "width: " << (*it)->width() << endl;
                x += coords.dim((*it).nucleus()).wid;
@@ -867,12 +861,6 @@ int MathData::pos2x(BufferView const * bv, size_type pos, int glue) const
 
 
 MathData::size_type MathData::x2pos(BufferView const * bv, int targetx) const
-{
-       return x2pos(bv, targetx, 0);
-}
-
-
-MathData::size_type MathData::x2pos(BufferView const * bv, int targetx, int glue) const
 {
        const_iterator it = begin();
        int lastx = 0;
@@ -881,8 +869,6 @@ MathData::size_type MathData::x2pos(BufferView const * bv, int targetx, int glue
        // find first position after targetx
        for (; currx < targetx && it != end(); ++it) {
                lastx = currx;
-               if ((*it)->getChar() == ' ')
-                       currx += glue;
                currx += coords.dim((*it).nucleus()).wid;
        }