diff --git a/include/mapnik/text/glyph_info.hpp b/include/mapnik/text/glyph_info.hpp index 0ca1990bf..0b78137f3 100644 --- a/include/mapnik/text/glyph_info.hpp +++ b/include/mapnik/text/glyph_info.hpp @@ -41,7 +41,6 @@ struct glyph_info glyph_index_t glyph_index; face_ptr face; unsigned char_index; //Position in the string of all characters i.e. before itemizing - char_properties *format; double width; double ymin; diff --git a/include/mapnik/text/itemizer.hpp b/include/mapnik/text/itemizer.hpp index e84b0cfdb..1f2373e54 100644 --- a/include/mapnik/text/itemizer.hpp +++ b/include/mapnik/text/itemizer.hpp @@ -39,12 +39,13 @@ namespace mapnik struct text_item { - UnicodeString str; + unsigned start; //First char + unsigned end; //First char after this item UScriptCode script; - char_properties format; + char_properties_ptr format; UBiDiDirection rtl; - text_item(UnicodeString const& str) : - str(str), script(), format(), rtl(UBIDI_LTR) + text_item() : + start(0), end(0), script(), format(), rtl(UBIDI_LTR) { } @@ -59,7 +60,7 @@ class text_itemizer { public: text_itemizer(); - void add_text(UnicodeString str, char_properties const& format); + void add_text(UnicodeString str, char_properties_ptr format); std::list const& itemize(); void clear(); UnicodeString const& get_text() { return text; } @@ -70,7 +71,7 @@ private: unsigned limit; T data; }; - typedef run format_run_t; + typedef run format_run_t; typedef run direction_run_t; typedef run script_run_t; UnicodeString text; diff --git a/include/mapnik/text_properties.hpp b/include/mapnik/text_properties.hpp index 78527d6ca..343a8f00c 100644 --- a/include/mapnik/text_properties.hpp +++ b/include/mapnik/text_properties.hpp @@ -34,6 +34,7 @@ // boost #include +#include namespace mapnik { @@ -70,6 +71,7 @@ struct char_properties color halo_fill; double halo_radius; }; +typedef boost::shared_ptr char_properties_ptr; enum label_placement_enum diff --git a/src/text/itemizer.cpp b/src/text/itemizer.cpp index 9c82b1860..0ed200fda 100644 --- a/src/text/itemizer.cpp +++ b/src/text/itemizer.cpp @@ -35,7 +35,7 @@ text_itemizer::text_itemizer() : text(), format_runs(), direction_runs(), script } -void text_itemizer::add_text(UnicodeString str, char_properties const& format) +void text_itemizer::add_text(UnicodeString str, char_properties_ptr format) { text += str; format_runs.push_back(format_run_t(format, text.length())); @@ -112,7 +112,9 @@ void text_itemizer::create_item_list() while (position < text.length()) { unsigned next_position = std::min(script_itr->limit, std::min(dir_itr->limit, format_itr->limit)); - text_item item(text.tempSubStringBetween(position, next_position)); + text_item item; + item.start = position; + item.end = next_position; item.format = format_itr->data; item.script = script_itr->data; item.rtl = dir_itr->data;