only memcache local fonts if not already globally known and not already cached (avoid extra io for ttc)

This commit is contained in:
Dane Springmeyer 2014-10-02 00:47:32 -07:00
parent 887f5a982b
commit 66889d32f9

View file

@ -293,11 +293,16 @@ bool Map::load_fonts()
bool result = false; bool result = false;
for (auto const& kv : font_file_mapping_) for (auto const& kv : font_file_mapping_)
{ {
mapnik::util::file file(kv.second.second); auto const& global_mapping = freetype_engine::get_mapping();
if (file.open()) if ((global_mapping.find(kv.first) == global_mapping.end()) &&
(font_memory_cache_.find(kv.second.second) == font_memory_cache_.end()))
{ {
auto item = font_memory_cache_.emplace(kv.second.second, std::make_pair(std::move(file.data()),file.size())); mapnik::util::file file(kv.second.second);
if (item.second) result = true; if (file.open())
{
auto item = font_memory_cache_.emplace(kv.second.second, std::make_pair(std::move(file.data()),file.size()));
if (item.second) result = true;
}
} }
} }
return result; return result;