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
Various in-page footnotes, tables and covers fixes and tweaks #558
Conversation
This hint was initially added to prevent footnote popups by frontend, and is rarely useful and used. Have it also prevent in-page footnotes from being added to the pages of links with that hint.
When footnotes are pushed on a next page, make sure this page ends up in the same "flow": if the next content is part of another "flow", emit a page with only these footnotes, and create a new page for the coming content.
Tweak for table cells similar to how we do with negative text-indent in normal paragraphs. In getRenderedWidths(), try to properly size them when overflow are not allowed ("book" render mode), although this won't handle all cases.
FB2 cover drawing uses a specific codepath: update it so it behaves as all other images drawing in regards to the invertImage setting set on the main DrawBuf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if the fallback cover patch is identical there are at least 8300 known false negatives. (Though I don't recall the <svg><image>
thing otoh. :-)
Please provide 1 real-life EPUB out of these 8300 :) |
All of them follow this pattern: https://www.dbnl.org/tekst/lapi001goet01_01/ebook/lapi001goet01_01.epub |
By "false negative", you mean this commit is not enough to detect the cover in this book ? |
Exactly, it's a false negative because of the text rule. |
We're talking about a single heuristic addition, right? Yes, I think alt=cover (lowercased for comparison) sounds like a sensible thing to use. |
Yes. It's either, in the first XHTML fragment:
|
Sounds good to me. |
If no EPUB3 or EPUB2 cover found, look at the first XHTML fragment from the spine: if it contains a single image and no text, assume that image can be used as a cover. Also relax these conditions if the image has alt"=cover": it must just be before any text and other images.
a6a71cb
to
05b3c3d
Compare
In-page footnotes: avoid with
-cr-hint: noteref-ignore
This hint was initially added to prevent footnote popups by frontend, and is rarely useful and used. Have it also prevent in-page footnotes from being added to the pages of links with that hint.
Already documented at https://github.com/koreader/koreader/blob/67cd647d1a6a36c95d512b1ee461b7a7faf484c4/frontend/apps/reader/modules/readerstyletweak.lua#L882-L885 :
In-page footnotes: ensure they don't cross "flows"
When footnotes are pushed on a next page, make sure this page ends up in the same "flow": if the next content is part of another "flow", emit a page with only these footnotes, and create a new page for the coming content.
See #443 (comment) for details and screenshots of the issue.
Tables: fix rendering when negative text-indent
Tweak for table cells similar to how we do with negative text-indent in normal paragraphs.
In
getRenderedWidths()
, try to properly size them when overflow are not allowed ("book" render mode), although this won't handle all cases.FB2 cover drawing: ensure
_invertImages
flagFB2 cover drawing uses a specific codepath: update it so it behaves as all other images drawing in regards to the invertImage setting set on the main DrawBuf.
Should allow closing koreader/koreader#11574.
EPUB: fallback to look for a cover in the first fragment
If no EPUB3 or EPUB2 cover found, look at the first XHTML fragment from the spine: if it contains a single image and no text, assume that image can be used as a cover. Also accept an image with
<img alt"=cover">
in this first fragment if it comes before any text or other images.See koreader/koreader#11571 (comment).
It uses the idea (and early patch, adapted) described at koreader/koreader#11491 (comment) and followups, that ended up not making it into crengine, as just fixing support for EPUB3 covers was enough (done in #555).
Should allow closing koreader/koreader#11571.
This change is