12-06-2017, 08:24 AM | #1 |
Enthusiast
Posts: 26
Karma: 10
Join Date: Dec 2017
Device: Kindle Oasis 2, Nook Glowlight 3
|
5.9.2: Custom font possible without jailbreak?
Hi,
Currently I am using 7" Kindle Oasis, and it updated to 5.9.2 automatically the day I got it, therefore jailbreak is not possible right now. However, during the initial setup, I have tried to switch the language to Simplified Chinese, and Kindle prompted font updates available, and downloaded and installed the font, again automatically. Recently while browsing the system folder in kindle, I found there is a file under kindle's system/fonts directory, called "zh-Hans.font", apparently for "Simplified Chinese fonts". Out of curiosity, I opened this file with hex editor, and found the file is actually a compressed romfs file. So I copy it to a linux machine and mount it. There are two files and two directories in it. The first file is called "image_manifest", with the content: Spoiler:
So it describes the content of this cromfs file, ttf font files and their names when tapping the "Aa" button while reading. Another file is a fontconfig file named "02-zh-Hans.conf" with the content: Spoiler:
The "dir" tag implies that kindle mount this cromfs font file to the directory specified, and use the fonts provided in this file. The two directories are "fonts" where the ttf font files are located, and a "cache" directory for fontconfig cache. I was wondering whether I can add new fonts using this approach, so I create similar directory structures and files for zh-Hant (Traditional Chinese) with one single font and it's md5sum. I don't have tool to build compressed romfs file, so I just use genromfs to generate a non-compressed romfs file, named "zh-Hant.font". I then put this file into system/fonts/ directory, when I eject kindle storage, the "font update" screen appears on kindle but shortly disappeared. Afterward, nothing changes, reboot does no effect, and when I check system/fonts/ again, the file I put was deleted. I think this approach might work for adding new custom fonts to kindle (without substitute old ones), but so far I haven't success yet. There are be several approached worth trying. First, perhaps I should use compressed romfs instead of plain romfs, but then I need to install fuse and cromfs. Second, maybe I need to pre-generate cache file for the font to be installed, but my linux box is now 64bit and kindle is 32bit, need some work to do that (if possible). Not sure whether this works for other languages, I assume it does, because kindle will try to install fonts with xx_yyyy.font file placed in system/fonts/. But it may take some effort to figure out how it works... |
12-06-2017, 11:19 AM | #2 |
Guru
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
I did do some attempts with this a while back, and I learned the files are signed with some method. I don't remember too many details, but I know it checked something so I could not put in any random file.
|
Advert | |
|
12-06-2017, 12:03 PM | #3 |
Enthusiast
Posts: 26
Karma: 10
Join Date: Dec 2017
Device: Kindle Oasis 2, Nook Glowlight 3
|
some corrections:
I thought "Compressed ROMFS" refers to "cromfs", but I am wrong, it's actually "cramfs". Now I generate "zh-Hant.font" using mkcramfs and with some progress, the file now stays in system/fonts and is not deleted by kinlde. However, I still can't see new font added. Maybe I need to add pre-generated fontconfig cache for my font, but I have no clue how to do that at the moment. I am curious however, does kindle not upgraded to 5.9.2 have "system" folder? As for the file check, since the font update is independent of system update, such check should be self-contained. The question is the directories specified in "02-zh-Hans.conf", are they already in kindle or automatically generated from this file? |
12-06-2017, 12:20 PM | #4 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Keep in mind that over USB cable (without a jail break) you are seeing a very tiny bit of the overall file system tree.
What is your goal? Is it you want to install Traditional Chinese fonts? Once upon a time, Kindles supported a "USE_ALT_FONTS" option. Long time gone from the firmware. That fonts from Amazon are signed. There should be tools in the Wiki for handling the file packages. Since you can not sign the font packages with Amazon's private key (they keep it in a safe at the Amazon headquarters), you will have to sign the font package with our private key(s). But that just means you have to have our public key installed on the Kindle. Which in turn requires a jail break. Note: You can download the 5.9.2 update package from Amazon - You can download the current KindleTool from: https://www.mobileread.com/forums/sh...d.php?t=225030 Use Kindletool to convert it to a *.tar.gz archive file - Open it - The file: rootfs.img will be just what you would expect from the name - the complete system image. You can mount it on your linux system with the mount command, no arguments needed, your linux system mount command will recognize it. (It had better, Kindles run the Amazon distribution of Linux.) |
12-06-2017, 07:34 PM | #5 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
IIRC, the whole font package stuff is signed/manifested, and locked down somewhat tightly.
That said, I only very vaguely looked at it, and quite a while ago at that, so, yeah, go crazy if you want to dig into it further . |
Advert | |
|
12-06-2017, 08:15 PM | #6 |
Connoisseur
Posts: 89
Karma: 12
Join Date: May 2012
Device: Sony PRS-350, Kindle 4, PW2, Voyage, Oasis, Kobo Aura One
|
Fonts
I just use Calibre and choose any font I want and use it as the Publisher Font from Mobi or Epub to Azw3. Works perfectly (although sometimes I have to remove the publisher style sheet) with the 7" on 5.9.2
|
12-06-2017, 08:35 PM | #7 |
Enthusiast
Posts: 26
Karma: 10
Join Date: Dec 2017
Device: Kindle Oasis 2, Nook Glowlight 3
|
|
12-06-2017, 08:38 PM | #8 |
Enthusiast
Posts: 26
Karma: 10
Join Date: Dec 2017
Device: Kindle Oasis 2, Nook Glowlight 3
|
Just browsing the rootfs.img, found "opt/amazon/data.whitelist" which contains the following lines:
Code:
.... ./system/fonts/ja.font ./system/fonts/zh-Hans.font ./system/fonts ./system .... Keep digging. |
12-06-2017, 08:40 PM | #9 | |
Enthusiast
Posts: 26
Karma: 10
Join Date: Dec 2017
Device: Kindle Oasis 2, Nook Glowlight 3
|
Quote:
I just want to see whether it will work. I did jailbreak my previous kindles and installed fonthack, but at the end I always come back to Amazon's own font. |
|
12-06-2017, 09:54 PM | #10 | |
Enthusiast
Posts: 26
Karma: 10
Join Date: Dec 2017
Device: Kindle Oasis 2, Nook Glowlight 3
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Jailbreak 5.3.7.2 and remove special ads/add custom screensaver | Stacker344 | Kindle Developer's Corner | 2 | 09-25-2014 05:59 AM |
Could i change the font size choice without jailbreak? | crcc25 | Kindle Developer's Corner | 5 | 06-03-2013 12:58 PM |
Removing custom screensavers and jailbreak | alansplace | Kindle Developer's Corner | 3 | 09-15-2012 02:36 PM |
Hacks Best custom font? | robollama | Amazon Kindle | 7 | 05-01-2011 07:33 PM |
Jailbreak and custom Apps question | joblack | Kindle Developer's Corner | 0 | 07-04-2010 08:12 AM |