AnkiDroid and Japanese Characters

1,301 views
Skip to first unread message

AnkiFollower12

unread,
Jul 26, 2013, 11:07:10 AM7/26/13
to anki-a...@googlegroups.com
To preface, I recently switched from iOS to Android (4.2.2). I am quite pleased with the Android OS (with the exception that it does not render Japanese fonts properly - another rant for another day).

Hopefully this is a user error on my end and not something that cannot be addressed without rooting the device.

Below is what my card templates look like on Anki for desktop:

Front Template:

<span style="font-family: IPAGothic; font-size: 60px; color: #ffffff;"><span style="font-family: IPAGothic; font-size: 56px; color: #ffffff">{{Front}}</span></span>

Styling:

.card {

font-family: myfont;

font-size: 20px;

text-align: center;

color: white;

background-color: black;

}


@font-face { font-family: myfont; src: url('_ipag.ttf'); }


Back Template:


{{FrontSide}}


<hr id=answer>


<span style="font-family: IPAGothic; font-size: 38px; color: #ffffff;"><span style="font-family: IPAGothic; font-size: 33px; color: #ffffff">{{Back}}</span></span>


I followed the instruction pertaining to how to embed a font and I think I did it correctly. I also copied the IPAGothic font to the AnkiDroid fonts directory on my phone.

I then went to settings on AnkiDroid and selected the IPAGothic font for default and deck browser fonts.

When I open AnkiDroid and browse my deck, the cards display with the correct font. However, when reviewing, the fonts are still displaying incorrectly. I assume this is because they use the fallback font (which defaults to Chinese-rendered characters), but shouldn't they be displayed using the font I specified?

Any help would be greatly appreciated.

Flavio Lerda

unread,
Jul 26, 2013, 1:47:25 PM7/26/13
to anki-a...@googlegroups.com, AnkiFollower12
Hello,

I think you mixed different methods.

If you are using the fonts directory you should not use @font-face and name of the font in the style attribute should match the file name.
If you are using @font-face, the font should be in the media directory of your collection.

I hope this helps,
Flavio



--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anki-android...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Flavio Lerda

AnkiFollower12

unread,
Jul 26, 2013, 2:31:36 PM7/26/13
to anki-a...@googlegroups.com, AnkiFollower12
Thank you for your response.

I see what you mean about mixing methods.

I opted to delete the font out of my 'media' directory. I then opened Anki, deleted the @ line and also the font-family line, and now my styling looks like this:

.card {

font-size: 20px;

text-align: center;

color: white;

background-color: black;

}


(Note: I tried this both with and without the font-family line).

I synced and closed the desktop version. I then opened and synced AnkiDroid. Still no joy :(

As I mentioned before, the font used for browsing looks correct. Unfortunately the cards do not render properly. Do I need to change something else on my desktop version in order to get this to happen?

Flavio Lerda

unread,
Jul 26, 2013, 2:47:01 PM7/26/13
to anki-a...@googlegroups.com, AnkiFollower12
You still need to specify the font-family in your template as:

<span style="font-family: _ipag; font-size: 60px; color: #ffffff;">{{Front}}</span>

Assuming that "_ipag.ttf" is the name of the file on your device, which should be stored under the fonts directory.

The way the fonts are used in the editor and in the review screen are completely unrelated and in fact they do not need to be to the same value.

Flavio

AnkiFollower12

unread,
Jul 26, 2013, 3:15:50 PM7/26/13
to anki-a...@googlegroups.com, AnkiFollower12
I solved the issue, thanks to you! Many thanks, Flavio.

I did as you instructed and added my font family tag back. The desktop version of Anki needs the actual font name (IPA Gothic) in order to work.

On my phone, I simply renamed _ipag to IPA Gothic. Viola! Works like a charm. :)

Having an in-app way to change fonts is great (wish Evernote would do it), but ultimately I would hope that Google/Manufacturers would get together and change the fallback font so that Japanese fonts look they way thei were intended (i.e. not Chinese glyphs).

Thanks again!

Flavio Lerda

unread,
Jul 26, 2013, 9:10:09 PM7/26/13
to anki-a...@googlegroups.com, AnkiFollower12
Glad to hear this was fixed for you.

It is not that easy to change the fallback font actually, due
to the Han unification in Unicode. The same character can be
both Chinese or Japanese. If the fallback font were changed,
then the Chinese characters would be displayed incorrectly.

A Japanese manufacturer of course might be happy with that,
but there is no correct solution unless the specific language is
specified somewhere outside of the characters themselves.
Specifying a font is a way to do that.

Flavio

Isshin

unread,
Jul 27, 2013, 3:31:08 PM7/27/13
to anki-a...@googlegroups.com, AnkiFollower12
I got a lot of help in setting up my Galaxy equipment (Note 10.1 e mobile phone) from the Wiki at Koohi: http://rtkwiki.koohii.com/wiki/Android_Applications

As I recall, I used Fontomizer.on my Android 2.x device, but didn't neet it on the Android 4 device. I probably have "overkill" by now, but use the MultiLing keyboard and the Mazec2 (beta version free for testing for perhaps about 90 days don't remember when it timed out and Pro version definitely worth the price - the handwriting IME seems to manage to recognize just about anything I throw at it...).

As far as I can see, the Japanese fonts are showing properly on both devices and Japanese input works nicely.

Good luck!
Isshin

AnkiFollower12

unread,
Jul 29, 2013, 11:31:23 AM7/29/13
to anki-a...@googlegroups.com, AnkiFollower12
I'm currently using Swype for Japanese input (I looked at several IMEs and Swype works quite well, IMHO) so no problems there. I'm holding off on rooting my device for the time being, so I suppose I'll have to live with the system fonts (and the Chinese glyphs) for now. The Koohi guide is very nice though and provides lots of insight.

I very much appreciate for the help guys!
Reply all
Reply to author
Forward
0 new messages