MOBI Output: Fix latest kindle firmware not displaying select publisher font option for calibre produced azw3 files. Fixes #1920613 [Kindle Firmware 5.13.5 changed embedded font management](https://bugs.launchpad.net/calibre/+bug/1920613)

This commit is contained in:
Kovid Goyal 2021-03-22 11:00:10 +05:30
parent 90020202f0
commit 1387cfc39f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -42,6 +42,7 @@ EXTH_CODES = {
'language': 524,
'primary_writing_mode': 525,
'page_progression_direction': 527,
'override_kindle_fonts': 528,
}
COLLAPSE_RE = re.compile(r'[ \t\r\n\v]+')
@ -221,6 +222,10 @@ def build_exth(metadata, prefer_author_sort=False, is_periodical=False,
exth.write(ppd)
nrecs += 1
exth.write(pack(b'>II', EXTH_CODES['override_kindle_fonts'], len(b'true') + 8))
exth.write(b'true')
nrecs += 1
exth = exth.getvalue()
trail = len(exth) % 4
pad = b'\0' * (4 - trail) # Always pad w/ at least 1 byte