View Single Post
Old 01-06-2015, 09:59 PM   #109
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
Improved `ePub fixed/adjustable top/bottom margins` patch.

I have a new patch that replaces both the `ePub adjustable top/bottom margin` and `ePub fixed top/bottom margin` patches.

With this patch you can choose the top and bottom @page margin behaviour independently. E.g. you can choose an adjustable top margin with a fixed bottom margin of custom size, or both margins adjustable, or both margins of different fixed sizes, etc.

Spoiler:
Code:
<Patch>
patch_name = `ePub fixed/adjustable top/bottom margins`
patch_enable = `yes`
#
# If enabled, this patch sets the @page margin sizes in epubs, overriding any
# @page margin set in the book's stylesheet.
#
# By default the top and bottom margins are set to be adjustable, their size
# similar to the left/right margin size set by the adjustment slider. There
# are options to set the top and/or bottom margin to a fixed size instead.
#
# Note that this patch has the side-effect of removing the body bottom padding
# from the built-in stylesheet, which means that there will no longer be a line
# of padding added automatically at the end of chapters.
#
# getReadingLineHeight(...) --> getReadingLeftMargin(...)
replace_bytes = 51EBC0, 4A F7 EC E8, 2C F7 F4 ED
# QString.arg(double, ...) --> QString.arg(int64, ...)
replace_bytes = 51EBC4, 20 22 4F F0 FF 33, 20 21 01 22 0A 23
replace_bytes = 51EBCE, AD F8 04 20 00 93, 02 91 42 43 01 93
replace_bytes = 51EBD8, 00 22 67 23 37 F7 EA EC, 00 23 00 93 2C F7 94 E9
#      padding-bottom: %1em !important;\n
# --> }@page{margin:%1px 0 %1px 0}\nbody{
replace_string = C99B8C, `\x20\x00p\x00a\x00d\x00d\x00i\x00n\x00g\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00 \x00%\x001\x00e\x00m\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00\n\x00`, `}\x00@\x00p\x00a\x00g\x00e\x00{\x00m\x00a\x00r\x00g\x00i\x00n\x00:\x00%\x001\x00p\x00x\x00 \x000\x00 \x00%\x001\x00p\x00x\x00 \x000\x00}\x00\n\x00b\x00o\x00d\x00y\x00{\x00`
#
# Optional replacement value: Uncomment for a fixed top margin size in px,
# default 25px. Replacement value is margin size, two digits separated by \x00
# (Leave commented out for an adjustable top margin.)
#replace_string = C99BA8, `%\x001`, `2\x005`
#
# Optional replacement value: Uncomment for a fixed bottom margin size in px,
# default 00px. Replacement value is margin size, two digits separated by \x00
# (Leave commented out for an adjustable bottom margin.)
#replace_string = C99BB6, `%\x001`, `0\x000`
#
# Replacement value: Sets the value of the adjustable top/bottom margin (if any)
# to a multiple of readingLeftMargin, in pixels. Suggested values are:
# Normal reading mode: 5px (Touch/Mini), 6px (Glo/Aura), 8px (AuraHD/H2O)
# Full-screen reading mode: 6px (Touch/Mini), 7px (Glo/Aura), 10px (AuraHD/H2O)
replace_int = 51EBC6, 1, 6
</Patch>

Last edited by GeoffR; 01-06-2015 at 10:09 PM. Reason: spelling
GeoffR is offline   Reply With Quote