MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ImTextStrFromUtf8

Function ImTextStrFromUtf8

lib/imgui/imgui.cpp:1612–1629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1610}
1611
1612int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining)
1613{
1614 ImWchar* buf_out = buf;
1615 ImWchar* buf_end = buf + buf_size;
1616 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1617 {
1618 unsigned int c;
1619 in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
1620 if (c == 0)
1621 break;
1622 if (c <= IM_UNICODE_CODEPOINT_MAX) // FIXME: Losing characters that don't fit in 2 bytes
1623 *buf_out++ = (ImWchar)c;
1624 }
1625 *buf_out = 0;
1626 if (in_text_remaining)
1627 *in_text_remaining = in_text;
1628 return (int)(buf_out - buf);
1629}
1630
1631int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end)
1632{

Callers 3

ImFileOpenFunction · 0.85
InputTextExMethod · 0.85

Calls 1

ImTextCharFromUtf8Function · 0.85

Tested by

no test coverage detected