Hack: Enabling Unicode in XScreenSaver
Submitted by infojunkie on Sat, 2007-08-04 08:05.
When I tried to display Arabic text in some of the hacks, like noseguy, I failed miserably. Panicked, I posted to the Ubuntu forum asking for help. With a little help from my friends, and some code digging, I found that XScreenSaver hacks are not Unicode-ready at all.
So I started to convert noseguy to Unicode as a proof of concept. This little experiment succeeded, and you can find attached a modified version of noseguy.c (from XScreenSaver 5.03) that handles Unicode non-English chars. The code uses a Unicode-enabling library for Xlib originally found on Debian.org, mixed with some Arabic-shaping code that's part of Mohammed Sameer's Katoob.
To run this fix:
- Replace hacks/noseguy.c with the attached one
- Place attached unicode.c and unicode.h in utils/
- Edit your utils/Makefile to include unicode.c in the compilation (SRCS, OBJS, HDRS)
- Edit your hacks/Makefile to include unicode.o in the compilation of noseguy.
Next steps are:
- Get jwz's approval before applying this fix to all hacks
- Fix the xscreensaver-text Perl script to return UTF-8
- Fix Makefile.in to properly include unicode.c
- Fix the Arabic-shaping code
- Abstract the Arabic-handling code into a language-independent mechanism
{{wiki:20070834-ar-utf8_0.png}}
Stay tuned!
| Attachment | Size |
|---|---|
| noseguy.c | 17.9 KB |
| unicode.c | 12.49 KB |
| unicode.h | 1.92 KB |
| 20070834-ar-utf8.png | 8.01 KB |