Originally Posted by Ephemerality
I've actually been working quite a bit over the past week on creating an x-ray builder that generates all of the loc and chapter information by unpacking the mobi file and running through the raw book content (the page-by-page info is calculated on the Kindle itself).
The format is fairly simple, each loc points to a point in the book and defines the excerpts you see on that character's page. The locations are positions within the raw html file (I've been unpacking the mobis with mobi_unpack using the -r flag to get the raw markup). The default loc that the X-Ray builder here gives is [100,100,100,6], so say that is [A,B,C,D].
A is the start position of the excerpt.
B is is the length of the excerpt.
C is the position within the excerpt that starts being bolded.
D is the length of the bolded section.
Edit #2: I hadn't thought about it, but since the Calibre version already has access to the book it could definitely be modified to add the locs. My version is a separate program done in C# so it's not nearly as convenient...
Good work! I guess I need to have a dig around in the Calibre internals to see how easy it is to get these offsets.