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

Offset value for pagination #1318

Open
decoherencer opened this issue May 19, 2024 · 5 comments
Open

Offset value for pagination #1318

decoherencer opened this issue May 19, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@decoherencer
Copy link

I don't mind mostly double pages appearing if Epubs don't have those properties to enforce pagination always, but I feel there should be an offset value to offset the first page;
most of the time, it's this issue of unmatched pages getting into double page-view instead of displaying with the next one. An offset setting would help a lot.
I may be confused with another software, but I used to use this long ago.

related #1147

@decoherencer decoherencer added the enhancement New feature or request label May 19, 2024
@johnfactotum
Copy link
Owner

johnfactotum commented May 22, 2024

I may be confused with another software, but I used to use this long ago.

You're probably thinking of the "Odd Pages Left" setting in Evince.

@jancborchardt
Copy link

Currently the page layout for double pages always seems to be like this:

1 2
3 4
5 6

Which is not what any standard book does and thus it also destroys the layout of a spread/centerfold. Instead this would be correct:

Empty 1
2 3
4 5

Seems like this could be the default, without any offset setting needed, no?

@johnfactotum
Copy link
Owner

As far as I can tell, yes, for PDF and CBZ, odd page recto should be the default. But the setting is still needed because a large number of documents require odd pages to be verso.

Not entirely sure about fixed-layout EPUB/Kindle books, though. I don't see a particular requirement in the spec and my interpretation has been that it should default to verso, and this is indeed what at least some books assume.

@jancborchardt
Copy link

Not entirely sure about fixed-layout EPUB/Kindle books, though. I don't see a particular requirement in the spec and my interpretation has been that it should default to verso, and this is indeed what at least some books assume.

At least for the EPUBs which I have, all of them would look better with odd page recto as default. They have a cover page, which would be on the right side (or centered, or left) but definitely alone on the first 2-up view.
Then when you open the book you see page 2 left and page 3 right.

But yeah as you said, likely a lot of documents still require a setting anyway. However I would be curious to know if it’s really the majority of documents which do not assume a cover page?

@johnfactotum
Copy link
Owner

johnfactotum commented Jun 21, 2024

With EPUB, it doesn't really have anything to do with cover pages. You're supposed to specify the page-spread-* properties. You can do that with the first page, or any page. Some books set it for every spine item to ensure that every spread would be correctly displayed.

The problem only arises when the EPUB fails to include this info. According to the spec, if you don't specify, it basically means that the spread placement is unimportant:

To indicate that two consecutive pages represent a true spread, EPUB creators SHOULD use the rendition:page-spread-left and rendition:page-spread-right properties on the spine items for the two adjacent EPUB content documents, and omit the properties on spine items where one-up or two-up presentation is equally acceptable.

I could be missing something, but it doesn't seem to say anything about the default placement of the first page. It only says,

When a reading system renders a synthetic spread, the default behavior is to populate the spread by rendering the next EPUB content document in the next available unpopulated viewport, where the next available viewport is determined by the given page progression direction or by local declarations within EPUB content documents.

But we should just do whatever other reading systems are doing. I might be missing something, but from testing with the file from koreader/koreader#6215, which doesn't seem to have any page-spread-* properties and has a blank page before the cover page, it would appear that both Thorium and Apple Books display the spreads correctly. If so then we should continue defaulting to verso page first for EPUBs.

A counter example is "The Real Mother Goose" from https://bbebooksthailand.com/samples.html. This books doesn't use the standard EPUB properties. Instead it relies on the proprietary open-to-spread property in META-INF/com.apple.ibooks.display-options.xml, which isn't supported by Foliate. If I have to guess, this is probably the reason why the EPUBs you have are displayed wrong. now fixed with johnfactotum/foliate-js@51c02bf.


It must be emphasized, though, that the above doesn't necessarily apply to KF8 (AZW3) files. Currently it will read the RESC record, which might contain the correct page-spread-* properties. But I'm not sure what the expected behavior would be if this is not available. From the KF8 version of "The Real Mother Goose" above, unlike the EPUB version, there's no cover page.

But from Amazon's guidelines, if you don't specify page-spread-* in the EPUB, it will default to page-spread-center, which means it won't render any spreads at all!


Anyway, the only way to be sure would be to prepare a bunch of test cases and open them with Apple Books, Thorium Reader, Kindle Previewer, etc.

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

No branches or pull requests

3 participants