| 57 { |
57 { |
| 58 int size; |
58 int size; |
| 59 int width = 0; |
59 int width = 0; |
| 60 const char *str = string; |
60 const char *str = string; |
| 61 |
61 |
| |
62 if (len <= 0) { |
| |
63 len = g_utf8_strlen(string, -1); |
| |
64 } |
| |
65 |
| 62 while (width < len && *str) { |
66 while (width < len && *str) { |
| 63 size = g_unichar_iswide(g_utf8_get_char(str)) ? 2 : 1; |
67 size = g_unichar_iswide(g_utf8_get_char(str)) ? 2 : 1; |
| 64 if (width + size > len) |
68 if (width + size > len) |
| 65 break; |
69 break; |
| 66 str = g_utf8_next_char(str); |
70 str = g_utf8_next_char(str); |