View Single Post
Old 05-19-2015, 08:41 AM   #10
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
Margin patches

The following three patches can be used individually or in any combination:

1. `Custom left & right margins`

The margin adjustment slider has nine settings which allow the left/right margins to be increased by a percentage of the screen width. The increase is in addition to any @page or body margin set in the book by the publisher.

In the unpatched firmware the increments are 0%, 2%, 4%, 6%, 8%, 10%, 12%, 14%, 16%. At the highest setting almost one third of the screen is margin! The `Custom left & right margins` patch allows these nine values to be changed, the default patched increments are: 0%, 1%, 2%, 3%, 4%, 5%, 6%, 7%, 8%.


2. `Custom kepub default margins`

The KEPUB reader has an extra default left/right margin of 20px (25px on the Glo/Aura) which is added to the margin set in the book and by the adjustment slider. The `Custom kepub default margins`patch allows the size of this default margin to be changed. The default patched value is 5px.

The following screenshots (Glo, 3.15.0) show a synced KePub with the margin adjustment slider set to minimum:
1. Normal reading mode, without patch.
2. Normal reading mode, patched.
3. Full-screen reading mode, without patch
4. Full-screen reading mode, patched.
Click image for larger version

Name:	unpatched-kepub-normal.png
Views:	4750
Size:	100.7 KB
ID:	138452Click image for larger version

Name:	patched-kepub-normal.png
Views:	4577
Size:	100.6 KB
ID:	138453Click image for larger version

Name:	unpatched-kepub-full-screen.png
Views:	4395
Size:	109.4 KB
ID:	138454Click image for larger version

Name:	patched-kepub-full-screen.png
Views:	4422
Size:	113.6 KB
ID:	138455
(Note that all screenshots are with the `Fix kepub side bearing font cut-off bug` patch applied, which makes the left/right margins an extra 0.2em larger.)


3. `ePub fixed/adjustable top/bottom margins`

(Note that in some firmware versions there were separate `ePub fixed top/bottom margins` and `ePub adjustable top/bottom margins` patches.)

This patch modifies the built-in EPUB stylesheet to set the top and bottom @page margins to either a fixed number of pixels, or to a variable size depending on the position of the margin adjustment slider. The left/right @page margins are set to zero. The margins set by this patch override the @page margins set in the book by the publisher.

The patch has three options, which can be changed independently:
1. Choose the top margin to be adjustable, or set a fixed size in px.
2. Choose the bottom margin to be adjustable, or set a fixed size in px.
3. Choose the adjustment multiple, a size in px that the adjustable top/bottom margins change by for each percent of screen width of the left/right margins set by the adjustment slider.

In full-screen reading mode the KEPUB reader sets the top/bottom margins to be equal to the left/right margin, so when you move the adjustment slider all four margins change. The adjustable top/bottom option of the `ePub fixed/adjustable top/bottom margins` patch adds a similar feature to the EPUB reader. However, unlike the KEPUB reader, the patch affects epubs in both normal and full-screen reading modes.

The images below are each a composite of nine screenshots showing a rectangle drawn to the maximum size available at each position of the margin slider:
1. Normal reading mode, default patch settings (adjustment multiple = 6px.)
2. Full-screen reading mode, adjustment multiple = 7px.
Click image for larger version

Name:	epub-normal.png
Views:	4190
Size:	6.9 KB
ID:	138450Click image for larger version

Name:	epub-fullscreen.png
Views:	5282
Size:	4.9 KB
ID:	138451

These screenshots were taken from the first page of this test book: margintest.epub on my Glo with firmware 3.15.0 and the `Custom reading footer style`, `Custom left & right margins` patches (with default patch settings) in addition to the `ePub fixed/adjustable top/bottom margins` patch.

Getting the most out of this patch might take a bit of trial and error, as the best choice of adjustment multiple depends not only on device type but on whether you use normal or full-screen reading mode.

In full-screen mode the adjustment multiple should be about 1% of the screen width (6px for Touch/Mini, 7-8px for Glo/Aura, 10-11px for AuraHD/H2O/GloHD), assuming there is no left/right body margin set in the book.

But in normal reading mode, because of the footer and small built-in top margin, it is impossible to get a value for the adjustment multiple that results in the top/bottom margin being proportional to the left/right at all slider settings unless a body margin is added to the book (which then messes with the proportionality in full-screen reading mode.) A value slightly less than 1% should give reasonable results except at the lowest slider positions.

Last edited by GeoffR; 05-19-2015 at 12:05 PM. Reason: Use the term 'adjustment multiple' to refer to the amount the adjustable top/bottom margins increase by.
GeoffR is offline   Reply With Quote