int const SubtitleContentProperty::COLOUR = 508;
int const SubtitleContentProperty::OUTLINE = 509;
int const SubtitleContentProperty::OUTLINE_COLOUR = 510;
+int const SubtitleContentProperty::LINE_SPACING = 511;
SubtitleContent::SubtitleContent (Content* parent)
: ContentPart (parent)
, _colour (255, 255, 255)
, _outline (false)
, _outline_colour (0, 0, 0)
+ , _line_spacing (1)
{
}
node->optional_number_child<int>("OutlineGreen").get_value_or(255),
node->optional_number_child<int>("OutlineBlue").get_value_or(255)
)
+ , _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or (1))
{
if (version >= 32) {
_use = node->bool_child ("UseSubtitles");
throw JoinError (_("Content to be joined must have the same subtitle Y scale."));
}
+ if (c[i]->subtitle->line_spacing() != ref->line_spacing()) {
+ throw JoinError (_("Content to be joined must have the same subtitle line spacing."));
+ }
+
list<shared_ptr<Font> > fonts = c[i]->subtitle->fonts ();
if (fonts.size() != ref_fonts.size()) {
throw JoinError (_("Content to be joined must use the same fonts."));
_y_scale = ref->y_scale ();
_language = ref->language ();
_fonts = ref_fonts;
+ _line_spacing = ref->line_spacing ();
connect_to_fonts ();
}
root->add_child("OutlineRed")->add_child_text (raw_convert<string> (_outline_colour.r));
root->add_child("OutlineGreen")->add_child_text (raw_convert<string> (_outline_colour.g));
root->add_child("OutlineBlue")->add_child_text (raw_convert<string> (_outline_colour.b));
+ root->add_child("LineSpacing")->add_child_text (raw_convert<string> (_line_spacing));
for (list<shared_ptr<Font> >::const_iterator i = _fonts.begin(); i != _fonts.end(); ++i) {
(*i)->as_xml (root->add_child("Font"));
s << raw_convert<string> (x_scale())
<< "_" << raw_convert<string> (y_scale())
<< "_" << raw_convert<string> (x_offset())
- << "_" << raw_convert<string> (y_offset());
+ << "_" << raw_convert<string> (y_offset())
+ << "_" << raw_convert<string> (line_spacing());
/* XXX: I suppose really _fonts shouldn't be in here, since not all
types of subtitle content involve fonts.
{
maybe_set (_language, language, SubtitleContentProperty::LANGUAGE);
}
+
+void
+SubtitleContent::set_line_spacing (double s)
+{
+ maybe_set (_line_spacing, s, SubtitleContentProperty::LINE_SPACING);
+}
static int const COLOUR;
static int const OUTLINE;
static int const OUTLINE_COLOUR;
+ static int const LINE_SPACING;
};
/** @class SubtitleContent
return _outline_colour;
}
+ void set_line_spacing (double s);
+
+ double line_spacing () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _line_spacing;
+ }
+
static boost::shared_ptr<SubtitleContent> from_xml (Content* parent, cxml::ConstNodePtr, int version);
protected:
bool _outline;
dcp::Colour _outline_colour;
std::list<boost::signals2::connection> _font_connections;
+ /** scaling factor for line spacing; 1 is "standard", < 1 is closer together, > 1 is further apart */
+ double _line_spacing;
};
#endif