]> git.lyx.org Git - features.git/commitdiff
Replace MathData::kerning_ member by a function
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 14 Jul 2019 12:42:37 +0000 (14:42 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:36 +0000 (15:48 +0200)
This allows to make kerning depend on the BufferView? This is not
useful right now, but may become useful for multimonotor setting with
different dpi.

src/mathed/MathData.cpp
src/mathed/MathData.h

index 0676dc732a7b72490c428331f12ec669f4931a93..9bfd558fe2856d8e1475648b8c9b1963255cf25a 100644 (file)
@@ -48,7 +48,7 @@ namespace lyx {
 
 MathData::MathData(Buffer * buf, const_iterator from, const_iterator to)
        : base_type(from, to), minasc_(0), mindes_(0), slevel_(0),
-         sshift_(0), kerning_(0), buffer_(buf)
+         sshift_(0), buffer_(buf)
 {}
 
 
@@ -282,7 +282,6 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim, bool tight) const
 
        MathRow mrow(mi, this);
        mrow.metrics(mi, dim);
-       kerning_ = mrow.kerning(bv);
 
        // Set a minimal ascent/descent for the cell
        if (tight)
@@ -381,6 +380,12 @@ void MathData::drawT(TextPainter & pain, int x, int y) const
 }
 
 
+int MathData::kerning(BufferView const * bv) const
+{
+       return  bv->mathRow(this).kerning(bv);
+}
+
+
 void MathData::updateBuffer(ParIterator const & it, UpdateType utype)
 {
        // pass down
index b118d6c41f2d412cae1fa22c3054196bb108dc4f..810223d5be970c9721c1169d9fe633bd428d717e 100644 (file)
@@ -69,7 +69,7 @@ public:
 public:
        ///
        MathData(Buffer * buf = 0) : minasc_(0), mindes_(0), slevel_(0),
-                                    sshift_(0), kerning_(0), buffer_(buf) {}
+                                    sshift_(0), buffer_(buf) {}
        ///
        MathData(Buffer * buf, const_iterator from, const_iterator to);
        ///
@@ -170,7 +170,7 @@ public:
        /// additional super/subscript shift
        int sshift() const { return sshift_; }
        /// Italic correction as described in InsetMathScript.h
-       int kerning(BufferView const *) const { return kerning_; }
+       int kerning(BufferView const *) const;
        ///
        void swap(MathData & ar) { base_type::swap(ar); }
 
@@ -188,7 +188,6 @@ protected:
        mutable int mindes_;
        mutable int slevel_;
        mutable int sshift_;
-       mutable int kerning_;
        Buffer * buffer_;
 
 private: