| 967 | } |
| 968 | |
| 969 | int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining) |
| 970 | { |
| 971 | ImWchar* buf_out = buf; |
| 972 | ImWchar* buf_end = buf + buf_size; |
| 973 | while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) |
| 974 | { |
| 975 | unsigned int c; |
| 976 | in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); |
| 977 | if (c == 0) |
| 978 | break; |
| 979 | if (c < 0x10000) // FIXME: Losing characters that don't fit in 2 bytes |
| 980 | *buf_out++ = (ImWchar)c; |
| 981 | } |
| 982 | *buf_out = 0; |
| 983 | if (in_text_remaining) |
| 984 | *in_text_remaining = in_text; |
| 985 | return (int)(buf_out - buf); |
| 986 | } |
| 987 | |
| 988 | int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end) |
| 989 | { |
no test coverage detected