summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-20 23:49:48 +0100
committerCarl Hetherington <cth@carlh.net>2020-12-20 23:49:48 +0100
commitc6665c157bdb6903661d21c571c7d112b54ad8fd (patch)
tree81910900fb9bcee8958674fef3b1fb70f115d14d /src
parent2b522d0382a6d4534f1504123a9d16700fe50f0a (diff)
Accept fonts as data blocks rather than files.
Diffstat (limited to 'src')
-rw-r--r--src/interop_subtitle_asset.cc7
-rw-r--r--src/interop_subtitle_asset.h2
-rw-r--r--src/smpte_subtitle_asset.cc4
-rw-r--r--src/smpte_subtitle_asset.h2
-rw-r--r--src/subtitle_asset.h2
5 files changed, 9 insertions, 8 deletions
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc
index 316fb08a..c6173a26 100644
--- a/src/interop_subtitle_asset.cc
+++ b/src/interop_subtitle_asset.cc
@@ -119,10 +119,11 @@ InteropSubtitleAsset::xml_as_string () const
}
void
-InteropSubtitleAsset::add_font (string load_id, boost::filesystem::path file)
+InteropSubtitleAsset::add_font (string load_id, dcp::ArrayData data)
{
- _fonts.push_back (Font (load_id, make_uuid(), file));
- _load_font_nodes.push_back (shared_ptr<InteropLoadFontNode> (new InteropLoadFontNode (load_id, file.leaf().string ())));
+ _fonts.push_back (Font(load_id, make_uuid(), data));
+ string const uri = String::compose("font_%1.ttf", _load_font_nodes.size());
+ _load_font_nodes.push_back (shared_ptr<InteropLoadFontNode>(new InteropLoadFontNode(load_id, uri)));
}
bool
diff --git a/src/interop_subtitle_asset.h b/src/interop_subtitle_asset.h
index 4b96c795..b34a2a28 100644
--- a/src/interop_subtitle_asset.h
+++ b/src/interop_subtitle_asset.h
@@ -64,7 +64,7 @@ public:
std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const;
- void add_font (std::string load_id, boost::filesystem::path file);
+ void add_font (std::string load_id, dcp::ArrayData data);
std::string xml_as_string () const;
void write (boost::filesystem::path path) const;
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc
index 0ebfcc61..606ef84c 100644
--- a/src/smpte_subtitle_asset.cc
+++ b/src/smpte_subtitle_asset.cc
@@ -527,10 +527,10 @@ SMPTESubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions
}
void
-SMPTESubtitleAsset::add_font (string load_id, boost::filesystem::path file)
+SMPTESubtitleAsset::add_font (string load_id, dcp::ArrayData data)
{
string const uuid = make_uuid ();
- _fonts.push_back (Font (load_id, uuid, file));
+ _fonts.push_back (Font(load_id, uuid, data));
_load_font_nodes.push_back (shared_ptr<SMPTELoadFontNode> (new SMPTELoadFontNode (load_id, uuid)));
}
diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h
index 09cd4634..1f2215a8 100644
--- a/src/smpte_subtitle_asset.h
+++ b/src/smpte_subtitle_asset.h
@@ -75,7 +75,7 @@ public:
std::string xml_as_string () const;
void write (boost::filesystem::path path) const;
void add (boost::shared_ptr<Subtitle>);
- void add_font (std::string id, boost::filesystem::path file);
+ void add_font (std::string id, dcp::ArrayData data);
void set_key (Key key);
void set_content_title_text (std::string t) {
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h
index 063a2dfd..ab909a26 100644
--- a/src/subtitle_asset.h
+++ b/src/subtitle_asset.h
@@ -94,7 +94,7 @@ public:
}
virtual void add (boost::shared_ptr<Subtitle>);
- virtual void add_font (std::string id, boost::filesystem::path file) = 0;
+ virtual void add_font (std::string id, dcp::ArrayData data) = 0;
std::map<std::string, ArrayData> font_data () const;
std::map<std::string, boost::filesystem::path> font_filenames () const;