View Single Post
Old 12-25-2014, 07:38 PM   #95
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
`Enforce user line spacing and justification in ePubs` patch

Here is a patch to make the line spacing and justification settings selected from the reading settings (Aa) menu take effect in some epubs where they wouldn't work before.

It works by changing the built-in epub stylesheet so that the line spacing and justification settings are overridden at body and paragraph <p> level, instead of just body level. This is similar to what the kepub reader does.

Note: It still won't work on those books where the publisher has used <div> instead of <p> for paragraphs.

Also note: This is not the ideal way to get these settings to take effect, as it can result in some line spacing or justification settings in the book being overridden when they really shouldn't be. The only way to get perfect results is to edit the book and fix the problems at source.

See the note in the patch about commenting out a line if you are using the `ePub adjustable top/bottom margins` or `ePub fixed top/bottom margin` patches, as this patch changes the same part of the stylesheet used by those patches.

Spoiler:
Code:
<Patch>
patch_name = `Enforce user line spacing and justification in ePubs`
patch_enable = `yes`
#
# This patch causes the line spacing and justification settings selected from
# the reading settings (Aa) menu to be applied at body and paragraph level,
# instead of just at body level. This will result in the settings taking effect
# for some books where they wouldn't before, but there will still be some books
# where they still won't take effect, and there may also be some books where
# they do take effect when they shouldn't. (The only way to get perfect results
# is to edit the epub and fix the problems at source.)
#
replace_string = C99AD0, `b\x00o\x00d\x00y\x00 \x00{\x00\n\x00`, `b\x00o\x00d\x00y\x00,\x00p\x00{\x00`
#
# Comment out the following line if the `ePub adjustable top/bottom margin` or
# `ePub fixed top/bottom margin` patches are enabled.
#
replace_string = C99B8E, `p\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 \x00b\x00o\x00d\x00y\x00 \x00{\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00\n\x00`
</Patch>
GeoffR is offline   Reply With Quote