View Single Post
Old 11-09-2015, 06:06 AM   #108
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
`Ignore ePub Adobe XPGT stylesheet (page-template.xpgt)`

Here is a patch to make the ePub reader ignore any Adobe XPGT stylesheets.

These stylesheets are commonly named page-template.xpgt and often contain page margins. The problem with them is that their margins are added to the @page margins set in the CSS stylsheet, but some readers ignore the XPGT stylesheet, so readers which notice the XPGT stylesheet will end up with larger margins than readers which don't.

I can't find a clean way to prevent the XPGT stylesheet file being loaded, so this patch tries instead to prevent the contents from being recognised. A better approach would be to remove the XPGT stylesheet altogether before sideloading the ePub, which can be done easily using the Modify ePub plugin in Calibre, but the patch has the advantage that it should work with DRM ePubs too.

Edit: But the Modify ePub plugin can also remove the margins from the XPGT stylesheet without removing the stylesheet altogether.

I haven't tested this patch much, but it seems to work as I expect. It is a multi-version patch and should word with firmware 3.3.0 to 3.18.0, and maybe future firmware versions too.

Paste into librmsdk.so.1.0.0.patch
Spoiler:
Code:
<Patch>
patch_name = `Ignore ePub Adobe XPGT stylesheet (page-template.xpgt)`
patch_enable = `yes`
# Multi-version patch: 3.3.0 - 3.18.0+
find_base_address = `\0template\0`
replace_string = 0001, `t`, `_`
</Patch>

Last edited by GeoffR; 11-10-2015 at 12:28 AM. Reason: But the Modify ePub plugin ...
GeoffR is offline   Reply With Quote