commit - 77526f756e23e362081ac807521f901f2e5cd5e6
commit + 22511c41d55a38a770541ae617a09383d5e6ad1c
blob - 7d985b188407c3e86a5c227530c5dad2fb4f300c
blob + a50c9ee0545db977ab4b9afbe49955cdddddbda4
--- drw.c
+++ drw.c
int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
{
- int ty, ellipsis_x = 0;
+ int i, ty, ellipsis_x = 0;
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len, ellipsis_width;
XftDraw *d = NULL;
Fnt *usedfont, *curfont, *nextfont;
FcPattern *match;
XftResult result;
int charexists = 0, overflow = 0;
+ /* keep track of a couple codepoints for which we have no match. */
+ enum { nomatches_len = 64 };
+ static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches;
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
return 0;
* character must be drawn. */
charexists = 1;
+ for (i = 0; i < nomatches_len; ++i) {
+ /* avoid calling XftFontMatch if we know we won't find a match */
+ if (utf8codepoint == nomatches.codepoint[i])
+ goto no_match;
+ }
+
fccharset = FcCharSetCreate();
FcCharSetAddChar(fccharset, utf8codepoint);
curfont->next = usedfont;
} else {
xfont_free(usedfont);
+ nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
+no_match:
usedfont = drw->fonts;
}
}