Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
Release 4
-
None
Description
[UPDATE: Although not a fix for the accent attribute issue, version 2.4 has much improved vertical spacing in general.]
QtMmlWidget ignores the "accent" attribute of the mover tag
Did:
Made QtMmlWidget display these two MathML snippets:
1.
<math>
<mrow>
<mover accent="true">
<mi>v</mi>
<mo stretchy="true">→</mo>
</mover>
</mrow>
</math>
2.
<math>
<mrow>
<mover accent="false">
<mi>v</mi>
<mo stretchy="true">→</mo>
</mover>
</mrow>
</math>
Expected to see:
In snippet 1, the arrow should have been closer to the v than in snippet 2, as described in section 3.4.5 of the MathML spec (http://www.w3.org/TR/REC-MathML/chap3_4.html)
Got instead:
Both snippets render identically, the arrow is very far from the v
PATCH:
— qtmmlwidget-2.3-opensource/src/qtmmlwidget.cpp.ark 2009-04-09 15:31:53.915181603 +0200
+++ qtmmlwidget-2.3-opensource/src/qtmmlwidget.cpp 2009-04-09 15:31:38.047180319 +0200
@@ -269,8 +269,9 @@ class MmlNode : public Mml
MmlNode *parentWithExplicitAttribute(const QString &name, NodeType type = NoNode);
int interpretSpacing(const QString &value, bool *ok) const;
- private:
+ protected:
MmlAttributeMap m_attribute_map;
+ private:
bool m_stretched;
QRect m_my_rect, m_parent_rect;
QPoint m_rel_origin;
@@ -4995,8 +4996,14 @@ void MmlMoverNode::layoutSymbol()
QRect base_rect = base->myRect();
QRect over_rect = over->myRect();
- int spacing = (int)(g_mfrac_spacing*(over_rect.height()
+ int spacing;
+ if(m_attribute_map.value("accent", "false") != "true")
+ spacing = (int)(g_mfrac_spacing*(over_rect.height()
+ base_rect.height()));
+ else
+ // We actually have to go negative here to make an accent look right because
+ // characters don't typically go all the way to the top of the rect
+ spacing = (int)((-g_mfrac_spacing-0.1)*(over_rect.height() + base_rect.height()));
base->setRelOrigin(QPoint(-base_rect.width()/2, 0));
over->setRelOrigin(QPoint(-over_rect.width()/2,