diff --git a/include/mapnik/symbolizer_enumerations.hpp b/include/mapnik/symbolizer_enumerations.hpp index 74c940931..4b2770ffa 100644 --- a/include/mapnik/symbolizer_enumerations.hpp +++ b/include/mapnik/symbolizer_enumerations.hpp @@ -125,6 +125,7 @@ enum text_transform_enum : std::uint8_t UPPERCASE, LOWERCASE, CAPITALIZE, + REVERSE, text_transform_enum_MAX }; diff --git a/src/symbolizer_enumerations.cpp b/src/symbolizer_enumerations.cpp index 6f290f1f0..bd79562b4 100644 --- a/src/symbolizer_enumerations.cpp +++ b/src/symbolizer_enumerations.cpp @@ -160,6 +160,7 @@ static const char * text_transform_strings[] = { "uppercase", "lowercase", "capitalize", + "reverse", "" }; diff --git a/src/text/formatting/text.cpp b/src/text/formatting/text.cpp index 17b5ae2f6..8247bd26a 100644 --- a/src/text/formatting/text.cpp +++ b/src/text/formatting/text.cpp @@ -28,6 +28,7 @@ #include #include #include +#include // boost #include @@ -53,21 +54,28 @@ node_ptr text_node::from_xml(xml_node const& xml, fontset_map const& fontsets) void text_node::apply(evaluated_format_properties_ptr const& p, feature_impl const& feature, attributes const& vars, text_layout &output) const { mapnik::value_unicode_string text_str = util::apply_visitor(evaluate(feature,vars), *text_).to_unicode(); - if (p->text_transform == UPPERCASE) + switch (p->text_transform) { - text_str = text_str.toUpper(); - } - else if (p->text_transform == LOWERCASE) - { - text_str = text_str.toLower(); - } + case UPPERCASE: + text_str.toUpper(); + break; + case LOWERCASE: + text_str.toLower(); + break; + case REVERSE: + text_str.reverse(); + break; + case CAPITALIZE: #if !UCONFIG_NO_BREAK_ITERATION - else if (p->text_transform == CAPITALIZE) - { // note: requires BreakIterator support in ICU which is optional - text_str = text_str.toTitle(nullptr); - } + text_str.toTitle(nullptr); +#else + MAPNIK_LOG_DEBUG(text_node) << "text capitalize (toTitle) disabled because ICU was built without UCONFIG_NO_BREAK_ITERATION"; #endif + break; + default: + break; + } if (text_str.length() > 0) { output.add_text(text_str, p); } diff --git a/tests/visual_tests/grids/orientation-800-200-1.0-grid-reference.json b/tests/visual_tests/grids/orientation-800-200-1.0-grid-reference.json index a614346b0..1ab4cbdad 100644 --- a/tests/visual_tests/grids/orientation-800-200-1.0-grid-reference.json +++ b/tests/visual_tests/grids/orientation-800-200-1.0-grid-reference.json @@ -2,8 +2,8 @@ "keys": [ "", "9", - "2", "1", + "2", "8", "3", "4", @@ -35,23 +35,23 @@ " !! ", " ! ! ", " ! ", - " # !! ", - " $ ### %% %%% ! ", - " $ # % % % !! ", - " $ $$ # & & && %% % % !!! ", - " $$$ $ ## & & & ' ( )) * % ! ++ + + ", - " $ $ &&& &&& ( )) + + ++ ", - " $$$ ### '' ( ) + + ++ ", - " $ ### ' ' ( ( ) * * ** ", - " '' ' ' ( ( )) * * * ", - " '' ' ''' ( *** *** ", - " ' '' ''' (( )) ", - " ' ' '' ( ) ) ", - " ' ' ", - " '' ", + " !! ", + " # $$ %% %%% ! ", + " # $ & % % % !! ", + " # ## $ &&& & %% % % !!! ", + " ### # $$$ & && & ' ( )) * % ! ++ + + ", + " # # & & ''' ( )) + + ++ ", + " ### $ '' ( ) + + ++ ", + " # $ ' ' ( ( ) * * ** ", + " '' ( ( )) * * * ", + " ' ' ( *** *** ", + " '' '' ' (( )) ", + " ' ' '' ( ) ) ", + " '''' '' ", + " ' ' ", + " ''' ", " '' ", - " '' ", - " '' ", + " ", " ", " ", " ", diff --git a/tests/visual_tests/grids/orientation-800-200-2.0-grid-reference.json b/tests/visual_tests/grids/orientation-800-200-2.0-grid-reference.json index 7479bb64b..61fe64b06 100644 --- a/tests/visual_tests/grids/orientation-800-200-2.0-grid-reference.json +++ b/tests/visual_tests/grids/orientation-800-200-2.0-grid-reference.json @@ -1,6 +1,7 @@ { "keys": [ "", + "9", "1", "2", "8", @@ -9,7 +10,6 @@ "5", "6", "7", - "9", "10" ], "data": {}, @@ -24,45 +24,45 @@ " ", " ", " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ! ## # ", - " !! # # # $ $$$ $$$$$$ ", - " ! ! # # # $$ $ $$ $ $$ ", - " ! ! # ## $$ $$$ $ ", - " ! ! !! # # %%%%% % % % $$ $ $ ", - " ! !!! ## % % % %% $$$ $ $ ", - " ! ! !! ## %% % % % $ $ $ $ ", - " !!! ! #### %% % % & ' ( ) $ * +++++ + + ++ ", - " ! ! ## % % % % % ' (( ( + + + ++ ", - " ! ! # % %% % % % '' ( ( ( ++ + +++ ", - " !!!! # # ' ' ( ((( ++ + + ", - " !!!!! ## ## ' ' ' ( (( + + + + + ", - " ! ## ' ' ' ( ))))) ) ) ) +++++++ ++ + ++ ", - " ! ## # ' '' (( ) ) ) ) ", - " ! # # '' ' ' (( )) ) ))) ", - " ' '' (((( )) ) ) ", - " ' ' ( ) ) ) ) ) ", - " ' ( )))))) )))) )) ", - " ''''' ( ( ", - " ' '' (( ( ", - " ' (( ", - " ' ( (( ", - " ( ( ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", + " !! ", + " ! ! ", + " ! !! ", + " ! !! ", + " ! ! ", + " !! ", + " !! ", + " !!! ", + " # !! ", + " ## $$ % %%% %%%%!% ", + " # # $$$ %% % %% % !% ", + " # # $ $$ & %% %%% %!! !! ", + " # # ## &&&& & & & %% % % !! ", + " # ### $$ & && & & %%% % % !! ! ", + " # # ## $$ & & & && % % % % ! ! ", + " ### # $$$$$ & & && & ' ( ) * % ! +++++ + + ++ ", + " # # $$ $ &&&& & & &&& ( )) ) + + + ++ ", + " # # & & ' ''' (( ) ) ) ++ + +++ ", + " #### $ $ ''' ' ( ( ) ))) ++ + + ", + " ##### $$ ''' ' ( ( ( ) )) + + + + + ", + " # $$$$ ' '' ' ( ( ( ) ***** * * * +++++++ ++ + ++ ", + " # $ $ ' '' ( (( )) * * * * ", + " # ' (( ( ( )) ** * *** ", + " '''' ' ( (( )))) ** * * ", + " ' ' ( ( ) * * * * * ", + " '' ' ( ) ****** **** ** ", + " '' '' ' '' ((((( ) ) ", + " '' ' ' '' ' ( (( )) ) ", + " ' ' ' '' ' ( )) ", + " ' ' ' '' ( ) )) ", + " ' '' '' ' ) ) ", + " '' ' ' ' ", + " '''' ' ' ", + " ' ' ", + " '''' ' ", + " ' ' ", + " '' ' ", + " '' ' ", + " ' ", " " ] } \ No newline at end of file diff --git a/tests/visual_tests/images/orientation-800-200-1.0-agg-reference.png b/tests/visual_tests/images/orientation-800-200-1.0-agg-reference.png index 0bd22d32a..5eaa3c15f 100644 Binary files a/tests/visual_tests/images/orientation-800-200-1.0-agg-reference.png and b/tests/visual_tests/images/orientation-800-200-1.0-agg-reference.png differ diff --git a/tests/visual_tests/images/orientation-800-200-1.0-cairo-reference.png b/tests/visual_tests/images/orientation-800-200-1.0-cairo-reference.png index a52275693..b6723dd5b 100644 Binary files a/tests/visual_tests/images/orientation-800-200-1.0-cairo-reference.png and b/tests/visual_tests/images/orientation-800-200-1.0-cairo-reference.png differ diff --git a/tests/visual_tests/images/orientation-800-200-2.0-agg-reference.png b/tests/visual_tests/images/orientation-800-200-2.0-agg-reference.png index 285d8c73d..1a9555e90 100644 Binary files a/tests/visual_tests/images/orientation-800-200-2.0-agg-reference.png and b/tests/visual_tests/images/orientation-800-200-2.0-agg-reference.png differ diff --git a/tests/visual_tests/images/orientation-800-200-2.0-cairo-reference.png b/tests/visual_tests/images/orientation-800-200-2.0-cairo-reference.png index 96b88ca2a..817f99dea 100644 Binary files a/tests/visual_tests/images/orientation-800-200-2.0-cairo-reference.png and b/tests/visual_tests/images/orientation-800-200-2.0-cairo-reference.png differ diff --git a/tests/visual_tests/styles/orientation.xml b/tests/visual_tests/styles/orientation.xml index 387b5c8c2..aaf34575c 100644 --- a/tests/visual_tests/styles/orientation.xml +++ b/tests/visual_tests/styles/orientation.xml @@ -17,52 +17,52 @@