View Single Post
Old 09-08-2018, 02:35 PM   #71
Owl_
Enthusiastic reader
Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.
 
Posts: 424
Karma: 3880485
Join Date: Mar 2017
Location: Italy
Device: Kindle paperwhite3, Kobo aura one, kobo touch 2.0, Kobo Clara HD,Poke2
patching problems

Quote:
Originally Posted by jackie_w View Post
As promised here is a new patch which will allow you to customise the appearance of the text in the dictionary pop-up widget and full-screen dictionary page.

You can customise one or more of the following:
  • font-family (choose any font on your device, built-in or sideloaded)
  • font-size
  • line-height
As far as I can tell (trial and error) these are the current unpatched Kobo defaults:
Code:
         font-family    font-size   line-height
         -----------    ---------   -----------
    Glo: Georgia        23px        1.4em
    H2O: Georgia        29px        1.4em
  GloHD: Georgia        32px        1.4em
AuraONE: Georgia        42px        1.4em
... so work out your new custom font-size/line-height settings using these as a guideline.

Here is the patch code. It goes in libnickel.so.1.0.0.patch.
Spoiler:
Code:
<Patch>
patch_name = `Dictionary text font-family/font-size/line-height - beta`
patch_enable = `no`
# Multi-version patch: 4.4.9298 - 4.4.9298+
#
# This patch allows you to to customise the appearance of the text 
# in the dictionary pop-up widget and full-screen dictionary page.
#
# You can change one or more of the following attributes:
#   - font-family
#   - font-size
#   - line-height
#
# Stage 1: Change DictionaryView to remove %1, %2 etc variables
#   from:
#       * { font: %1px %2; line-height: %5em; }
#       div.descriptionFont { font-family: %3; }
#       ol { font-size: %1px; font-weight: bold; margin-left: %4em; margin-top: 0px; }
#       ol p { font-size: %1px; font-weight:normal; }
#
#   to:
#       * { font-size: 40px; line-height: 1.3em; font-family: Georgia                                           ;}
#       ol   { margin-left: 1em; margin-top: 0px; }
#       ol p { font-size:  1em; font-weight:normal; }
#
# ##### N.B. Do not change the next 2 lines #####
find_base_address = `* { font: %1px %2; line-height: %5em; }`
replace_string = 0000, `* { font: %1px %2; line-height: %5em; }\ndiv.descriptionFont { font-family: %3; }\nol { font-size: %1px; font-weight: bold; margin-left: %4em; margin-top: 0px; }\nol p { font-size: %1px; font-weight:normal; }\n`, `* { font-size: 40px; line-height: 1.4em; font-family: Georgia                                           ;}\n        \nol   { margin-left: 1em; margin-top: 0px; }\nol p { font-size:  1em; font-weight:normal; }\n`
# ##### N.B. Do not change anything above this line #####
#
#
# Stage 2: N.B. You MUST keep old and new strings EXACTLY the same length
#
# Un-comment ONE ONLY of the following replace_string examples 
#   to change dictionary font-family from default Georgia:
#   - to a different built-in font
#   - to one of your sideloaded custom fonts
#
# Notes for changing font-family:
#   1.  Pad the shorter of the old/new strings with spaces to 
#       keep same length for both strings (see examples below)
#
#   2.  If the new font-family name (max. 50 chars) contains any spaces it must be
#       wrapped in "double-quotes" (see examples 2, 3)
#
#   3.  To change from Georgia to the Kobo default sans-serif font, Avenir, 
#       use either one of the following to achieve the same result:
#       - sans-serif
#       - "Avenir Next Medium"
# 
# Examples for customising font-family:
#replace_string = 0036, `Georgia   `, `sans-serif`
#replace_string = 0036, `Georgia    `, `"Gill Sans"`
#replace_string = 0036, `Georgia      `, `"Kobo Nickel"`
#replace_string = 0036, `Georgia `, `Bookerly`
#
# Un-comment and edit next line to change font-size
#replace_string = 000F, `40px`, `30px`
#
# Un-comment and edit next line to change line spacing
#replace_string = 0022, `1.4`, `1.3`
</Patch>


Although the patch code looks quite long, most of it is Help Notes. The only lines you need to change are in the last 10 lines of the patch.

I've attached 3 screenshots:
  1. unpatched KA1 [**]
  2. patched KA1: font-family: "Gill Sans", font-size: 38px, line-height: 1.1em
  3. patched KA1: font-family: Bookerly, font-size: 45px, line-height: 1.4em
[**] Let me rephrase that. By 'unpatched' I mean before this particular patch was enabled. My other dictionary patch `Dictionary frame size - beta8` (in nickel.patch) is already enabled in all 3 of the screenshots. The 2 dictionary patches are not dependent on each other. Enable either, both or neither as you wish.

Please report back in this thread if you have any problems.

Caveat: If you own several different Kobo models it is unlikely that you will be able to find one set of custom values which will look good on all devices so you may need to run the patch process multiple times with a different libnickel.so.1.0.0.patch file for each.
Hi, this is as I edited the patch, but I think I've done something wrong. could paste the correct text?

#
# Examples for customising font-family:
#replace_string = 0036, `Georgia `, `sans-serif`
replace_string = 0036, `"Gill Sans"`
#replace_string = 0036, `Georgia `, `"Kobo Nickel"`
#replace_string = 0036, `Georgia `, `Bookerly`
#
# Un-comment and edit next line to change font-size
replace_string = 000F, `30px`, `30px`
#
# Un-comment and edit next line to change line spacing
replace_string = 0022, `1.1`, `1.1`
</Patch>
Owl_ is offline   Reply With Quote