How to install japanese fonts for Anki?

3,361 views
Skip to first unread message

Alexander Rundberg

unread,
May 18, 2012, 5:56:34 AM5/18/12
to anki-a...@googlegroups.com
So this is more of an Android question than an AnkiDroid, but I figured people here should know better than anyone how to do this and which fonts are good and not so good. I found some information on Google for how to do this but surprisingly little actually. I found a TrueType font that seem popular (DroidSansJapanese I think it was called), but it seems strange to me that Android would be using TrueType primarily and not OpenType.

Though I know AnkiDroid has a nifty setting of choosing a font, I'd also love some information on how to set up the priority of fonts well. I need european characters (northern european being the most important) and am quite happy with the look of my default font, except that on my device it uses a chinese font for kanji which... well, you know... see attached image.

Don't think it should matter, but I'm running HTC Sense(-based rom) on my phone; which I guess would explain why the primary font is in chinese. It's rooted and everything so I can do whatever I want, would rather not download font apps (font manager apps I don't mind at all though) as it seems kind of wasteful.

Thanks!
2012-05-18 11.40.45.png

Valarian

unread,
May 19, 2012, 6:00:31 AM5/19/12
to anki-a...@googlegroups.com
When I was using the Motorola Milestone and any rom before Gingerbread, all I had to do was copy DroidSansJapanese.ttf to the /system/fonts directory.

The /system file structure is mounted read only.  I executed mount -o remount,rw /system to mount it read/write.

Now that I'm in Ice Cream Sandwich, I had to not only copy that file, but also edit a file in /system/etc called fallback_fonts.xml
Following the format of the other files, add an entry for DroidSansJapanese.ttf.

Your new entry must come before the last entry called something like DroidFallback, which seems to be a catch all for everything that doesn't match anywhere else.

Priority is given to files that are higher on the list.

Adding the font using /system/etc/system_fonts.xml also worked for me, but could be higher risk if you gum up the file.  I triple checked my edits to make sure I hadn't made any errors, paying double attention to my opening and closing tags.

Hopefully that helps you a little bit.

Alexander Rundberg

unread,
May 19, 2012, 7:26:52 AM5/19/12
to anki-a...@googlegroups.com
This worked! Thank you so much! :-)

Now I'm just gonna get a nicer font... DroidSansJapanese was OK but maybe Mincho would be even better. :-)

2012年5月19日土曜日 12時00分31秒 UTC+2 Valarian:

Alexander Rundberg

unread,
May 19, 2012, 8:01:36 AM5/19/12
to anki-a...@googlegroups.com
Do you know if it matters that I put fonts in subfolders within /system/fonts?
Would make it easy to keep track of different kinds of "subfonts" (bold, italic, regular) within a font.


2012年5月19日土曜日 12時00分31秒 UTC+2 Valarian:

Valarian

unread,
May 19, 2012, 4:09:45 PM5/19/12
to anki-a...@googlegroups.com
I'm sorry, I have no idea.  I've never seen an example of anyone doing this before.  In fact, I only figured out how to add a font to ICS 18 hours ago.

Nicolas Raoul

unread,
May 21, 2012, 3:32:19 AM5/21/12
to anki-a...@googlegroups.com
Thanks for the tip Valarian!

I pasted it to the wiki:
https://code.google.com/p/ankidroid/wiki/UsingCustomFonts

Cheers!
Nicolas Raoul
> --
> You received this message because you are subscribed to the Google Groups
> "AnkiDroid" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/anki-android/-/FM10KOnEbIcJ.
>
> To post to this group, send an email to anki-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> anki-android...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/anki-android?hl=en-GB.

Valarian

unread,
May 21, 2012, 4:35:59 AM5/21/12
to anki-a...@googlegroups.com
I think the page you've pasted it to is a different from the issue I'm addressing.

Japanese characters display improperly across all of android and any programs running in it by default because android doesn't come with a Japanese font installed and thus has to fall back to Chinese.  If AnkiDroid specifies fonts that aren't installed on the phone itself, which is the case, I believe, then editing the fallback_fonts.xml file is unnecessary.

Using the method I described fixes Japanese across the entire device and all programs since it adds Japanese fonts to the system, but it requires root access to copy the font and edit the fallback_fonts.xml file.  Your page seems to address fonts for non-rooted users by using an AnkiDroid specific workaround, which is totally cool.

I should mention as a disclaimer that messing around in your /system directory is dangerous if you don't know what you're doing.  I'm not saying you don't know that, but if anyone sees this in the future I thought I should make them aware of the risk.

Nicolas Raoul

unread,
May 21, 2012, 4:38:44 AM5/21/12
to anki-a...@googlegroups.com
Hum, you are right.
I think I should have added the info to paragraph "Method 2" of this page:
https://code.google.com/p/ankidroid/wiki/Installation#Adding_support_for_special_characters_on_Android
Would it be the right place?

Thanks a lot!
Nicolas Raoul
> --
> You received this message because you are subscribed to the Google Groups
> "AnkiDroid" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/anki-android/-/pMd5hskEzDgJ.

Valarian

unread,
May 21, 2012, 4:46:53 AM5/21/12
to anki-a...@googlegroups.com
Yes, that looks about right.  ICS just adds an additional hurdle that took me a few hours to figure out.  >.<
Reply all
Reply to author
Forward
0 new messages