diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/hints.cc | 24 | ||||
| -rw-r--r-- | src/lib/render_text.cc | 6 | ||||
| -rw-r--r-- | src/lib/string_text.h | 2 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 99882ec0e..f3e91dbea 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -586,17 +586,19 @@ Hints::closed_caption(PlayerText text, DCPTimePeriod period) { int lines = text.string.size(); for (auto i: text.string) { - if (utf8_strlen(i.text()) > MAX_CLOSED_CAPTION_LENGTH) { - ++lines; - if (!_long_ccap) { - _long_ccap = true; - hint( - fmt::format( - "At least one of your closed caption lines has more than {} characters. " - "It is advisable to make each line {} characters at most in length.", - MAX_CLOSED_CAPTION_LENGTH, - MAX_CLOSED_CAPTION_LENGTH) - ); + if (auto text_string = i.string_text()) { + if (utf8_strlen(*text_string) > MAX_CLOSED_CAPTION_LENGTH) { + ++lines; + if (!_long_ccap) { + _long_ccap = true; + hint( + fmt::format( + "At least one of your closed caption lines has more than {} characters. " + "It is advisable to make each line {} characters at most in length.", + MAX_CLOSED_CAPTION_LENGTH, + MAX_CLOSED_CAPTION_LENGTH) + ); + } } } } diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 3dcc317fa..7d9d1ea2e 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -151,7 +151,11 @@ marked_up(vector<StringText> subtitles, int target_height, float fade_factor, st out += make_span(i, " ", "letter_spacing=\"" + fmt::to_string(std::round(spacing)) + "\""); } - out += make_span(i, i.text(), {}); + if (i.string_text()) { + out += make_span(i, *i.string_text(), {}); + } else { + out += make_span(i, i.ruby_text()->base, {}); + } } return out; diff --git a/src/lib/string_text.h b/src/lib/string_text.h index d39a889cf..6908235f6 100644 --- a/src/lib/string_text.h +++ b/src/lib/string_text.h @@ -28,7 +28,7 @@ #include <dcp/text_string.h> -/** A wrapper for SubtitleString which allows us to: +/** A wrapper for dcp::TextString which allows us to: * * - include settings that are not applicable to true DCP subtitles. * For example, we can set outline width for burn-in but this cannot be specified in DCP XML. |
