]> git.lyx.org Git - lyx.git/commitdiff
Account for kerning when positioning scripts in the MathFontOld and
authorEnrico Forestieri <forenr@lyx.org>
Fri, 23 Mar 2007 18:55:50 +0000 (18:55 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 23 Mar 2007 18:55:50 +0000 (18:55 +0000)
MathUnknown insets.

* src/mathed/InsetMathUnknown.C
(InsetMathUnknown::metrics): Cache kerning of last char.

* src/mathed/InsetMathUnknown.h
* src/mathed/InsetMathFontOld.h
(InsetMathUnknown::kerning): New. Return cached kerning value.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17528 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathFontOld.h
src/mathed/InsetMathUnknown.C
src/mathed/InsetMathUnknown.h

index 734fabc3e7dfe87760deaa6a84cfefa67f774ef2..3cdf775602bd3a95c150e670e9d2d8edb0207f11 100644 (file)
@@ -43,6 +43,8 @@ public:
        void normalize(NormalStream &) const;
        ///
        void infoize(odocstream & os) const;
+       ///
+       int kerning() const { return cell(0).kerning(); }
 
 private:
        virtual std::auto_ptr<InsetBase> doClone() const;
index 302c913829a266906e87611b3a3f7d54781ffb17..b99e5e64041da76876c44b49d322af636673eef8 100644 (file)
@@ -56,6 +56,8 @@ void InsetMathUnknown::normalize(NormalStream & os) const
 bool InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        mathed_string_dim(mi.base.font, name_, dim);
+       docstring::const_reverse_iterator rit = name_.rbegin();
+       kerning_ = mathed_char_kerning(mi.base.font, *rit);
        if (dim_ == dim)
                return false;
        dim_ = dim;
index d1ab2bc50a9bb7c49891897f3d368937bd694e6a..9d30e1980732fbcde7c6b417993b0ad7e9fa7eb6 100644 (file)
@@ -51,6 +51,8 @@ public:
        void finalize();
        ///
        bool final() const;
+       ///
+       int kerning() const { return kerning_; }
 private:
        virtual std::auto_ptr<InsetBase> doClone() const;
        ///
@@ -59,6 +61,8 @@ private:
        bool final_;
        ///
        bool black_;
+       ///
+       mutable int kerning_;
 };