From: Enrico Forestieri Date: Fri, 23 Mar 2007 18:55:50 +0000 (+0000) Subject: Account for kerning when positioning scripts in the MathFontOld and X-Git-Tag: 1.6.10~10526 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e53e4d06726919c0fbf386bbe8f9d62a640b74d7;p=lyx.git Account for kerning when positioning scripts in the MathFontOld and 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 --- diff --git a/src/mathed/InsetMathFontOld.h b/src/mathed/InsetMathFontOld.h index 734fabc3e7..3cdf775602 100644 --- a/src/mathed/InsetMathFontOld.h +++ b/src/mathed/InsetMathFontOld.h @@ -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 doClone() const; diff --git a/src/mathed/InsetMathUnknown.C b/src/mathed/InsetMathUnknown.C index 302c913829..b99e5e6404 100644 --- a/src/mathed/InsetMathUnknown.C +++ b/src/mathed/InsetMathUnknown.C @@ -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; diff --git a/src/mathed/InsetMathUnknown.h b/src/mathed/InsetMathUnknown.h index d1ab2bc50a..9d30e19807 100644 --- a/src/mathed/InsetMathUnknown.h +++ b/src/mathed/InsetMathUnknown.h @@ -51,6 +51,8 @@ public: void finalize(); /// bool final() const; + /// + int kerning() const { return kerning_; } private: virtual std::auto_ptr doClone() const; /// @@ -59,6 +61,8 @@ private: bool final_; /// bool black_; + /// + mutable int kerning_; };