ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.55k stars 2.21k forks source link

Embedded font does not display #3342

Closed hssm closed 9 years ago

hssm commented 9 years ago

Originally reported on Google Code with ID 2446

AnkiDroid 2.3.2
Android 4.4.2 on non-rooted device

What steps will reproduce the problem?

1. Create deck in Anki for Windows. Style front field to use custom font, per instructions
in Anki manual. Deck works on Windows.

2. Export deck as .apkg including media (file attached) and transfer to Android device.

3. Open .apkg file using AnkiDroid. Deck installs without problems, font file is present
in AnkiDroid/collection.media folder, but fields styled in custom font display in default
font instead. 

Problem has persisted through complete reinstall of Ankidroid and recreation of deck
from scratch using Windows Anki.

Reported by fct.clarke on 2014-12-19 04:24:34


hssm commented 9 years ago
Do other fonts work, like Noto? It's possible it's not actually in truetype format:
http://ankidroid.org/docs/manual.html#customFonts

Reported by perceptualchaos2 on 2014-12-19 05:00:34

hssm commented 9 years ago

Reported by perceptualchaos2 on 2014-12-19 05:00:44

hssm commented 9 years ago
Will check but same process worked fine about a year ago on my previous Android tablet,
which shouldn't be the case if it's not a proper TTF surely?

Reported by fct.clarke on 2014-12-19 12:13:32

hssm commented 9 years ago
Update: Noto fonts anmd Windows system fonts don't work either.

Reported by fct.clarke on 2014-12-19 13:59:19

hssm commented 9 years ago
Hmmm can you see if you can get the font to change by changing the default font and
applicability under settings->fonts?

Reported by perceptualchaos2 on 2014-12-20 10:08:40

hssm commented 9 years ago
Screenshots attached.

01.png: App's default behaviour (system default font, applicability: when no font specified).
Note the two fonts are not identical.

02.png: Bold italic font, applicability when no font specified.

03.png: Italic font, applicability always.

Reported by fct.clarke on 2014-12-21 01:27:36


hssm commented 9 years ago

Reported by nicolas.raoul on 2015-01-27 05:18:28

hssm commented 9 years ago
I am experiencing the same problem: custom fonts are not displayed on AnkiDroid.
When the same deck is used on Anki/linux, the custom font is displayed.

Version: Ankidroid 2.4. KitKat 4.4.4.

Custom font: Wang Fonts (Chinese Simplified). Yes, its a true type font!
https://code.google.com/p/ankidroid/wiki/FreelyDistributableFonts 

Flash card style sheet snippet:
---
.kai{
 font-family: FangSongMedium;
 font-size: 40px;
}
@font-face{font-family:FangSongMedium; src:url('wts47.ttf');}
---

The 'wts47.tff' has been uploaded to my ankiweb account, and sync into the AnkiDroid
'AnkiDroid/collection.media' folder. I have confirmed this by manually inspecting the
file system.

Reported by pross@xvid.org on 2015-03-07 12:45:51

hssm commented 9 years ago
Disregard comment #8. Problem was fixed by trying another font.

Reported by pross@xvid.org on 2015-03-07 14:11:52

hssm commented 9 years ago
A custom western font works fine for me (Linux Libertine Display), a 4MiB large kanji
font (Epson Kyokasho) on the other hand is ignored. (epkyouka.ttf from http://www.epson.jp/download2/printer/driver/win/page/ttf30.htm
- it says .exe but 'unzip' handles it). The font is part of my media files, it's synced
properly and works on the desktop.

I have an old SGS i9000 running Cyanogenmod 11 (otherwise I'd be stuck with Android
2).

I'm not sure if it stopped working after an AnkiDroid update, or CM update. If this
particular font works for anyone else, it's probably CM at fault in my case...

Reported by Andreas.Klauer on 2015-04-04 13:13:02

hssm commented 9 years ago
AnkiDroid basically has no code that handles the displaying of fonts, it's all handled
by the operating system's WebView. I recommend using Google Noto fonts; they are free,
open-source, guaranteed to work, and look good.

Reported by perceptualchaos2 on 2015-04-06 02:24:00

hssm commented 9 years ago
I can't use another font, this font is unique and there is no Google Noto
version of it available. Your answer amounts to "not my problem".

Reported by fct.clarke on 2015-04-06 07:40:17

hssm commented 9 years ago
No my answer amounts to "nothing we can do about it, sorry"

Reported by perceptualchaos2 on 2015-04-06 10:10:24

hssm commented 9 years ago
Since I commented on this issue I'd also like to put in a link to the solution (at least
in my case):

https://groups.google.com/d/topic/anki-android/svgWDMukz1s/discussion

Reported by Andreas.Klauer on 2015-05-12 11:30:30