fix back compat for text-placement-type:dummy - closes #2502

This commit is contained in:
Dane Springmeyer 2014-10-06 11:37:39 -07:00
parent 4aec64871d
commit 737c299341
3 changed files with 18 additions and 2 deletions

View file

@ -291,9 +291,13 @@ bool Map::register_fonts(std::string const& dir, bool recurse)
bool Map::load_fonts()
{
bool result = false;
for (auto const& kv : font_file_mapping_)
auto const& global_mapping = freetype_engine::get_mapping();
auto const& global_cache = freetype_engine::get_cache();
for (auto const& kv : font_file_mapping_) // for every face-name:filepath
{
auto const& global_mapping = freetype_engine::get_mapping();
auto const& face_name = kv.second.second;
// if font data is already cached
std::clog << "kv.first " << kv.first << "\n";
if ((global_mapping.find(kv.first) == global_mapping.end()) &&
(font_memory_cache_.find(kv.second.second) == font_memory_cache_.end()))
{

View file

@ -35,6 +35,7 @@ registry::registry()
{
register_name("simple", &text_placements_simple::from_xml);
register_name("list", &text_placements_list::from_xml);
register_name("dummy", &text_placements_list::from_xml);
}
void registry::register_name(std::string name, from_xml_function_ptr ptr, bool overwrite)

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map background-color="white" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="My Style">
<Rule>
<!-- https://github.com/mapnik/mapnik/issues/2502 -->
<TextSymbolizer face-name="DejaVu Sans Book" placement-type="dummy">[name]</TextSymbolizer>
</Rule>
</Style>
</Map>