Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-22-2014, 05:50 AM   #1
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
Adjustable top/bottom margin patch testing

Here is a patch to make the top and/or bottom margins adjustable in epubs. I.e. when you use the slider to adjust the left/right margins, the top/bottom margins change too. Please treat this as experimental for now, I have tested it a little on my Glo and it seems to work without problems, but I am still learning ARM assembly and I might have overlooked something, so more testing and feedback would be good.

The patch works by modifying the epub reader's built-in stylesheet. The original stylesheet looks like this:

Code:
@font-face { font-family: -ua-default; font-style: normal; font-weight: normal; src: url('res:///fonts/normal/%1') }
@font-face { font-family: -ua-default; font-style: italic; font-weight: normal; src: url('res:///fonts/italic/%1') }
@font-face { font-family: -ua-default; font-style: italic; font-weight: bold; src: url('res:///fonts/bolditalic/%1') }
@font-face { font-family: -ua-default; font-style: normal; font-weight: bold; src: url('res:///fonts/bold/%1') }
body, p { font-family: -ua-default !important; }
body {
 text-align: %1 !important;
 line-height: %1em !important;
 padding-bottom: %1em !important;
 -kobo-font-sharpness: %1;
 -kobo-font-thickness: %1;
}
Each "%1" is a variable. Originally "padding-bottom: %1" got the same value as "line-height: %1". The patch replaces the body{padding bottom:%1em} with a @page{margin:%1 0}, and supplies it with the value of readingLeftMargin(x2) in place of readingLineHeight.

(One side effect of this is that the epub reader no longer adds any padding at the end of a chapter, I don't know if this is important or not?)

(Edit: Another side effect seems to be that any @page margins set in the epub itself will not take effect)

You can change how much the top/bottom margins increase by editing the replacement string in the patch. I have used units of pt which seems about right on my Glo, but feedback about how it suits other devices would be useful.

This patch should work okay on its own, but it is probably better in combination with the custom margins and footer patches. If you choose to make the bottom margin adjustable, then you will probably want to modify your footer so that there is not too much margin between the top of the page number and the bottom of the text. Hopefully we can find good combinations of footer and bottom margin size to look good on the different devices.

Patch for firmware 3.2.0 (kpg.exe version, yes I have tested it with kpg.exe ths time :-)
Spoiler:
Code:
# Firmware 3.2.0 (kpg.conf version)
<Patch>
patch_name = `ePub adjustable top/bottom margin`
patch_enable = `yes`
# getReadingLineHeight() --> getReadingLeftMargin()
replace_bytes = 8C2F48, FA F4 D6 E8, D3 F4 62 EC
# QString.arg(double, ...) --> QString.arg(uint64, ...)
replace_bytes = 8C2F4E, FF 33, 0A 23
replace_bytes = 8C2F54, 00 93, 01 93
replace_bytes = 8C2F5A, CD F8 04 80, CD F8 08 80
replace_bytes = 8C2F62, 00 22 67 23, 00 23 00 93
replace_bytes = 8C2F6A, E0 F4 2E EC, F3 F4 CE EB
#
# Top/bottom margin scale: 2xreadingLeftMargin
replace_bytes = 8C2F4C, 4F F0, 02 18
#
# Top/bottom margin scale: 1xreadingLeftMargin
#replace_bytes = 8C2F4C, 4F F0, 02 46
#
# Modify stylesheet: top margin example:
replace_xor_00 = 1181F4C, `\x20padding-bottom: %1em !important;\n\x00`, `}\n@page {margin:%1pt 0 0 0}\nbody {\x00`
#
# Top and bottom margin example:
#replace_xor_00 = 1181F4C, `\x20padding-bottom: %1em !important;\n\x00`, `}\n@page {margin:%1pt 0}\nbody {\x00`
#
</Patch>


Patch for firmware 3.2.0 (patch32lsb.conf version):
Spoiler:
Code:
# Firmware 3.2.0 (patch32lsb version)
<Patch>
patch_name = `ePub adjustable top/bottom margin`
patch_enable = `yes`
# getReadingLineHeight() --> getReadingLeftMargin()
replace_bytes = 8C2F48, FA F4 D6 E8, D3 F4 62 EC
# QString.arg(double, ...) --> QString.arg(uint64, ...)
replace_bytes = 8C2F4E, FF 33, 0A 23
replace_bytes = 8C2F54, 00 93, 01 93
replace_bytes = 8C2F5A, CD F8 04 80, CD F8 08 80
replace_bytes = 8C2F62, 00 22 67 23, 00 23 00 93
replace_bytes = 8C2F6A, E0 F4 2E EC, F3 F4 CE EB
#
# Top/bottom margin scale: 2xreadingLeftMargin
replace_bytes = 8C2F4C, 4F F0, 02 18
#
# Top/bottom margin scale: 1xreadingLeftMargin
#replace_bytes = 8C2F4C, 4F F0, 02 46
#
# Modify stylesheet: top margin example:
replace_string = 1181F4C, ` padding-bottom: %1em !important;\n`, `}\n@page {margin:%1pt 0 0 0}\nbody {`
#
# Top and bottom margin example:
#replace_string = 1181F4C, ` padding-bottom: %1em !important;\n`, `}\n@page {margin:%1pt 0}\nbody {`
#
</Patch>


Edit: Here is the patches for firmware 3.3.0. The adjustable margins work with the new full-screen reading mode too. Unfortunately the way the stylesheet is stored makes it difficult to edit the replacement strings in the patch, be careful not to change the length of the replacement strings if you do attempt to edit them.

Patch for firmware 3.3.0 (kpg.conf version)
Spoiler:
Code:
# Firmware 3.3.0 (8eb9c1f8b2)

<Patch>
patch_name = `ePub adjustable top/bottom margin`
patch_enable = `yes`
# getReadingLineHeight() --> getReadingLeftMargin()
replace_bytes = 4E8BD0, 47 F7 CA E9, 2A F7 F8 E9
# QString.arg(double, ...) --> QString.arg(int64, ...)
replace_bytes = 4E8BD4, 20 22 4F F0 FF 33, 20 21 01 22 0A 23
replace_bytes = 4E8BDE, AD F8 04 20 00 93, 02 91 42 43 01 93
replace_bytes = 4E8BE8, 00 22 67 23 34 F7 36 EF, 00 23 00 93 29 F7 92 ED
#
# Set the value of the top/bottom margin to a multiple of readingLeftMargin,
# in pixels. Suggested values: 4px (Touch/Mini), 5px (Glo/Aura), 7px (Aura HD)
replace_int = 4E8BD6, 1, 5
#
# Modify stylesheet, only top margin adjustable: @page {margin:%1px 0 0 0 0}
#replace_xor_00 = BE8A20, `\x20\x00p\x00a\x00d\x00d\x00i\x00n\x00g\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00\x20\x00%\x001\x00e\x00m\x00\x20\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00\n\x00`, `}\x00\n\x00@\x00p\x00a\x00g\x00e\x00\x20\x00{\x00m\x00a\x00r\x00g\x00i\x00n\x00:\x00%\x001\x00p\x00x\x00\x20\x000\x00\x20\x000\x00\x20\x000\x00}\x00\n\x00b\x00o\x00d\x00y\x00\x20\x00{\x00`
#
# Modify stylesheet, top and bottom adjustable: @page {margin:%1px 0}
replace_xor_00 = BE8A20, `\x20\x00p\x00a\x00d\x00d\x00i\x00n\x00g\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00\x20\x00%\x001\x00e\x00m\x00\x20\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00\n\x00`, `}\x00\n\x00@\x00p\x00a\x00g\x00e\x00\x20\x00{\x00m\x00a\x00r\x00g\x00i\x00n\x00:\x00%\x001\x00p\x00x\x00\x20\x000\x00}\x00\n\x00b\x00o\x00d\x00y\x00\x20\x00{\x00\x20\x00\x20\x00\x20\x00\x20\x00`
#
</Patch>


Patch for firmware 3.3.0 (patch32lsb.conf version)
Spoiler:
Code:
# Firmware 3.3.0 (8eb9c1f8b2)
<Patch>
patch_name = `ePub adjustable top/bottom margin`
patch_enable = `yes`
# getReadingLineHeight() --> getReadingLeftMargin()
replace_bytes = 4E8BD0, 47 F7 CA E9, 2A F7 F8 E9
# QString.arg(double, ...) --> QString.arg(int64, ...)
replace_bytes = 4E8BD4, 20 22 4F F0 FF 33, 20 21 01 22 0A 23
replace_bytes = 4E8BDE, AD F8 04 20 00 93, 02 91 42 43 01 93
replace_bytes = 4E8BE8, 00 22 67 23 34 F7 36 EF, 00 23 00 93 29 F7 92 ED
#
# Set the value of the top/bottom margin to a multiple of readingLeftMargin,
# in pixels. Suggested values: 4px (Touch/Mini), 5px (Glo/Aura), 7px (Aura HD)
replace_int = 4E8BD6, 1, 5
#
# Modify stylesheet, only top margin adjustable: @page {margin:%1px 0 0 0 0}
#replace_string = BE8A20, `\x20\x00p\x00a\x00d\x00d\x00i\x00n\x00g\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00\x20\x00%\x001\x00e\x00m\x00\x20\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00\n\x00`, `}\x00\n\x00@\x00p\x00a\x00g\x00e\x00\x20\x00{\x00m\x00a\x00r\x00g\x00i\x00n\x00:\x00%\x001\x00p\x00x\x00\x20\x000\x00\x20\x000\x00\x20\x000\x00}\x00\n\x00b\x00o\x00d\x00y\x00\x20\x00{\x00`
#
# Modify stylesheet, top and bottom adjustable: @page {margin:%1px 0}
replace_string = BE8A20, `\x20\x00p\x00a\x00d\x00d\x00i\x00n\x00g\x00-\x00b\x00o\x00t\x00t\x00o\x00m\x00:\x00\x20\x00%\x001\x00e\x00m\x00\x20\x00!\x00i\x00m\x00p\x00o\x00r\x00t\x00a\x00n\x00t\x00;\x00\n\x00`, `}\x00\n\x00@\x00p\x00a\x00g\x00e\x00\x20\x00{\x00m\x00a\x00r\x00g\x00i\x00n\x00:\x00%\x001\x00p\x00x\x00\x20\x000\x00}\x00\n\x00b\x00o\x00d\x00y\x00\x20\x00{\x00\x20\x00\x20\x00\x20\x00\x20\x00`
#
</Patch>

Last edited by GeoffR; 04-28-2014 at 06:16 PM. Reason: Updated patches for firmware version 3.3.0
GeoffR is offline   Reply With Quote
Old 04-22-2014, 08:51 AM   #2
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
Here are some screenshots of an epub on my Glo with the margin slider at three different positions (0, 4, 7). The adjustable margin patch is applied with the top and bottom and 2x scale options, units in pt, and the footer patch is applied with min/max-height: 30px, padding-bottom: 25px.

(obviously the bottom margin will still vary depending on font size, line spacing etc.)
Attached Thumbnails
Click image for larger version

Name:	screen_001.png
Views:	566
Size:	117.7 KB
ID:	121966   Click image for larger version

Name:	screen_002.png
Views:	535
Size:	106.4 KB
ID:	121967   Click image for larger version

Name:	screen_003.png
Views:	519
Size:	105.9 KB
ID:	121968  
GeoffR is offline   Reply With Quote
Advert
Old 04-22-2014, 10:40 PM   #3
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by GeoffR View Post
(One side effect of this is that the epub reader no longer adds any padding at the end of a chapter, I don't know if this is important or not?)
Hi Geoff,
It's too late for me to try this until tomorrow, however, I think it's possible that this 'no padding side effect' may also solve the long-standing 'end-of-chapter bug' (the one a bit like the 'long paragraph bug').
jackie_w is offline   Reply With Quote
Old 04-25-2014, 01:15 AM   #4
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
Quote:
Originally Posted by jackie_w View Post
It's too late for me to try this until tomorrow, however, I think it's possible that this 'no padding side effect' may also solve the long-standing 'end-of-chapter bug' (the one a bit like the 'long paragraph bug').
Unfortunately not though, I find the end-of-chapter bug is still present in firmware 3.3.0, with or without this patch.
GeoffR is offline   Reply With Quote
Old 04-25-2014, 01:11 PM   #5
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
My comment was based on an entirely coincidental experimental patch I've been trying for the last week. Following your 'unitless line height' patch I thought I'd try something similar by applying a simple Patch to change
Code:
padding-bottom: %1em !important;
to
Code:
padding-bottom: 0    !important;
to see if the end-of-chapter bug could be improved.

It's quite difficult to be absolutely sure, especially because my own standard styling includes a small non-zero margin-top (0.25em) on standard paragraphs, so I don't expect to see the same number of lines on every page. My gut-feel is that sometimes it has helped to get the last line of some chapters fitted onto the bottom of a page rather than starting a new page for the last few words. Of course, some chapters do still end on the first line of a new page but again, my gut-feel is that they wouldn't have fitted on the previous page with the existing font-size/line-spacing settings.

I am sure that my testing could have been more scientific but I'm inclined to stick to reading books with my preferred styling for now and just 'suck it and see' for a while It's been a harmless patch so far, but as I never use padding settings in my standard css it's hard to say whether others who do use it would see some unwanted side-effect.
jackie_w is offline   Reply With Quote
Advert
Old 04-27-2014, 04:09 AM   #6
sage79
Enthusiast
sage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of itsage79 has read War And Peace ... all of it
 
Posts: 46
Karma: 66500
Join Date: Jan 2011
Device: kobo glo
I notice that if this patch is activated that line spacing don't match to my ebook config when i open a new ebook. i use 0.92 spacing and when i open a ebook sometimes the line are close. I change a parameter and always is fine.

Last edited by sage79; 04-27-2014 at 06:08 AM.
sage79 is offline   Reply With Quote
Old 04-27-2014, 06:05 PM   #7
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
Quote:
Originally Posted by sage79 View Post
I notice that if this patch is activated that line spacing don't match to my ebook config when i open a new ebook. i use 0.92 spacing and when i open a ebook sometimes the line are close. I change a parameter and always is fine.
By new book do you mean one that has never been opened before?

I have seen something similar just with the ordinary `My line spacing values` patch, but only when opening a book that I had previously opened before patching. I think it has something to do with the line spacing value that was previously set in the book no longer matching any of the values on the slider after patching (e.g. if the book had been set to 1.07 with the unpatched firmware, but 1.07 is not one of the values that I have on my slider after patching).
GeoffR is offline   Reply With Quote
Old 04-28-2014, 06:26 PM   #8
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
I've updated the patches for firmware 3.3.0, the scale for the top/bottom margins can now be set to any number of pixels by changing the replace_int line.

I have found a value of 5px looks good on my Glo, closely matching the size of the left/right margins. Based on the different resolution screens I assume that a value of 4px would suit the Touch/Mini and 7px for the Aura HD.
GeoffR is offline   Reply With Quote
Old 04-29-2014, 02:28 AM   #9
scoky
Connoisseur
scoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy blue
 
Posts: 62
Karma: 13112
Join Date: Feb 2013
Device: Kindle Paperwhite; KOBO AURA HD
Quote:
Originally Posted by GeoffR View Post
I've updated the patches for firmware 3.3.0, the scale for the top/bottom margins can now be set to any number of pixels by changing the replace_int line.

I have found a value of 5px looks good on my Glo, closely matching the size of the left/right margins. Based on the different resolution screens I assume that a value of 4px would suit the Touch/Mini and 7px for the Aura HD.
Thank you for this. However, I have tried to patch this by using the patcher in https://www.mobileread.com/forums/sho...d.php?t=238175, it always reports errors for this margin patch.
scoky is offline   Reply With Quote
Old 04-29-2014, 02:34 AM   #10
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
Quote:
Originally Posted by scoky View Post
Thank you for this. However, I have tried to patch this by using the patcher in https://www.mobileread.com/forums/sho...d.php?t=238175, it always reports errors for this margin patch.
What error does it report? Are you using the kpg.exe or patch32lsb version of the patch? Note that the latest instructions for patching from Windows use patch32lsb and not kpg.exe.
GeoffR is offline   Reply With Quote
Old 04-29-2014, 02:51 AM   #11
scoky
Connoisseur
scoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy blue
 
Posts: 62
Karma: 13112
Join Date: Feb 2013
Device: Kindle Paperwhite; KOBO AURA HD
Quote:
Originally Posted by GeoffR View Post
What error does it report? Are you using the kpg.exe or patch32lsb version of the patch? Note that the latest instructions for patching from Windows use patch32lsb and not kpg.exe.
I used kpg.exe and successed and it works well, thanks!
If I use the patch32lsb and it reports error. Does this patcher work on Windows 7 64bit?

error information:
C:\Users\xxx\Desktop\patch_kobo_330\tools\pa32lsb. exe: line 227 in 'C:\Users\
xxx\Desktop\patch_kobo_330\3.3.0_source\libnickel. so.1.0.0.patch': replace_xo
r not implemented, use encode_xor8 + replace_string instead.
ERROR processing C:\Users\xxx\Desktop\patch_kobo_330\3.3.0_source\l ibnickel.s
o.1.0.0.patch
Press any key to continue . . .
scoky is offline   Reply With Quote
Old 04-29-2014, 03:12 AM   #12
scoky
Connoisseur
scoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy bluescoky can differentiate black from dark navy blue
 
Posts: 62
Karma: 13112
Join Date: Feb 2013
Device: Kindle Paperwhite; KOBO AURA HD
Quote:
Originally Posted by scoky View Post
I used kpg.exe and successed and it works well, thanks!
If I use the patch32lsb and it reports error. Does this patcher work on Windows 7 64bit?

error information:
C:\Users\xxx\Desktop\patch_kobo_330\tools\pa32lsb. exe: line 227 in 'C:\Users\
xxx\Desktop\patch_kobo_330\3.3.0_source\libnickel. so.1.0.0.patch': replace_xo
r not implemented, use encode_xor8 + replace_string instead.
ERROR processing C:\Users\xxx\Desktop\patch_kobo_330\3.3.0_source\l ibnickel.s
o.1.0.0.patch
Press any key to continue . . .
Sorry for my careless mistake and I use patch32lsb.conf version and it works.
Thanks.
scoky is offline   Reply With Quote
Old 05-01-2014, 09:38 PM   #13
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
I've included this patch with the other patches in the instructions for patching 3.3.x thread, but I've left it disabled by default. Although I have been using this patch without any problems on my Glo, and now wouldn't want to be without it, it might not be such a big deal to others :-)
GeoffR is offline   Reply With Quote
Old 05-15-2014, 06:09 AM   #14
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
Getting the bottom margin to match the top margin when using this patch can take a bit of fiddling with the reading footer. With the example reading footer patch the space above the page number is probably too large, but if you reduce the max-height of the reading footer then the page number can get cut off if using fonts like Gothic which sit very low on the line compared to other fonts. A way around this is to add a negative margin-top to the reading footer.

Below is the reading footer patch I am currently using on my Glo with firmware 3.3.0 to get good results when reading epubs with the adjustable top/bottom margin patch. It looks not too bad with kepubs too, although the space above the page number is smaller than ideal in that case. I've added examples for the Touch and Aura HD too, based on the difference in screen dpi compared to the Glo:

Firmware 3.3.0:
Spoiler:
Code:
<Patch>
patch_name = `Custom reading footer (for use with adjustable top/bottom margins patch)`
patch_enable = `yes`
replace_string = DAAC44, `ReadingFooter {\n\tmin-height: 70px;\n\tmax-height: 70px;\n\tqproperty-footerMargin: 40;\n}\n\nReadingFooter[qApp_deviceCodeName="kraken"], \nReadingFooter[qApp_deviceCodeName="phoenix"] {\n\tmin-height: 82px;\n\tmax-height: 82px;\n\tqproperty-footerMargin: 15;\n}\n\nReadingFooter[qApp_deviceCodeName="dragon"] {\n\tmin-height: 120px;\n\tmax-height: 120px;\n\tqproperty-footerMargin: 20;\n}\n\n* {\n\tfont-size: 16px;\n}\n\n[qApp_deviceCodeName="kraken"], \n[qApp_deviceCodeName="phoenix"] {\n\tfont-size: 20px;\n}\n\n[qApp_deviceCodeName="dragon"] {\n\tfont-size: 26px;\n}\n\n[qApp_localeName="ja_JP"] {\n\tfont-family: A-OTF Gothic MB101 Pr6N;\n}`, `ReadingFooter {\n\tmin-height: 70px;\n\tmax-height: 70px;\n\tqproperty-footerMargin: 40;\n}\n\n* {\n\tfont-size: 16px;\n\tpadding-bottom: 0px;\n\tmargin-top:  0px;\n}\n\n[qApp_localeName="ja_JP"] {\n\tfont-family: A-OTF Gothic MB101 Pr6N;\n}`
#
# Uncomment the replace_string lines of one of the examples below, comment out
# the rest. If you choose to make further changes to the examples, BE CAREFUL
# NOT TO ALTER THE LENGTH OF THE REPLACEMENT STRINGS! (Add or remove spaces if
# necessary to keep the total length the same.)
#
# Example for Touch
#replace_string = DAAC55, `min-height: 70px;`, `min-height: 32px;`
#replace_string = DAAC68, `max-height: 70px;`, `max-height: 32px;`
#replace_string = DAAC85, `footerMargin: 40;`, `footerMargin: 40;`
#replace_string = DAAC9F, `font-size: 16px;`, `font-size: 16px;`
#replace_string = DAACB1, `padding-bottom: 0px;`, `padding-bottom:16px;`
#replace_string = DAACC7, `margin-top:  0px;`, `margin-top: -4px;`
#
# Example for Glo/Aura
replace_string = DAAC55, `min-height: 70px;`, `min-height: 40px;`
replace_string = DAAC68, `max-height: 70px;`, `max-height: 40px;`
replace_string = DAAC85, `footerMargin: 40;`, `footerMargin: 15;`
replace_string = DAAC9F, `font-size: 16px;`, `font-size: 20px;`
replace_string = DAACB1, `padding-bottom: 0px;`, `padding-bottom:20px;`
replace_string = DAACC7, `margin-top:  0px;`, `margin-top: -5px;`
#
# Example for AuraHD
#replace_string = DAAC55, `min-height: 70px;`, `min-height: 50px;`
#replace_string = DAAC68, `max-height: 70px;`, `max-height: 50px;`
#replace_string = DAAC85, `footerMargin: 40;`, `footerMargin: 20;`
#replace_string = DAAC9F, `font-size: 16px;`, `font-size: 26px;`
#replace_string = DAACB1, `padding-bottom: 0px;`, `padding-bottom:25px;`
#replace_string = DAACC7, `margin-top:  0px;`, `margin-top: -7px;`
</Patch>
GeoffR is offline   Reply With Quote
Old 06-13-2014, 01:02 PM   #15
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Would it be possible to completely remove the body margin/padding (or make them 0)? I'd like to have simply:

@page { margin: %1 }

without "!important". Hopefully, that will let me force zero margins in a cover page with @page { margin: 0 !important}. But I'm afraid this CSS will have lower priority than the one in the book...
Jellby is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Margin bottom, top problem on tablet zs55 Reading and Management 7 05-23-2013 06:20 AM
ODT to EPUB: margin-top and -bottom in tables beedaddy Conversion 0 05-25-2012 05:05 AM
margin top, bottom, additive or not ? cybmole Conversion 5 02-16-2011 12:33 PM
anyway to change Kindle top/bottom margin? cdpango Kindle Developer's Corner 2 11-28-2010 08:20 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 06:58 AM


All times are GMT -4. The time now is 08:52 PM.


MobileRead.com is a privately owned, operated and funded community.