-
-
Notifications
You must be signed in to change notification settings - Fork 297
Home
- Reading progress slider not showing up?
- How are notes and bookmarks stored?
- How to use text-to-speech?
- How to use custom themes?
- My book is not displayed properly!
- Custom style isn't applied consistently
- How are reading time estimates calculated?
- Why does the Flatpak require sandbox escape?
- Known issues
In order to display the slider, Epub.js must generate locations for the entire book. For books with lots of pages, this could take a while. In the meantime, you can still read the book and use all other functionalities normally.
Once the locations are generated, the info is cached (in ~/.cache/com.github.johnfactotum.Foliate
) and should load instantly next time you open the book.
Your reading progress, bookmarks, and annotations are saved in ~/.local/share/com.github.johnfactotum.Foliate
If you're using the flatpak version, they should be in ~/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate
The data for each book is stored in a JSON file named after the book's identifier. If you'd like to sync or backup your progress and notes, simply copy these files and everything should just work™.
Inside the JSON file, the structure looks like this:
{
"lastLocation": "epubcfi(/6/12[main2]!/4/2/2/2/1:0)", // your reading progress
"annotations": [
{
"value": "epubcfi(/6/12[main2]!/4/2/2/2,/1:0,/1:286)",
// highlight color
"color": "aqua",
// the highlighted text
"text": "Good sense is, of all things among men, the most equally distributed; for every one thinks himself so abundantly provided with it, that those even who are the most difficult to satisfy in everything else, do not usually desire a larger measure of this quality than they already possess.",
// ... and your note
"note": "Very droll, René."
},
// ...
],
"bookmarks": [], // bookmarks are stored here
"metadata": { /* the book's metadata is provided here for convenience, starting from v1.5.0 */ }
}
The "epubcfi(...)" parts are EPUB Canonical Fragment Identifiers, which is the "standardized method for referencing arbitrary content within an EPUB® Publication."
Foliate supports espeak
/espeak-ng
and festival
. The exact command can be configured in the preference dialog.
Other speech synthesis programs can be used, but Foliate expects the following interface:
- The program would read text from
stdin
and speak them - Return when finished speaking
- Stop speaking when
SIGINT
is received
If the program doesn't support this, one can write a wrapper script and set it as the TTS command. For example, to use gTTS, the following script can be used:
#!/bin/bash
gtts-cli --file /dev/stdin | play -t mp3 - &
trap 'kill $!; exit 0' INT
wait
The themes can be configured from the menu. This is the recommended way.
If you want to manually edit themes, you can edit the file /home/user/.config/com.github.johnfactotum.Foliate/themes.json
(or create the file if does not already exists). If you're using the flatpak version, the file should be placed in ~/.var/app/com.github.johnfactotum.Foliate/config/com.github.johnfactotum.Foliate
.
You can help by testing out whether it's a problem with Epub.js, or a problem specific to Foliate:
- Go to https://futurepress.github.io/epub.js/examples/input.html (It's best to test with a WebKit-based browser, as there are sometimes WebKit specific issues)
- Use the input button at the top of that page to choose your file. Note that the button might not show if your viewport is too small. Try resizing the window or zooming out if you don't see the button.
- The prev/next button on their example is currently broken. However, if you open your browser's developer tools, you should be able to use the console and run
rendition.next()
andrendition.prev()
. - If it doesn't work, consider reporting the issue upstream. If it only fails in Foliate, you can report it here.
Currently Foliate only overrides font-size on body
and p
with !important
, and it may not work with some books' stylesheet. You can edit the book (either manually or with an editor) and view the stylesheet to see what's causing this, then we can see if we can override it without breaking other books.
Generally, it's kind of hard to strike a balance between user control and publisher control. Ultimately, it is up to the publishers to not hardcode styles too much.
Currently, it simply uses the number of characters as a rough estimate, with adjustments applied to CJK languages. (If it's wildly inaccurate for some language, please open an issue!) It isn't based on the page turning speed.
Foliate requires the --talk-name=org.freedesktop.Flatpak
permission in order to access dictd
and text-to-speech programs on the host. If you don't need these functionalities, you can override this permission.
Books with vertical text are not currently supported. This has been reported upstream.