pass parameter by reference
store reference to wstring in text_path
This commit is contained in:
parent
01f4984804
commit
1ea7bffd4c
3 changed files with 23 additions and 23 deletions
|
@ -307,26 +307,26 @@ namespace mapnik
|
|||
return dimension_t(slot->advance.x >> 6, glyph_bbox.yMax - glyph_bbox.yMin);
|
||||
}
|
||||
|
||||
void get_string_info(string_info *info)
|
||||
{
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
std::wstring text = info->get_string();
|
||||
|
||||
for (std::wstring::const_iterator i=text.begin();i!=text.end();++i)
|
||||
{
|
||||
void get_string_info(string_info & info)
|
||||
{
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
std::wstring const& text = info.get_string();
|
||||
|
||||
for (std::wstring::const_iterator i=text.begin();i!=text.end();++i)
|
||||
{
|
||||
dimension_t char_dim = character_dimensions(*i);
|
||||
|
||||
info->add_info(*i, char_dim.first, char_dim.second);
|
||||
|
||||
|
||||
info.add_info(*i, char_dim.first, char_dim.second);
|
||||
|
||||
width += char_dim.first;
|
||||
height = char_dim.second > height ? char_dim.second : height;
|
||||
|
||||
}
|
||||
info->set_dimensions(width, height);
|
||||
}
|
||||
|
||||
}
|
||||
info.set_dimensions(width, height);
|
||||
}
|
||||
|
||||
void render(double x0, double y0)
|
||||
{
|
||||
FT_Error error;
|
||||
|
|
|
@ -50,14 +50,13 @@ namespace mapnik
|
|||
{
|
||||
protected:
|
||||
typedef boost::ptr_vector<character_info> characters_t;
|
||||
std::wstring string_;
|
||||
characters_t characters_;
|
||||
|
||||
std::wstring const& text_;
|
||||
double width_;
|
||||
double height_;
|
||||
public:
|
||||
string_info(std::wstring string)
|
||||
: string_(string),
|
||||
string_info(std::wstring const& text)
|
||||
: text_(text),
|
||||
width_(0),
|
||||
height_(0) {}
|
||||
|
||||
|
@ -94,7 +93,7 @@ namespace mapnik
|
|||
|
||||
std::wstring const& get_string() const
|
||||
{
|
||||
return string_;
|
||||
return text_;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -466,8 +466,9 @@ namespace mapnik
|
|||
text_renderer<mapnik::Image32> ren(pixmap_,face);
|
||||
ren.set_pixel_size(sym.get_text_size());
|
||||
ren.set_fill(sym.get_fill());
|
||||
|
||||
string_info info(text);
|
||||
ren.get_string_info(&info);
|
||||
ren.get_string_info(info);
|
||||
|
||||
placement_finder<label_collision_detector4> finder(detector_);
|
||||
|
||||
|
@ -681,7 +682,7 @@ namespace mapnik
|
|||
placement_finder<label_collision_detector4> finder(detector_);
|
||||
|
||||
string_info info(text);
|
||||
ren.get_string_info(&info);
|
||||
ren.get_string_info(info);
|
||||
unsigned num_geom = feature.num_geometries();
|
||||
for (unsigned i=0;i<num_geom;++i)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue