View Single Post
Old 01-30-2015, 03:06 AM   #158
truemarine
Member
truemarine has a complete set of Star Wars action figures.truemarine has a complete set of Star Wars action figures.truemarine has a complete set of Star Wars action figures.truemarine has a complete set of Star Wars action figures.
 
Posts: 20
Karma: 374
Join Date: Dec 2013
Device: K4B, Kobo Aura H2O
Quote:
Originally Posted by GeoffR View Post
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>
Thanks for the patch provided. Is is possible to have control over line spacing and justification seperately? I prefer to have control over line spacing only, for example. In case I really need to override the justification setting, most of the time the epub file needs some modification to itself...
truemarine is offline   Reply With Quote