* in this object's member variables.
* @param node Node to read.
*/
-TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr)
- : v_align (CENTER)
+TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr, string font_id_attribute)
+ : h_position (0)
+ , h_align (HALIGN_CENTER)
+ , v_position (0)
+ , v_align (VALIGN_CENTER)
{
text = node->content ();
- optional<float> x = node->optional_number_attribute<float> ("VPosition");
- if (!x) {
- x = node->number_attribute<float> ("Vposition");
+
+ optional<float> hp = node->optional_number_attribute<float> ("HPosition");
+ if (!hp) {
+ hp = node->optional_number_attribute<float> ("Hposition");
+ }
+ if (hp) {
+ h_position = hp.get () / 100;
+ }
+
+ optional<string> ha = node->optional_string_attribute ("HAlign");
+ if (!ha) {
+ ha = node->optional_string_attribute ("Halign");
+ }
+ if (ha) {
+ h_align = string_to_halign (ha.get ());
}
- v_position = x.get () / 100;
-
- optional<string> v = node->optional_string_attribute ("VAlign");
- if (!v) {
- v = node->optional_string_attribute ("Valign");
+
+ optional<float> vp = node->optional_number_attribute<float> ("VPosition");
+ if (!vp) {
+ vp = node->optional_number_attribute<float> ("Vposition");
+ }
+ if (vp) {
+ v_position = vp.get () / 100;
+ }
+
+ optional<string> va = node->optional_string_attribute ("VAlign");
+ if (!va) {
+ va = node->optional_string_attribute ("Valign");
}
-
- if (v) {
- v_align = string_to_valign (v.get ());
+ if (va) {
+ v_align = string_to_valign (va.get ());
}
list<cxml::NodePtr> f = node->node_children ("Font");
BOOST_FOREACH (cxml::NodePtr& i, f) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr, font_id_attribute)));
}
}