Beispiel #1
0
size_t
get_real_string_width(const char str[], size_t max_screen_width)
{
	size_t width = 0;
	while(*str != '\0' && max_screen_width != 0)
	{
		size_t char_width = get_char_width(str);
		size_t char_screen_width = get_char_screen_width(str, char_width);
		if(char_screen_width > max_screen_width)
		{
			break;
		}
		max_screen_width -= char_screen_width;
		width += char_width;
		str += char_width;
	}
	return width;
}
Beispiel #2
0
size_t
utf8_get_screen_width_of_char(const char str[])
{
	return get_char_screen_width(str, get_char_width(str));
}