babluboy / bookworm

A simple ebook reader for Elementary OS
GNU General Public License v3.0
1.32k stars 100 forks source link

Pages Support #170

Open freddyhayward opened 6 years ago

freddyhayward commented 6 years ago

I read in #162 that page support (i.e. splitting chapters into pages based on character/line length) has been requested, but I couldn't find it any open issues regarding it on this repo. IMO this should be considered as a top priority in reaching parity with commercial ebook readers as it's how most people would expect to read books. As also mentioned in #162, this would allow for better bookmarking support and would make 2-page view more practical, as it would eliminate the need to scroll back up halfway through a chapter.

babluboy commented 6 years ago

@tttom64 Thanks for raising this. splitting chapters into pages is a key future goal and I will use this issue to track the same. Pages can be a fixed number of chars or a fixed number of lines - this again need to be adjusted based on the window size? I need to think on how to design the same to be simple and generic for all ebook formats. once a chapter is broken into pages, the bookmark will support the pages as well.

ghost commented 6 years ago

For what it's worth, all readers I know start up in pages mode per default, and I find it makes a huge difference in reading lengthier pure text books like fiction novels, where you can easily lose track of where you are when scrolling a huge viewport filled with a continuous wall of text. So it would be amazing if that could be added :smile:

Edit: also, I believe all major readers split up lines arbitrarily based on chars that fit based on current window size - so not on some notion of preexisting line breaks.

captain-cavemaaaan commented 5 years ago

When you say "future goal", how far off in the future are you talking? This ought to be priority number one, to be completed yesterday, as it really isn't a useful application the way it works at the moment. Looks like a fine reader otherwise (I have a few other quibbles, but not show-stoppers), and I'll try to remember to come back and check on the progress from time to time, but since this issue goes back at least a year, I'm not holding my breath... (Edit: actually, if I disable "two page reading" and keep the window very narrow, it's merely annoying, not actually unusable)

babluboy commented 5 years ago

@captain-cavemaaaan apologies for the long running issue. I try to implement it but has not found a way that is fast and efficient without breaking the fundamental design of displaying html content.

I think the way to achieve pagination is to hide content exceeding the current viewport and show it in chunks until the complete HTML chapter is read. There is no use trying to split the html contents at the time the book is processed into the library as the user can change the view port size any time by resizing the window.

I can only give my spare time to improve bookworm but rest assured this issue is on top of my agenda. If anyone is able to provide a suitable javascript for showing content dynamically it will be great. I have tried some methods but does not work correctly with webview that bookworm uses

captain-cavemaaaan commented 5 years ago

I just upgraded to Fedora 29 and bookworm just segfaults now, so I can't test it, but if you just put "html { height: 100%; column-width: 100mm; }" into a style sheet, that should limit the text height (it works in Firefox, to produce a side-scrolling view, but spacebar doesn't work to page down (or across, rather); without column-width it has no effect. Use a suitably narrow minimum column width, and you can use column-count to limit to 1 or 2 columns). Obviously you want to do it in bookworm, though (if it works there), so the epub author doesn't have to....

babluboy commented 5 years ago

@captain-cavemaaaan thanks for the suggestion I was trying to use the column method but didn’t quite get it to work will check further.

I will raise another issue to track the segfault and fix it for fedora.

babluboy commented 4 years ago

This link provides some approaches that I can make use of for splitting long chapters into various pages

https://stackoverflow.com/questions/49330858/display-dynamic-html-content-like-an-epub-ebook-without-converting-html-to-epub/52141971

cges30901 commented 4 years ago

I think CSS column-count might be easier. You increase column-count until content fit in each page. However, this method will fail if big elements like images exist, so it needs adjustments.

babluboy commented 4 years ago

I think CSS column-count might be easier. You increase column-count until content fit in each page. However, this method will fail if big elements like images exist, so it needs adjustments.

Thanks. I was trying with CSS columns but could not get it to work. Is there a sample working code you can point me at.

cges30901 commented 4 years ago

I will provide javascript I am using later. I am dealing with a bug that makes pagination fail now.

cges30901 commented 4 years ago

Hello, this and this are the javascripts I use.

Current problems:

  1. Margin of body and images are hardcoded.
  2. Images are set to block.
  3. Not sure if there are other elements that make pagination fail.
  4. Other problems that I do not notice.
babluboy commented 4 years ago

@cges30901 Can you show me an example of how to use this javascript.