|
|
#1 |
|
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jun 2026
Device: Kindle Oasis, Kindle Paperwhite, Kobo Libra 2
|
[Conversion Output] kfxgen - open-source python KFX generator
Hi everyone, I'm happy to share a plugin I've been working on since last December.
kfxgen is an open-source Calibre output plugin that generates Kindle KFX files natively in Python — without invoking Amazon's Kindle Previewer. It produces a working in-book table of contents and Kindle navigation pane, and has been tested on Kindle hardware. It also shows images across the books I've tested. I'm posting it here for others to try and review. Feedback, bug reports, and corrections are very welcome. A few things up front:
Why another KFX plugin The official KFX Output plugin depends on Kindle Previewer, which is closed-source, Windows/Mac-only (Linux needs Wine), and takes minutes per book. kfxgen runs in pure Python, converts in seconds, works anywhere Calibre runs, and needs no external binaries. The main reason I built it: custom fonts that actually render. KFX honors the font you've selected on the Kindle — including custom fonts you've installed on the device — and applies that font's OpenType features (ligatures, contextual alternates), which AZW3/MOBI didn't do reliably for me. kfxgen writes override_kindle_font: false so the device font is respected rather than overridden. Note: the font lives on the Kindle, not in the file — kfxgen does not embed font files, so the custom font must be installed on the device. Building kfx output files via the kindle previewer was slow, and this method drastically speeds up the process. How it relates to jhowell's "KFX Output" This is a separate, independent plugin. In Calibre's plugin list it appears as kfxgen (not "KFX Output"). Because both produce the same KFX output format, only one can own the KFX conversion slot at a time — if you have both installed, enable just one. kfxgen is intended as a faster, dependency-free alternative for people who want it; jhowell's plugin remains the reference. Validation Every release runs a full pytest suite in CI and is exercised against a 90-book public-domain Project Gutenberg corpus (English, German, Dutch, Latin, Beowulf/Odyssey, heavily illustrated books, the Complete Works of Shakespeare with 1,169 TOC entries, etc.) with per-book correctness metrics. Output has been checked on Kindle devices. Requirements
Install
Code:
calibre-customize -a kfxgen-plugin-5.3.18.zip
I leaned heavily on jhowell's kfx input and kfx output to create this successfully, so many thanks to jhowell! The plugin may be downloaded here. The main page is here along with tests and security review information: https://github.com/jloutsch/kfxgen Tests available here |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,347
Karma: 29630884
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Good work. If you are willing to lift the no font embedding limitation I might be willing to merge your plugin into calibre, making it a builtin plugin after it has matured a bit and seen some testing via users.
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 83,920
Karma: 153649587
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You really should properly embed this plugin in your first post like all the other plugins that calibre knows of. make it so the plugin can eventually be installed with calibre.
|
|
|
|
|
|
#4 |
|
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jun 2026
Device: Kindle Oasis, Kindle Paperwhite, Kobo Libra 2
|
My opinion was that KFX can display any custom fonts installed on the kindle, which would negate the need to embed fonts?
|
|
|
|
|
|
#5 |
|
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jun 2026
Device: Kindle Oasis, Kindle Paperwhite, Kobo Libra 2
|
|
|
|
|
| Advert | |
|
|
|
|
#6 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,845
Karma: 64181416
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Beta posts are inline as they are created, then moved to post #1 or removed as relevant after user testing. You can't edit posts yet as your post count is too low. A forum mod can move to post 1 as needed until then. Last edited by theducks; Yesterday at 11:35 AM. Reason: note added |
|
|
|
|
|
|
#7 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 83,920
Karma: 153649587
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Are you going to be able to keep up with any changes Amazon makes to KFX? |
|
|
|
|
|
|
#8 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,378
Karma: 95902893
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
My interest in KFX is mostly in discovering how it works and converting from it to other formats. The KFX Output plugin was originally created to allow me to experiment with the Kindle Previewer's conversion to KPF/KFX in order to reverse engineer different aspects of that e-book format.
I have no interest in replicating the Previewer's capabilities but I do see how having an alternative to using it could be useful to others. This plugin seems like a good idea to me. |
|
|
|
|
|
#9 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,347
Karma: 29630884
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That would imply that every book is limited to the fonts ont he kindle. Embedded have many use cases, such as showing glyphs from other writing systems, showing stylised text such as handwriting fonts, showing special symbols such as mathematical fonts etc etc
|
|
|
|
![]() |
| Tags |
| conversion, kfx, plugin |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Conversion Output] KFX Output | jhowell | Plugins | 1778 | 06-25-2026 12:09 PM |
| Fixed page KPS to KFX or blank PDF to KFX conversion? | jackm8 | Conversion | 6 | 02-20-2026 02:02 PM |
| KFX to EPUB conversion can break page-list, while KFX Input plugin works consistently | mallomar | Calibre | 11 | 07-20-2025 10:25 PM |
| Another EPub3/2 generator with single python file | tkirke | ePub | 1 | 10-24-2012 03:57 PM |
| Python source for: Open Containing Folder | Agama | Development | 1 | 08-10-2012 05:13 AM |