pgaskin / kobopatch-patches

Patches for use with kobopatch.
https://pgaskin.net/kobopatch-patches/
MIT License
236 stars 22 forks source link

Synched KePub padding adjustment for vertical layout #83

Open keikhcheung opened 3 years ago

keikhcheung commented 3 years ago

Hello,

Is there a possible way to add/modify the latest patch release 4.25.15875 to increase padding-bottom for vertical layout for synchronised KePub? I am having a problem when reading synched KePubs with some side-loaded fonts where the bottom Chinese/Japanese/Korean character would get cut off. I would like to add some padding-bottom of 0.3em to it.

When using original publisher default font, things are fine. publisher-default

When using side-loaded fonts, you can see the last characters on each line in the red rectangle are cut off. side-loaded-font-1

side-loaded-font-2

I crawled up a bit the old Kobo patches here and found these lines. I thought they may be helpful so I tried adding them to libnickel.so.1.0.0.yaml of the kobopatch_4.25.15875. However, that doesn't work and I could not really figure out how to otherwise either…

The code I added to libnickel.so.1.0.0.yaml is:

Fix three KePub fullScreenReading bugs:
  - Enabled: yes
  - Description: See https://www.mobileread.com/forums/showpost.php?p=3113460&postcount=16
  - FindReplaceString:
      Find:    "img { display: block; margin-left: auto !important; margin-right: auto !important; width: auto !important; height: auto !important; }"
      Replace: "body { margin: 0 !important; padding: 0 !important; }  body>div { padding-left: 0.2em !important; padding-right:  0.3em !important; }"
      # CUSTOM SETTING: Changing padding-right from 0.2em to 0.3em.
      #
      MustMatchLength: yes
    # Optional replacement values below (all relate to the second problem above):
    # 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.
  - ReplaceString: {Offset: 0x52, Find: "2", Replace: "2"}
  - ReplaceString: {Offset: 0x74, Find: "2", Replace: "3"}
    # CUSTOM SETTING: Changing to 3 for 0.3em for padding-bottom.
    #
    # The default patch settings are suitable for horizontal languages only.
    # Uncomment the following two replace_string lines for vertical languages only:
  - ReplaceString: {Offset: 0x4A, Find: "left:", Replace: "top:\x20"}
  - ReplaceString: {Offset: 0x6A, Find: "right: ", Replace: "bottom:"}

Would very much appreciate any information that can help solve this. Thanks in advance.

jackiew1 commented 3 years ago

@keikhcheung I think patch Fix three KePub fullScreenReading bugs was removed from the standard pack a long time ago. I don't remember whether it was because it no longer worked or because Kobo had fixed something so it was no longer needed. @pgaskin might have a better memory than me.