Here is a patch for http://bugzilla.lyx.org/show_bug.cgi?id=3705. It adds the kerning method to a macro to inherit the kerning from the expanded form. Moreover the marker metrics calls are remove as they are not drawn anyway.

Stefan

Index: src/mathed/MathMacro.h
===================================================================
--- src/mathed/MathMacro.h      (Revision 18774)
+++ src/mathed/MathMacro.h      (Arbeitskopie)
@@ -54,6 +54,8 @@
        ///
        docstring name() const;
        ///
+       int kerning() const { return kerning_; }
+       ///
        void setExpansion(MathData const & exp, MathData const & args) const;

        ///
@@ -85,6 +87,8 @@
        mutable MacroData macroBackup_;
        ///
        mutable bool editing_;
+       ///
+       mutable int kerning_;
 };


Index: src/mathed/MathMacro.cpp
===================================================================
--- src/mathed/MathMacro.cpp    (Revision 18774)
+++ src/mathed/MathMacro.cpp    (Arbeitskopie)
@@ -44,6 +44,8 @@
        bool metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo &, int x, int y) const;
+       ///
+       int kerning() const { return mathMacro_.cell(idx_).kerning(); }

 private:
        std::auto_ptr<Inset> doClone() const;
@@ -65,7 +67,6 @@
        macro.unlock();
        mathMacro_.cell(idx_).metrics(mi, dim);
        macro.lock();
-       metricsMarkers2(dim);
        if (dim_ == dim)
                return false;
        dim_ = dim;
@@ -114,6 +115,7 @@

 bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
 {
+       kerning_ = 0;
        if (!MacroTable::globalMacros().has(name())) {
                mathed_string_dim(mi.base.font, "Unknown: " + name(), dim);
        } else {
@@ -143,10 +145,10 @@
                        macro.lock();
                        expanded_.metrics(mi, dim);
                        macro.unlock();
+                       kerning_ = expanded_.kerning();
                        editing_ = false;
                }
        }
-       metricsMarkers2(dim);
        if (dim_ == dim)
                return false;
        dim_ = dim;
@@ -199,7 +201,6 @@
                if (editing_ != editing(pi.base.bv) || macroBackup_ != macro)
                        pi.base.bv->cursor().updateFlags(Update::Force);
        }
-       drawMarkers2(pi, x, y);
 }




Attachment: macrospacearound.patch
Description: Binary data

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to