The Japanese dictionary xjdic in Slackware 14

The source for xjdic, the stand alone front-end for Jim Breen's Japanese-English dictionary, can still be retrieved from it's home page, but the code does no longer compile correctly in Slackware 14. Already in Slackware 13 xjdic crashed a lot, but now every look-up resulted in an overrun. Too bad. Potentially xjic is delightfully fast and responsive!

Luckily xjdic is being maintained at Debian, but something weird is going on. I'd be inclined to file a bug report of some sort, but since I'm not actually using Debian, that would probably be awkward.

I made a Slackware package with the script deb2tgz from the latest version at Debian, (version xjdic-24-8), but while it worked, it ignored two configuration options: rvdisplay off and kanamode. The first is a bit trivial, it says that xjdic should not reverse highlight the search term (decreases readability). The second is really weird: instead of kana you see the roman letters and symbols that you type. To give a very clear example, instead of アィディア you see axidexia. I really hated that. But had I not seen it work in Ubuntu? Turns out, that was version xjdic-24-7. So I downgraded. That restored at least the kana input, which is much better. ¹

(Here's the Ubuntu version of xjdic-24-7)

Once you've converted the deb to tgz and installed it, you need to download edict, (optionally edict2 - I use them both), kanjidic, and enamdict, place them with the other libraries in /var/lib/xjdic (not in /usr/share/xjdic) and generate index files (cd to /usr/share/xjdic and do xjdxgen [name dic]; see the old installation guide for more details). Create ~/.xjdicrc with at least these lines (see /usr/share/doc/xjdic/dot.xjdicrc and the guide):

dicdir  /var/lib/xjdic
kdicfile    kanjidic
dicfile edict
dicfile edict2
dicfile enamdict
kdnoshow YELUQMKZ
rvdisplay off

Type xjdic in Xfce's Terminal, and you're good to go (if there's is an error about missing libraries, there's something wrong with your ~/.xjdicrc file).

It's a bit weird that xjdic runs in the default terminal of Xfce, since it wants to be in a eucjp LANG environment. Apparently Xcfe's terminal is quite smart. Alternatively you can run it in rxvt, but to make xjdic in rxvt look nice, you need to edit .Xdefaults and install a bunch of very old X fonts (which I did of course).

If you really want to know, add to or create ~/.Xdefaults and add something like the following:

rxvtbackground:    black
rxvtforeground:    grey75
rxvtfont:   -shinonome-gothic-medium-r-normal--16-150-75-75-c-80-iso8859-1
rxvtmfont:   -shinonome-mincho-medium-r-normal--16-150-75-75-c-160-jisx0208.1990-0

The Shinonome font looks great, but does not ship with Slackware. A package with fonts that contained it used to live here, but it doesn't seem to load anymore. Try this link or Google something like Xorg-jpfonts-3.0-noarch-1.tgz.

If you use another combination of Latin and Japanese fonts, check xlsfonts for fonts that are identical between the normal- and -[iso|jisx] parts, except that the last number needs to be twice as high in the Japanese font (because of the double-width thing, 80/160 in my example).

Of course the -iso8859-1 is Latin and jisx0208.1990-0 Japanese, you have to check for that as well (use search parameters like xlsfonts | grep -i jisx0208.1990-0 etc.).

If you can't find a font that looks as great as Shinonome, you may ask me for it, I'll mail you a tarball.

Put new X fonts under /usr/share/fonts (I've got a folder japanese) and try to let X know it's there, which can be tricky. First, if necessary (the original package contained a fonts.dir file already), cd to the font's folder and do mkfontdir . (note the dot; or do mkfontdir [full path]). Then, something like xset fp+ /usr/share/fonts/japanese and xset fp rehash and perhaps even fontconfig's fc-cache for good order. Check xlsfonts for the font. If everything fails, reboot. :-P

In the box below a screenshot of xjdic in rxvt using the Shinonome font.

  1. Unfortunately even this version occasionally crashes.