Thread: K5 JBPatch
View Single Post
Old 03-02-2016, 01:29 PM   #1795
sprite7
Member
sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.sprite7 could sell banana peel slippers to a Deveel.
 
Posts: 12
Karma: 3190
Join Date: Dec 2014
Device: Kindle Voyage, Kindle PW2
Changing margins and mobi font sizes for dummies
Works with jailbroken Voyage/KPW3/KPW2/KPW1 5.4.x-5.6.x and others (probably). Tested on Voyage 5.6.5, see also https://www.mobileread.com/forums/sho....php?p=2527653

Not а fish, but а fishing rod.

1. USBNetwork@Windows.
You need it to read/write Kindle system jar files.
Spoiler:

See here https://wiki.mobileread.com/wiki/Kind...USB_Networking

To write files, open PuTTy and write
Quote:
if you need to change anything that is not in /mnt/us, then you will need to first mount the filesystem as RW (readwrite):
mntroot rw
Once you're done, you should put the filesystem back to RO (readonly):
mntroot ro
To navigate Kindle filesystem, use WinSCP app.


2. Changing margins
Spoiler:
  1. Copy file "/opt/amazon/ebook/lib/ReaderSDK-impl-en_GB.jar" from Kindle to you PC using usbnetwork. (For en_GB language or another file for another language)
  2. Make a backup copy of the original jar file. (And it's a good idea to copy it to Kindle in the same folder, "ReaderSDK-impl-en_GB.jar.bak")
  3. To edit jar file, unarchive it (I use WinRar) in "ReaderSDK-impl-en_GB" folder.
  4. To edit jar file, download Java Bytecode Editor here https://www.mobileread.com/forums/sho...d.php?t=236780 , unarchive it, run jbe.bat. Open file "ReaderSDK-impl-en_GB\com\amazon\ebook\booklet\reader\resources\Re aderResources_en_GB.class". In left panel go to "Methods"-"<init>"-"[0] Code". In right panel go to "Code Editor"
  5. Ctrl+F not working in code editor, so Ctrl+A -> Ctrl+C and paste text to notepad. Once you done edit text, delete text in code editor, paste new text and press "Save method".
  6. What to edit.
    See here for PW1/2 (213 dpi) https://www.mobileread.com/forums/sho....php?p=2699121 For Voyage/PW3 multiply it for 0.4245 see here https://www.mobileread.com/forums/sho...66#post3060466
    My examples for 5.6.5 Voyage:
    Spoiler:
    1. Original
      Code:
      ldc_w "font.wordsperline.margin.list"
      aastore
      dup
      iconst_3
      newarray int
      iconst_1
      dup
      pop2
      dup
      iconst_0
      ldc_w 50.94
      invokestatic com/amazon/ebook/booklet/reader/resources/ReaderResources_en_GB/pixVal(F)I
      iastore
      dup
      iconst_1
      dup_x2
      ldc_w 33.96
      invokestatic com/amazon/ebook/booklet/reader/resources/ReaderResources_en_GB/pixVal(F)I
      iastore
      dup
      iconst_2
      ldc_w 16.98
      Edited
      Code:
      ldc_w "font.wordsperline.margin.list"
      aastore
      dup
      iconst_3
      newarray int
      iconst_1
      dup
      pop2
      dup
      iconst_0
      ldc_w 12.74
      invokestatic com/amazon/ebook/booklet/reader/resources/ReaderResources_en_GB/pixVal(F)I
      iastore
      dup
      iconst_1
      dup_x2
      ldc_w 8.49
      invokestatic com/amazon/ebook/booklet/reader/resources/ReaderResources_en_GB/pixVal(F)I
      iastore
      dup
      iconst_2
      ldc_w 6.38
    2. Original
      Code:
      ldc_w "reader.progressbar.margin"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 13.58
      Edited
      Code:
      ldc_w "reader.progressbar.margin"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 8.49
    3. Original
      Code:
      ldc_w "reader.progressbar.height"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 8.49
      Edited
      Code:
      ldc_w "reader.progressbar.height"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 8.49
    4. Original
      Code:
      ldc_w "reader.progressbar.footer.height"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 13.58
      Edited
      Code:
      ldc_w "reader.progressbar.footer.height"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 8.49
    5. Original
      Code:
      ldc_w "reader.content.topMargin"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 13.58
      Edited
      Code:
      ldc_w "reader.content.topMargin"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 5.36
    6. Original
      Code:
      ldc_w "reader.content.bottomMargin"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 13.58
      Edited
      Code:
      ldc_w "reader.content.bottomMargin"
      aastore
      dup
      iconst_1
      new java/lang/Integer
      dup
      ldc_w 8.49
      Note:"reader.progressbar.footer.height" and "reader.content.bottomMargin" should be the same.
  7. You should pack back jar file from unpacked folder "ReaderSDK-impl-en_GB". For update jar file using WinRar: open "ReaderSDK-impl-en_GB.jar" file in WinRar, navigate to "ReaderSDK-impl-en_GB.jar\com\amazon\ebook\booklet\reader\resource s" and drag-and-drop your new file "ReaderResources_en_GB.class"
  8. Copy "ReaderSDK-impl-en_GB.jar" back to your Kindle.
  9. Unplug and restart your Kindle.
  10. The values for left & right margin are cached and after first reboot after changing the jar files you have to open Aa menu and press on one of the other two margin icons and then press on the first one. Then the value (and thus the margin size itself) gets updated.

3. Changing mobi font sizes.
Spoiler:

Mobi-drawing-en_GB.jar
See https://www.mobileread.com/forums/sho...postcount=1588
Note: quick dictionary uses #3 font size.

Last edited by sprite7; 12-30-2016 at 03:14 PM.
sprite7 is offline   Reply With Quote