This commit avoids unnecessary metrics recalculations by caching the last LyXFont used. I had to cleanup the width(), ascent() and descend() redundancies by transferring that to InsetBase.
InsetMathDim should go now as it is not really needed.
* InsetBase: properly handle inset Dimension.
* InsetOld: get rid of redundant width(), ascent() and descent()
* InsetMathDim: ditto
* InsetMathChar::metrics(): avoid metrics recalculation if font is unchanged.
* InsetMathSymbol::metrics(): ditto
* InsetMathKern: use InsetBase::dim_ instead of local ones.
* InsetMathSpace:
- use InsetBase::dim_ instead of local ones.
- space to width transformation transferred to anonymous namespace.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17899 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathSupport.[Ch]
(mathed_char_kerning): New. Compute right kerning for the given
font and character as the difference between right bearing and
logical width.
* src/mathed/InsetMathScript.[Ch]
(InsetMathScript::dx1, InsetMathScript::metrics): Account for
nucleus right kerning.
(InsetMathScript::nker): New. Return the nucleus right kerning
if positive, zero otherwise.
* src/mathed/MathData.[Ch]
(MathArray::metrics): Cache the nucleus right kerning value.
(MathArray::kerning): New. Return cached right kerning.
* src/mathed/InsetMathChar.[Ch]
(InsetMathChar::metrics): Cache the character right kerning.
(InsetMathChar::kerning): New. Return cached right kerning.
* src/mathed/InsetMath.h
(InsetMath::kerning): New virtual method.
* src/mathed/InsetMathSymbol.[Ch]
(InsetMathSymbol::metrics): Cache the symbol right kerning.
(InsetMathSymbol::kerning): New. Return cached right kerning.
* src/mathed/InsetMathFont.[Ch]
(InsetMathFont::kerning): New. Return cached right kerning.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17497 a592a061-630c-0410-9148-cb99ea01b6c8