Package: ratmenu Version: 2.3.18 Severity: wishlist ratmenu doesn't seem to support multibyte/UTF-8 characters.
How to reproduce: Open an uxterm with e.g. -misc-fixed-medium-r-*-*-13-*-*-*-*-60-iso10646-1 as font: uxterm -font '-misc-fixed-medium-r-*-*-13-*-*-*-*-60-iso10646-1' Then enter the following lines: echo `perl -le 'print map chr, 226, 152, 186, 226, 134, 146'` 'echo bla' You shoud see a smiley, an arrow and the two words echo and bla. If you pass these arguments including the same font to ratmenu, you won't see the the smiley nor the arrow but the ISO-Latin-1 (I guess) characters with the numbers 226, 152, 186, 226, 134 and 146: ratmenu -font '-misc-fixed-medium-r-*-*-13-*-*-*-*-60-iso10646-1' `perl -le 'print map chr, 226, 152, 186, 226, 134, 146'` 'echo bla' There is a ratmenu fork called ratmen[1][2] whose development stalled according to its README. For this fork, there is a working patch for multibyte/UTF-8 support at [3]. Unfortunately with one exception this patch doesn't apply to ratmenu. [1] http://ratpoison.antidesktop.net/wiki/ratmen [2] http://www.update.uu.se/~zrajm/programs/ratmen/ [3] http://www.rubyist.net/~rubikitch/computer/ratmen/i18n.patch, also attached to this mail as wished by the ratmenu maintainer. If you compile ratmen with that patch, the following command will show a menu with smiley and arrow as it should also be possible with ratmenu: ratmen --font '-misc-fixed-medium-r-*-*-13-*-*-*-*-60-iso10646-1' `perl -le 'print map chr, 226, 152, 186, 226, 134, 146'` 'echo bla' Below is the patch for ratmen of which I hope that it maybe modified to apply to ratmenu, too, by someone with more code insight than I have. :-) --- ratmen.c 2004/05/21 13:06:35 1.1 +++ ratmen.c 2004/05/21 15:23:37 1.3 @@ -56,6 +56,7 @@ #include <X11/Xutil.h> #include <X11/Xatom.h> #include <X11/Xresource.h> +#include <X11/Xlocale.h> #include <getopt.h> #define FONT "9x15bold" @@ -68,8 +69,9 @@ #define MenuMaskNoMouse (ExposureMask|StructureNotifyMask\ |KeyPressMask|FocusChangeMask) - - +#define XTextWidth XmbTextEscapement +#define XLoadQueryFont XLoadQueryFontSet +XFontSet XLoadQueryFontSet(Display *, const char *); Display *dpy; /* lovely X stuff */ int screen; @@ -82,7 +84,8 @@ Colormap dcmap; XColor color; -XFontStruct *font; +XFontSet font; +short font__ascent, font__descent; Atom wm_protocols; Atom wm_delete_window; int g_argc; /* for XSetWMProperties to use */ @@ -143,6 +146,24 @@ void version(void); +XFontSet XLoadQueryFontSet(Display *disp, const char *fontset_name) +{ + XFontSet fontset; + int missing_charset_count; + char **missing_charset_list; + char *def_string; + + fontset = XCreateFontSet(disp, fontset_name, + &missing_charset_list, &missing_charset_count, + &def_string); + if (missing_charset_count && debug) { + fprintf(stderr, "Missing charsets in FontSet(%s) creation.\n", fontset_name); + XFreeStringList(missing_charset_list); + } + return fontset; +} + + /* * Event loop monitor thingy stolen from: (use option `--debug') * http://www-h.eng.cam.ac.uk/help/tpl/graphics/X/X11R5/node41.html @@ -585,10 +606,12 @@ char *cp; XGCValues gv; unsigned long mask; + XFontSetExtents *extent; g_argc = argc; /* save command line args */ g_argv = argv; - + setlocale(LC_CTYPE, ""); + /* get program name (=default X resource class & title) */ if ((cp = strrchr(argv[0], '/'))) /* if argv[0] contains slash */ progname = ++cp; /* use all after that */ @@ -653,13 +676,16 @@ fprintf(stderr, "%s: fatal: cannot load font `%s'\n", progname, fontname); exit(1); } + extent = XExtentsOfFontSet(font); + font__ascent = extent->max_logical_extent.height * 4 / 5; + font__descent = extent->max_logical_extent.height / 5; + gv.foreground = fg^bg; gv.background = bg; - gv.font = font->fid; gv.function = GXxor; gv.line_width = 0; - mask = GCForeground | GCBackground | GCFunction | GCFont | GCLineWidth; + mask = GCForeground | GCBackground | GCFunction | GCLineWidth; gc = XCreateGC(dpy, root, mask, &gv); signal(SIGCHLD, reap); @@ -772,7 +798,7 @@ } wide = dx; - high = font->ascent + font->descent + 1; + high = font__ascent + font__descent + 1; dy = numitems * high; /* height of menu window */ if (dy > display_height) /* shrink if outside screen */ dy = display_height - (display_height % high); @@ -1114,8 +1140,8 @@ } else { /* align == left */ tx = 0; } - ty = i*high + font->ascent + 1; - XDrawString(dpy, menuwin, gc, tx, ty, labels[j], strlen(labels[j])); + ty = i*high + font__ascent + 1; + XmbDrawString(dpy, menuwin, font, gc, tx, ty, labels[j], strlen(labels[j])); } XFillRectangle(dpy, menuwin, gc, 0, 0, wide, high); } @@ -1170,8 +1196,8 @@ } else { /* align == left */ tx = 0; } - ty = i * high + font->ascent + 1; - XDrawString(dpy, menuwin, gc, tx, ty, labels[j], strlen(labels[j])); + ty = i * high + font__ascent + 1; + XmbDrawString(dpy, menuwin, font, gc, tx, ty, labels[j], strlen(labels[j])); } if (cur_item >= 0) XFillRectangle(dpy, menuwin, gc, 0, (cur_item - cur_top) * high, wide, high); @@ -1201,7 +1227,7 @@ } else { |* align == left *| tx = 0; } - ty = i*high + font->ascent + 1; + ty = i*high + font__ascent + 1; XDrawString(dpy, menuwin, gc, tx, ty, labels[i], strlen(labels[i])); } XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (990, 'unstable'), (600, 'stable'), (400, 'oldstable'), (110, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.29-2-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages ratmenu depends on: ii libc6 2.9-13 GNU C Library: Shared libraries ii libx11-6 2:1.2.1-1 X11 client-side library ratmenu recommends no packages. Versions of packages ratmenu suggests: ii menu 2.1.41 generates programs menu for all me ii ratpoison 1.4.4-1 keyboard-only window manager pn xbindkeys <none> (no description available) ii xclip 0.08-8 command line interface to X select -- no debconf information -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

