First of all, make sure your device is
JailBroken.
If you own a PW1, it might also be a
very good idea to make sure you have the
Rescue Pack installed,
because both the ALT_FONTS stuff and this can have a pretty intrusive impact on the framework & boot process, so better be safe than sorry
.
Playing with fonts on a Kindle has always been a great way to get the framework in a mood, especially since the K3, so I'll say it right away: this deserves the title hack, so I'd
strongly recommend being handy with the basics of how all of this works, how it might go wrong, and how to fix it, and at the very least always have an SSH shell ready & open when you're testing your setup. Most of the instructions will make that clear, and provide methods that will leave you time to recover from mistakes if you have a shell available.
First of all, an important notice for FW >= 5.4.x users: you will
not see your custom fonts in the Aa menu on this device. Currently, the only way to actually use your custom fonts is thus to use the font overrides feature.
If you intend to use the Font Overrides KUAL menu:
You will need the
Python package. Make sure it's installed *before* the Fonts hack.
As usual, you'll need
MRPI for the install process.
Download the
K5 Fonts Hack package from the
Snapshots thread, and unpack it. In here, you'll find a few files.
First, upload the appropriate install .bin file for your device (
Update_linkfonts_0.14.N_install_pw2_kt2_kv_pw3_koa _kt3_koa2_pw4_kt4.bin for a PW2
or a KT2 or a KV or a PW3 or a KOA or a KT3 or a KOA2 or a PW4 or a KT4, the other one for a Touch or a PW1) to the
mrpackages directory of your Kindle.
Now, eject & unplug your Kindle, and run MRPI via KUAL:
Helper -> Install MR Packages. It should take a couple dozen of seconds.
NOTE: Since I'm not sure if this hack will work on earlier firmwares than
5.3.1, the installer will refuse to launch if you're using an older firmware.
And that's it for the installation
. Now for a quick look at what you can do with it… All of the settings/tweaks I'll talk about are found in the
Fonts KUAL menu that the hack installs, so, if you're not already using KUAL, now would be a good time to correct that
The basics: adding new font choices to the Aa menu (with some caveats on FW >= 5.4, read everything carefully). It's as simple as dropping your font files (no need to rename the files) in the
linkfonts/fonts folder at the root of your Kindle.
NOTE: If you've already played with the
USE_ALT_FONTS tweak, you were using the
fonts folder, not
linkfonts/fonts. This works, too, but is discouraged for various reasons mostly related to full official updates, see the NOTES section at the bottom
.
Once you're done adding new fonts, run the
Fonts -> Fonts Hack Behavior > Update fontconfig cache KUAL button to let the Kindle know about them.
Once the framework has restarted, you should now see your new fonts in the Aa menu (except on FW >= 5.4.x, but you do need to follow this step to add new fonts)! Make sure you try them both in 'old' Mobi7 files, *and* in KF8 files: if the UI freezes when you try to turn the page, or if the framework restarts when you open the Aa menu, congratulations, you've found a font the framework chokes on! (Running
restart lab126_gui should throw you back to the Home screen, and let you kill the offending font. Typically, this is this kind of stuff using a custom FT override might help with.).
Once you're done mucking around, and after checking that everything seems to be working okay, I'd recommend doing a full, proper restart, just to lower the chances of something wonky happening at boot.
If you're familiar with the
USE_ALT_FONTS tweak, you're also aware that it makes the full range of CJK fonts visible in the Aa menu. To remove them (all) from the Aa menu, run the
Fonts -> Fonts Hack Behavior > Hide CJK Fonts KUAL button, and then restart the framework (via the
Fonts > Restart the framework now KUAL button) or your device.
Like my K2/3/4 Fonts hack, you will also have a choice of three different FreeType libraries to choose from in the
Fonts -> FreeType Override KUAL menu. Freetype's job is to render the fonts, so enabling this can have a drastic impact on the 'look' of your fonts. It can also help avoid a lot of weird issues with custom fonts. I'm personally usually running the BCI override.
To give you a rough idea of the differences between the three choices: BCI should be the closest to Amazon's, it uses the native bytecode to hint TrueType fonts; AutoHint instead relies on freetype's own code to automatically hint fonts (it can help with fonts with broken bytecode, or at least bytecode that freetype chokes on); and light is basically autohint with a twist, might be a little closer to BCI.
(I'll refer you to the freetype & fontconfig documentation if you want more info about all this).
You'll need to restart the X server (via the
Fonts > Restart the X server now KUAL button) to take an FT override into account. Make sure your system is in a sane state (ie. it cold boots properly) before using an FT override (meaning don't try to do a billion things at once, take it step by step), and make sure the X server restarts properly before rebooting your Kindle.
To be perfectly honest, I'm usually doing these configuration tests with the device plugged, and an SSH shell available & ready, to be able to catch and stop anything wonky happening before it escalates into more annoying/time consuming stuff… (Running
stop x should take care of the usual suspects, and leave you ample time to fix stuff without playing against the clock).
And finally, and of particular importance for FW >= 5.4.x users, you'll also be able to override the default fonts for the four basic families (serif (Caecilia Regular), sans (Helvetica Neue LT), mono, condensed (Caecilia Condensed)), plus the fallback font (Code2000). This is handled via the
Font Overrides KUAL menu. Each basic family has a submenu for Amazon fonts, and Custom fonts. Those submenus are blank by default. This is why there is a
Font Overrides > Populate this menu button
. Once you see the 'Finished rebuilding menu' message at the bottom of your screen, go back to the
Font Overrides menu (if it's still blank -- which might happen if you have a heavy KUAL extensions folder, or a lot of custom fonts --, hit the
Font Overrides > ** Refresh ** button).
It should now be pretty self-explanatory: clicking a font in a family submenu will set this font as the default for this family! Run the
Fonts > Restart the framework now KUAL button to take these changes into account.
Of course, make sure the font you want to use actually works correctly on your setup, before shooting yourself in the foot
.
It goes without saying, but do
not override a default family with a font that only works with a custom FT lib, that's only asking for trouble!
Keep in mind that this KUAL menu can be pretty large, so if you feel it's slowing down KUAL cache refreshes too much, feel free to blacklist it (extension name
linkfonts-ovr) via the KUAL_search_exclude_paths setting in KUAL's config
.
Also, for those a bit more familiar with fontconfig, you're welcome to take a look at the examples in
linkfonts/etc/conf.avail, a few of those can be pretty useful (more fine-grained control, making some fonts bigger, …)
.