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

Fixed font size in epub #184

Open
winstonma opened this issue Sep 25, 2024 · 6 comments
Open

Fixed font size in epub #184

winstonma opened this issue Sep 25, 2024 · 6 comments

Comments

@winstonma
Copy link

winstonma commented Sep 25, 2024

Environment

  • Operating System: Ubuntu 24.04
  • node --version: v20.17.0
  • npm --version: 10.8.2
  • yarn --version, if using Yarn:
  • percollate --version: 4.2.3

Description

I first ran the following command to generate the epub file:

percollate epub https://stratechery.com/2024/enterprise-philosophy-and-the-first-wave-of-ai/ -o "Enterprise Philosophy and The First Wave of AI.epub"

Then open the generated epub in Foliate and KOReader. But when I tried to adjust the font size in both app didn't change the font size.

Upload the epub file for checking (I just convert the image in the epub file, other things untouched). Please rename the file into .epub extension and open with your favorite EPUB reader.

@winstonma
Copy link
Author

Also wonder if it is possible that if the command didn't specify the output filename, percollate would use the title as the output filename?

@danburzo
Copy link
Owner

Thanks for reporting. This is the default CSS that ships with the EPUB, I don’t notice anything in there that could prevent the text from scaling in EPUB readers. In any case, you can either add to it with the --css option or replace it with the --style option. I would suggest trying to produce the EPUB without any styles by using:

touch empty-style.css && percollate epub --style empty-style.css https://stratechery.com/2024/enterprise-philosophy-and-the-first-wave-of-ai/ 

It would give us an idea if the issue is with the CSS or the XHTML markup.

Also wonder if it is possible that if the command didn't specify the output filename, percollate would use the title as the output filename?

It should use the simplified title (spaces replaced with dashes, etc.) as the output filename when using the percollate command on a single item.

@winstonma
Copy link
Author

winstonma commented Sep 29, 2024

touch empty-style.css && percollate epub --style empty-style.css https://stratechery.com/2024/enterprise-philosophy-and-the-first-wave-of-ai/

Using the command provided I can adjust the font size. I guess it is caused by the CSS.

Then I tried to edit style.css in the epub, using Sigil. After the following line is removed then I can resize the font of the article in both epub reading app.

font-size: 12pt;

It should use the simplified title (spaces replaced with dashes, etc.) as the output filename when using the percollate command on a single item.

Thanks

@danburzo
Copy link
Owner

Thanks for investigated! If that’s the case, this command should help producing EPUBs until the issue is resolved:

percollate epub --css "html { font-size: initial }" https://article

It remains to be investigated whether having a font-size on the html element in the default CSS is an EPUB antipattern on our side, or whether it makes sense to open issues with the reader apps mentioned.

@winstonma
Copy link
Author

winstonma commented Sep 29, 2024

Thanks

I also checked the EPUB Spec. Here is my finding:

Not sure if that help narrow down

@winstonma
Copy link
Author

winstonma commented Oct 1, 2024

font-size: 12pt;

@danburzo Just wonder if it is a good idea to replace px with em?

Repository owner deleted a comment Oct 24, 2024
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

2 participants