| 2228 | } |
| 2229 | |
| 2230 | int ImTextStrToUtf8(char* out_buf, int out_buf_size, const ImWchar* in_text, const ImWchar* in_text_end) |
| 2231 | { |
| 2232 | char* buf_p = out_buf; |
| 2233 | const char* buf_end = out_buf + out_buf_size; |
| 2234 | while (buf_p < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text) |
| 2235 | { |
| 2236 | unsigned int c = (unsigned int)(*in_text++); |
| 2237 | if (c < 0x80) |
| 2238 | *buf_p++ = (char)c; |
| 2239 | else |
| 2240 | buf_p += ImTextCharToUtf8_inline(buf_p, (int)(buf_end - buf_p - 1), c); |
| 2241 | } |
| 2242 | *buf_p = 0; |
| 2243 | return (int)(buf_p - out_buf); |
| 2244 | } |
| 2245 | |
| 2246 | int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end) |
| 2247 | { |
no test coverage detected