View Single Post
Old 12-01-2015, 12:19 AM   #132
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
`Fix three KePub fullScreenReading bugs`

This is a new patch to replace the three seperate patches (`KePub zero body margin/padding`, `Fix kepub side bearing font cut-off bug`, `Disable KePub FullSceenReading block img style`) for the three problems that affect KePubs in full-screen reading mode. (See this post)

I will be including this patch instead of the other three patches in future versions, and I intend to have it enabled by default, so I'm posting it here in case anyone wants to test it out.

It has the advantage that is is much simpler, and has no effect on normal reading mode at all.

Multi-version patch 3.3.0 - 3.18.0+, paste into libnickel.so.1.0.0.patch.
Spoiler:
Code:
<Patch>
patch_name = `Fix three KePub fullScreenReading bugs`
patch_enable = `yes`
# Multi-version patch: 3.3.0 - 3.18.0+
#
# (See https://www.mobileread.com/forums/showpost.php?p=3113460&postcount=16
# for screenshots and more information about the problems this patch fixes.)
#
# In full-screen reading mode (when the FullScreenReading feature setting is
# activated and the "Show header and footer" reading setting is unticked) the
# KePub reader has three problems:
#
# 1. If the book's stylesheet has non-zero body margin/padding, then the
#    text is shifted to the right and can be cut off at the right margin.
# 2. Characters with large side bearing values (such as italic f, J) can
#    be cut off if they appear at either end of a line.
# 3. Images which are supposed to be displayed inline (flowing with the text)
#    are instead displayed centred in a seperate block.
#
# This patch fixes those problems by replacing the following faulty style,
# which is the cause of problem 3.:
#
#   img {
#     display: block;
#     margin-left: auto !important;
#     margin-right: auto !important;
#     width: auto !important;
#     height: auto !important;
#   }
#
# with the following two styles, which work around problems 1. and 2.:
#
#   body {
#     margin: 0 !important;
#     padding: 0 !important;
#   }
#
#   body>div {
#     padding-left: 0.2em !important;
#     padding-right: 0.2em !important;
#   }
#
#
find_base_address = `\0i\0m\0g\0 \0{\0 \0d\0i\0s\0p\0l\0a\0y\0:\0 \0b\0l\0o\0c\0k\0;\0`
replace_string = 0001, `i\0m\0g\0 \0{\0 \0d\0i\0s\0p\0l\0a\0y\0:\0 \0b\0l\0o\0c\0k\0;\0 \0m\0a\0r\0g\0i\0n\0-\0l\0e\0f\0t\0:\0 \0a\0u\0t\0o\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0m\0a\0r\0g\0i\0n\0-\0r\0i\0g\0h\0t\0:\0 \0a\0u\0t\0o\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0w\0i\0d\0t\0h\0:\0 \0a\0u\0t\0o\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0h\0e\0i\0g\0h\0t\0:\0 \0a\0u\0t\0o\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0}\0`, `b\0o\0d\0y\0 \0{\0 \0m\0a\0r\0g\0i\0n\0:\0 \00\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0p\0a\0d\0d\0i\0n\0g\0:\0 \00\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0}\0 \0 \0b\0o\0d\0y\0>\0d\0i\0v\0 \0{\0 \0p\0a\0d\0d\0i\0n\0g\0-\0l\0e\0f\0t\0:\0 \00\0.\02\0e\0m\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0p\0a\0d\0d\0i\0n\0g\0-\0r\0i\0g\0h\0t\0:\0 \0 \00\0.\02\0e\0m\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0}\0`
#
#
# Optional replacement values below (all relate to the second problem above):
#
# Uncomment to set the amount of added padding: `1` = 0.1em, `2` = 0.2em, etc.
# 0.1em is enough for many fonts, but some (such as Georgia) need 0.2em.
#
#replace_string = 00A5, `2`, `1`
#replace_string = 00E9, `2`, `1`
#
# The default patch settings are suitable for horizontal languages only.
# Uncomment the following two replace_string lines for vertical languages only:
#
#replace_string = 0095, `l\0e\0f\0t\0:\0`, `t\0o\0p\0:\0 \0`
#replace_string = 00D5, `r\0i\0g\0h\0t\0:\0 \0`, `b\0o\0t\0t\0o\0m\0:\0`
#
# ... or the following two replace_string lines for both horizontal and vertical
# languages: (But note that this will cause the padding to be added at the
# beginning/end of each chapter too.)
#
#replace_string = 0093, `-\0l\0e\0f\0t\0:\0`, `:\0 \0 \0 \0 \0 \0`
#replace_string = 00AD, `!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0 \0p\0a\0d\0d\0i\0n\0g\0-\0r\0i\0g\0h\0t\0:\0`, `\x20\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0`
#
# Sideloaded KePubs created with old versions of the KoboTouchExtended driver,
# and perhaps some other KePubs that haven't been through Kobo's EPUB2 to KEPUB
# conversion process, might not have a wrapper div to apply the padding styles
# to. Uncomment the following line to work around the second problem for these
# KePubs too. (But beware, this can have unwanted side effects such as extra
# space between paragraphs if the above option for both horizontal and vertical
# languages is uncommented too.)
#
#replace_string = 0079, `d\0i\0v\0`, `*\0 \0 \0`
</Patch>
GeoffR is offline   Reply With Quote