diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-03-05 00:46:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-03-05 23:52:14 +0100 |
| commit | 474e13cf51457a51a6870c324e77ca30290a0d28 (patch) | |
| tree | 9a96ab781a07fff8c84812d7dd0570eac83dddbb | |
| parent | aa10e37a255a63dc269fb30358a5946d558e39b0 (diff) | |
Add Content::{font_paths,replace_font_path}().
| -rw-r--r-- | src/lib/content.cc | 31 | ||||
| -rw-r--r-- | src/lib/content.h | 3 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 60073f860..5e3d01847 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -31,6 +31,7 @@ #include "content_factory.h" #include "exceptions.h" #include "film.h" +#include "font.h" #include "job.h" #include "text_content.h" #include "util.h" @@ -570,3 +571,33 @@ Content::has_mapped_audio() const return audio && !audio->mapping().mapped_output_channels().empty(); } + +vector<boost::filesystem::path> +Content::font_paths() const +{ + vector<boost::filesystem::path> paths; + + for (auto i: text) { + for (auto j: i->fonts()) { + if (j->file()) { + paths.push_back(*j->file()); + } + } + } + + return paths; +} + + +void +Content::replace_font_path(boost::filesystem::path old_path, boost::filesystem::path new_path) +{ + for (auto i: text) { + for (auto j: i->fonts()) { + if (j->file() && *j->file() == old_path) { + j->set_file(new_path); + } + } + } +} + diff --git a/src/lib/content.h b/src/lib/content.h index bee7419dd..8ddb7d7e7 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -139,6 +139,9 @@ public: return _paths[i]; } + std::vector<boost::filesystem::path> font_paths() const; + void replace_font_path(boost::filesystem::path old_path, boost::filesystem::path new_path); + std::time_t last_write_time(size_t i) const { boost::mutex::scoped_lock lm(_mutex); return _last_write_times[i]; |
