Stop using static initialisation so that dcpomatic::write() can be called more than...
[dcpomatic.git] / src / lib / font.h
index 5876bf8a46052cbbbd75ad2adb941a581b2c7029..c1405d0f61c81d1695c95bca5d72009f87f63e43 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #ifndef DCPOMATIC_FONT_H
 #define DCPOMATIC_FONT_H
 
+
+#include <dcp/array_data.h>
 #include <libcxml/cxml.h>
 #include <boost/optional.hpp>
 #include <boost/signals2.hpp>
 #include <boost/filesystem.hpp>
 #include <string>
 
+
 namespace dcpomatic {
 
+
 class Font
 {
 public:
@@ -37,12 +42,21 @@ public:
 
        explicit Font (cxml::NodePtr node);
 
+       Font (std::string id, boost::filesystem::path file)
+               : _id (id)
+               , _file (file)
+       {}
+
        void as_xml (xmlpp::Node* node);
 
        std::string id () const {
                return _id;
        }
 
+       void set_id (std::string id) {
+               _id = id;
+       }
+
        boost::optional<boost::filesystem::path> file () const {
                return _file;
        }
@@ -52,17 +66,24 @@ public:
                Changed ();
        }
 
+       boost::optional<dcp::ArrayData> data() const;
+
        boost::signals2::signal<void()> Changed;
 
 private:
-       /** Font ID, used to describe it in the subtitle content */
+       /** Font ID, used to describe it in the subtitle content; could be either a
+        *  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;
 };
 
+
 bool operator!= (Font const & a, Font const & b);
 bool operator== (Font const & a, Font const & b);
 
+
 }
 
 #endif