View Single Post
Old 11-17-2016, 08:23 PM   #56
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
`Force user font-family in ePubs`

This patch should make the ePub reader ignore all font-family styles in the book's stylesheet, so that the only font used is the one selected from the device.

It could spoil the formatting of some books because it won't be possible for the publisher to use multiple fonts in the same book, e.g. serif/sans-serif/monospace text will all be rendered with the same font. A better approach would be to edit the book's stylesheet ato selectively change the font-family styles for the main body text and leave other special styles in place, but the advantage of the patch is that it should work with DRM books too.

This is a two-part patch, you need to enable or disable both parts together. It should work on all firmware versions 3.3.0 - 4.1.7729 and maybe later versions too. It hasn't been tested much, so let me know if there are problems.

`Force user font-family in ePubs (Part 1 of 2)` (libnickel.so.1.0.0.patch)
Spoiler:
Code:
<Patch>
patch_name = `Force user font-family in ePubs (Part 1 of 2)`
patch_enable = `yes`
# Multi-version patch: 3.3.0 - 4.1.7729+
#
## This is part 1 of 2. Also enable part 2 in librmsdk.so.1.0.0.patch
##
## This patch prevents any font-family style set in the book's stylesheet from
## being recognised. It might spoil the style of books which use multiple fonts,
## but will ensure that the font-family set from the device menu takes effect.
#
find_base_address = `f\0o\0n\0t\0-\0f\0a\0m\0i\0l\0y\0:\0 \0-\0u\0a\0-\0d\0e\0f\0a\0u\0l\0t\0;\0 \0f\0o\0n\0t\0-\0s\0t\0y\0l\0e\0:\0 \0n\0o\0r\0m\0a\0l\0;\0 \0f\0o\0n\0t\0-\0w\0e\0i\0g\0h\0t\0:\0 \0n\0o\0r\0m\0a\0l\0;\0`
replace_string = 0000, `f`, `_`
find_base_address = `f\0o\0n\0t\0-\0f\0a\0m\0i\0l\0y\0:\0 \0-\0u\0a\0-\0d\0e\0f\0a\0u\0l\0t\0;\0 \0f\0o\0n\0t\0-\0s\0t\0y\0l\0e\0:\0 \0i\0t\0a\0l\0i\0c\0;\0 \0f\0o\0n\0t\0-\0w\0e\0i\0g\0h\0t\0:\0 \0n\0o\0r\0m\0a\0l\0;\0`
replace_string = 0000, `f`, `_`
find_base_address = `f\0o\0n\0t\0-\0f\0a\0m\0i\0l\0y\0:\0 \0-\0u\0a\0-\0d\0e\0f\0a\0u\0l\0t\0;\0 \0f\0o\0n\0t\0-\0s\0t\0y\0l\0e\0:\0 \0i\0t\0a\0l\0i\0c\0;\0 \0f\0o\0n\0t\0-\0w\0e\0i\0g\0h\0t\0:\0 \0b\0o\0l\0d\0;\0`
replace_string = 0000, `f`, `_`
find_base_address = `f\0o\0n\0t\0-\0f\0a\0m\0i\0l\0y\0:\0 \0-\0u\0a\0-\0d\0e\0f\0a\0u\0l\0t\0;\0 \0f\0o\0n\0t\0-\0s\0t\0y\0l\0e\0:\0 \0n\0o\0r\0m\0a\0l\0;\0 \0f\0o\0n\0t\0-\0w\0e\0i\0g\0h\0t\0:\0 \0b\0o\0l\0d\0;\0`
replace_string = 0000, `f`, `_`
find_base_address = `f\0o\0n\0t\0-\0f\0a\0m\0i\0l\0y\0:\0 \0-\0u\0a\0-\0d\0e\0f\0a\0u\0l\0t\0 \0!\0i\0m\0p\0o\0r\0t\0a\0n\0t\0;\0`
replace_string = 0000, `f`, `_`
</Patch>

`Force user font-family in ePubs (Part 2 of 2)` (librmsdk.so.1.0.0.patch)
Spoiler:
Code:
<Patch>
patch_name = `Force user font-family in ePubs (Part 2 of 2)`
patch_enable = `yes`
# Multi-version patch: 3.3.0 - 4.1.7729+
#
## This is part 2 of 2. Also enable part 1 in libnickel.so.1.0.0.patch
##
## This patch prevents any font-family style set in the book's stylesheet from
## being recognised. It might spoil the style of books which use multiple fonts,
## but will ensure that the font-family set from the device menu takes effect.
## (Unless the publisher has used the font shorthand style; see option below.)
#
find_base_address = `\0font-family\0`
replace_string = 0001, `f`, `_`
#
# Uncomment the following two lines to also prevent the font shorthand style
# from being recognised. The font shorthand style is not very common in ePubs,
# but where used it can also prevent the font-family from being adjusted.
# Beware that this option will likely have much bigger side-effects on the
# book's formatting, because the font shorthand style is used to set the
# font-size, line-height, and other styles in addition to font-family.
#
#find_base_address = `\0font\0`
#replace_string = 0001, `f`, `_`
</Patch>
GeoffR is offline   Reply With Quote