2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
* \file InsetMathFont.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.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-19 13:00:56 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathFont.h"
|
2007-11-05 23:46:17 +00:00
|
|
|
|
|
|
|
#include "LaTeXFeatures.h"
|
2007-04-26 16:05:57 +00:00
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "MathParser.h"
|
2007-11-05 23:46:17 +00:00
|
|
|
#include "MetricsInfo.h"
|
|
|
|
|
2014-11-14 17:18:30 +00:00
|
|
|
#include "support/gettext.h"
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
#include "support/lassert.h"
|
2014-11-14 17:18:30 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2008-05-06 10:36:32 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
2014-11-14 17:18:30 +00:00
|
|
|
using namespace lyx::support;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2009-11-08 11:45:46 +00:00
|
|
|
InsetMathFont::InsetMathFont(Buffer * buf, latexkeys const * key)
|
|
|
|
: InsetMathNest(buf, 1), key_(key)
|
2002-08-01 15:53:46 +00:00
|
|
|
{}
|
2002-05-30 07:09:54 +00:00
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetMathFont::clone() const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return new InsetMathFont(*this);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
std::string InsetMathFont::font() const
|
|
|
|
{
|
|
|
|
LASSERT(isAscii(key_->name), return "mathnormal");
|
|
|
|
return to_ascii(key_->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
InsetMath::mode_type InsetMathFont::currentMode() const
|
2002-07-18 11:02:33 +00:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-03 00:05:58 +00:00
|
|
|
bool InsetMathFont::lockedMode() const
|
|
|
|
{
|
2020-10-05 10:38:09 +00:00
|
|
|
return key_->extra == "forcetext";
|
2009-07-03 00:05:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-26 19:04:36 +00:00
|
|
|
void InsetMathFont::write(TeXMathStream & os) const
|
2016-09-10 16:32:44 +00:00
|
|
|
{
|
|
|
|
// Close the mode changing command inserted during export if
|
|
|
|
// we are going to output another mode changing command that
|
|
|
|
// actually doesn't change mode. This avoids exporting things
|
|
|
|
// such as \ensuremath{a\mathit{b}} or \textit{a\text{b}} and
|
|
|
|
// produce instead \ensuremath{a}\mathit{b} and \textit{a}\text{b}.
|
|
|
|
if (os.pendingBrace()
|
|
|
|
&& ((currentMode() == TEXT_MODE && os.textMode())
|
|
|
|
|| (currentMode() == MATH_MODE && !os.textMode()))) {
|
|
|
|
os.os() << '}';
|
|
|
|
os.pendingBrace(false);
|
|
|
|
os.textMode(!os.textMode());
|
|
|
|
}
|
|
|
|
InsetMathNest::write(os);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
Changer dummy = mi.base.changeFontSet(font());
|
2004-01-30 11:41:12 +00:00
|
|
|
cell(0).metrics(mi, dim);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
Changer dummy = pi.base.changeFontSet(font());
|
2017-01-06 08:52:10 +00:00
|
|
|
cell(0).draw(pi, x, y);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathFont::metricsT(TextMetricsInfo const & mi, Dimension &) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2007-09-23 22:39:49 +00:00
|
|
|
// FIXME: BROKEN!
|
|
|
|
Dimension dim;
|
|
|
|
cell(0).metricsT(mi, dim);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathFont::drawT(TextPainter & pain, int x, int y) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(0).drawT(pain, x, y);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
docstring InsetMathFont::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
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathFont::validate(LaTeXFeatures & features) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
InsetMathNest::validate(features);
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
std::string fontname = font();
|
2010-03-31 18:57:47 +00:00
|
|
|
if (features.runparams().isLaTeX()) {
|
|
|
|
// Make sure amssymb is put in preamble if Blackboard Bold or
|
|
|
|
// Fraktur used:
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
if (fontname == "mathfrak" || fontname == "mathbb")
|
2010-03-31 18:57:47 +00:00
|
|
|
features.require("amssymb");
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
if (fontname == "text" || fontname == "textnormal"
|
|
|
|
|| (fontname.length() == 6 && fontname.substr(0, 4) == "text"))
|
2010-03-31 18:57:47 +00:00
|
|
|
features.require("amstext");
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
if (fontname == "mathscr")
|
2013-05-02 14:38:25 +00:00
|
|
|
features.require("mathrsfs");
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
if (fontname == "textipa")
|
2010-03-31 18:57:47 +00:00
|
|
|
features.require("tipa");
|
Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-07 21:58:55 +00:00
|
|
|
if (fontname == "ce" || fontname == "cf")
|
2010-03-31 18:57:47 +00:00
|
|
|
features.require("mhchem");
|
2020-06-11 14:42:31 +00:00
|
|
|
if (fontname == "mathds")
|
|
|
|
features.require("dsfont");
|
2010-03-31 18:57:47 +00:00
|
|
|
} else if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
|
2011-12-06 22:17:13 +00:00
|
|
|
features.addCSSSnippet(
|
2010-03-31 18:57:47 +00:00
|
|
|
"span.normal{font: normal normal normal inherit serif;}\n"
|
|
|
|
"span.fraktur{font: normal normal normal inherit cursive;}\n"
|
|
|
|
"span.bold{font: normal normal bold inherit serif;}\n"
|
|
|
|
"span.script{font: normal normal normal inherit cursive;}\n"
|
|
|
|
"span.italic{font: italic normal normal inherit serif;}\n"
|
|
|
|
"span.sans{font: normal normal normal inherit sans-serif;}\n"
|
|
|
|
"span.monospace{font: normal normal normal inherit monospace;}\n"
|
2011-12-06 22:17:13 +00:00
|
|
|
"span.noun{font: normal small-caps normal inherit normal;}");
|
2010-03-31 18:57:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The fonts we want to support are listed in lib/symbols
|
|
|
|
void InsetMathFont::htmlize(HtmlStream & 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;
|
|
|
|
docstring const & tag = key_->name;
|
|
|
|
if (tag == "mathnormal" || tag == "mathrm"
|
|
|
|
|| tag == "text" || tag == "textnormal"
|
|
|
|
|| tag == "textrm" || tag == "textup"
|
|
|
|
|| tag == "textmd")
|
|
|
|
variant = "normal";
|
|
|
|
else if (tag == "frak" || tag == "mathfrak")
|
|
|
|
variant = "fraktur";
|
2020-06-11 14:42:31 +00:00
|
|
|
else if (tag == "mathbf" || tag == "textbf")
|
2010-03-31 18:57:47 +00:00
|
|
|
variant = "bold";
|
2020-06-11 14:42:31 +00:00
|
|
|
else if (tag == "mathbb" || tag == "mathbbm"
|
|
|
|
|| tag == "mathds")
|
|
|
|
variant = "double-struck";
|
2010-03-31 18:57:47 +00:00
|
|
|
else if (tag == "mathcal")
|
2013-05-02 14:38:25 +00:00
|
|
|
variant = "script";
|
2010-03-31 18:57:47 +00:00
|
|
|
else if (tag == "mathit" || tag == "textsl"
|
|
|
|
|| tag == "emph" || tag == "textit")
|
|
|
|
variant = "italic";
|
|
|
|
else if (tag == "mathsf" || tag == "textsf")
|
|
|
|
variant = "sans";
|
|
|
|
else if (tag == "mathtt" || tag == "texttt")
|
|
|
|
variant = "monospace";
|
|
|
|
else if (tag == "textipa" || tag == "textsc" || tag == "noun")
|
|
|
|
variant = "noun";
|
2013-05-02 14:38:25 +00:00
|
|
|
|
2010-03-31 18:57:47 +00:00
|
|
|
docstring const beg = (tag.size() < 4) ? from_ascii("") : tag.substr(0, 4);
|
|
|
|
if (!variant.empty()) {
|
2011-04-01 22:34:40 +00:00
|
|
|
os << MTag("span", "class='" + variant + "'")
|
|
|
|
<< cell(0)
|
|
|
|
<< ETag("span");
|
2010-03-31 18:57:47 +00:00
|
|
|
} else
|
|
|
|
os << cell(0);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 16:59:56 +00:00
|
|
|
// The fonts we want to support are listed in lib/symbols
|
2020-12-26 19:02:46 +00:00
|
|
|
void InsetMathFont::mathmlize(MathMLStream & ms) const
|
2009-12-31 16:59:56 +00:00
|
|
|
{
|
|
|
|
// 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;
|
2009-12-31 18:38:01 +00:00
|
|
|
docstring const & tag = key_->name;
|
|
|
|
if (tag == "mathnormal" || tag == "mathrm"
|
|
|
|
|| tag == "text" || tag == "textnormal"
|
|
|
|
|| tag == "textrm" || tag == "textup"
|
|
|
|
|| tag == "textmd")
|
2009-12-31 16:59:56 +00:00
|
|
|
variant = "normal";
|
2009-12-31 18:38:01 +00:00
|
|
|
else if (tag == "frak" || tag == "mathfrak")
|
2009-12-31 16:59:56 +00:00
|
|
|
variant = "fraktur";
|
2020-06-10 21:14:16 +00:00
|
|
|
else if (tag == "mathbf" || tag == "textbf")
|
2009-12-31 16:59:56 +00:00
|
|
|
variant = "bold";
|
2020-06-10 21:14:16 +00:00
|
|
|
else if (tag == "mathbb" || tag == "mathbbm"
|
|
|
|
|| tag == "mathds")
|
|
|
|
variant = "double-struck";
|
2009-12-31 18:38:01 +00:00
|
|
|
else if (tag == "mathcal")
|
2013-05-02 14:38:25 +00:00
|
|
|
variant = "script";
|
2009-12-31 18:38:01 +00:00
|
|
|
else if (tag == "mathit" || tag == "textsl"
|
2009-12-31 19:35:56 +00:00
|
|
|
|| tag == "emph" || tag == "textit")
|
2009-12-31 16:59:56 +00:00
|
|
|
variant = "italic";
|
2009-12-31 19:35:56 +00:00
|
|
|
else if (tag == "mathsf" || tag == "textsf")
|
2009-12-31 16:59:56 +00:00
|
|
|
variant = "sans-serif";
|
2009-12-31 18:38:01 +00:00
|
|
|
else if (tag == "mathtt" || tag == "texttt")
|
2009-12-31 16:59:56 +00:00
|
|
|
variant = "monospace";
|
|
|
|
// no support at present for textipa, textsc, noun
|
2013-05-02 14:38:25 +00:00
|
|
|
|
2020-06-11 19:25:22 +00:00
|
|
|
if (!variant.empty())
|
2019-05-09 23:52:07 +00:00
|
|
|
ms << MTag("mstyle", "mathvariant='" + variant + "'")
|
2020-06-11 19:25:22 +00:00
|
|
|
<< cell(0)
|
|
|
|
<< ETag("mstyle");
|
|
|
|
else
|
2019-05-09 23:52:07 +00:00
|
|
|
ms << cell(0);
|
2009-12-31 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
void InsetMathFont::infoize(odocstream & os) const
|
2002-05-30 07:09:54 +00:00
|
|
|
{
|
2014-11-14 17:18:30 +00:00
|
|
|
os << bformat(_("Font: %1$s"), key_->name);
|
2002-05-30 07:09:54 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|