[HowTo] Change Font in Rikaichan

Index » The Japanese language

  • 1
 
Reply #1 - 2013 July 19, 1:40 pm
Soul_Reaver Member
Registered: 2013-03-10 Posts: 10

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.

Last edited by Soul_Reaver (2013 July 23, 3:26 am)

Reply #2 - 2013 July 19, 2:41 pm
ryuudou Member
Registered: 2009-03-05 Posts: 406

Everything displays correctly for me by default, actually.

Reply #3 - 2013 July 19, 3:18 pm
Soul_Reaver Member
Registered: 2013-03-10 Posts: 10

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.

Last edited by Soul_Reaver (2013 July 19, 3:19 pm)

Advertising (register and sign in to hide this)
JapanesePod101 Sponsor
 
Reply #4 - 2013 July 20, 2:28 pm
ryuudou Member
Registered: 2009-03-05 Posts: 406

My phone used to do what you're talking about. Cool tip though.

Reply #5 - 2013 July 20, 9:41 pm
kashiwagi New member
Registered: 2013-07-20 Posts: 1

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 - 2013 July 23, 3:28 am
Soul_Reaver Member
Registered: 2013-03-10 Posts: 10

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.

  • 1