(xfs->max_char_or_byte2 - xfs->min_char_or_byte2 + 1)));
}
+ if (!xfs->per_char) /* per_char NULL => everything in range exists */
+ return TRUE;
+
return (xfs->per_char[index].ascent + xfs->per_char[index].descent > 0 ||
xfs->per_char[index].width > 0);
}
if (!sbstring[0])
return FALSE; /* not even in the charset */
- return x11_font_has_glyph(xfont->fonts[0], 0, sbstring[0]);
+ return x11_font_has_glyph(xfont->fonts[0], 0,
+ (unsigned char)sbstring[0]);
}
}
clen++;
n = 1;
- /*
- * 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 it's a right-to-left character, we must display it on
+ * its own, to stop Pango helpfully re-reversing our already
+ * reversed text.
+ */
+ if (!is_rtl(string[0])) {
- 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;
+ }
+ }
+ }
+ }
pango_layout_set_text(layout, utfptr, clen);
pango_layout_get_pixel_extents(layout, NULL, &rect);
utflen -= clen;
utfptr += clen;
+ string += n;
x += n * cellwidth;
}
if (!font)
return NULL;
+ fallback = NULL;
if (font->want_fallback) {
for (i = 0; i < lenof(unifont_types); i++) {
if (unifont_types[i]->create_fallback) {