#include "InsetMathFont.h"
#include "InsetMathSymbol.h"
-#include "Length.h"
#include "MathData.h"
#include "MathFactory.h"
#include "MathParser.h"
#include "support/debug.h"
#include "support/docstream.h"
#include "support/lassert.h"
+#include "support/Length.h"
#include "support/lyxlib.h"
#include <map>
int mathed_font_x_height(FontInfo const & font)
{
- return theFontMetrics(font).ascent('x');
+ return theFontMetrics(font).xHeight();
}
/* The math units. Quoting TeX by Topic, p.205:
}
-void mathedSymbolDim(MetricsBase & mb, Dimension & dim, latexkeys const * sym)
+docstring const & mathedSymbol(MetricsBase & mb, latexkeys const * sym)
{
- LASSERT((bool)sym, return);
+ return (mb.font.style() == DISPLAY_STYLE && !sym->dsp_draw.empty()) ?
+ sym->dsp_draw : sym->draw;
+}
+
+
+int mathedSymbolDim(MetricsBase & mb, Dimension & dim, latexkeys const * sym)
+{
+ LASSERT((bool)sym, return 0);
//lyxerr << "metrics: symbol: '" << sym->name
// << "' in font: '" << sym->inset
// << "' drawn as: '" << sym->draw
sym->extra == "mathalpha" &&
mb.fontname == "mathit";
std::string const font = italic_upcase_greek ? "cmm" : sym->inset;
- Changer dummy = mb.changeFontSet(font);
- mathed_string_dim(mb.font, sym->draw, dim);
+ bool const change_font = font != "cmr" ||
+ (mb.fontname != "mathbb" &&
+ mb.fontname != "mathds" &&
+ mb.fontname != "mathfrak" &&
+ mb.fontname != "mathcal" &&
+ mb.fontname != "mathscr");
+ Changer dummy = change_font ? mb.changeFontSet(font) : Changer();
+ mathed_string_dim(mb.font, mathedSymbol(mb, sym), dim);
+ return mathed_char_kerning(mb.font, mathedSymbol(mb, sym).back());
}
sym->extra == "mathalpha" &&
pi.base.fontname == "mathit";
std::string const font = italic_upcase_greek ? "cmm" : sym->inset;
-
- Changer dummy = pi.base.changeFontSet(font);
- pi.draw(x, y, sym->draw);
+ bool const change_font = font != "cmr" ||
+ (pi.base.fontname != "mathbb" &&
+ pi.base.fontname != "mathds" &&
+ pi.base.fontname != "mathfrak" &&
+ pi.base.fontname != "mathcal" &&
+ pi.base.fontname != "mathscr");
+ Changer dummy = change_font ? pi.base.changeFontSet(font) : Changer();
+ pi.draw(x, y, mathedSymbol(pi.base, sym));
}
inh_shape, Color_math},
{"mathbb", MSB_FAMILY, inh_series,
inh_shape, Color_math},
+ {"mathds", DS_FAMILY, inh_series,
+ inh_shape, Color_math},
{"mathtt", TYPEWRITER_FAMILY, inh_series,
inh_shape, Color_math},
{"mathit", inh_family, inh_series,
MathWordList const & words = mathedWordList();
MathWordList::const_iterator it = words.find(word);
if (it != words.end()) {
- string const req = it->second.requires;
+ string const req = it->second.required;
if (!req.empty())
features.require(req);
}