int reel_count,
optional<string> content_summary,
list<ReferencedReelAsset> const & refs,
- FontIdMap const& fonts,
- shared_ptr<dcpomatic::Font> chosen_interop_font,
- dcp::ArrayData default_font,
shared_ptr<const Film> film,
DCPTimePeriod period,
boost::filesystem::path output_dcp,
shared_ptr<Result> reel_asset;
if (asset) {
- if (film->interop()) {
- if (chosen_interop_font) {
- /* We only add one font, as Interop will ignore subsequent ones (and some validators will
- * complain if they are even present)
- */
- asset->add_font(fonts.get(chosen_interop_font), chosen_interop_font->data().get_value_or(default_font));
- } else {
- }
- } else {
- for (auto const& font: fonts.map()) {
- asset->add_font(font.second, font.first->data().get_value_or(default_font));
- }
- }
-
if (auto interop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(asset)) {
auto directory = output_dcp / interop->id ();
boost::filesystem::create_directories (directory);
ReelWriter::create_reel_text (
shared_ptr<dcp::Reel> reel,
list<ReferencedReelAsset> const & refs,
- FontIdMap const& fonts,
- shared_ptr<dcpomatic::Font> chosen_interop_font,
int64_t duration,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
) const
{
auto subtitle = maybe_add_text<dcp::ReelInteropSubtitleAsset, dcp::ReelSMPTESubtitleAsset, dcp::ReelSubtitleAsset> (
- _subtitle_asset, duration, reel, _reel_index, _reel_count, _content_summary, refs, fonts, chosen_interop_font, _default_font, film(), _period, output_dcp, _text_only
+ _subtitle_asset, duration, reel, _reel_index, _reel_count, _content_summary, refs, film(), _period, output_dcp, _text_only
);
if (subtitle) {
_reel_count,
_content_summary,
refs,
- fonts,
- chosen_interop_font,
- _default_font,
film(),
_period,
output_dcp,
for (auto const& i: _closed_caption_assets) {
auto a = maybe_add_text<dcp::ReelInteropClosedCaptionAsset, dcp::ReelSMPTEClosedCaptionAsset, dcp::ReelClosedCaptionAsset> (
- i.second, duration, reel, _reel_index, _reel_count, _content_summary, refs, fonts, chosen_interop_font, _default_font, film(), _period, output_dcp, _text_only
+ i.second, duration, reel, _reel_index, _reel_count, _content_summary, refs, film(), _period, output_dcp, _text_only
);
DCPOMATIC_ASSERT (a);
a->set_annotation_text (i.first.name);
_reel_count,
_content_summary,
refs,
- fonts,
- chosen_interop_font,
- _default_font,
film(),
_period,
output_dcp,
shared_ptr<dcp::Reel>
ReelWriter::create_reel (
list<ReferencedReelAsset> const & refs,
- FontIdMap const & fonts,
- shared_ptr<dcpomatic::Font> chosen_interop_font,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
set<DCPTextTrack> ensure_closed_captions
create_reel_markers (reel);
}
- create_reel_text (reel, refs, fonts, chosen_interop_font, duration, output_dcp, ensure_subtitles, ensure_closed_captions);
+ create_reel_text(reel, refs, duration, output_dcp, ensure_subtitles, ensure_closed_captions);
if (_atmos_asset) {
reel->add (make_shared<dcp::ReelAtmosAsset>(_atmos_asset, 0));
void
-ReelWriter::write (PlayerText subs, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period, FontIdMap const& fonts)
+ReelWriter::write(PlayerText subs, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period, FontIdMap const& fonts, shared_ptr<dcpomatic::Font> chosen_interop_font)
{
shared_ptr<dcp::SubtitleAsset> asset;
i.set_out (dcp::Time(period.to.seconds() - _period.from.seconds(), tcr));
i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::SubtitleStandard::INTEROP : dcp::SubtitleStandard::SMPTE_2014));
auto sub = make_shared<dcp::SubtitleString>(i);
- sub->set_font(fonts.get(i.font));
+ /* i.font is a shared_ptr<Font> which uniquely identifies the font we want,
+ * though if we are Interop we can only have one font, so we'll use the chosen
+ * one instead.
+ */
+ auto font = film()->interop() ? chosen_interop_font : i.font;
+ /* We can get the corresponding ID from fonts */
+ auto const font_id_to_use = fonts.get(font);
+ /* Give this subtitle the correct font ID */
+ sub->set_font(font_id_to_use);
asset->add(sub);
+ /* Make sure the asset LoadFonts the font we just asked for */
+ asset->ensure_font(font_id_to_use, font->data().get_value_or(_default_font));
}
for (auto i: subs.bitmap) {
void fake_write (int size);
void repeat_write (Frame frame, Eyes eyes);
void write (std::shared_ptr<const AudioBuffers> audio);
- void write (PlayerText text, TextType type, boost::optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period, FontIdMap const& fonts);
+ void write(PlayerText text, TextType type, boost::optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period, FontIdMap const& fonts, std::shared_ptr<dcpomatic::Font> chosen_interop_font);
void write (std::shared_ptr<const dcp::AtmosFrame> atmos, AtmosMetadata metadata);
void finish (boost::filesystem::path output_dcp);
std::shared_ptr<dcp::Reel> create_reel (
std::list<ReferencedReelAsset> const & refs,
- FontIdMap const & fonts,
- std::shared_ptr<dcpomatic::Font> chosen_interop_font,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
std::set<DCPTextTrack> ensure_closed_captions
void create_reel_text (
std::shared_ptr<dcp::Reel> reel,
std::list<ReferencedReelAsset> const & refs,
- FontIdMap const& fonts,
- std::shared_ptr<dcpomatic::Font> chosen_interop_font,
int64_t duration,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
/* Add reels */
for (auto& i: _reels) {
- cpl->add (i.create_reel(_reel_assets, _fonts, _chosen_interop_font, output_dcp, _have_subtitles, _have_closed_captions));
+ cpl->add(i.create_reel(_reel_assets, output_dcp, _have_subtitles, _have_closed_captions));
}
/* Add metadata */
period = back_off(period);
}
- (*reel)->write(text, type, track, period, _fonts);
+ (*reel)->write(text, type, track, period, _fonts, _chosen_interop_font);
}
vector<HangingText> new_hanging_texts;
for (auto i: _hanging_texts) {
if (i.period.from == reel.period().from) {
- reel.write (i.text, i.type, i.track, i.period, _fonts);
+ reel.write(i.text, i.type, i.track, i.period, _fonts, _chosen_interop_font);
} else {
new_hanging_texts.push_back (i);
}