From c433039121e361d4466ac626d879edaa18050ffb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 10 Sep 2020 23:37:32 +0200 Subject: Add set_font_file() --- src/interop_subtitle_asset.cc | 18 ++++++++++++++++++ src/interop_subtitle_asset.h | 1 + 2 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index f6410520..f7e38965 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -276,3 +276,21 @@ InteropSubtitleAsset::add_to_pkl (shared_ptr pkl, boost::filesystem::path r } } } + + +void +InteropSubtitleAsset::set_font_file (string load_id, boost::filesystem::path file) +{ + BOOST_FOREACH (Font& i, _fonts) { + if (i.load_id == load_id) { + i.file = file; + } + } + + BOOST_FOREACH (shared_ptr i, _load_font_nodes) { + if (i->id == load_id) { + i->uri = file.filename().string(); + } + } +} + diff --git a/src/interop_subtitle_asset.h b/src/interop_subtitle_asset.h index ba8b5edf..4b96c795 100644 --- a/src/interop_subtitle_asset.h +++ b/src/interop_subtitle_asset.h @@ -70,6 +70,7 @@ public: void write (boost::filesystem::path path) const; void resolve_fonts (std::list > assets); void add_font_assets (std::list >& assets); + void set_font_file (std::string load_id, boost::filesystem::path file); /** Set the reel number or sub-element identifier * of these subtitles. -- cgit v1.2.3