From f68a99a93b7a735d9983d8946f058a71f5b11cd4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 16 May 2023 23:12:40 +0200 Subject: Make it possible to write subtitle assets without any tags. --- src/subtitle_asset.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/subtitle_asset.h') diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index bc5fa882..88f05659 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -115,8 +115,13 @@ public: std::map font_data () const; std::map font_filenames () const; - virtual void write (boost::filesystem::path) const = 0; - virtual std::string xml_as_string () const = 0; + enum class FontTags { + OMIT, + INCLUDE + }; + + virtual void write(boost::filesystem::path, FontTags font_tags = FontTags::INCLUDE) const = 0; + virtual std::string xml_as_string(FontTags font_tags = FontTags::INCLUDE) const = 0; Time latest_subtitle_out () const; @@ -178,7 +183,7 @@ protected: Time fade_time (xmlpp::Element const * node, std::string name, boost::optional tcr) const; void position_align (ParseState& ps, xmlpp::Element const * node) const; - void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Standard standard) const; + void subtitles_as_xml(xmlpp::Element* root, int time_code_rate, Standard standard, FontTags fonts) const; /** All our subtitles, in no particular order */ std::vector> _subtitles; @@ -220,6 +225,7 @@ private: void maybe_add_subtitle (std::string text, std::vector const & parse_state, float space_before, Standard standard); static void pull_fonts (std::shared_ptr part); + static void clear_fonts(std::shared_ptr part); }; -- cgit v1.2.3