Back

[HowTo] Change Font in Rikaichan

#1
So,
I'm sure quite a few here use the Firefox Rikaichan add-on to assist them in their studies.
I've recently noticed that the default font (at least on my system) sometimes displays faulty Kanji (uses Chinese fonts instead of Japanese ones) and that there is no option in the preferences to change that. By now I found out it's related to Ubuntu and is best changed at the OS level (There are quite a few guides on the net).

However you may still feel the need to customize Rikaichan.
For example you might want to use a serif font or you want it to display the stroke order (by using the KanjiStrokerOrders font). The possibilities are numerous.

In order to change the Rikaichan fonts do the following:

In Firefox click 'Help' -> 'Troubleshooting Information'
On the config site click the 'Open Directory'-button next to 'Profile Directory'

In this directory open (or create) the folder 'chrome' and then open (or create) the file 'userContent.css'. Paste the following piece of code in there, save and restart Firefox. Voilà, the font for displaying Kanji in Rikaichan is changed.

Code:
#rikaichan-window .k-kanji {
    font-family: TakaoPGothic !important;
}
#rikaichan-window .w-kanji {
    font-family: TakaoPGothic !important;
}
You can also change the font of the Kana and English words with these classes (I haven't tested those though):

k-eigo (Font used for English)
k-yomi (Font used for readings in the Kanji dict.)
w-kana (Font used for Kana in the words dict.)

I hope this helps anyone here.

Cheers.
Edited: 2013-07-23, 3:26 am
Reply
#2
Everything displays correctly for me by default, actually.
Reply
#3
I guess it's connected to Ubuntu.
I also get faulty fonts on jisho.org and here on the forums while the review and study page show the correct font from the Firefox preferences. At least I got it working in Rikaichan now.

On Windows everything works perfectly though.
Edited: 2013-07-19, 3:19 pm
Reply
May 16 - 30 : Pretty Big Deal: Save 31% on all Premium Subscriptions! - Sign up here
JapanesePod101
#4
My phone used to do what you're talking about. Cool tip though.
Reply
#5
Ran into the same issue with Ubuntu in the past. What happens is that if your locale is set to something like en_US.UTF-8 then fontconfig / pango choose fonts based on total number of glyphs covered by the font, so you can end up with Chinese glyphs interspersed with the Japanese. It's been a while since i messed with this, but as i recall there is a workaround available via the PANGO_LANGUAGE env var, or the ubuntu-specific 'fontconfig-voodoo' tool.
Reply
#6
Well I kinda fixed it by meddling around with ~/fonts.conf.
Now everywhere the correct font is displayed yet I still had to change the Rikaichan font to get a sans serif font. Oddly enough on my other Ubuntu system everything works right out of the box without manually configuring anything.

Anyways some might still find this useful for customizing purposes for example for letting Rikaichan display the stroke order.
Reply