2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
|
* \file InsetMathKern.cpp
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* 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
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathKern.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "MathStream.h"
|
|
|
|
|
#include "MathSupport.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Dimension.h"
|
2001-08-21 14:20:50 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
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
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathKern::InsetMathKern()
|
2007-04-22 08:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2002-03-27 10:51:46 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-28 12:58:49 +00:00
|
|
|
|
InsetMathKern::InsetMathKern(Length const & w)
|
2002-03-27 10:51:46 +00:00
|
|
|
|
: wid_(w)
|
2007-04-22 08:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2002-03-27 10:51:46 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
InsetMathKern::InsetMathKern(docstring const & s)
|
|
|
|
|
: wid_(to_utf8(s))
|
2007-04-22 08:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2001-08-21 14:20:50 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
auto_ptr<Inset> InsetMathKern::doClone() const
|
2001-08-21 14:20:50 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return auto_ptr<Inset>(new InsetMathKern(*this));
|
2001-08-21 14:20:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
|
2001-08-21 14:20:50 +00:00
|
|
|
|
{
|
2007-06-13 17:18:37 +00:00
|
|
|
|
dim.asc = 0;
|
|
|
|
|
dim.des = 0;
|
|
|
|
|
dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
|
|
|
|
|
if (dim == dim_)
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return false;
|
2007-06-13 17:18:37 +00:00
|
|
|
|
dim_ = dim;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return true;
|
2001-08-21 14:20:50 +00:00
|
|
|
|
}
|
2001-11-08 12:06:56 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathKern::draw(PainterInfo &, int, int) const
|
2002-03-25 12:11:25 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathKern::write(WriteStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
|
{
|
2006-10-22 10:15:23 +00:00
|
|
|
|
os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
|
2001-11-08 12:06:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathKern::normalize(NormalStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
|
{
|
2006-10-22 10:15:23 +00:00
|
|
|
|
os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
|
2001-11-08 12:06:56 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|