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

Implement auto-layout for reflowable EPUB #76

Open
JayPanoz opened this issue Oct 28, 2024 · 2 comments
Open

Implement auto-layout for reflowable EPUB #76

JayPanoz opened this issue Oct 28, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@JayPanoz
Copy link
Contributor

With version 2 of ReadiumCSS, implementers are losing the responsive layout that can be mapped to the auto value in user-settings (typically with 1 column or 2 columns as the two other values for this setting).

As researched, developed, and tested in Readium Playground, such an “auto-layout mode” can be tied to a minimal and an optimal line-lengths (as a number of characters, based on the ch length), with the number of columns being determined from these 2 values.

The experimental implementation in Playground is relying on a canvas and measureText to compute these line-lengths depending on the font-family used, a sample of text (e.g. paragraph of content, description in metadata, etc.), letter-spacing and word-spacing, the padding/gap of the page, etc. Then it will check how many optimal line-lengths the current window can host.

Caveats are:

  • word-spacing needs a text-sample to approximate the average of spaces per line;
  • letter-spacing and word-spacing are not implemented for canvas in Safari at the moment;
  • neither are writing-mode and text-orientation so there’s no support for CJK out of the box.

These two last issues can be solved using the same technique though (by rendering character per character, with an offset).

@JayPanoz JayPanoz added the enhancement New feature or request label Oct 28, 2024
@chocolatkey
Copy link
Member

@JayPanoz would the path forwards for you be to port your implementation in the playground to the ts-toolkit?

@JayPanoz
Copy link
Contributor Author

@chocolatkey I guess so, although there’s some overlap with #75 at first sight. We should probably address some things in common e.g. breakpoint if that happens to be supported for a full-fledged “auto-layout” for FXL.

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
Status: Icebox
Development

No branches or pull requests

2 participants