MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / ImTextStrToUtf8

Function ImTextStrToUtf8

Chapter_16/shared_sources/imgui/imgui.cpp:1575–1589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1573}
1574
1575int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end)
1576{
1577 char* buf_out = buf;
1578 const char* buf_end = buf + buf_size;
1579 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1580 {
1581 unsigned int c = (unsigned int)(*in_text++);
1582 if (c < 0x80)
1583 *buf_out++ = (char)c;
1584 else
1585 buf_out += ImTextCharToUtf8(buf_out, (int)(buf_end-buf_out-1), c);
1586 }
1587 *buf_out = 0;
1588 return (int)(buf_out - buf);
1589}
1590
1591int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end)
1592{

Callers 2

InputTextExMethod · 0.85

Calls 1

ImTextCharToUtf8Function · 0.85

Tested by

no test coverage detected