Rename symbols to match coding standards.

This commit is contained in:
Hermann Kraus 2012-07-28 20:32:11 +02:00
parent 981c11c563
commit 212760b507
2 changed files with 13 additions and 13 deletions

View file

@ -85,7 +85,7 @@ public:
text_layout(face_manager_freetype & font_manager); text_layout(face_manager_freetype & font_manager);
inline void add_text(UnicodeString const& str, char_properties_ptr format) inline void add_text(UnicodeString const& str, char_properties_ptr format)
{ {
itemizer.add_text(str, format); itemizer_.add_text(str, format);
} }
void layout(double wrap_width, unsigned text_ratio); void layout(double wrap_width, unsigned text_ratio);
@ -107,9 +107,9 @@ private:
face_manager_freetype &font_manager_; face_manager_freetype &font_manager_;
//processing //processing
text_itemizer itemizer; text_itemizer itemizer_;
/// Maps char index (UTF-16) to width. If multiple glyphs map to the same char the sum of all widths is used /// Maps char index (UTF-16) to width. If multiple glyphs map to the same char the sum of all widths is used
std::map<unsigned, double> width_map; std::map<unsigned, double> width_map_;
double width_; double width_;
double height_; double height_;

View file

@ -38,14 +38,14 @@
namespace mapnik namespace mapnik
{ {
text_layout::text_layout(face_manager_freetype &font_manager) text_layout::text_layout(face_manager_freetype &font_manager)
: font_manager_(font_manager), itemizer(), width_(0), height_(0), lines_() : font_manager_(font_manager), itemizer_(), width_(0), height_(0), lines_()
{ {
} }
void text_layout::layout(double wrap_width, unsigned text_ratio) void text_layout::layout(double wrap_width, unsigned text_ratio)
{ {
text_line_ptr line = boost::make_shared<text_line>(0, itemizer.get_text().length()); text_line_ptr line = boost::make_shared<text_line>(0, itemizer_.get_text().length());
shape_text(line, 0, itemizer.get_text().length()); //Process full text shape_text(line, 0, itemizer_.get_text().length()); //Process full text
break_line(line, wrap_width, text_ratio); //Break line if neccessary break_line(line, wrap_width, text_ratio); //Break line if neccessary
if (lines_.size()) if (lines_.size())
{ {
@ -71,7 +71,7 @@ void text_layout::break_line(text_line_ptr line, double wrap_width, unsigned tex
for (double i = 1.0; ((wrap_at = string_width/i)/(string_height*i)) > text_ratio && (string_width/i) > wrap_width; i += 1.0) ; for (double i = 1.0; ((wrap_at = string_width/i)/(string_height*i)) > text_ratio && (string_width/i) > wrap_width; i += 1.0) ;
} }
UnicodeString const& text = itemizer.get_text(); UnicodeString const& text = itemizer_.get_text();
Locale locale; //TODO: Is the default constructor correct? Locale locale; //TODO: Is the default constructor correct?
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
BreakIterator *breakitr = BreakIterator::createLineInstance(locale, status); BreakIterator *breakitr = BreakIterator::createLineInstance(locale, status);
@ -83,8 +83,8 @@ void text_layout::break_line(text_line_ptr line, double wrap_width, unsigned tex
for (unsigned i=0; i<text.length(); i++) for (unsigned i=0; i<text.length(); i++)
{ {
//TODO: Char spacing //TODO: Char spacing
std::map<unsigned, double>::const_iterator width_itr = width_map.find(i); std::map<unsigned, double>::const_iterator width_itr = width_map_.find(i);
if (width_itr != width_map.end()) if (width_itr != width_map_.end())
{ {
current_line_length += width_itr->second; current_line_length += width_itr->second;
} }
@ -112,13 +112,13 @@ void text_layout::break_line(text_line_ptr line, double wrap_width, unsigned tex
void text_layout::shape_text(text_line_ptr line, unsigned start, unsigned end) void text_layout::shape_text(text_line_ptr line, unsigned start, unsigned end)
{ {
UnicodeString const& text = itemizer.get_text(); UnicodeString const& text = itemizer_.get_text();
size_t length = end - start; size_t length = end - start;
line->reserve(length); //Preallocate memory line->reserve(length); //Preallocate memory
std::list<text_item> const& list = itemizer.itemize(start, end); std::list<text_item> const& list = itemizer_.itemize(start, end);
std::list<text_item>::const_iterator itr = list.begin(), list_end = list.end(); std::list<text_item>::const_iterator itr = list.begin(), list_end = list.end();
for (; itr != list_end; itr++) for (; itr != list_end; itr++)
{ {
@ -148,7 +148,7 @@ void text_layout::shape_text(text_line_ptr line, unsigned start, unsigned end)
tmp.format = itr->format; tmp.format = itr->format;
face->glyph_dimensions(tmp); face->glyph_dimensions(tmp);
width_map[glyphs[i].cluster] += tmp.width; width_map_[glyphs[i].cluster] += tmp.width;
line->add_glyph(tmp); line->add_glyph(tmp);
// std::cout << "glyph:" << glyphs[i].mask << " xa:" << positions[i].x_advance << " ya:" << positions[i].y_advance << " xo:" << positions[i].x_offset << " yo:" << positions[i].y_offset << "\n"; // std::cout << "glyph:" << glyphs[i].mask << " xa:" << positions[i].x_advance << " ya:" << positions[i].y_advance << " xo:" << positions[i].x_offset << " yo:" << positions[i].y_offset << "\n";
@ -158,7 +158,7 @@ void text_layout::shape_text(text_line_ptr line, unsigned start, unsigned end)
void text_layout::clear() void text_layout::clear()
{ {
itemizer.clear(); itemizer_.clear();
lines_.clear(); lines_.clear();
} }