diff --git a/include/mapnik/text/text_properties.hpp b/include/mapnik/text/text_properties.hpp index 7b8093875..eb8a65925 100644 --- a/include/mapnik/text/text_properties.hpp +++ b/include/mapnik/text/text_properties.hpp @@ -76,13 +76,12 @@ struct MAPNIK_DECL format_properties symbolizer_base::value_type halo_opacity; symbolizer_base::value_type wrap_char; symbolizer_base::value_type halo_radius; + symbolizer_base::value_type fill; + symbolizer_base::value_type halo_fill; // std::string face_name; boost::optional fontset; text_transform_e text_transform; //Per expression - color fill; - color halo_fill; - }; @@ -101,7 +100,7 @@ struct MAPNIK_DECL text_layout_properties // This function is used to collect attributes. void add_expressions(expression_set & output) const; - //Per layout options + // per layout expressions symbolizer_base::value_type dx; symbolizer_base::value_type dy; symbolizer_base::value_type orientation; diff --git a/src/load_map.cpp b/src/load_map.cpp index c54e67940..24a8c1ca7 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -1226,8 +1226,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& node) placements->defaults.from_xml(node, fontsets_); } - if (strict_ && - !placements->defaults.format_defaults.fontset) + if (strict_ && !placements->defaults.format_defaults.fontset) { ensure_font_face(placements->defaults.format_defaults.face_name); } diff --git a/src/text/text_properties.cpp b/src/text/text_properties.cpp index 348d83496..0f4cef48a 100644 --- a/src/text/text_properties.cpp +++ b/src/text/text_properties.cpp @@ -72,16 +72,15 @@ void text_symbolizer_properties::process(text_layout & output, feature_impl cons format->halo_radius = boost::apply_visitor(extract_value(feature,attrs), format_defaults.halo_radius); std::string const& wrap_char = boost::apply_visitor(extract_value(feature,attrs), format_defaults.wrap_char); - if (!wrap_char.empty()) - { - format->wrap_char = wrap_char[0]; - } + if (!wrap_char.empty()) format->wrap_char = wrap_char[0]; + + format->fill = boost::apply_visitor(extract_value(feature,attrs), format_defaults.fill); + format->halo_fill = boost::apply_visitor(extract_value(feature,attrs), format_defaults.halo_fill); format->face_name = format_defaults.face_name; format->fontset = format_defaults.fontset; format->text_transform = format_defaults.text_transform; - format->fill = format_defaults.fill; - format->halo_fill = format_defaults.halo_fill; + tree_->apply(format, feature, attrs, output); } @@ -293,20 +292,15 @@ void format_properties::from_xml(xml_node const& node, fontset_map const& fontse set_property_from_xml(text_opacity, "opacity", node); set_property_from_xml(halo_opacity, "halo-opacity", node); set_property_from_xml(wrap_char, "wrap-character", node); - - optional fill_ = node.get_opt_attr("fill"); - if (fill_) fill = *fill_; - optional halo_fill_ = node.get_opt_attr("halo-fill"); - if (halo_fill_) halo_fill = *halo_fill_; + set_property_from_xml(fill, "fill", node); + set_property_from_xml(halo_fill, "halo-fill", node); optional tconvert_ = node.get_opt_attr("text-transform"); if (tconvert_) text_transform = *tconvert_; optional face_name_ = node.get_opt_attr("face-name"); - if (face_name_) - { - face_name = *face_name_; - } + if (face_name_) face_name = *face_name_; + optional fontset_name_ = node.get_opt_attr("fontset-name"); if (fontset_name_) { @@ -352,16 +346,8 @@ void format_properties::to_xml(boost::property_tree::ptree & node, bool explicit if (!(text_opacity == dfl.text_opacity) || explicit_defaults) serialize_property("opacity", text_opacity, node); if (!(halo_opacity == dfl.halo_opacity) || explicit_defaults) serialize_property("halo-opacity", halo_opacity, node); // - - if (fill != dfl.fill || explicit_defaults) - { - set_attr(node, "fill", fill); - } - - if (halo_fill != dfl.halo_fill || explicit_defaults) - { - set_attr(node, "halo-fill", halo_fill); - } + if (!(fill == dfl.fill) || explicit_defaults) serialize_property("fill", fill, node); + if (!(halo_fill == dfl.halo_fill) || explicit_defaults) serialize_property("halo-fill", halo_fill, node); if (text_transform != dfl.text_transform || explicit_defaults) {