2002-05-30 07:09:54 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_fontinset.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_streamstr.h"
|
|
|
|
#include "math_support.h"
|
|
|
|
#include "LaTeXFeatures.h"
|
|
|
|
#include "textpainter.h"
|
2002-06-14 12:24:28 +00:00
|
|
|
#include "frontends/Painter.h"
|
2002-05-30 07:09:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MathFontInset::MathFontInset(string const & name)
|
|
|
|
: MathNestInset(1), name_(name)
|
|
|
|
{
|
2002-06-14 12:24:28 +00:00
|
|
|
//lock(true);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathFontInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathFontInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::metrics(MathMetricsInfo & mi) const
|
|
|
|
{
|
|
|
|
MathFontSetChanger dummy(mi.base, name_.c_str());
|
2002-07-11 11:27:24 +00:00
|
|
|
dim_ = xcell(0).metrics(mi);
|
|
|
|
metricsMarkers();
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
|
|
|
|
{
|
|
|
|
//lyxerr << "MathFontInset::draw\n";
|
2002-06-18 15:44:30 +00:00
|
|
|
//MathNestInset::draw(pi, x, y);
|
2002-05-30 07:09:54 +00:00
|
|
|
MathFontSetChanger dummy(pi.base, name_.c_str());
|
2002-06-18 15:44:30 +00:00
|
|
|
xcell(0).draw(pi, x + 1, y);
|
2002-06-24 15:37:14 +00:00
|
|
|
drawMarkers(pi, x, y);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::metricsT(TextMetricsInfo const & mi) const
|
|
|
|
{
|
2002-07-11 11:27:24 +00:00
|
|
|
dim_ = xcell(0).metricsT(mi);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::drawT(TextPainter & pain, int x, int y) const
|
|
|
|
{
|
|
|
|
//lyxerr << "drawing font code: " << code_ << '\n';
|
|
|
|
xcell(0).drawT(pain, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
os << '\\' << name_ << '{' << cell(0) << '}';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::normalize(NormalStream & os) const
|
|
|
|
{
|
|
|
|
os << "[font_ " << name_ << " " << cell(0) << "]";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::validate(LaTeXFeatures & features) const
|
|
|
|
{
|
|
|
|
// Make sure amssymb is put in preamble if Blackboard Bold or
|
|
|
|
// Fraktur used:
|
|
|
|
if (name_ == "mathfrak" || name_ == "mathbb")
|
|
|
|
features.require("amssymb");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::infoize(std::ostream & os) const
|
|
|
|
{
|
|
|
|
os << "Font: " << name_;
|
|
|
|
}
|