2 Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "string_text.h"
22 #include <dcp/raw_convert.h>
23 #include <libxml++/libxml++.h>
26 using dcp::raw_convert;
29 operator== (StringText const & a, StringText const & b)
31 return static_cast<dcp::SubtitleString const &>(a) == static_cast<dcp::SubtitleString const &>(b) && a.outline_width == b.outline_width;
35 StringText::transfer_xml (xmlpp::Node* node) const
38 node->add_child("Font")->add_child_text(*font());
40 node->add_child("Italic")->add_child_text(italic() ? "1" : "0");
41 node->add_child("Bold")->add_child_text(bold() ? "1" : "0");
42 node->add_child("Underline")->add_child_text(underline() ? "1" : "0");
43 node->add_child("Colour")->add_child_text(colour().to_argb_string());
44 node->add_child("Size")->add_child_text(raw_convert<string>(size()));
45 node->add_child("AspectAdjust")->add_child_text(raw_convert<string>(aspect_adjust()));
46 node->add_child("Direction")->add_child_text(dcp::direction_to_string(direction()));
47 node->add_child("Text")->add_child_text(text());
48 node->add_child("Effect")->add_child_text(dcp::effect_to_string(effect()));
49 node->add_child("EffectColour")->add_child_text(effect_colour().to_argb_string());
51 node->add_child("OutlineWidth")->add_child_text(raw_convert<string>(outline_width));