link-grammar-5.8.0/link-grammar/print/print-util.c
/**
 * Return the width, in text-column-widths, of the utf8-encoded
 * character. The will return a NEGATIVE VALUE if the character
 * width is not know (no glyph for a valid UTF-8 codepoint) or
 * if the input is not a valid UTF-8 character!
 *
 * The mbstate_t argument is not used, since we convert only from utf-8.
 * FIXME: This function (along with other places that use mbrtowc()) need
 * to be fixed for Windows (utf-16 wchar_t).
 * Use char32_t with mbrtoc32() instead of mbrtowc().
 */
Return the width, in text-column-widths, of the utf8-encoded
character. The will return a NEGATIVE VALUE if the character
width is not know (no glyph for a valid UTF-8 codepoint) or
if the input is not a valid UTF-8 character!

The mbstate_t argument is not used, since we convert only from utf-8.
FIXME: This function (along with other places that use mbrtowc()) need
to be fixed for Windows (utf-16 wchar_t).
Use char32_t with mbrtoc32() instead of mbrtowc().
Return the width in text - column - widths of the utf8 - encoded character . The will return a NEGATIVE VALUE if the character width is not know ( no glyph for a valid UTF - 8 codepoint ) or if the input is not a valid UTF - 8 character! The mbstate_t argument is not used since we convert only from utf - 8 . FIXME : This function ( along with other places that use mbrtowc () ) need to be fixed for Windows ( utf - 16 wchar_t ) . Use char32_t with mbrtoc32 () instead of mbrtowc () .
int utf8_charwidth(const char *s)
{
	wchar_t wc;
	int n = mbrtowc(&wc, s, MB_LEN_MAX, NULL);
	if (n == 0) return 0;
	if (n < 0)
	{
		return -2 ;
	}
	return mk_wcwidth(wc);
}
int utf8_charwidth ( const char * s ) { wchar_t wc ; int n = mbrtowc ( & wc , s , MB_LEN_MAX , NULL ) ; if ( n == 0 ) return 0 ; if ( n < 0 ) { return -2 ; } return mk_wcwidth ( wc ) ; }
Return the width, in text-column-widths, of the utf8-encoded
 character.
Return the width in text - column - widths of the utf8 - encoded character .
// prt_error("Error: charwidth(%s): mbrtowc() returned %d\n", s, n); /* Yes, we want this! It signals the error! */