- //lyxerr << "metrics: symbol: '" << sym_->name
- // << "' in font: '" << sym_->inset
- // << "' drawn as: '" << sym_->draw
- // << "'" << endl;
-
- bool const italic_upcase_greek = sym_->inset == "cmr" &&
- sym_->extra == "mathalpha" &&
- mi.base.fontname == "mathit";
- std::string const font = italic_upcase_greek ? "cmm" : sym_->inset;
- int const em = mathed_font_em(mi.base.font);
- FontSetChanger dummy(mi.base, from_ascii(font));
- mathed_string_dim(mi.base.font, sym_->draw, dim);
- docstring::const_reverse_iterator rit = sym_->draw.rbegin();
- kerning_ = mathed_char_kerning(mi.base.font, *rit);
- // correct height for broken cmex and wasy font
- if (sym_->inset == "cmex" || sym_->inset == "wasy") {
- h_ = 4 * dim.des / 5;
+ // set dim
+ // FIXME: this should depend on BufferView
+ // set negative kerning_ so that a subscript is moved leftward
+ kerning_ = -mathedSymbolDim(mi.base, dim, sym_);
+ if (sym_->draw != sym_->name) {
+ // align character vertically
+ // FIXME: this should depend on BufferView
+ h_ = 0;
+ if (mathClass() == MC_OP) {
+ // center the symbol around the fraction axis
+ // See rule 13 of Appendix G of the TeXbook.
+ h_ = axis_height(mi.base) + (dim.des - dim.asc) / 2;
+ } else if (sym_->inset == "wasy") {
+ // correct height for broken wasy font
+ h_ = 4 * dim.des / 5;
+ }