summaryrefslogtreecommitdiff
path: root/src/subtitle_asset.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/subtitle_asset.cc')
-rw-r--r--src/subtitle_asset.cc27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index 8d492727..c0ffb75a 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -30,6 +30,7 @@
#include <libxml++/nodes/element.h>
#include <boost/algorithm/string.hpp>
#include <boost/shared_array.hpp>
+#include <boost/foreach.hpp>
#include <fstream>
using std::string;
@@ -308,32 +309,12 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* root, int time_code_rate, strin
}
}
-void
-SubtitleAsset::add_font_data (string id, boost::filesystem::path file)
-{
- boost::uintmax_t size = boost::filesystem::file_size (file);
- FILE* f = fopen_boost (file, "rb");
- if (!f) {
- throw FileError ("could not open font file for reading", file, errno);
- }
-
- shared_array<uint8_t> data (new uint8_t[size]);
- size_t const read = fread (data.get(), 1, size, f);
- fclose (f);
-
- if (read != size) {
- throw FileError ("could not read font file", file, -1);
- }
-
- _fonts[id] = FileData (data, size);
-}
-
map<string, Data>
-SubtitleAsset::fonts () const
+SubtitleAsset::fonts_with_load_ids () const
{
map<string, Data> out;
- for (map<string, FileData>::const_iterator i = _fonts.begin(); i != _fonts.end(); ++i) {
- out[i->first] = i->second;
+ BOOST_FOREACH (Font const & i, _fonts) {
+ out[i.load_id] = i.data;
}
return out;
}