add support for Ayatana indicator to Notification plugin
[claws.git] / src / plugins / litehtml_viewer / litehtml / document_container.cpp
blobd3802473e18a2a11cdd76a69b96cdc692e7c5ca3
1 #include "html.h"
2 #include "document_container.h"
4 void litehtml::document_container::split_text(const char* text, const std::function<void(const char*)>& on_word, const std::function<void(const char*)>& on_space)
6 std::wstring str;
7 std::wstring str_in = (const wchar_t*)utf8_to_wchar(text);
8 ucode_t c;
9 for (size_t i = 0; i < str_in.length(); i++)
11 c = (ucode_t)str_in[i];
12 if (c <= ' ' && (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f'))
14 if (!str.empty())
16 on_word(wchar_to_utf8(str.c_str()));
17 str.clear();
19 str += c;
20 on_space(wchar_to_utf8(str.c_str()));
21 str.clear();
23 // CJK character range
24 else if (c >= 0x4E00 && c <= 0x9FCC)
26 if (!str.empty())
28 on_word(wchar_to_utf8(str.c_str()));
29 str.clear();
31 str += c;
32 on_word(wchar_to_utf8(str.c_str()));
33 str.clear();
35 else
37 str += c;
40 if (!str.empty())
42 on_word(wchar_to_utf8(str.c_str()));