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
|
|
|
|
|
2007-11-27 20:51:20 +00:00
|
|
|
|
#include "support/docstring.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
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-08-30 18:03:17 +00:00
|
|
|
|
Inset * InsetMathKern::clone() const
|
2001-08-21 14:20:50 +00:00
|
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
|
return new InsetMathKern(*this);
|
2001-08-21 14:20:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
|
void 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'));
|
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
|
|
|
|
{
|
2009-09-28 22:11:02 +00:00
|
|
|
|
if (wid_.empty())
|
|
|
|
|
os << "\\kern" << ' ';
|
|
|
|
|
else
|
|
|
|
|
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
|
|
|
|
{
|
2009-09-28 22:11:02 +00:00
|
|
|
|
if (wid_.empty())
|
|
|
|
|
os << "[kern]";
|
|
|
|
|
else
|
|
|
|
|
os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
|
2001-11-08 12:06:56 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|