-void MathSymbolInset::metrics(MathMetricsInfo const & mi) const
-{
- LyXFont font;
- mi_ = mi;
- MathTextCodes c = code();
- if (sym_->latex_font_id > 0 && math_font_available(c)) {
- whichFont(font, c, mi_);
- mathed_char_dim(font, char(sym_->latex_font_id), ascent_, descent_, width_);
- if (c == LM_TC_CMEX) {
- h_ = 4 * descent_ / 5;
- ascent_ += h_;
- descent_ -= h_;
- }
- } else {
- if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB)) {
- whichFont(font, code2(), mi_);
- mathed_char_dim(font, char(sym_->id), ascent_, descent_, width_);
- } else {
- whichFont(font, LM_TC_TEX, mi_);
- mathed_string_dim(font, sym_->name, ascent_, descent_, width_);
- }
+void MathSymbolInset::metrics(MathMetricsInfo & mi) const
+{
+ //lyxerr << "metrics: symbol: '" << sym_->name
+ // << "' in font: '" << sym_->inset
+ // << "' drawn as: '" << sym_->draw
+ // << "'\n";
+ MathFontSetChanger dummy(mi.base, sym_->inset.c_str());
+ mathed_string_dim(mi.base.font, sym_->draw, ascent_, descent_, width_);
+ // correct height for broken cmex font
+ if (sym_->inset == "cmex") {
+ h_ = 4 * descent_ / 5;
+ ascent_ += h_;
+ descent_ -= h_;