| 1209 | } |
| 1210 | |
| 1211 | int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end) |
| 1212 | { |
| 1213 | char* buf_out = buf; |
| 1214 | const char* buf_end = buf + buf_size; |
| 1215 | while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) |
| 1216 | { |
| 1217 | unsigned int c = (unsigned int)(*in_text++); |
| 1218 | if (c < 0x80) |
| 1219 | *buf_out++ = (char)c; |
| 1220 | else |
| 1221 | buf_out += ImTextCharToUtf8(buf_out, (int)(buf_end-buf_out-1), c); |
| 1222 | } |
| 1223 | *buf_out = 0; |
| 1224 | return (int)(buf_out - buf); |
| 1225 | } |
| 1226 | |
| 1227 | int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end) |
| 1228 | { |
no test coverage detected