Merge branch 'master' of github.com:mapnik/mapnik into render-time-variables

This commit is contained in:
Dane Springmeyer 2014-05-16 07:49:06 -07:00
commit 03bb82b13f
2 changed files with 15 additions and 20 deletions

View file

@ -81,7 +81,7 @@ struct feature_collection_grammar :
start = feature_collection | feature_from_geometry(_val) | feature(_val)
;
feature_collection = lit('{') >> (type | features) % lit(',') >> lit('}')
feature_collection = lit('{') >> (type | features | json.key_value) % lit(',') >> lit('}')
;
type = lit("\"type\"") >> lit(':') >> lit("\"FeatureCollection\"")

View file

@ -73,10 +73,9 @@ void init_freetype(FT_Memory memory, FT_Library & library)
FT_Add_Default_Modules(library);
}
freetype_engine::freetype_engine() :
library_(nullptr),
memory_(new FT_MemoryRec_)
freetype_engine::freetype_engine()
: library_(nullptr),
memory_(new FT_MemoryRec_)
{
init_freetype(&*memory_, library_);
}
@ -236,10 +235,9 @@ bool freetype_engine::register_fonts_impl(std::string const& dir, FT_LibraryRec_
std::vector<std::string> freetype_engine::face_names ()
{
std::vector<std::string> names;
std::map<std::string,std::pair<int,std::string> >::const_iterator itr;
for (itr = name2file_.begin();itr!=name2file_.end();++itr)
for (auto const& kv : name2file_)
{
names.push_back(itr->first);
names.push_back(kv.first);
}
return names;
}
@ -252,13 +250,12 @@ std::map<std::string,std::pair<int,std::string> > const& freetype_engine::get_ma
face_ptr freetype_engine::create_face(std::string const& family_name)
{
std::map<std::string, std::pair<int,std::string> >::const_iterator itr;
itr = name2file_.find(family_name);
auto itr = name2file_.find(family_name);
if (itr != name2file_.end())
{
FT_Face face;
std::map<std::string,std::string>::const_iterator mem_font_itr = memory_fonts_.find(itr->second.second);
auto mem_font_itr = memory_fonts_.find(itr->second.second);
if (mem_font_itr != memory_fonts_.end()) // memory font
{
@ -279,8 +276,7 @@ face_ptr freetype_engine::create_face(std::string const& family_name)
std::ifstream is(itr->second.second.c_str() , std::ios::binary);
std::string buffer((std::istreambuf_iterator<char>(is)),
std::istreambuf_iterator<char>());
std::pair<std::map<std::string,std::string>::iterator,bool> result
= memory_fonts_.insert(std::make_pair(itr->second.second, buffer));
auto result = memory_fonts_.insert(std::make_pair(itr->second.second, buffer));
FT_Error error = FT_New_Memory_Face (library_,
reinterpret_cast<FT_Byte const*>(result.first->second.c_str()),
@ -313,10 +309,9 @@ stroker_ptr freetype_engine::create_stroker()
template <typename T>
face_ptr face_manager<T>::get_face(const std::string &name)
face_ptr face_manager<T>::get_face(std::string const& name)
{
face_ptr_cache_type::iterator itr;
itr = face_ptr_cache_.find(name);
auto itr = face_ptr_cache_.find(name);
if (itr != face_ptr_cache_.end())
{
return itr->second;
@ -333,7 +328,7 @@ face_ptr face_manager<T>::get_face(const std::string &name)
}
template <typename T>
face_set_ptr face_manager<T>::get_face_set(const std::string &name)
face_set_ptr face_manager<T>::get_face_set(std::string const& name)
{
face_set_ptr face_set = std::make_shared<font_face_set>();
if (face_ptr face = get_face(name))
@ -344,13 +339,13 @@ face_set_ptr face_manager<T>::get_face_set(const std::string &name)
}
template <typename T>
face_set_ptr face_manager<T>::get_face_set(const font_set &fset)
face_set_ptr face_manager<T>::get_face_set(font_set const& fset)
{
std::vector<std::string> const& names = fset.get_face_names();
face_set_ptr face_set = std::make_shared<font_face_set>();
for (std::vector<std::string>::const_iterator name = names.begin(); name != names.end(); ++name)
for (auto const& name : names)
{
face_ptr face = get_face(*name);
face_ptr face = get_face(name);
if (face)
{
face_set->add(face);