Merge branch '1.0' of git.carlh.net:git/libdcp into 1.0
[libdcp.git] / src / text.cc
index 782d17112f88a737e3e580f3178857384d08757b..d18066dd198d6da16a41cb087f761016fae60d09 100644 (file)
 #include "xml.h"
 #include "font.h"
 #include <libcxml/cxml.h>
+#include <boost/foreach.hpp>
 
 using std::string;
+using std::list;
 using boost::shared_ptr;
 using boost::optional;
 using namespace dcp;
@@ -35,7 +37,7 @@ using namespace dcp;
  *  in this object's member variables.
  *  @param node Node to read.
  */
-Text::Text (boost::shared_ptr<const cxml::Node> node)
+Text::Text (boost::shared_ptr<const cxml::Node> node, int tcr)
        : v_align (CENTER)
 {
        text = node->content ();
@@ -43,7 +45,7 @@ Text::Text (boost::shared_ptr<const cxml::Node> node)
        if (!x) {
                x = node->number_attribute<float> ("Vposition");
        }
-       v_position = x.get ();
+       v_position = x.get () / 100;
        
        optional<string> v = node->optional_string_attribute ("VAlign");
        if (!v) {
@@ -54,5 +56,8 @@ Text::Text (boost::shared_ptr<const cxml::Node> node)
                v_align = string_to_valign (v.get ());
        }
 
-       font_nodes = type_children<Font> (node, "Font");
+       list<cxml::NodePtr> f = node->node_children ("Font");
+       BOOST_FOREACH (cxml::NodePtr& i, f) {
+               font_nodes.push_back (shared_ptr<Font> (new Font (i, tcr)));
+       }
 }