diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-05-12 01:35:26 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-05-12 01:35:26 +0200 |
| commit | 7777eed2b60d40915b5f4cc8330b1f5207feb3b3 (patch) | |
| tree | e361b88cf128116aa4e5c2a05707f760ee30d6f8 | |
| parent | c1e9e33c857aa464a0cc2890998253cd80bfebeb (diff) | |
Add SubtitleAsset::ensure_font().v1.8.69
| -rw-r--r-- | src/subtitle_asset.cc | 9 | ||||
| -rw-r--r-- | src/subtitle_asset.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index d6103a1d..5a448f3f 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -928,3 +928,12 @@ SubtitleAsset::format_xml(xmlpp::Document const& document, optional<pair<string, return state.xml; } + +void +SubtitleAsset::ensure_font(string load_id, dcp::ArrayData data) +{ + if (std::find_if(_fonts.begin(), _fonts.end(), [load_id](Font const& font) { return font.load_id == load_id; }) == _fonts.end()) { + add_font(load_id, data); + } +} + diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 28db9574..bc5fa882 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -111,6 +111,7 @@ public: virtual void add (std::shared_ptr<Subtitle>); virtual void add_font (std::string id, dcp::ArrayData data) = 0; + void ensure_font(std::string id, dcp::ArrayData data); std::map<std::string, ArrayData> font_data () const; std::map<std::string, boost::filesystem::path> font_filenames () const; |
