diff --git a/include/mapnik/font_engine_freetype.hpp b/include/mapnik/font_engine_freetype.hpp index 33ac45035..73227cdbf 100644 --- a/include/mapnik/font_engine_freetype.hpp +++ b/include/mapnik/font_engine_freetype.hpp @@ -100,10 +100,8 @@ private: static font_memory_cache_type global_memory_fonts_; }; -class MAPNIK_DECL face_manager : private util::noncopyable +class MAPNIK_DECL face_manager { - using face_ptr_cache_type = std::map; - public: face_manager(font_library & library, freetype_engine::font_file_mapping_type const& font_file_mapping, @@ -112,9 +110,13 @@ public: face_set_ptr get_face_set(std::string const& name); face_set_ptr get_face_set(font_set const& fset); face_set_ptr get_face_set(std::string const& name, boost::optional fset); - inline stroker_ptr get_stroker() { return stroker_; } + stroker_ptr get_stroker() const { return stroker_; } + private: - face_ptr_cache_type face_ptr_cache_; + using face_cache = std::map; + using face_cache_ptr = std::shared_ptr; + + face_cache_ptr face_cache_; font_library & library_; freetype_engine::font_file_mapping_type const& font_file_mapping_; freetype_engine::font_memory_cache_type const& font_memory_cache_; diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index b0f137473..f5d713cad 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -361,7 +361,7 @@ face_ptr freetype_engine::create_face(std::string const& family_name, face_manager::face_manager(font_library & library, freetype_engine::font_file_mapping_type const& font_file_mapping, freetype_engine::font_memory_cache_type const& font_cache) - : face_ptr_cache_(), + : face_cache_(new face_cache()), library_(library), font_file_mapping_(font_file_mapping), font_memory_cache_(font_cache) @@ -376,8 +376,8 @@ face_manager::face_manager(font_library & library, face_ptr face_manager::get_face(std::string const& name) { - auto itr = face_ptr_cache_.find(name); - if (itr != face_ptr_cache_.end()) + auto itr = face_cache_->find(name); + if (itr != face_cache_->end()) { return itr->second; } @@ -391,7 +391,7 @@ face_ptr face_manager::get_face(std::string const& name) freetype_engine::get_cache()); if (face) { - face_ptr_cache_.emplace(name,face); + face_cache_->emplace(name, face); } return face; }