dwm/patch/statuscolors.c
bakkeby 8c4eaccf16 Adding pango patch (ref. #10)
Text from original patch:

Using pango markup for status text

Use a single font. Removed some code utf8 code from drw.
Created for pango 1.44. Older versions might not have getter
for font height, ascent + descent can be used instead.
All texts are rendered with pango but only status is with
markup. Increased stext size (in case a lot of markup is used).
MIN/MAX is already defined (didn't redefine them).
2020-06-11 16:44:43 +02:00

27 lines
397 B
C

int
textw_wosc(char *s)
{
char *ts = s;
char *tp = s;
int sw = 0;
char ctmp;
while (1) {
if ((unsigned int)*ts > LENGTH(colors)) {
ts++;
continue;
}
ctmp = *ts;
*ts = '\0';
#if PANGO_PATCH
sw += drw_font_getwidth(drw, tp, True);
#else
sw += drw_fontset_getwidth(drw, tp);
#endif // PANGO_PATCH
*ts = ctmp;
if (ctmp == '\0')
break;
tp = ++ts;
}
return sw;
}