Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -710,8 +710,8 @@ class IcuStringIterator : public StringIterator
|
||||
icu::BreakIterator *char_itr; ///< ICU iterator for characters.
|
||||
icu::BreakIterator *word_itr; ///< ICU iterator for words.
|
||||
|
||||
SmallVector<UChar, 32> utf16_str; ///< UTF-16 copy of the string.
|
||||
SmallVector<size_t, 32> utf16_to_utf8; ///< Mapping from UTF-16 code point position to index in the UTF-8 source string.
|
||||
std::vector<UChar> utf16_str; ///< UTF-16 copy of the string.
|
||||
std::vector<size_t> utf16_to_utf8; ///< Mapping from UTF-16 code point position to index in the UTF-8 source string.
|
||||
|
||||
public:
|
||||
IcuStringIterator() : char_itr(NULL), word_itr(NULL)
|
||||
@@ -720,8 +720,8 @@ public:
|
||||
this->char_itr = icu::BreakIterator::createCharacterInstance(icu::Locale(_current_language != NULL ? _current_language->isocode : "en"), status);
|
||||
this->word_itr = icu::BreakIterator::createWordInstance(icu::Locale(_current_language != NULL ? _current_language->isocode : "en"), status);
|
||||
|
||||
*this->utf16_str.Append() = '\0';
|
||||
*this->utf16_to_utf8.Append() = 0;
|
||||
this->utf16_str.push_back('\0');
|
||||
this->utf16_to_utf8.push_back(0);
|
||||
}
|
||||
|
||||
virtual ~IcuStringIterator()
|
||||
@@ -738,29 +738,29 @@ public:
|
||||
* for word break iterators (especially for CJK languages) in combination
|
||||
* with UTF-8 input. As a work around we have to convert the input to
|
||||
* UTF-16 and create a mapping back to UTF-8 character indices. */
|
||||
this->utf16_str.Clear();
|
||||
this->utf16_to_utf8.Clear();
|
||||
this->utf16_str.clear();
|
||||
this->utf16_to_utf8.clear();
|
||||
|
||||
while (*s != '\0') {
|
||||
size_t idx = s - string_base;
|
||||
|
||||
WChar c = Utf8Consume(&s);
|
||||
if (c < 0x10000) {
|
||||
*this->utf16_str.Append() = (UChar)c;
|
||||
this->utf16_str.push_back((UChar)c);
|
||||
} else {
|
||||
/* Make a surrogate pair. */
|
||||
*this->utf16_str.Append() = (UChar)(0xD800 + ((c - 0x10000) >> 10));
|
||||
*this->utf16_str.Append() = (UChar)(0xDC00 + ((c - 0x10000) & 0x3FF));
|
||||
*this->utf16_to_utf8.Append() = idx;
|
||||
this->utf16_str.push_back((UChar)(0xD800 + ((c - 0x10000) >> 10)));
|
||||
this->utf16_str.push_back((UChar)(0xDC00 + ((c - 0x10000) & 0x3FF)));
|
||||
this->utf16_to_utf8.push_back(idx);
|
||||
}
|
||||
*this->utf16_to_utf8.Append() = idx;
|
||||
this->utf16_to_utf8.push_back(idx);
|
||||
}
|
||||
*this->utf16_str.Append() = '\0';
|
||||
*this->utf16_to_utf8.Append() = s - string_base;
|
||||
this->utf16_str.push_back('\0');
|
||||
this->utf16_to_utf8.push_back(s - string_base);
|
||||
|
||||
UText text = UTEXT_INITIALIZER;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
utext_openUChars(&text, this->utf16_str.Begin(), this->utf16_str.Length() - 1, &status);
|
||||
utext_openUChars(&text, this->utf16_str.data(), this->utf16_str.size() - 1, &status);
|
||||
this->char_itr->setText(&text, status);
|
||||
this->word_itr->setText(&text, status);
|
||||
this->char_itr->first();
|
||||
@@ -771,7 +771,7 @@ public:
|
||||
{
|
||||
/* Convert incoming position to an UTF-16 string index. */
|
||||
uint utf16_pos = 0;
|
||||
for (uint i = 0; i < this->utf16_to_utf8.Length(); i++) {
|
||||
for (uint i = 0; i < this->utf16_to_utf8.size(); i++) {
|
||||
if (this->utf16_to_utf8[i] == pos) {
|
||||
utf16_pos = i;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user