From 66889d32f9159a98f1734c9b5f037e369041d032 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 2 Oct 2014 00:47:32 -0700 Subject: [PATCH] only memcache local fonts if not already globally known and not already cached (avoid extra io for ttc) --- src/map.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 48b83a958..0bd9b66b5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -293,11 +293,16 @@ bool Map::load_fonts() bool result = false; for (auto const& kv : font_file_mapping_) { - mapnik::util::file file(kv.second.second); - if (file.open()) + auto const& global_mapping = freetype_engine::get_mapping(); + 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())); - if (item.second) result = true; + mapnik::util::file file(kv.second.second); + 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;