Rename symbols to match coding standards.
This commit is contained in:
parent
b3c5969c3e
commit
66cbf45cd7
2 changed files with 31 additions and 31 deletions
|
@ -63,7 +63,7 @@ public:
|
|||
void add_text(UnicodeString str, char_properties_ptr format);
|
||||
std::list<text_item> const& itemize(unsigned start=0, unsigned end=0);
|
||||
void clear();
|
||||
UnicodeString const& get_text() { return text; }
|
||||
UnicodeString const& get_text() { return text_; }
|
||||
private:
|
||||
template<typename T> struct run
|
||||
{
|
||||
|
@ -78,18 +78,18 @@ private:
|
|||
typedef std::list<format_run_t> format_run_list;
|
||||
typedef std::list<script_run_t> script_run_list;
|
||||
typedef std::list<direction_run_t> direction_run_list;
|
||||
UnicodeString text;
|
||||
UnicodeString text_;
|
||||
/// Format runs are always sorted by char index
|
||||
format_run_list format_runs;
|
||||
format_run_list format_runs_;
|
||||
/// Directions runs are always in visual order! This is different from
|
||||
/// format and script runs!
|
||||
direction_run_list direction_runs;
|
||||
direction_run_list direction_runs_;
|
||||
/// Script runs are always sorted by char index
|
||||
script_run_list script_runs;
|
||||
script_run_list script_runs_;
|
||||
void itemize_direction(unsigned start, unsigned end);
|
||||
void itemize_script();
|
||||
void create_item_list();
|
||||
std::list<text_item> output;
|
||||
std::list<text_item> output_;
|
||||
template <typename T> typename T::const_iterator find_run(T const& list, unsigned position);
|
||||
};
|
||||
} //ns mapnik
|
||||
|
|
|
@ -31,40 +31,40 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
text_itemizer::text_itemizer() : text(), format_runs(), direction_runs(), script_runs()
|
||||
text_itemizer::text_itemizer() : text_(), format_runs_(), direction_runs_(), script_runs_()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void text_itemizer::add_text(UnicodeString str, char_properties_ptr format)
|
||||
{
|
||||
unsigned start = text.length();
|
||||
text += str;
|
||||
format_runs.push_back(format_run_t(format, start, text.length()));
|
||||
unsigned start = text_.length();
|
||||
text_ += str;
|
||||
format_runs_.push_back(format_run_t(format, start, text_.length()));
|
||||
}
|
||||
|
||||
std::list<text_item> const& text_itemizer::itemize(unsigned start, unsigned end)
|
||||
{
|
||||
if (end == 0) {
|
||||
end = text.length();
|
||||
end = text_.length();
|
||||
}
|
||||
// format itemiziation is done by add_text()
|
||||
itemize_direction(start, end);
|
||||
itemize_script();
|
||||
create_item_list();
|
||||
return output;
|
||||
return output_;
|
||||
}
|
||||
|
||||
void text_itemizer::clear()
|
||||
{
|
||||
output.clear();
|
||||
text.remove();
|
||||
format_runs.clear();
|
||||
output_.clear();
|
||||
text_.remove();
|
||||
format_runs_.clear();
|
||||
}
|
||||
|
||||
void text_itemizer::itemize_direction(unsigned start, unsigned end)
|
||||
{
|
||||
direction_runs.clear();
|
||||
direction_runs_.clear();
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
int32_t length = end - start;
|
||||
UBiDi *bidi = ubidi_openSized(length, 0, &error);
|
||||
|
@ -73,13 +73,13 @@ void text_itemizer::itemize_direction(unsigned start, unsigned end)
|
|||
MAPNIK_LOG_ERROR(text_itemizer) << "Failed to create bidi object: " << u_errorName(error) << "\n";
|
||||
return;
|
||||
}
|
||||
ubidi_setPara(bidi, text.getBuffer() + start, length, UBIDI_DEFAULT_LTR, 0, &error);
|
||||
ubidi_setPara(bidi, text_.getBuffer() + start, length, UBIDI_DEFAULT_LTR, 0, &error);
|
||||
if (U_SUCCESS(error))
|
||||
{
|
||||
UBiDiDirection direction = ubidi_getDirection(bidi);
|
||||
if(direction != UBIDI_MIXED)
|
||||
{
|
||||
direction_runs.push_back(direction_run_t(direction, start, end));
|
||||
direction_runs_.push_back(direction_run_t(direction, start, end));
|
||||
} else
|
||||
{
|
||||
// mixed-directional
|
||||
|
@ -94,7 +94,7 @@ void text_itemizer::itemize_direction(unsigned start, unsigned end)
|
|||
run_start += start; //Add offset to compensate offset in setPara
|
||||
std::cout << "visual run, rtl:" << direction
|
||||
<< " start:" << start << " length:" << length << "\n";
|
||||
direction_runs.push_back(direction_run_t(direction, start, start+length));
|
||||
direction_runs_.push_back(direction_run_t(direction, start, start+length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,12 +106,12 @@ void text_itemizer::itemize_direction(unsigned start, unsigned end)
|
|||
|
||||
void text_itemizer::itemize_script()
|
||||
{
|
||||
if (!script_runs.empty()) return; //Already done
|
||||
if (!script_runs_.empty()) return; //Already done
|
||||
|
||||
ScriptRun runs(text.getBuffer(), text.length());
|
||||
ScriptRun runs(text_.getBuffer(), text_.length());
|
||||
while (runs.next())
|
||||
{
|
||||
script_runs.push_back(script_run_t(runs.getScriptCode(), runs.getScriptStart(), runs.getScriptEnd()));
|
||||
script_runs_.push_back(script_run_t(runs.getScriptCode(), runs.getScriptStart(), runs.getScriptEnd()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,20 +137,20 @@ void text_itemizer::create_item_list()
|
|||
* RTL visual 987654 | 321
|
||||
* Glyphs within a single run are reversed by the shaper.
|
||||
*/
|
||||
output.clear();
|
||||
direction_run_list::const_iterator dir_itr = direction_runs.begin(), dir_end = direction_runs.end();
|
||||
output_.clear();
|
||||
direction_run_list::const_iterator dir_itr = direction_runs_.begin(), dir_end = direction_runs_.end();
|
||||
for (; dir_itr != dir_end; dir_itr++)
|
||||
{
|
||||
unsigned position = dir_itr->start;
|
||||
unsigned end = dir_itr->end;
|
||||
std::list<text_item>::iterator rtl_insertion_point = output.end();
|
||||
std::list<text_item>::iterator rtl_insertion_point = output_.end();
|
||||
// Find first script and format run
|
||||
format_run_list::const_iterator format_itr = find_run(format_runs, position);
|
||||
script_run_list::const_iterator script_itr = find_run(script_runs, position);
|
||||
format_run_list::const_iterator format_itr = find_run(format_runs_, position);
|
||||
script_run_list::const_iterator script_itr = find_run(script_runs_, position);
|
||||
while (position < end)
|
||||
{
|
||||
assert(script_itr != script_runs.end());
|
||||
assert(format_itr != format_runs.end());
|
||||
assert(script_itr != script_runs_.end());
|
||||
assert(format_itr != format_runs_.end());
|
||||
text_item item;
|
||||
item.start = position;
|
||||
position = std::min(script_itr->end, std::min(format_itr->end, end));
|
||||
|
@ -160,10 +160,10 @@ void text_itemizer::create_item_list()
|
|||
item.rtl = dir_itr->data;
|
||||
if (dir_itr->data == UBIDI_LTR)
|
||||
{
|
||||
output.push_back(item);
|
||||
output_.push_back(item);
|
||||
} else
|
||||
{
|
||||
rtl_insertion_point = output.insert(rtl_insertion_point, item);
|
||||
rtl_insertion_point = output_.insert(rtl_insertion_point, item);
|
||||
}
|
||||
if (script_itr->end == position) script_itr++;
|
||||
if (format_itr->end == position) format_itr++;
|
||||
|
|
Loading…
Reference in a new issue