summaryrefslogtreecommitdiff
path: root/src/lib/font.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-04-19 23:53:58 +0200
committerCarl Hetherington <cth@carlh.net>2023-04-19 23:53:58 +0200
commitf6a51c4902d6c1983d58e1073f048d50ba2a50df (patch)
treea56cadf9bd7d142cd0f6ebcd1508b109cb3dfe67 /src/lib/font.h
parentbb2924236bc100d6f98b7778bae31aeee48637fa (diff)
Wrap path/data in a struct.
Diffstat (limited to 'src/lib/font.h')
-rw-r--r--src/lib/font.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/font.h b/src/lib/font.h
index 55c4249cc..b9e90f65e 100644
--- a/src/lib/font.h
+++ b/src/lib/font.h
@@ -44,13 +44,15 @@ public:
Font (std::string id, boost::filesystem::path file)
: _id (id)
- , _file (file)
- {}
+ {
+ _content.file = file;
+ }
Font (std::string id, dcp::ArrayData data)
: _id (id)
- , _data (data)
- {}
+ {
+ _content.data = data;
+ }
void as_xml (xmlpp::Node* node);
@@ -63,11 +65,11 @@ public:
}
boost::optional<boost::filesystem::path> file () const {
- return _file;
+ return _content.file;
}
void set_file (boost::filesystem::path file) {
- _file = file;
+ _content.file = file;
Changed ();
}
@@ -76,6 +78,13 @@ public:
*/
boost::optional<dcp::ArrayData> data() const;
+ /** The actual TTF/OTF font data, as either a filename or the raw data itself */
+ struct Content
+ {
+ boost::optional<dcp::ArrayData> data;
+ boost::optional<boost::filesystem::path> file;
+ };
+
boost::signals2::signal<void()> Changed;
private:
@@ -83,8 +92,7 @@ private:
* font family name or an ID from some DCP font XML.
*/
std::string _id;
- boost::optional<dcp::ArrayData> _data;
- boost::optional<boost::filesystem::path> _file;
+ Content _content;
};