Changeset View
Changeset View
Standalone View
Standalone View
tools/tools/locale/tools/getwidths.c
- This file was added.
#include <locale.h> | |||||
#include <stdio.h> | |||||
#include <utf8proc.h> | |||||
int | |||||
main(void) | |||||
{ | |||||
char mbc[MB_CUR_MAX]; | |||||
int32_t wc; | |||||
int i, mbl, wcw; | |||||
setlocale(LC_CTYPE, "C.UTF-8"); | |||||
printf("VERSION %s\n", utf8proc_version()); | |||||
for (int32_t wc = 0; wc < 0x110000; wc++) { | |||||
wcw = utf8proc_charwidth(wc); | |||||
if (wcw == 1) | |||||
continue; | |||||
mbl = wctomb(mbc, wc); | |||||
if (mbl <= 0) | |||||
continue; | |||||
for (i = 0; i < mbl; i++) | |||||
printf("\\\\\\\\x%02hhX", mbc[i]); | |||||
printf(" %d\n", wcw); | |||||
} | |||||
return (0); | |||||
} |