Joachim Breitner's Homepage
Unicode Hack
(No, this is not security related. Some people call screensavers “hacks”. But I did get your attention, didn’t I?)
Whenever I happen to run gucharmap, I like to just browse and have a look at all those weird characters other people, especially asian, are using: A lot of them look really cool. So I thought: This would be a great screensaver.
After some API digging I created that screensaver. It uses fontconfig to open the FreeSans and the DejaVu Sans fonts, selects a random glyph from these and display’s it full screen. Below, the unicode code point and characer name are printed. After a few seconds, the next character is displayed – nothing else, nothing hectic, quite relaxing.
When you download the code, you will find a file “uncode.c”, which is the hack itself, a file “unicode-names.h”, which is taken from gucharmap and only slightly modified, as well as a buch of files from the xscreensaver distribution. To re-compile the binary, use the script “compile”, which runs gcc with flags I stole from the xscreensaver Makefile. I know this build “system” is everything but correct or sensible, but it works for me...
Unfortunately I don’t think it can be included in xscreensaver, as it depends on libfontconfig. If someone would rewrite it using only libX11, this might be possible, so if you like it, feel free to steal the idea.
Comments
No, not really.
I inverted the colors, though. They should be configurable.
Yes, it could be configurable, but I don’t think it’s worth the hassle: It won’t go in the xscreensaver distribution, it is not worth making an extra package, so I’ll just leave it on my blog for interested people, and they can easily change the code. For now at least.
Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.
gcc -pedantic -Wall -Wstrict-prototypes -Wnested-externs -I. -I/usr/X11R6/include \
`pkg-config --cflags --libs gtk+-2.0` \
`pkg-config --cflags --libs libpng12` \
`pkg-config --cflags --libs libxml-2.0` \
`pkg-config --cflags --libs libglade-2.0` \
-DSTANDALONE -DHAVE_CONFIG_H -g -O2 -L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lXext -lm -lXft -o unicode *.c