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

Fonts are not deobfuscated #721

Closed
zchap26 opened this issue Apr 30, 2021 · 10 comments
Closed

Fonts are not deobfuscated #721

zchap26 opened this issue Apr 30, 2021 · 10 comments
Labels
bug Something isn't working epub.js Related to Epub.js
Milestone

Comments

@zchap26
Copy link

zchap26 commented Apr 30, 2021

Hello,

I have got three ebooks that are not displayed properly when using either calibre on Windows or foliate on Linux.
Using the EPUB.js Input Example page generates the same issue.

When opened in Adobe Digital Editions, the ebooks are readable. I do not want to use Adobe Digital Editions.

I am reporting the problem here because since submitting the issue on 01.03.2021, there has only been scant activity on futurepress/epub.js. Seeing that there are bug reports for epub.js on johnfactotum/foliate and that there is johnfactotum/epub.js, I am hoping that maybe this is the right place.

The ebooks in question are:

  1. The Anesthetic Crisis Manual
  2. The Resuscitation Crisis Manual
  3. The Perfusion Crisis Manual

The issue occurs every time one of the ebooks is displayed and affects all pages.

Can this be fixed?

Regards,

zchap26

Screenshot from 2021-03-01 15-02-29

Screenshot from 2021-03-01 15-03-04

Screenshot from 2021-04-30 09-45-46

@zchap26 zchap26 added the bug Something isn't working label Apr 30, 2021
@itprojects
Copy link
Contributor

itprojects commented May 1, 2021

@zchap26 There are many reasons for which a book can be unreadable.

What is your Foliate version?

What is your install method?: meson, flatpak, snap, which other?

Does this happen with (free/libre) Gutenberg Books?

All of these books seem proprietary. Perhaps there is a problem with the DRM fonts? (if any)

Have you tried changing the default font? On the right in Foliate > Menu > Font button

Maybe it's the spacing. You can change that in Foliate, too.

Consider unticking "Use Publisher Font" in Foliate.

One final option is if you are willing to edit the epub with calibre. Then you would remove the fonts entirely from the epub. This way any reader that is viewing the locally edited files will use the system font, which presumably solves the problem.

@johnfactotum
Copy link
Owner

johnfactotum commented May 2, 2021

Can't say for sure without seeing the files, but those look like fixed layout books with hardcoded spacing designed to work with a specific font, and it looks broken when the font is not loaded.

Now, as to why the font failed to load, I haven't any idea. Might be that the format isn't supported by WebKitGTK, or maybe Epub.js isn't resolving the path properly, or some other issue.

@johnfactotum johnfactotum added the epub.js Related to Epub.js label May 2, 2021
@zchap26
Copy link
Author

zchap26 commented May 6, 2021

Foliate 2.6.3
flatpak
Don Quixote seems to display without any issues
changing the default font does not resolve the issue
changing the spacing does not resolve the issue
Use Publisher Font was not ticked, changing this option does not seem to have any effect

@itprojects
Copy link
Contributor

If other ePub's like Don Quixote display acceptably (enough), then Foliate is working.

Note: If The books display (too) perfectly in Adobe products that can be an issue. Epubs are essentially html pages; some html pages optimised for Mac/Win browsers, can show defects when displayed in Linux browsers. Maybe the ePub's are perfect, but for the wrong OS or browser (webkit).

Can this be fixed?

No.

@Iss-in
Copy link

Iss-in commented Jun 27, 2021

same issue here , ebub is good in other readers ( moon reader on android and calibre on linux ) ,

sample sshot ( left foliate, right calibre )
2021-06-27_14-02-22

font is roboto in both readers, changing font also doesn't help. broken rendering is constant with all fonts .

edit : same issue as in #650

@johnfactotum
Copy link
Owner

I think I know why the fonts aren't loaded. It's probably because the fonts are obfuscated. If you unzip the EPUB file, you should see a file called encryption.xml in the META-INF/ directory. Obfuscated fonts need to be decrypted, which Epub.js doesn't do. So the fonts don't work.

@itprojects
Copy link
Contributor

If it's true, then if you delete the encryption.xml file, delete the font files, zip the extracted files into a new zip with the same structure, and rename to file.epub, then this problem should disappear.

@johnfactotum
Copy link
Owner

@itprojects If it's true, doing those things will not make the problem disappear.

First of all, currently obfuscated fonts are already ignored. So deleting them will do nothing.

But more importantly, in fixed layout books, the position of all the text is fixed, so the correct font is required. If you've ever opened a PDF that forgets to embed a specific font, you'd see the same kind of broken rendering.

@itprojects
Copy link
Contributor

@johnfactotum You're probably right. No harm in trying, maybe we learn something for debug :)

@johnfactotum johnfactotum changed the title ebooks unreadable Fonts are not deobfuscated Sep 23, 2022
@johnfactotum johnfactotum added this to the 3.0 milestone Sep 23, 2022
@johnfactotum
Copy link
Owner

Fixed in the gtk4 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working epub.js Related to Epub.js
Projects
None yet
Development

No branches or pull requests

4 participants