2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_kerninset.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2001-12-05 08:04:20 +00:00
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
#include <config.h>
|
2001-08-21 14:20:50 +00:00
|
|
|
|
|
|
|
|
|
#include "math_kerninset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
2001-12-05 08:04:20 +00:00
|
|
|
|
#include "math_streamstr.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
|
#include "math_support.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "dimension.h"
|
2001-08-21 14:20:50 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2002-01-11 17:57:02 +00:00
|
|
|
|
|
2001-08-21 14:20:50 +00:00
|
|
|
|
MathKernInset::MathKernInset()
|
2002-03-27 10:51:46 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MathKernInset::MathKernInset(LyXLength const & w)
|
|
|
|
|
: wid_(w)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MathKernInset::MathKernInset(string const & s)
|
|
|
|
|
: wid_(s)
|
2001-08-21 14:20:50 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
auto_ptr<InsetBase> MathKernInset::clone() const
|
2001-08-21 14:20:50 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new MathKernInset(*this));
|
2001-08-21 14:20:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void MathKernInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2001-08-21 14:20:50 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
|
|
|
|
|
dim.asc = 0;
|
|
|
|
|
dim.des = 0;
|
2001-08-21 14:20:50 +00:00
|
|
|
|
}
|
2001-11-08 12:06:56 +00:00
|
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
|
void MathKernInset::draw(PainterInfo &, int, int) const
|
2002-03-25 12:11:25 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void MathKernInset::write(WriteStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
|
{
|
2004-04-13 06:27:29 +00:00
|
|
|
|
#warning this crashs on startup!
|
|
|
|
|
//os << "\\kern" << wid_.asLatexString() << ' ';
|
|
|
|
|
os << "\\kern0mm ";
|
2001-11-08 12:06:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void MathKernInset::normalize(NormalStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << "[kern " << wid_.asLatexString() << ']';
|
2001-11-08 12:06:56 +00:00
|
|
|
|
}
|