diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-03 23:32:48 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-03 23:32:48 +0100 |
| commit | e1f53890da6e4be2555a9e17a52edcc03d53656b (patch) | |
| tree | ff148f4d8dc54b1a09fa21ca743fce261f01c021 /src/text_node.cc | |
| parent | 47b52fb54f302d5faf93a19ae2fe28fa610f96ca (diff) | |
Basic HAlign / HPosition support.
Diffstat (limited to 'src/text_node.cc')
| -rw-r--r-- | src/text_node.cc | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/text_node.cc b/src/text_node.cc index 834b78b2..6332e1f5 100644 --- a/src/text_node.cc +++ b/src/text_node.cc @@ -38,22 +38,43 @@ using namespace dcp; * @param node Node to read. */ TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr) - : v_align (CENTER) + : 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; } - v_position = x.get () / 100; - optional<string> v = node->optional_string_attribute ("VAlign"); - if (!v) { - v = node->optional_string_attribute ("Valign"); + 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 ()); } - if (v) { - v_align = string_to_valign (v.get ()); + 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 (va) { + v_align = string_to_valign (va.get ()); } list<cxml::NodePtr> f = node->node_children ("Font"); |
