Hebrew font no longer working

115 views
Skip to first unread message

David Sumbler

unread,
Oct 22, 2015, 4:21:06 PM10/22/15
to anki-a...@googlegroups.com
I am running CyanogenMod v.10.2.0 (based on Android 4.3.1) on a Google
Nexus 7.

I have the Hebrew font ezra.ttf included in my collection.media folder
under the name "_ezra.ttf", as instructed in the Anki manual.

In the "styling" section of the relevant cards I have the line

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

(I am not sure where I got this line from because it doesn't seem to
appear in the current manual, but I suppose it must have been in a
previous version of the manual.)

In the relevant part of the template I have

<span style="font-family: myfont; font-size: 42px"
dir=rtl>{{Nikkud}}</span>

(Nikkud is the field name.)

This works in Anki on my desktop computer, but does not work in
Ankidroid on my Nexus: in Ankidroid I just see a basic sans-serif font.

So I have tried doing things in the way described in the current Anki
manual. I have

.mystyle1 { font-family: ezra; font-size: 42px; dir=rtl; }

in the "styling" section, and

<div class=mystyle1>{{Nikkud}}</div>

in the template. But this does not work in either Anki or in Ankidroid:
I just get the sans-serif font in both versions.

How do I get the correct font to display in both programs?

David

Tim

unread,
Oct 22, 2015, 8:28:21 PM10/22/15
to AnkiDroid, da...@aeolia.co.uk
It's possible that there's a problem with your font on newer versions of Android. To test that theory, could you try using the Google Noto Hebrew font?
If you search on the forum there's some things that you can do to fix broken fonts if you really want to use that one.

David Sumbler

unread,
Oct 23, 2015, 5:04:29 AM10/23/15
to Tim, AnkiDroid
I don't think that the newness of my Android version can be the problem
- possibly the opposite. I recently changed back to an older Android
version (4.3) because later ones slow the Nexus down unacceptably.

The problem with the font only showed itself after this change.
Previously the Ezra font displayed correctly in Anki and in Ankidroid,
and of course it still does in my Ubuntu 12.04 using the apparently
non-standard "@font-face" line.

But using the ".mystyle1 { font-family: ezra;}" form, as described in
the current manual, it doesn't work either in Ankidroid or Anki itself.

David

Tim

unread,
Oct 23, 2015, 5:19:36 AM10/23/15
to AnkiDroid, perceptu...@gmail.com, da...@aeolia.co.uk
If you previously had it working on both AnkiDroid and Anki Desktop with a previous ROM, then you've answered your own question...

Flavio Lerda

unread,
Oct 23, 2015, 6:30:50 AM10/23/15
to AnkiDroid, perceptu...@gmail.com, da...@aeolia.co.uk
As Tim says, if you changed the version of Android on your devices (upgraded or downgraded), chances are that is the cause of the problem.
Trying a different font might be a way to diagnose if the version of Android you have right now does not support any fonts (unlikely), or whether it works only for some font formats. Tim's suggestion is a good way to determine that, using a font that others have tried before.

Just wanted to clarify one thing about the way to set up fonts, in case others are reading this.

This is the relevant line in the manual:
@font-face { font-family: myfont; src: url('_arial.ttf'); }
The use of "@font-face" is the only supported way to have a custom font and it is not a "non-standard" line, it is actually mandatory.

Whether you use an inline style, as in:
<span style="font-family: myfont;">{{FieldName}}</span>
or you do so by defining a class and applying to the element:
<span class="mystyle">{{FieldName}}</span>
.mystyle { font-family: myfont; }
it is mostly up to you, and the only difference (which is the point in the manual in which the example above appears, http://ankisrs.net/docs/manual.html#_fonts_on_a_mac) is that you can have different fonts for different operating systems using selectors (which is a rather advanced feature).

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.
To post to this group, send email to anki-a...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/anki-android/88fe13c5-d61c-455c-b43a-8f6e40395de6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Sumbler

unread,
Oct 23, 2015, 7:50:12 AM10/23/15
to Flavio Lerda, AnkiDroid, perceptu...@gmail.com
Well, I solved the minor problem of the class style not working in Anki
itself, by checking the font-family name in FontForge. I hadn't got it
right!

I have now tried the Google Noto font (and 2 other Hebrew fonts), and
all of them work in Anki but not in Ankidroid. I can confirm that the
fonts are correctly named in collection.media, and are being copied to
the tablet when I sync with the desktop computer.

Although I have had these fonts working in Ankidroid previously, I
suppose it is possible that this was before the newer version of
Ankidroid appeared. I remember that there used to be a different method
of using fonts: I still have some fonts installed
in /sdcard/Ankidroid/Fonts dating from that time.

Can anyone tell me what the earliest version of Android is that will
support Anki's current method of using additional fonts? At present I
am using Android 4.3.1 which is, after all, only 2 years old. I believe
this was the last version of Jellybean. I am a bit reluctant to move
again to KitKat, because my experience is that every OS upgrade slows
the machine down. But perhaps I'll have to compromise and use the
earliest version of Android that Ankidroid will actually work with.

David

Tim

unread,
Oct 23, 2015, 8:22:48 PM10/23/15
to AnkiDroid, fle...@gmail.com, perceptu...@gmail.com, da...@aeolia.co.uk
I've used custom fonts successfully on most versions of Android.... If Noto isn't working, I think the problem is not so much your version of Android, but the fact that you're using a non-standard CM ROM which may have a broken WebView. I'd suggest either flashing a factory image of your favorite Android version, or going back to what you were using before that worked. Please understand that since it's clearly not an AnkiDroid problem, we can't provide you any further help on this issue.

David Sumbler

unread,
Oct 24, 2015, 8:46:15 AM10/24/15
to Tim, AnkiDroid, fle...@gmail.com
Problem solved - I've had to go back to the "Fix for Hebrew vowels" in
the AnkiDroid workarounds. It took me a while, because I couldn't find
the Tohu.ttf font: the link from the option in AnkiDroid is out of date.

But everything is now working fine, both in Anki and AnkiDroid.

Thanks for your help.

David
Reply all
Reply to author
Forward
0 new messages