View Single Post
Old 02-23-2015, 05:23 AM   #15
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 `KePub zero body margin/padding` patch.

I've updated the `KePub zero body margin/padding` patch. (This patch fixes the problem with some kepubs in full-screen reading mode where the text is shifted to the right and cut off at the right margin.)

The new patch fixes the problem in full-screen mode, but unlike the old patch it doesn't prevent the margins being changed in normal reading mode.

Spoiler:
Code:
<Patch>
patch_name = `KePub zero body margin/padding`
patch_enable = `yes`
# Multi-version patch: 3.12.0 - 3.13.1+
#
# This patch adds the following to the built-in KePub stylesheet:
#
#   body{margin:0!important;padding:0!important}
#
# which solves the problem with the text of some KePubs being shifted to the
# right and cut off at the right margin in full-screen reading mode.
#
find_base_address = `\t\0.\0K\0B\0S\0t\0a\0c\0k\0K\0e\0y\0w\0o\0r\0d\0[\0w\0r\0i\0t\0i\0n\0g\0M\0o\0d\0e\0=\0"\0v\0e\0r\0t\0i\0c\0a\0l\0-\0r\0l\0"\0]\0`
#
replace_string = 0000, `\t\0.\0K\0B\0S\0t\0a\0c\0k\0K\0e\0y\0w\0o\0r\0d\0[\0w\0r\0i\0t\0i\0n\0g\0M\0o\0d\0e\0=\0"\0v\0e\0r\0t\0i\0c\0a\0l\0-\0r\0l\0"\0]\0 \0a\0 \0{\0 \0b\0o\0r\0d\0e\0r\0-\0r\0i\0g\0h\0t\0:\0 \01\0p\0x\0 \0s\0o\0l\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\0x\0 \0d\0o\0t\0t\0e\0d\0 \0b\0l\0a\0c\0k\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0}\0 \0\t\0`, `r\0t\0i\0c\0a\0l\0-\0l\0r\0"\0]\0,\0.\0K\0B\0A\0u\0t\0h\0o\0r\0A\0n\0n\0o\0t\0a\0t\0i\0o\0n\0C\0o\0n\0t\0i\0n\0u\0e\0d\0[\0w\0r\0i\0t\0i\0n\0g\0M\0o\0d\0e\0=\0"\0v\0e\0r\0t\0i\0c\0a\0l\0-\0l\0r\0"\0]\0{\0b\0o\0r\0d\0e\0r\0-\0l\0e\0f\0t\0:\02\0p\0x\0 \0d\0o\0t\0t\0e\0d\0 \0b\0l\0a\0c\0k\0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0}\0b\0o\0d\0y\0{\0m\0a\0r\0g\0i\0n\0:\00\0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0p\0a\0d\0d\0i\0n\0g\0:\00\0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0}\0`
#
# The body rule inserted above takes effect in normal reading mode too, which
# interferes with another rule used to set the user margins in normal reading
# mode. To prevent that happening, the following change is made to increase the
# priority of the user margin setting rule:
#
#     body { margin: 0px %1% 0px %2% ! important;}\n
# --> html body{margin:0px %1% 0px %2%!important;}\n
#
find_base_address = `b\0o\0d\0y\0 \0{\0 \0m\0a\0r\0g\0i\0n\0:\0 \00\0p\0x\0 \0%\01\0%\0`
#
replace_string = 0000, `b\0o\0d\0y\0 \0{\0 \0m\0a\0r\0g\0i\0n\0:\0 \00\0p\0x\0 \0%\01\0%\0 \00\0p\0x\0 \0%\02\0%\0 \0!\0 \0i\0`, `h\0t\0m\0l\0 \0b\0o\0d\0y\0{\0m\0a\0r\0g\0i\0n\0:\00\0p\0x\0 \0%\01\0%\0 \00\0p\0x\0 \0%\02\0%\0!\0i\0`
</Patch>


Edit: New patch above, also added to patch_kobo_3131.zip attached to post #1.

Last edited by GeoffR; 02-24-2015 at 12:21 AM. Reason: Include new patch in this post and in patch_kobo_3131.zip in post #1
GeoffR is offline   Reply With Quote