![]() |
#1 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
AZW3 (KF8) and embedded fonts
First off... this is no big deal. Everything displays/works as expected in the calibre viewer, kindle devices, and KindePreviewer ... but I've noticed something odd about converting ePubs with embedded fonts to the new MOBI format. Just wondering if it's the intended behavior or something I'm doing wrong/not understanding.
Starting with an ePub that contains unobfuscated, embedded fonts ... when you use calibre to convert to A) an AZW3 or B) a "new" mobi; the fonts seem to be obfuscated when using MobiUnpack to inspect the contents of the calibre produced file. However when converting that same ePub (with unobfuscated, embedded fonts) to mobi using the "both" mobi output option (combination mobi/KF8) the fonts are un-obfuscated when inspecting the calibre produced file with MobiUnpack. To recap: all fonts seem to end up obfuscated in the stand-alone KF8 conversions (AZW3 or the "new" mobi output option), but they end up un-obfuscated when converting using the "both" mobi output option (starting with the same ePub with un-obfuscated, embedded fonts). Sorry if that makes no sense, as I said, it's curiosity more than anything. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,190
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I really cannot recall what the intended behavior is, you'll have to go spelunking in the code.
|
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I took a quick look, and for the life of me ... I can't figure out why the embedded fonts would ever be unencrypted when building KF8s with calibre.
The write_font_record function in the utils.py (ebooks/mobi/) has an optional parameter to obfuscate fonts that defaults to 'True'. Code:
def write_font_record(data, obfuscate=True, compress=True): Code:
self.records.append(write_font_record(item.data)) ![]() The Tweak Book feature seems to un-obfuscate them, regardless, when exploding, so nothing really critical is going on, but I'd just like to get my head around it if I can. |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,190
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Are you sure that they are unobfuscated in a joint file? Are they compressed?
|
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,190
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
An easy way to test if they are indeed obfuscated is stick a print statement in read_font_record and try converting the book running tweak book from the command line.
|
![]() |
![]() |
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'm frankly baffled. According to debug print statements (in read_font_record and write_font_record) when converting via the command-line, calibre is always obfuscating the fonts -- stand-alone KF8 or joint file.
I need to revisit Mobi_Unpack's handling of obfuscated fonts, because it unpacks the joint file's fonts as unobfuscated and the standalone file's fonts as obfuscated (although I know the same font handling routine handles joint vs stand-alone KF8s). EDIT: I think I'll just change calibre's write_font_record to: Code:
def write_font_record(data, obfuscate=False, compress=True): ![]() I know Kindlegen/KindePreviewer doesn't produce xor'd, obfuscated fonts (I think Amazon only obfuscates them before/upon delivery). Last edited by DiapDealer; 09-14-2012 at 03:01 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
AZW3 vs KF8 | bhoyt | Calibre | 4 | 08-18-2012 01:41 AM |
Embedding fonts in AZW3/KF8 | pirl8 | Calibre | 47 | 07-24-2012 05:25 PM |
Add embedded fonts to azw3 | arad26 | Amazon Kindle | 1 | 07-20-2012 08:19 AM |
Calibre has a serious bug with KF8 & embedded fonts | JSWolf | Conversion | 4 | 07-08-2012 10:26 PM |
Embedded fonts on KF8 & Kindle Touch | dbh2ppa | Amazon Kindle | 5 | 04-27-2012 09:41 PM |