- for (size_type pos = 0; pos < data_.size(); ++pos) {
- MathAtom const * p = data_.at(pos);
- p->metrics(st);
- ascent_ = std::max(ascent_, p->ascent());
- descent_ = std::max(descent_, p->descent());
- width_ += p->width();
+
+ for (const_iterator it = begin(); it != end(); ++it) {
+ MathInset const * p = it->nucleus();
+ if (MathScriptInset const * q = data_.asScript(it)) {
+ q->metrics(p, st);
+ ascent_ = std::max(ascent_, q->ascent(p));
+ descent_ = std::max(descent_, q->descent(p));
+ width_ += q->width(p);
+ ++it;
+ } else {
+ p->metrics(st);
+ ascent_ = std::max(ascent_, p->ascent());
+ descent_ = std::max(descent_, p->descent());
+ width_ += p->width();
+ }