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
)
7 std::wstring str_in
= (const wchar_t*)utf8_to_wchar(text
);
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'))
16 on_word(wchar_to_utf8(str
.c_str()));
20 on_space(wchar_to_utf8(str
.c_str()));
23 // CJK character range
24 else if (c
>= 0x4E00 && c
<= 0x9FCC)
28 on_word(wchar_to_utf8(str
.c_str()));
32 on_word(wchar_to_utf8(str
.c_str()));
42 on_word(wchar_to_utf8(str
.c_str()));