+
+ if (_subtitle_content) {
+ boost::filesystem::path const liberation = shared_path () / "LiberationSans-Regular.ttf";
+
+ /* Add all the fonts to the subtitle content and as assets to the DCP */
+ BOOST_FOREACH (shared_ptr<Font> i, _fonts) {
+ boost::filesystem::path const from = i->file.get_value_or (liberation);
+ _subtitle_content->add_font (i->id, from.leaf().string ());
+
+ boost::filesystem::path to = _film->dir (_film->dcp_name ()) / _subtitle_content->id ();
+ boost::filesystem::create_directories (to, ec);
+ if (ec) {
+ throw FileError (_("Could not create directory"), to);
+ }
+
+ to /= from.leaf();
+
+ boost::system::error_code ec;
+ boost::filesystem::copy_file (from, to, ec);
+ if (ec) {
+ throw FileError ("Could not copy font to DCP", from);
+ }
+
+ dcp.add (shared_ptr<dcp::Font> (new dcp::Font (to)));
+ }
+
+ _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _subtitle_content->id () / subtitle_content_filename (_subtitle_content));
+ reel->add (shared_ptr<dcp::ReelSubtitleAsset> (
+ new dcp::ReelSubtitleAsset (
+ _subtitle_content,
+ dcp::Fraction (_film->video_frame_rate(), 1),
+ _picture_mxf->intrinsic_duration (),
+ 0
+ )
+ ));
+
+ dcp.add (_subtitle_content);
+ }