add 'font_directory' attribute to map to allow for regstration of fonts within - in combination with r2025 this closes #168

This commit is contained in:
Dane Springmeyer 2010-10-07 01:49:07 +00:00
parent 2f46db5aba
commit 2fc2b4c443
3 changed files with 9 additions and 1 deletions

View file

@ -14,6 +14,8 @@ For a complete change history, see the SVN log.
Mapnik Trunk Mapnik Trunk
------------ ------------
- Added ability to register fonts within XML using Map level 'font_directory' parameter (#168)
- TextSymbolizer: Change text_convert to text_transform to better match css naming (r2211) - TextSymbolizer: Change text_convert to text_transform to better match css naming (r2211)
- Shapefile Plugin: Throw error if attribute name is requested that does not exist (#604) - Shapefile Plugin: Throw error if attribute name is requested that does not exist (#604)

View file

@ -192,6 +192,12 @@ void map_parser::parse_map( Map & map, ptree const & pt )
map.set_buffer_size(*buffer_size); map.set_buffer_size(*buffer_size);
} }
optional<std::string> font_directory = get_opt_attr<std::string>(map_node,"font_directory");
if (font_directory)
{
freetype_engine::register_fonts( ensure_relative_to_xml(font_directory), false);
}
// Check if relative paths should be interpreted as relative to/from XML location // Check if relative paths should be interpreted as relative to/from XML location
// Default is true, and map_parser::ensure_relative_to_xml will be called to modify path // Default is true, and map_parser::ensure_relative_to_xml will be called to modify path
optional<boolean> paths_from_xml = get_opt_attr<boolean>(map_node, "paths_from_xml"); optional<boolean> paths_from_xml = get_opt_attr<boolean>(map_node, "paths_from_xml");

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" background-color="#eee"> <Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" font_directory="../fonts/" background-color="#eee">
<!-- nik2img.py -b 60 46 80 28 text_styles.xml text_styles.png --> <!-- nik2img.py -b 60 46 80 28 text_styles.xml text_styles.png -->
<Style name="custom_font"> <Style name="custom_font">