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
This commit is contained in:
Enrico Forestieri 2007-03-23 18:55:50 +00:00
parent c79381b9aa
commit e53e4d0672
3 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,8 @@ public:
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
int kerning() const { return cell(0).kerning(); }
private: private:
virtual std::auto_ptr<InsetBase> doClone() const; virtual std::auto_ptr<InsetBase> doClone() const;

View File

@ -56,6 +56,8 @@ void InsetMathUnknown::normalize(NormalStream & os) const
bool InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const bool InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
mathed_string_dim(mi.base.font, name_, dim); 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) if (dim_ == dim)
return false; return false;
dim_ = dim; dim_ = dim;

View File

@ -51,6 +51,8 @@ public:
void finalize(); void finalize();
/// ///
bool final() const; bool final() const;
///
int kerning() const { return kerning_; }
private: private:
virtual std::auto_ptr<InsetBase> doClone() const; virtual std::auto_ptr<InsetBase> doClone() const;
/// ///
@ -59,6 +61,8 @@ private:
bool final_; bool final_;
/// ///
bool black_; bool black_;
///
mutable int kerning_;
}; };