summaryrefslogtreecommitdiff
path: root/src/lib/text_decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/text_decoder.cc')
-rw-r--r--src/lib/text_decoder.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc
index 75fa33605..db072eda6 100644
--- a/src/lib/text_decoder.cc
+++ b/src/lib/text_decoder.cc
@@ -20,6 +20,7 @@
#include "compose.hpp"
+#include "dcpomatic_log.h"
#include "log.h"
#include "text_content.h"
#include "text_decoder.h"
@@ -127,7 +128,7 @@ TextDecoder::remove_invalid_characters_for_xml(string text)
void
-TextDecoder::emit_plain_start(ContentTime from, vector<dcp::SubtitleString> subtitles, dcp::SubtitleStandard valign_standard)
+TextDecoder::emit_plain_start(ContentTime from, vector<dcp::TextString> subtitles, dcp::SubtitleStandard valign_standard)
{
vector<StringText> string_texts;
@@ -198,7 +199,7 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti
/* Align our subtitles to the bottom of the screen, because if we are making a SMPTE
* DCP and the projection system uses the wrong standard to interpret vertical position,
* a bottom-aligned subtitle will be less wrong than a top-aligned one. This is because
- * in the top-aligned case the difference will be the distance between bbox top an
+ * in the top-aligned case the difference will be the distance between bbox top and
* baseline, but in the bottom-aligned case the difference will be between bbox bottom
* and baseline (which is shorter).
*/
@@ -273,7 +274,7 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti
return dcp::Colour(lrintf(c.r * 255), lrintf(c.g * 255), lrintf(c.b * 255));
};
- auto dcp_subtitle = dcp::SubtitleString(
+ auto dcp_subtitle = dcp::TextString(
optional<string>(),
block.italic,
block.bold,
@@ -306,6 +307,10 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti
);
auto font = content()->get_font(block.font.get_value_or(""));
+ if (!font) {
+ LOG_WARNING("Could not find font '%1' in content; falling back to default", block.font.get_value_or(""));
+ font = std::make_shared<dcpomatic::Font>(block.font.get_value_or(""), default_font_file());
+ }
DCPOMATIC_ASSERT(font);
auto string_text = StringText(
@@ -332,7 +337,7 @@ TextDecoder::emit_stop (ContentTime to)
void
-TextDecoder::emit_plain(ContentTimePeriod period, vector<dcp::SubtitleString> subtitles, dcp::SubtitleStandard valign_standard)
+TextDecoder::emit_plain(ContentTimePeriod period, vector<dcp::TextString> subtitles, dcp::SubtitleStandard valign_standard)
{
emit_plain_start (period.from, subtitles, valign_standard);
emit_stop (period.to);