diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-24 15:05:19 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-24 15:05:19 +0100 |
| commit | 81312913ad26aaee12eeabd3f27a537806c97049 (patch) | |
| tree | 8a58899a4df44bc88f85d52707152934cc0ccb51 /src/subtitle_asset.h | |
| parent | 094117316524f12fc82adbdf721778eed04e66f6 (diff) | |
Fix various SNAFUs with Font ID handling.
Diffstat (limited to 'src/subtitle_asset.h')
| -rw-r--r-- | src/subtitle_asset.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 31afecb3..51385b22 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -70,7 +70,7 @@ public: void add (SubtitleString); virtual void add_font (std::string id, boost::filesystem::path file) = 0; - std::map<std::string, Data> fonts () const; + std::map<std::string, Data> fonts_with_load_ids () const; virtual void write (boost::filesystem::path) const = 0; virtual Glib::ustring xml_as_string () const = 0; @@ -85,32 +85,34 @@ protected: void parse_subtitles (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<FontNode> > font_nodes); void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, std::string xmlns) const; - void add_font_data (std::string id, boost::filesystem::path file); /** All our subtitles, in no particular order */ std::list<SubtitleString> _subtitles; - class FileData : public Data { + class Font + { public: - FileData () {} - - FileData (boost::shared_array<uint8_t> data_, boost::uintmax_t size_) - : Data (data_, size_) + Font (std::string load_id_, std::string uuid_, boost::filesystem::path file_) + : load_id (load_id_) + , uuid (uuid_) + , data (file_) + , file (file_) {} - FileData (boost::filesystem::path file_) - : Data (file_) + Font (std::string load_id_, std::string uuid_, Data data_) + : load_id (load_id_) + , uuid (uuid_) + , data (data_) {} - - /** .ttf file that this data was last written to */ + + std::string load_id; + std::string uuid; + Data data; + /** .ttf file that this data was last written to, if applicable */ mutable boost::optional<boost::filesystem::path> file; }; - /** Font data, keyed by a subclass-dependent identifier. - * For Interop, the string is the font ID from the subtitle file. - * For SMPTE, the string is the font's URN from the subtitle file. - */ - std::map<std::string, FileData> _fonts; + std::list<Font> _fonts; private: /** @struct ParseState |
