Change: [Win32] Use Uniscribe instead of ICU for text caret handling.

This removes the need for the ICU lib on Windows.
This commit is contained in:
Michael Lutz
2018-05-26 22:51:02 +02:00
parent 33829dc6ab
commit eec3f40931
13 changed files with 216 additions and 81 deletions

View File

@@ -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 */