View Single Post
Old 12-17-2014, 03:02 AM   #71
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
Update for the `Fix kepub side bearing font cut off bug` patchs in post #57. I've added options to the patches to allow for vertical language books:

For the "synced kepubs only" patch there are three options: left/right padding, top/bottom padding, or all four sides (default). The default option should work okay with both horizontal and vertical language kepubs.

For the "all kepubs (synced and sideloaded)" patch there are only two options: left/right padding, or top/bottom padding. This means you need to choose whether to fix the bug for horizontal language kepubs or vertical language kepubs, there is no option that works with both.

The problem with the sideloaded kepubs is that adding padding on all four sides will cause major side effects such as increased space between paragraphs. It would be possible to add padding to left/right or top/bottom depending on the text writing direction of the current book if there was enough space in the stylesheet, but there is just not enough room.

Quote:
Originally Posted by scoky View Post
Could these four padding be written like this?
Code:
body p,body div{padding:0.1em!important}
and there will be enough room.
I can create the patch like that if you want, but I think it will probably have big effects on the layout. I think what really needs to be done is something like this, once for each writing direction:
Code:
body[writingMode="horizontal-tb"] p, body[writingMode="horizontal-tb"] div {padding-left:0.1em!important;padding-right:0.1em!important}
Here is a patch for all kepubs that adds padding to all four sides. Let me know if it is worthwhile adding this as an option for sideloaded kepubs, or does it just have too many side effects on layout:
Spoiler:
Code:
<Patch>
patch_name = `Fix kepub side bearing font cut-off bug (all kepubs, padding all sides)`
patch_enable = `yes`
#
# This patch adds the following line to the built-in kepub stylesheet:
#
#   body p,body div{padding:0.1em 0.1em 0.1em 0.1em!important}
#
replace_string = DB4470, `.\x00K\x00B\x00H\x00i\x00g\x00h\x00l\x00i\x00g\x00h\x00t\x00i\x00n\x00g\x00 \x00{\x00 \x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00-\x00c\x00o\x00l\x00o\x00r\x00:\x00 \x00#\x00C\x006\x00C\x006\x00C\x006\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `.\x00K\x00B\x00H\x00i\x00g\x00h\x00l\x00i\x00g\x00h\x00t\x00i\x00n\x00g\x00{\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00-\x00c\x00o\x00l\x00o\x00r\x00:\x00#\x00C\x006\x00C\x006\x00C\x006\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00.\x00K\x00B\x00S\x00t\x00a\x00c\x00`
#
replace_string = DB44E6, `.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00,\x00 \x00.\x00K\x00B\x00S\x00e\x00a\x00r\x00c\x00h\x00R\x00e\x00s\x00u\x00l\x00t\x00,\x00 \x00.\x00K\x00B\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00,\x00 \x00.\x00K\x00B\x00H\x00i\x00g\x00h\x00l\x00i\x00g\x00h\x00t\x00i\x00n\x00g\x00 \x00,\x00 \x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00{\x00 \x00f\x00o\x00n\x00t\x00-\x00s\x00i\x00z\x00e\x00:\x00 \x001\x000\x000\x00%\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00-\x00w\x00e\x00b\x00k\x00i\x00t\x00-\x00t\x00e\x00x\x00t\x00-\x00c\x00o\x00m\x00b\x00i\x00n\x00e\x00:\x00 \x00i\x00n\x00h\x00e\x00r\x00i\x00t\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00,\x00.\x00K\x00B\x00S\x00e\x00a\x00r\x00c\x00h\x00R\x00e\x00s\x00u\x00l\x00t\x00,\x00.\x00K\x00B\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00,\x00.\x00K\x00B\x00H\x00i\x00g\x00h\x00l\x00i\x00g\x00h\x00t\x00i\x00n\x00g\x00,\x00 \x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00{\x00f\x00o\x00n\x00t\x00-\x00s\x00i\x00z\x00e\x00:\x001\x000\x000\x00%\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00-\x00w\x00e\x00b\x00k\x00i\x00t\x00-\x00t\x00e\x00x\x00t\x00-\x00c\x00o\x00m\x00b\x00i\x00n\x00e\x00:\x00i\x00n\x00h\x00e\x00r\x00i\x00t\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00.\x00K\x00B\x00S\x00e\x00a\x00r\x00c\x00h\x00R\x00e\x00s\x00u\x00l\x00t\x00{\x00b\x00a\x00c\x00k\x00`
#
replace_string = DB4626, `.\x00K\x00B\x00S\x00e\x00a\x00r\x00c\x00h\x00R\x00e\x00s\x00u\x00l\x00t\x00 \x00{\x00 \x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00-\x00c\x00o\x00l\x00o\x00r\x00:\x00 \x00#\x00C\x006\x00C\x006\x00C\x006\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `g\x00r\x00o\x00u\x00n\x00d\x00-\x00c\x00o\x00l\x00o\x00r\x00:\x00#\x00C\x006\x00C\x006\x00C\x006\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00 \x00a\x00{\x00c\x00o\x00l\x00o\x00r\x00:\x00b\x00l\x00a\x00`
#
replace_string = DB469C, `.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00 \x00a\x00 \x00{\x00 \x00c\x00o\x00l\x00o\x00r\x00:\x00 \x00b\x00l\x00a\x00c\x00k\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `c\x00k\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00,\x00.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00`
#
replace_string = DB46FC, `.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00,\x00 \x00.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00C\x00o\x00n\x00t\x00i\x00n\x00u\x00e\x00d\x00 \x00{\x00 \x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00-\x00c\x00o\x00l\x00o\x00r\x00:\x00 \x00t\x00r\x00a\x00n\x00s\x00p\x00a\x00r\x00e\x00n\x00t\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00t\x00e\x00x\x00t\x00-\x00d\x00e\x00c\x00o\x00r\x00a\x00t\x00i\x00o\x00n\x00:\x00 \x00n\x00o\x00n\x00e\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `a\x00t\x00i\x00o\x00n\x00C\x00o\x00n\x00t\x00i\x00n\x00u\x00e\x00d\x00{\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00-\x00c\x00o\x00l\x00o\x00r\x00:\x00t\x00r\x00a\x00n\x00s\x00p\x00a\x00r\x00e\x00n\x00t\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00t\x00e\x00x\x00t\x00-\x00d\x00e\x00c\x00o\x00r\x00a\x00t\x00i\x00o\x00n\x00:\x00n\x00o\x00n\x00e\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00 \x00`
#
replace_string = DB4802, `.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00 \x00a\x00 \x00{\x00 \x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00 \x001\x00p\x00x\x00 \x00s\x00o\x00l\x00i\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `a\x00{\x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x001\x00p\x00x\x00 \x00s\x00o\x00l\x00i\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00 \x00.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00,\x00.\x00K\x00`
#
replace_string = DB48C0, `.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00,\x00 \x00.\x00K\x00B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00C\x00o\x00n\x00t\x00i\x00n\x00u\x00e\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00 \x00{\x00 \x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00 \x002\x00p\x00x\x00 \x00d\x00o\x00t\x00t\x00e\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `B\x00A\x00u\x00t\x00h\x00o\x00r\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00C\x00o\x00n\x00t\x00i\x00n\x00u\x00e\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00{\x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x002\x00p\x00x\x00 \x00d\x00o\x00t\x00t\x00e\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00}\x00.\x00K\x00B\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00,\x00.\x00K\x00B\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00C\x00o\x00n\x00`
#
replace_string = DB49FA, `.\x00K\x00B\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00,\x00 \x00.\x00K\x00B\x00A\x00n\x00n\x00o\x00t\x00a\x00t\x00i\x00o\x00n\x00C\x00o\x00n\x00t\x00i\x00n\x00u\x00e\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00 \x00{\x00 \x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00 \x002\x00p\x00x\x00 \x00s\x00o\x00l\x00i\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `t\x00i\x00n\x00u\x00e\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00h\x00o\x00r\x00i\x00z\x00o\x00n\x00t\x00a\x00l\x00-\x00t\x00b\x00"\x00]\x00{\x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x002\x00p\x00x\x00 \x00s\x00o\x00l\x00i\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00}\x00.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00v\x00e\x00r\x00t\x00i\x00c\x00a\x00l\x00-\x00r\x00l\x00"\x00]\x00 \x00a\x00{\x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00r\x00i\x00g\x00h\x00t\x00:\x001\x00p\x00x\x00 \x00s\x00o\x00l\x00i\x00d\x00 \x00`
#
replace_string = DB4B1A, `.\x00K\x00B\x00S\x00t\x00a\x00c\x00k\x00K\x00e\x00y\x00w\x00o\x00r\x00d\x00[\x00w\x00r\x00i\x00t\x00i\x00n\x00g\x00M\x00o\x00d\x00e\x00=\x00"\x00v\x00e\x00r\x00t\x00i\x00c\x00a\x00l\x00-\x00r\x00l\x00"\x00]\x00 \x00a\x00 \x00{\x00 \x00b\x00o\x00r\x00d\x00e\x00r\x00-\x00r\x00i\x00g\x00h\x00t\x00:\x00 \x001\x00p\x00x\x00 \x00s\x00o\x00l\x00i\x00d\x00 \x00b\x00l\x00a\x00c\x00k\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00 \x00}\x00 \x00\t\x00`, `b\x00l\x00a\x00c\x00k\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00}\x00b\x00o\x00d\x00y\x00 \x00p\x00,\x00b\x00o\x00d\x00y\x00 \x00d\x00i\x00v\x00{\x00p\x00a\x00d\x00d\x00i\x00n\x00g\x00:\x000\x00.\x001\x00e\x00m\x00 \x000\x00.\x001\x00e\x00m\x00 \x000\x00.\x001\x00e\x00m\x00 \x000\x00.\x001\x00e\x00m\x00 \x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00}\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00`
#
# Fix typo in annotations styles: KBAuthorAnnotation --> .KBAuthorAnnotation
replace_string = DB4554, `\x20`, `.`
#
# Replacement values: padding size, 1 = 0.1em (top,right,bottom,left)
replace_string = DB4B6E, `1`, `1`
replace_string = DB4B7A, `1`, `1`
replace_string = DB4B86, `1`, `1`
replace_string = DB4B92, `1`, `1`
#
</Patch>

Last edited by GeoffR; 12-17-2014 at 03:24 AM. Reason: added patch
GeoffR is offline   Reply With Quote