diff options
author | Michael Lutz <michi@icosahedron.de> | 2018-05-26 22:51:02 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2018-06-06 21:37:09 +0200 |
commit | eec3f40931d7a7dc5a82691ee126f3f0ea0ae6a9 (patch) | |
tree | 4fafedae2025ad816c98326156694bff7e6308fd /src/os/windows/string_uniscribe.h | |
parent | 33829dc6abb61dc1a5c0d4807aad433cfcb45642 (diff) | |
download | openttd-eec3f40931d7a7dc5a82691ee126f3f0ea0ae6a9.tar.xz |
Change: [Win32] Use Uniscribe instead of ICU for text caret handling.
This removes the need for the ICU lib on Windows.
Diffstat (limited to 'src/os/windows/string_uniscribe.h')
-rw-r--r-- | src/os/windows/string_uniscribe.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/os/windows/string_uniscribe.h b/src/os/windows/string_uniscribe.h index a43a2a96e..6af858a88 100644 --- a/src/os/windows/string_uniscribe.h +++ b/src/os/windows/string_uniscribe.h @@ -15,6 +15,8 @@ #if defined(WITH_UNISCRIBE) #include "../../gfx_layout.h" +#include "../../string_base.h" +#include <vector> void UniscribeResetScriptCache(FontSize size); @@ -65,6 +67,26 @@ public: } }; +/** String iterator using Uniscribe as a backend. */ +class UniscribeStringIterator : public StringIterator { + /** */ + struct CharInfo { + bool word_stop : 1; ///< Code point is suitable as a word break. + bool char_stop : 1; ///< Code point is the start of a grapheme cluster, i.e. a "character". + }; + + std::vector<CharInfo> str_info; ///< Break information for each code point. + std::vector<size_t> utf16_to_utf8; ///< Mapping from UTF-16 code point position to index in the UTF-8 source string. + + size_t cur_pos; ///< Current iteration position. + +public: + virtual void SetString(const char *s); + virtual size_t SetCurPosition(size_t pos); + virtual size_t Next(IterType what); + virtual size_t Prev(IterType what); +}; + #endif /* defined(WITH_UNISCRIBE) */ #endif /* STRING_UNISCRIBE_H */ |