View Single Post
Old 12-18-2018, 01:53 AM   #50
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
`ePub left/right margins step size` (testing)

Left/Right margin size seems to be calculated in ReaderService::setViewport as W*(N/100.0), where W is screen width and N is the value selected from the margins slider. This patch changes the denominator from 100.0 (1% step size) to 200.0 (0.5% step size). Change 200.0 to any other value you like, e.g. 125.0 = 0.8%, 133.3 = 0.75%, 400.0 = 0.25%, etc. (percentage of screen width.)

Edit: As another example, you could get a margin step size of one pixel per step by setting the denominator to the screen width in pixels, e.g. 758.0 for the Glo, 1072.0 for the Clara, etc. (But probably not useful to set such a small step size when there are only nine steps on the margins slider.)

Note that the step value N is affected by the `Custom left/right margins` patch, and if you use the `ePub fixed/adjustable top/bottom margins` patch then you should adjust the suggested step size value in that patch to match the change made here, e.g. halve it there if using the 200.0 value here.

Beware that enabling this patch means that the margin step size will be different in ePub and KePub books, which could be annoying if you read both. To be really useful we would also need a KePub version of this patch, plus a patch to add more values to the margins slider.

(And as always, the actual final margin size might be affected by things in the individual book's stylesheet.)

`ePub left/right margins step size` (libnickel.so.1.0.0.patch)
Spoiler:
Code:
<Patch>
patch_name = `ePub left/right margins step size`
patch_enable = `no`
#
# Local constant in ReaderService::setViewport
replace_float = 48ca28, 100.0, 200.0
</Patch>

Last edited by GeoffR; 12-18-2018 at 03:18 AM. Reason: Added one pixel per step example.
GeoffR is offline   Reply With Quote