- if (rect.width == cellwidth) {
- /*
- * Try extracting more characters, for as long as they
- * stay well-behaved.
- */
- while (clen < utflen) {
- int oldclen = clen;
- clen++; /* skip UTF-8 introducer byte */
- while (clen < utflen &&
- (unsigned char)utfptr[clen] >= 0x80 &&
- (unsigned char)utfptr[clen] < 0xC0)
- clen++;
- n++;
- pango_layout_set_text(layout, utfptr, clen);
- pango_layout_get_pixel_extents(layout, NULL, &rect);
- if (rect.width != n * cellwidth) {
- clen = oldclen;
- n--;
- break;
- }
- }
- }
+ /*
+ * See if that character has the width we expect.
+ */
+ pango_layout_set_text(layout, utfptr, clen);
+ pango_layout_get_pixel_extents(layout, NULL, &rect);
+
+ if (rect.width == cellwidth) {
+ /*
+ * Try extracting more characters, for as long as they
+ * stay well-behaved.
+ */
+ while (clen < utflen) {
+ int oldclen = clen;
+ clen++; /* skip UTF-8 introducer byte */
+ while (clen < utflen &&
+ (unsigned char)utfptr[clen] >= 0x80 &&
+ (unsigned char)utfptr[clen] < 0xC0)
+ clen++;
+ n++;
+ pango_layout_set_text(layout, utfptr, clen);
+ pango_layout_get_pixel_extents(layout, NULL, &rect);
+ if (rect.width != n * cellwidth) {
+ clen = oldclen;
+ n--;
+ break;
+ }
+ }
+ }
+ }