View Single Post
Old 11-19-2015, 08:19 PM   #116
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 disable built-in body padding-bottom`

The built-in ePub stylesheet has the following line:
Code:
body { padding-bottom: %1em !important; }
where %1 is the currently selected line height calculated from the position of the line spacing slider.

This has the effect of adding a blank line to the end of the chapter (assuming the book has been created in the normal way with files split at chapter boundaries), and if the last line of text in the chapter would have fallen on the last line of the page then it gets pushed to the next page. More than one line might get pushed to the next page if the book has widows/orphans set higher than 1, or perhaps in some other situations such as if the body font-size is larger than the paragraph font-size.

The `ePub fixed/adjustable top/bottom margins` and `Enforce user line spacing and justification in ePubs` patches remove this line from the built-in stylesheet to make room for other things, but if you don't use those patches and want to prevent the last line of the chapter being pushed to the next page, then the following patch can be used to disable it:

Multi-version patch, paste into libnickel.so.1.0.0.patch:
Spoiler:
Code:
<Patch>
patch_name = `ePub disable built-in body padding-bottom`  
patch_enable = `yes`
# Multi-version patch: 3.3.0 - 3.18.0+
#
# The built-in ePub stylesheet adds a line of padding at the bottom of the
# body element, to prevent the chapter ending on the last line of a page.
# This patch disables that stylesheet entry.
#
# This patch is not compatible with `ePub fixed/adjustable top/bottom margins`
# or `Enforce user line spacing and justification in ePubs` patches, which
# already remove this stylesheet entry to make room for other things.
#
#      padding-bottom: %1em !important;\n
# -->  _adding-bottom: %1em !important;\n
#
find_base_address = `\x20\0p\0a\0d\0d\0i\0n\0g\0-\0b\0o\0t\0t\0o\0m\0:\0 \0%\01\0e\0m\0`
replace_string = 0002, `p`, `_`
</Patch>


Edit: These screenshots show the last page(s) of an ePub chapter (with orphans:1;widows:1;) settings are unchanged except for the above patch:

Unpatched:
Click image for larger version

Name:	unpatched1.png
Views:	521
Size:	128.2 KB
ID:	143919 Click image for larger version

Name:	unpatched2.png
Views:	535
Size:	6.2 KB
ID:	143920

Patched:
Click image for larger version

Name:	patched1.png
Views:	528
Size:	129.7 KB
ID:	143921

Last edited by GeoffR; 11-20-2015 at 12:42 AM. Reason: Added screenshots
GeoffR is offline   Reply With Quote