summaryrefslogtreecommitdiff
path: root/src/font_node.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-24 12:12:23 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-24 12:12:23 +0100
commitdb536bd9f9f16b79286c5f0bb54d0f283050f7dd (patch)
treefafae4349032739326592dfaa18d6b499c743f6c /src/font_node.cc
parenta5bf0e4edbdbf7a0818666313b1d3909986342f1 (diff)
Express standard differences in FontNode more neatly.
Diffstat (limited to 'src/font_node.cc')
-rw-r--r--src/font_node.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/font_node.cc b/src/font_node.cc
index 6dd6e58f..c24c29d6 100644
--- a/src/font_node.cc
+++ b/src/font_node.cc
@@ -45,11 +45,15 @@ using boost::shared_ptr;
using boost::optional;
using namespace dcp;
-FontNode::FontNode (cxml::ConstNodePtr node, optional<int> tcr, string font_id_attribute)
+FontNode::FontNode (cxml::ConstNodePtr node, optional<int> tcr, Standard standard)
{
text = node->content ();
- id = node->optional_string_attribute (font_id_attribute);
+ if (standard == INTEROP) {
+ id = node->optional_string_attribute ("Id");
+ } else {
+ id = node->optional_string_attribute ("ID");
+ }
size = node->optional_number_attribute<int64_t> ("Size").get_value_or (0);
aspect_adjust = node->optional_number_attribute<float> ("AspectAdjust");
italic = node->optional_bool_attribute ("Italic");
@@ -69,17 +73,17 @@ FontNode::FontNode (cxml::ConstNodePtr node, optional<int> tcr, string font_id_a
list<cxml::NodePtr> s = node->node_children ("Subtitle");
BOOST_FOREACH (cxml::NodePtr& i, s) {
- subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, tcr, font_id_attribute)));
+ subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, tcr, standard)));
}
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_id_attribute)));
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr, standard)));
}
list<cxml::NodePtr> t = node->node_children ("Text");
BOOST_FOREACH (cxml::NodePtr& i, t) {
- text_nodes.push_back (shared_ptr<TextNode> (new TextNode (i, tcr, font_id_attribute)));
+ text_nodes.push_back (shared_ptr<TextNode> (new TextNode (i, tcr, standard)));
}
}