2001-12-05 08:04:20 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-08-21 14:20:50 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_kerninset.h"
|
2002-03-25 12:11:25 +00:00
|
|
|
#include "math_extern.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"
|
2002-03-27 10:51:46 +00:00
|
|
|
#include "lyxrc.h"
|
2001-08-21 14:20:50 +00:00
|
|
|
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathKernInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathKernInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-25 12:11:25 +00:00
|
|
|
void MathKernInset::metrics(MathMetricsInfo const & mi) const
|
2001-08-21 14:20:50 +00:00
|
|
|
{
|
2002-03-27 10:51:46 +00:00
|
|
|
#ifdef WITH_WARNINGS
|
|
|
|
#warning fix this once the interface to LyXLength has improved
|
|
|
|
#endif
|
|
|
|
// this uses the numerical valu in pixels, even if the unit is cm or ex!
|
|
|
|
width_ = static_cast<int>(wid_.value());
|
|
|
|
width_ = (width_*static_cast<int>(lyxrc.zoom))/150;
|
2001-08-21 14:20:50 +00:00
|
|
|
ascent_ = 0;
|
|
|
|
descent_ = 0;
|
2002-03-27 10:51:46 +00:00
|
|
|
//cerr << "handling kern of width " << wid_.value() << "\n";
|
2001-08-21 14:20:50 +00:00
|
|
|
}
|
2001-11-08 12:06:56 +00:00
|
|
|
|
|
|
|
|
2002-03-25 12:11:25 +00:00
|
|
|
void MathKernInset::draw(Painter &, int, int) const
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathKernInset::write(WriteStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
2002-03-27 10:51:46 +00:00
|
|
|
os << "\\kern" << wid_.asLatexString() << " ";
|
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-03-27 10:51:46 +00:00
|
|
|
os << "[kern " << wid_.asLatexString() << "]";
|
2001-11-08 12:06:56 +00:00
|
|
|
}
|