Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom Font #5

Open
Zwiebelmettwurst opened this issue Oct 1, 2018 · 8 comments
Open

Using custom Font #5

Zwiebelmettwurst opened this issue Oct 1, 2018 · 8 comments

Comments

@Zwiebelmettwurst
Copy link

Hello,
i'm using a custom font for my chinese cards.
Unfortunately since the AnkiConnect update, that font doesn't work anymore.
Console output: chrome-extension://ihoaepdiibjbifnhcjoaddgcnfgjmjdk/_gkai00mp.ttf net::ERR_FILE_NOT_FOUND

When I put that font file in C:\Users\<USER>\AppData\Local\Google\Chrome\User Data\Default\Extensions\ihoaepdiibjbifnhcjoaddgcnfgjmjdk\0.4_0 it works for 1 second after Chrome detects an extension corruption.

I kindly ask you to add a function for custom fonts.

@corollari
Copy link
Owner

First of all, thanks for letting me know of this issue.
About the bug, could you upload the deck that's causing issues or explain how to create one with which I can reproduce the issue?
The problem is that ankiConnect only allows retrieving media files via an API call, so right now the extension is performing these API calls for everything which has a src attribute, which obviously misses stuff like fonts. A way to solve this issue would be to stop all web requests, call the ankiConnect API and encode the answer in binary (ankiConnect returns a base64-encoded answer) before returning it, which is exactly what I'll start working on.

@Zwiebelmettwurst
Copy link
Author

Thanks for your fast response!
Here are the files.
gkai00mp.zip
综合中级1.zip

@corollari
Copy link
Owner

This weekend I've been working on this and, while I thought this would be pretty straightforward, it seems it will take a bit longer to implement than planned, as, right now, the chrome extensions API doesn't support changing a request body[1][2].
Just wanted to give you a heads up so you know that I haven't forgotten about this.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=104058
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=487422

corollari added a commit that referenced this issue Nov 2, 2018
@corollari
Copy link
Owner

It seems I won't have the time needed to look into this (I don't even know if it's possible without submitting a PR to chome&firefox) till a few months later, so it will probably take a while.
Meanwhile, as a temporary fix, I prepared the branch fontissues, which has the font file you needed to get your cards working. You can use this version of ankiTab by downloading it, enabling developer mode in chrome and loading the extension unpacked.
In case you also want it for firefox just leave a comment and I'll sign it for you.

@Zwiebelmettwurst
Copy link
Author

Wow, good job!

@corollari
Copy link
Owner

Thanks, if you find any issue installing it just let me know :)

@Zwiebelmettwurst
Copy link
Author

Just had to add "_" in front of the file name. "_gkai00mp.ttf"

@itsmepvr
Copy link

Hello, I am also kind of getting into same issue with my decks. All the external images, js files and css files in the card returns error in console as file_not_found. I am using the annotation of '_' before each file and it works perfectly fine in Anki. In chrome, only the html part shows up but not the images, js and css those are in collection.media.
Am I missing something here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants