2002-05-30 07:09:54 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "math_fontinset.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_streamstr.h"
|
|
|
|
#include "math_support.h"
|
2002-07-17 10:25:33 +00:00
|
|
|
#include "math_parser.h"
|
2002-05-30 07:09:54 +00:00
|
|
|
#include "LaTeXFeatures.h"
|
2002-08-13 18:21:44 +00:00
|
|
|
#include "support/LOstream.h"
|
2002-05-30 07:09:54 +00:00
|
|
|
#include "textpainter.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-07-17 10:25:33 +00:00
|
|
|
MathFontInset::MathFontInset(latexkeys const * key)
|
|
|
|
: MathNestInset(1), key_(key)
|
2002-08-01 15:53:46 +00:00
|
|
|
{}
|
2002-05-30 07:09:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathFontInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathFontInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-18 11:02:33 +00:00
|
|
|
MathInset::mode_type MathFontInset::currentMode() const
|
|
|
|
{
|
2002-08-01 11:48:53 +00:00
|
|
|
if (key_->extra == "mathmode")
|
|
|
|
return MATH_MODE;
|
|
|
|
if (key_->extra == "textmode")
|
|
|
|
return TEXT_MODE;
|
|
|
|
return UNDECIDED_MODE;
|
2002-07-18 11:02:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathFontInset::metrics(MetricsInfo & mi) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
FontSetChanger dummy(mi.base, key_->name.c_str());
|
2002-08-02 14:29:42 +00:00
|
|
|
dim_ = cell(0).metrics(mi);
|
2002-07-11 11:27:24 +00:00
|
|
|
metricsMarkers();
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathFontInset::draw(PainterInfo & pi, int x, int y) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
FontSetChanger dummy(pi.base, key_->name.c_str());
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(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-08-02 14:29:42 +00:00
|
|
|
dim_ = cell(0).metricsT(mi);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::drawT(TextPainter & pain, int x, int y) const
|
|
|
|
{
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(0).drawT(pain, x, y);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-01 15:53:46 +00:00
|
|
|
string MathFontInset::name() const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2002-08-01 15:53:46 +00:00
|
|
|
return key_->name;
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::validate(LaTeXFeatures & features) const
|
|
|
|
{
|
2002-09-19 13:39:43 +00:00
|
|
|
MathNestInset::validate(features);
|
2002-05-30 07:09:54 +00:00
|
|
|
// Make sure amssymb is put in preamble if Blackboard Bold or
|
|
|
|
// Fraktur used:
|
2002-07-17 10:25:33 +00:00
|
|
|
if (key_->name == "mathfrak" || key_->name == "mathbb")
|
2002-05-30 07:09:54 +00:00
|
|
|
features.require("amssymb");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathFontInset::infoize(std::ostream & os) const
|
|
|
|
{
|
2002-07-17 10:25:33 +00:00
|
|
|
os << "Font: " << key_->name;
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|