summaryrefslogtreecommitdiff
path: root/src/subtitle_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-05-16 23:12:40 +0200
committerCarl Hetherington <cth@carlh.net>2023-05-16 23:12:40 +0200
commitf68a99a93b7a735d9983d8946f058a71f5b11cd4 (patch)
treea9b58d25a1a3268b3448e75d3205214c3f0c1ead /src/subtitle_asset.cc
parent245faa7fc2eb88a761e8d52603766b27b5a880c8 (diff)
Make it possible to write subtitle assets without any <Font> tags.2525-ccap-fonts
Diffstat (limited to 'src/subtitle_asset.cc')
-rw-r--r--src/subtitle_asset.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index f35b47ef..176ee02b 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -662,11 +662,21 @@ SubtitleAsset::pull_fonts (shared_ptr<order::Part> part)
}
+void
+SubtitleAsset::clear_fonts(shared_ptr<order::Part> part)
+{
+ part->font.clear();
+ for (auto child: part->children) {
+ clear_fonts(child);
+ }
+}
+
+
/** @param standard Standard (INTEROP or SMPTE); this is used rather than putting things in the child
* class because the differences between the two are fairly subtle.
*/
void
-SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, Standard standard) const
+SubtitleAsset::subtitles_as_xml(xmlpp::Element* xml_root, int time_code_rate, Standard standard, FontTags fonts) const
{
auto sorted = _subtitles;
std::stable_sort(sorted.begin(), sorted.end(), SubtitleSorter());
@@ -741,9 +751,12 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, S
}
}
- /* Pull font changes as high up the hierarchy as we can */
-
- pull_fonts (root);
+ if (fonts == FontTags::INCLUDE) {
+ /* Pull font changes as high up the hierarchy as we can */
+ pull_fonts(root);
+ } else {
+ clear_fonts(root);
+ }
/* Write XML */