| 40 } |
40 } |
| 41 |
41 |
| 42 int gnt_util_onscreen_width(const char *start, const char *end) |
42 int gnt_util_onscreen_width(const char *start, const char *end) |
| 43 { |
43 { |
| 44 int width = 0; |
44 int width = 0; |
| |
45 |
| |
46 if (end == NULL) |
| |
47 end = start + strlen(start); |
| 45 |
48 |
| 46 while (start < end) { |
49 while (start < end) { |
| 47 width += g_unichar_iswide(g_utf8_get_char(start)) ? 2 : 1; |
50 width += g_unichar_iswide(g_utf8_get_char(start)) ? 2 : 1; |
| 48 start = g_utf8_next_char(start); |
51 start = g_utf8_next_char(start); |
| 49 } |
52 } |