Internals: Added ImTextCountUtf8BytesFromChar() helper.

This commit is contained in:
omar
2018-07-16 23:31:27 +02:00
parent ac39c4b2a8
commit bb2de30e3e
2 changed files with 10 additions and 2 deletions

View File

@ -1479,6 +1479,13 @@ static inline int ImTextCharToUtf8(char* buf, int buf_size, unsigned int c)
}
}
// Not optimal but we very rarely use this function.
int ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end)
{
unsigned int dummy = 0;
return ImTextCharFromUtf8(&dummy, in_text, in_text_end);
}
static inline int ImTextCountUtf8BytesFromChar(unsigned int c)
{
if (c < 0x80) return 1;