The art of setting text to KStatusNotifierItem

Andriy Rysin arysin at gmail.com
Wed Jun 2 04:42:25 BST 2010


Got a little problem with this bug
https://bugs.kde.org/show_bug.cgi?id=240225
Looks like keyboard layout is the only systray item which needs to set the
text (if show flag is unchecked) and currently the text is drawn as an icon,
the text looks much cleaner than in 4.4 when it was to be overlayed and thus
needed a halo to be visible. But there's a problem with darker themes as
text is drawn with black and it becomes invisible.

Now there's no nice and quick way to fix it as I can see and there are
several solutions I could anticipate:

1. Allow setting text to KStatusNotifierItem (and let it deal with picking
appropriate font size, color etc) - architecturally nice solution and very
nice for the client app, but keyboard layout indicator being the only
customer for this I don't see this implemented (unfortunately for me)

2. Drawing text halo, e.g black text with white halo - I tried quickly and
could not find with a quick and reliable way to get the nice text: if you
draw the text black and halo white then (even if you manage to get halo look
ok with the font face and size you don't know) the black will look great on
light background but the white (halo'ed text) will look much worse on darker
themes and vice versa

3. "Cheat" by finding out (somehow) how to get the systray background and
just set the text color to be "opposite"

I am leaning towards 3 if there's not-so-ugly way to get systray background,
but I would also consider 2 if somebody can point me to reliable algorithm
that provides nice text drawing on random background (including gradients)
without knowing the font face and size.

Thanks,
Andriy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100601/b763b318/attachment.htm>


More information about the kde-core-devel mailing list