Card layout became "jumpy" after adding custom font

Hey there,

I looked quite a while in the various FAQs and forums but nothing…

So, the problem might be related to loading behaviour for fonts on mobile? First of all: they display correctly on desktop/web/mobile!

Because I study an Indian language, I wanted to get exposure to how the script looks in a serif and a sans serif font. So I put the same expression twice on the card. For this I added the custom .ttf files (320 KB, 270 KB - only for the “regular” style, not a variable font) to the media folder and it’s all fine.

BUT when the card front appears, a tiny jumping motion is visible (the audio button below moves slightly downwards). The motion becomes very visible once the answer is revealed. I removed the font face styles and no jumping.

Are custom fonts loaded every time again once a card side is revealed? I imagine the jump comes from “expanding” to its final size after loading all font information. No jumping on desktop. It seems odd, isn’t all info already loaded when I open my deck to study?

Any insights are appreciated. Thanks!

We are aware of this problem and the devs are working to resolve the issue. Can you try the new previewer? I was told to do so (it did not work for me). Go to Settings, Click on About and tap the AnkiDroid logo a couple of times. Now you’ll see developer options in settings. You can turn on the new previewer there.

btw you’re Bharatiya? I’m from Assam. I should learn an Indian language too. I was learning sanskrit a while ago but am too busy now.

2 Likes

I have the same problem before, when loading fonts, images, or js script, so now I just try to make the template as simple as possible

1 Like

And the problem is this slow you down and kind of breaks the flow. I’ve noticed that this doesn’t happen when you apply a different in-app font. That feature was recently removed but I wonder what made that case different.

Yes, I think it’s probably because every time a new card is shown, it renders html and loads resources again rather than store them in memory

1 Like

Hey sorata, thanks! I made the developer options show, but I can’t find an old/new previewer toggle anywhere. Also looked through the other menu options. Could you please tell me where exactly it hides?

No I’m not Indian. Sanskrit is probably really cool to know, I became interested after a yoga teacher course where we chanted mantras :sweat_smile: but I didn’t start learning afterwards.

It was unintentionally removed in 2.17.6 version. Try downgrading or if you wish upgrade to 2.18 version (which is easier to do). Something interesting happened yesterday actually, I downloaded a Japanese deck and didn’t encounter this behaviour. The font file was around 3 MB so maybe that is the reason. In my case the font file was around 20. I have tried to confirm this theory but it didn’t work. But that may be solved if I download latest alpha and turn on new previewer.

Edit after half an hour: In the 2.18alpha versions new previewer is used by default. I just installed 2.18alpha7 and there is something that goes by “new congrats screen”. Not sure whether it’s a name change. As far as I know 2.18 uses new previewer by default.

Why the heck they were teaching sanskrit mantras in yoga class lol? The way yoga is taught in the west is so misleading sometimes. I remember the wiki of r/yoga which said Hathayoga is physical postures which is just fundamentally wrong. I imagine people who spread yoga there oversimplified some things and also mystify it.

By the way, if you like “mantra” here is one of my favorite ones. It goes to say that you don’t have to make others uncomfortable in the name of truth, that we must find a balance. It’s kinda ironical too because the book it comes from is really controversial in India.