From a62d46b5e3df32de5706310bd1b86f58028a015d Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 31 Dec 2009 16:59:56 +0000 Subject: [PATCH] MathML for InsetMathFont. Unfortunately, this does not seem to render at the moment in Firefox, but it is the right way to do it. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32697 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathFont.cpp | 35 +++++++++++++++++++++++++++++++++++ src/mathed/InsetMathFont.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/src/mathed/InsetMathFont.cpp b/src/mathed/InsetMathFont.cpp index 57078817d6..e3271f8cca 100644 --- a/src/mathed/InsetMathFont.cpp +++ b/src/mathed/InsetMathFont.cpp @@ -106,6 +106,41 @@ void InsetMathFont::validate(LaTeXFeatures & features) const } +// The fonts we want to support are listed in lib/symbols +void InsetMathFont::mathmlize(MathStream & os) const +{ + // FIXME These are not quite right, because they do not nest + // correctly. A proper fix would presumably involve tracking + // the fonts already in effect. + std::string variant; + if (key_->name == "mathnormal" || key_->name == "mathrm" + || key_->name == "text" || key_->name == "textnormal" + || key_->name == "textrm" || key_->name == "textup" + || key_->name == "textmd") + variant = "normal"; + else if (key_->name == "frak" || key_->name == "mathfrak") + variant = "fraktur"; + else if (key_->name == "mathbb" || key_->name == "mathbf" + || key_->name == "textbf") + variant = "bold"; + else if (key_->name == "mathcal") + variant == "script"; + else if (key_->name == "mathit" || key_->name == "textsl" + || key_->name == "emph") + variant = "italic"; + else if (key_->name == "mathsf" || key_->name == "textit" + || key_->name == "textsf") + variant = "sans-serif"; + else if (key_->name == "mathtt" || key_->name == "texttt") + variant = "monospace"; + // no support at present for textipa, textsc, noun + + if (!variant.empty()) + os << "" + << cell(0) << ""; +} + + void InsetMathFont::infoize(odocstream & os) const { os << "Font: " << key_->name; diff --git a/src/mathed/InsetMathFont.h b/src/mathed/InsetMathFont.h index e687bc0ede..926732b3dc 100644 --- a/src/mathed/InsetMathFont.h +++ b/src/mathed/InsetMathFont.h @@ -46,6 +46,8 @@ public: /// void validate(LaTeXFeatures & features) const; /// + void mathmlize(MathStream &) const; + /// void infoize(odocstream & os) const; /// int kerning(BufferView const * bv) const { return cell(0).kerning(bv); } -- 2.39.2