I had an issue with publishing on Amazon KDP that caused me a lot of grief, so I thought I would document it.
This revolves around the use of embedded fonts. I know many people say that Kindle doesn’t support them, and you should avoid them, but they are supported, and they do work (mostly). This issue is about one of those times when they didn’t.
I built my ePub file (by hand and with Sigil), then ran KindleGen to get a .mobi file. I used the Kindle Previewer (useful piece of software) to test it. All was well. I generated a file (suffix .azk) to test on the Kindle reader on IOS (iPad and iPhone). You can copy that file to your device via iTunes. All was well. My chosen fonts worked just fine.
In order to publish to Kindle, you have to upload the .mobi file to Amazon KDP. The upload worked and a new (different) .mobi file was produced. I downloaded this to test on Kindle Previewer and found that one of the fonts was not loading correctly. Hmmm.
In case you didn’t know, this .mobi file is pretty much identical to an ePub file inside. Both are basically zip files that contain a set of folders holding all the HTML and CSS for your book (along with a manifest, index information, etc.). All the font files were present and in the right place (no, you can’t extract them and use them – Amazon kindly obfuscates them).
However, two references to the font-family CSS tag had been stripped out of the CSS file.
I finally found out that if you use a font-family in an HTML tag (via a class, of course) inside higher-level HTML tag, the Kindle converter gets confused and strips out both font-family tags. In my case, since one of the HTML tags was relatively unimportant, I switched that to use a standard san-serif font, which looks fine.
Just so that you know, I have a font-family defined for the <body> tag (which, providing that it has a valid fallback font, works fine) and on a <p> tag inside it. The paragraph (a one-liner) only had the font-family because it was referencing a bold version of the font.
The next time I uploaded the book, all was well.