Bump version
[libdcp.git] / src / text_node.cc
index 834b78b209295b43d98ec0e46eb881567d6c12c0..aa318ce75b4e4b6c6c425b45148258baa8b1ab0b 100644 (file)
@@ -37,27 +37,48 @@ using namespace dcp;
  *  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)));
        }
 }