View Single Post
Old 10-14-2016, 09:25 AM   #3
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Quote:
Originally Posted by chromeuser View Post
I just got the Kobo Aura One - so far, I like it. However, I have a problem with the margins with sideloaded epubs. The margin space works for left and right but not top and bottom (there is little space at the top). Is there a patch that allows me more control over the margins? Also, how would I install the patch? Thanks!
This can be quite a complicated topic because there are different ways the publisher can set the top/bottom margins, and so while there are some simple solutions that will work for most books, there are certain books that might need extra work to fix.

In short, the simplest method is to use Calibre to change the @page margin in the book's stylesheet. You can do this manually by editing the book and adding your own @page style, or automatically by configuring the KoboTouch driver to use the "Modify CSS" feature.

An example of a @page margin style, to increase the top margin only, is:
Code:
@page { margin-top: 25px; margin-bottom: 0px; }
Change the numbers to suit your device and preferences, put it in a file named "kobo_extra.css" in the root directory of your device, and configure the KoboTouch driver in calibre to enable the "Modify CSS" option. Thereafter every book you send to the device with Calibre will have that style added to its CSS stylesheet.

There are also patches that can override the publisher's @page top/bottom margin style, either with a fixed-size margin, or with adjustable margins that change when you change the left/right margins with the slider. See this post. If you do choose to use a patch, I recommend still using Calibre to change the @page margin in the book as well, so that if the patches stop working in the future you will still have sensible @page margins in the book to fall back on. Apart from being able to make the top/bottom margins adjustable, the advantage of patching is that it can override the @page margins in DRM books too.

But there are complications, here are some:

1. There are actually two ways that the publisher can set the top/bottom margins in a book: @page margin styles in the CSS stylesheet is one; the other is using the Adobe XPGT stylesheet (usually called page-template.xpgt). Some publishers use one method, some use the other, some use both (resulting in extra-large margins), and some use neither. The easiest way to avoid this complication is to use the Modify ePub plugin in Calibre to "Remove Adobe .xpgt files and links" before you sideload the book. There is also a patch that will cause the XPGT stylesheet to be ignored.

2. Some publishers set different @page styles for different parts of the book. For example, some set zero margins on the cover page so that the cover reaches the edges of the screen, but set it to a larger value for other pages. if you use the patch to override the @page margins then it will override all of them with the same value. If you use Calibre to change the @page margins in the stylesheet it might not override styles set for individual pages inside the individual HTML files. You can use the Modify ePub plugin to "Modify @page and body margin styles" to override the @page margins, but it doesn't always work for the body margins.

3. If the publisher makes the left/right margins large then the top/bottom margins will not be in proportion, and since the left/right margins can be set by the publisher using a number of different methods it is impossible to account for every possibility with any automatic procedure. There will be some books where the only way to reduce the left/right margins is to edit the book manually.

4. You may need to change the top/bottom margins if you switch from normal reading mode to full-screen mode, because of the huge footer in normal mode you probably want the bottom page margin to be zero, but in full-screen mode you probably want it to be the same as the top margin.

5. Edit: There are other things that affect the size of the gap at bottom of the page apart from margins: widows/orphans paragraph styles can add extra blank lines, so you might want to override the default or publisher's orphan/widows settings as well as @page margins, either using Calibre or a patch. Even with a zero bottom margin and no extra blank lines caused by orphans/widows settings, the space used by the footer is very large so you might want to reduce it using a patch. Also with some fonts the text doesn't sit in the centre of the line, so for example if it sits closer to the top of the line than the bottom then the top margin will look smaller and the bottom margin bigger. Some publishers have a small margin between each paragraph, which makes it impossible to get the gap at the bottom of the page consistent from page to page bacuse the number of paragraphs changes.

Edit: I am not suggesting this would suit everyone, but personally this is what I do (I have a Glo, currently running firmware 3.19.5761 but this hasnt changed for years):
* I read all books in full-screen mode (no header or footer.)
* I strip all XPGT stylesheets from the book using Modify ePub before sideloading.
* I manually edit all books before sideloading to set the left/right body margins to zero, set the orphans/widows to 1, remove margins between paragraphs, and set a default @page margin in the CSS stylesheet (but I leave the publisher's @page margins intact for special cases like the cover page.)
* I use the `ePub fixed/adjustable top/margins` patch with top and bottom margin adjustable. Because I have set the left/right margins in the book to zero, that results in all four top/bottom/left/right page margins being the same size whichever slider setting I select.

Last edited by GeoffR; 10-14-2016 at 10:45 AM. Reason: ... personally this is what I do ...
GeoffR is offline   Reply With Quote