View Single Post
Old 07-15-2018, 04:37 AM   #22
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
This is a simple example of how some patches can be split into a base patch plus a number of customising patches, so that options can be selected by enabling one of the customising patches instead of editing the main patch. With the new kobopatch tools this can provide a way to keep some of your customisations from one firmware version to the next.

`KePub stylesheet additions` example:

In libnickel.so.1.0.0, replace the `KePub stylesheet additions` patch with the following four patches:
`KePub stylesheet additions base`
`KePub stylesheet additions (justify)`
`KePub stylesheet additions (optimizeSpeed)`
`KePub stylesheet additions (optimizeLegibility)`
Spoiler:
Code:
<Patch>
patch_name = `KePub stylesheet additions base`
patch_enable = `no`
# Multi-version patch: 4.7.10413 - 4.9.11314+
#
## Makes room to add some additional CSS to the default KePub stylesheet.
## Also enable one of the following patches to select what gets added:
## `KePub stylesheet additions (justify)`
## `KePub stylesheet additions (optimizeSpeed)`
## `KePub stylesheet additions (optimizeLegibility)`
#
# This version adds enough for 47 extra characters
#
find_base_address = `.KBHighlighting, .KBSearchResult {`
#
replace_string = 0000, `.KBHighlighting, .KBSearchResult { background-color: #C6C6C6 !important; } \t`, `.KBHighlighting,.KBSearchResult{background-color:#C6C6C6!important}.KBSearch`
#
replace_string = 004C, `.KBSearchResult, .KBAnnotation, .KBHighlighting { font-size: 100% !important; -webkit-text-combine: inherit !important; } \t`, `Result,.KBAnnotation,.KBHighlighting{font-size:100%!important;-webkit-text-combine:inherit!important}.KBAnnotation[writingM`
#
replace_string = 00C7, `.KBAnnotation[writingMode="horizontal-tb"], .KBAnnotationContinued[writingMode="horizontal-tb"] { border-bottom: 2px solid black !important; } \t`, `ode="horizontal-tb"],.KBAnnotationContinued[writingMode="horizontal-tb"]{border-bottom:2px solid black!important}.KBAnnotation[writingMode="vert`
#
replace_string = 0157, `.KBAnnotation[writingMode="vertical-rl"], .KBAnnotationContinued[writingMode="vertical-rl"] { border-right: 2px solid black !important; } \t`, `ical-rl"],.KBAnnotationContinued[writingMode="vertical-rl"]{border-right:2px solid black!important}.KBAnnotation[writingMode="vertical-lr"]`
#
replace_string = 01E2, `.KBAnnotation[writingMode="vertical-lr"], .KBAnnotationContinued[writingMode="vertical-lr"] { border-left: 2px solid black !important; }`, `,.KBAnnotationContinued[writingMode="vertical-lr"]{border-left:2px solid black!important}/*********************************************/`
#
</Patch>

<Patch>
patch_name = `KePub stylesheet additions (justify)`
patch_enable = `no`
# Multi-version patch: 4.7.10413 - 4.9.11314+
# patch_group = `KePub stylesheet additions options`
# depends = `KePub stylesheet additions base`
#
## Adds body{text-align:justify} to the default KePub stylesheet.
## The publisher can still change the text alignment in the book's stylesheet.
#
find_base_address = `/**************************`
replace_string = 0000, `/**************************`, `body{text-align:justify}/**`
</Patch>

<Patch>
patch_name = `KePub stylesheet additions (optimizeSpeed)`
patch_enable = `no`
# Multi-version patch: 4.7.10413 - 4.9.11314+
# patch_group = `KePub stylesheet additions options`
# depends = `KePub stylesheet additions base`
#
## Adds body{text-rendering:optimizeSpeed} to the default KePub stylesheet.
## This disables kerning, but fixes some rendering problems that affect
## fully justified text, such as uneven space around em-dashes.
#
find_base_address = `/************************************`
replace_string = 0000, `/************************************`, `body{text-rendering:optimizeSpeed}/**`
</Patch>

<Patch>
patch_name = `KePub stylesheet additions (optimizeLegibility)`
patch_enable = `no`
# Multi-version patch: 4.7.10413 - 4.9.11314+
# patch_group = `KePub stylesheet additions options`
# depends = `KePub stylesheet additions base`
#
## Adds body{text-rendering:optimizeLegibility} to the default KePub stylesheet.
## This enables ligatures, but causes some additional rendering problems for
## fully justified text, such as uneven word spacing.
#
find_base_address = `/*****************************************`
replace_string = 0000, `/*****************************************`, `body{text-rendering:optimizeLegibility}/**`
</Patch>

Then, instead of enabling and editing the old `KePub stylesheet additions` patch, just enable `KePub stylesheet additions base` plus one of the other three patches,

Last edited by GeoffR; 07-15-2018 at 06:06 AM. Reason: changed patches to avoid being dependent on the base patch adding exactly 47 characters
GeoffR is offline   Reply With Quote