osd->font = XftFontOpenName(osd->dpy, osd->screen, "times-64");
if (!osd->font)
die("Cannot open font");
+ DBG("Font: asc=%d desc=%d ht=%d", osd->font->ascent, osd->font->descent, osd->font->height);
osd->mask_draw = XftDrawCreateBitmap(osd->dpy, osd->mask_bitmap);
if (!osd->mask_draw)
if (!XftColorAllocValue(osd->dpy, osd->visual, osd->cmap, &xrcm, &xfcm))
die("XftColorAllocValue failed");
- // FIXME: This is very ugly!
- XftDrawStringUtf8(osd->mask_draw, &xfcm, osd->font, 100, 100, str, strlen((char *) str));
- for (int off=1; off<=2; off++)
- for (int dir=0; dir<9; dir++)
- if (dir != 4)
- XftDrawStringUtf8(osd->mask_draw, &xfcm, osd->font, 100 + (dir/3 - 1) * off, 100 + (dir%3 - 1) * off, str, strlen((char *) str));
+ // This is slow, but unlike the method used by libxosd, the result isn't ugly.
+ int outline = 3;
+ for (int dx = -outline; dx <= outline; dx++)
+ for (int dy = -outline; dy <= outline; dy++)
+ if (dx*dx + dy*dy <= outline*outline)
+ XftDrawStringUtf8(osd->mask_draw, &xfcm, osd->font, 100 + dx, 100 + dy, str, strlen((char *) str));
#if 0
XGlyphInfo gi;