KF8
KF8 is Amazon's new Kindle Format 8 used on the Kindle Fire. It is also supported by fourth-generation Kindle devices running firmware version 4.1.0 or later, by Kindle for PC and by Kindle Reader for the Mac.
Contents |
[edit] Overview
KF8 (also called AZW3) is basically a compiled ePub that has been compiled using a Palm database and Amazon's DRM scheme. It is targeting ePub 3 version support but existing ePub can also be used. The latest KindleGen software will create KF8. KF8 replaces MOBI but actually includes both a MOBI database and a KF8 database in the same file for backwards compatibility using older Amazon Kindle readers.
Support: All Apps and Kindle devices except 1st & 2nd Generation Kindles and Kindle DX.
This is the latest version you can build at home for submission but Amazon may also offer your eBook in the KFX (KF version 10) format.
[edit] Features
Features include:
- HTML5 support - An ePub 3 feature.
- Full support for CSS to enable publishers to control all elements of the text layout, including line spacing, alignment, justification, margin, color, style, & border.
- Drop caps - Can be done in ePub 2.1 using CSS at the beginning of paragraphs.
- CSS3 support - An ePub 3 feature.
- Kindle Text Pop Up
- Fixed layouts - but not the same as anyone else is using. See Fixed layout ePub#Kindle KF8
- Kindle Comic Creator - Kindle Panel View - a variation on Fixed layouts for images. This can be used to convert CBR and CBZ files.
- Embedded fonts - An ePub feature.
- SVG - An ePub feature, can be zoomed with no loss of fidelity.
- TOC support from the ePub file TOC but it will not appear inline.
- Support for floating elements that includes boxed text, callouts, sidebars, & images with text wrapping.
- Support for numbered and bulleted lists.
- Support for nested tables and merged cells required by technical and textbooks.
- Support for background images on pages and for text on background images.
- Support for rounded corners of boxed elements.
- Support for drop shadow.
- Support for outline text.
- Support for multiple and repeated background images.
- Support for color gradient.
- Support for page numbers via APNX file.
- Enables fine-grained control of attributes for text and other elements through CSS selectors.
- Support for fixed-layout (FXL) pages for specified screen sizes.
Kindle devices newer than and including the Paperwhite and Fire HD support right to left vertical scripts and Japanese Ruby script. Older e Ink and tablet devices are limited to horizontal left to right Chinese, Japanese, and Korean text.
[edit] The Format
The internal format has been decoded using kindle unpack. It reveals that the basic format remains as a PDB file similar in structure to MOBI. Generally a KF8 file may contain both a MOBI file at the beginning and the newer KF8 version of ePub later. This of course increased the size of the book file although there is some attempt to share resources such as images between the two objects. Kindle Unpack can be used to separate the two structures by building a traditional MOBI file and a KF8 file without the MOBI part (actually a small dummy structure remains) to make the file smaller. There are flags near the start of the database that can be used to identify the type of file.
In spite of the fact that KF8 is targeted at ePub 3 source it still carries forward some HTML constructions that have been de-standardized for years and left over from MOBI's use. Amazon does publish the HTML statements and CSS3 statements that it will recognize. In addition KF8 has extended the ePub 3 format in incompatible ways to support its fixed layout option.
All Kindle products beginning with the Kindle 3 can support KF8, although the Kindle 3 requires an update to do so. However, the Kindle Apple App does not, it supports AZK instead with a fallback to KF7.
[edit] Compilation
Both KindleGen and the Kindle Previewer program can be used to create KF8 by compiling a source ePub file. An ePub file is a zip file containing several standard human readable files. KF8 compiles this into a binary form by creating an internal structure based on PDB. When this is done all of the original filenames disappear and any links to these are replaced by direct branches in the final database. Image files are retained as a binary structure with knowledge of the original image structure but file names and metadata are gone. Metadata that MOBI supports is still present in the results. The final form is a single binary file. The structure of this file is mostly defined in the MOBI article.
[edit] General Tips
In addition to the CSS tips in EPUB, the following tips are specific to EPUB source content for Kindle:
- When building an EPUB for Kindle, always set the cover page's linear to "no" in the EPUB spine.
- When building an EPUB for Kindle, remove the ISBN or use a different ISBN specific to Kindle. Kindle content does not require an ISBN, but should never have the same ISBN as a published EPUB.
[edit] CSS Tips
- Kindle on iOS does not always respect line-height when set using stylesheets. To avoid inconsistent positioning of drop caps, always specify this property in the style attribute on the drop cap tag itself.
- Kindle on some platforms does not respect the height CSS property on blocks containing text. This means that unless you use a custom drop cap font that defines a zero-height descender, you will get blank space below your drop cap on some Kindle readers. You can work around this bug by using two separate boxes—one to draw the glyph, one to space out the correct number of lines of text.
- Kindle does not respect CSS sizes on the <font> tag. If you have content that needs to show up in a larger size on mobi and KF8, the best way to do this like this:
- <span class="mobionly"><font size="8">...</font></span>
- <span class="kf8only"><span class="mylargertextclass">...</span></span>
- Then use media queries to define the kf8only and mobionly so that they each appear on appropriate platforms. For example:
- @media amzn-mobi {
- .kf8only {
- display: none;
- }
- .mobionly {
- display: inline;
- }
- .kf8only {
- }
- @media not amzn-mobi {
- .kf8only {
- display: inline;
- }
- .mobionly {
- display: none;
- }
- .kf8only {
- }
- @media amzn-mobi {
- Kindle does not handle the ­ entity very well. Use <wbr/> instead.
- Even though KF8 supports SVG, you must provide non-SVG fallback content for MOBI-based readers. Use the classes shown above to designate the SVG content as kf8-specific and the fallback content as mobi-specific.
Additionally, if you plan to distribute your MOBI/KF8 files through Amazon KDP (the normal distribution path for Kindle books), you may encounter two situations where fonts can get stripped out of your book and/or corrupted:
- If you a specific font is used for more than some large percentage of your text (the exact percentage is unknown, but perhaps more than half), KDP interprets that to be a main body font. To avoid problems, that font should be specified on the body tag in a stylesheet that is referenced by every HTML file. Additionally, you should avoid using that specific font in other styles. Otherwise, your fonts may be stripped out during processing.
- If you specify the text-rendering: CSS property, its value must be one of auto, optimizeSpeed, or inherit. If you specify a text-rendering value of geometricPrecision or optimizeLegibility, KDP will strip out every font-family property in your CSS (except in the @font declarations). Additionally, Amazon's online previewer fails to handle these text rendering modes even in SVG; when it is asked to draw in those modes (regardless of font), it renders rectangles where the glyphs should be.
- The KDP tool massively corrupts SVG containing text if it uses inline styles to set the font size. The problem is that KDP automatically converts all px font sizes to rem units. For normal text, this has no impact on anything. However, in SVG code, because the font size is unrelated to the size of the font used in the HTML body tag, this results in text that is only a couple of pixels tall. If you have SVG that contains text, you must replace all of your font-size: declarations in the CSS with font-size attributes on the enclosing text or tspan tag without the px measurement. For example:
- <text style="font-family: Geneva; font-size: 20px; font-weight: bold;">
- becomes
- <text font-size="20" style="font-family: Geneva; font-weight: bold;">
[edit] For more information
- Amazon's KF8 description
- KindleUnpack can take apart KF8 files.
- A list of supported HTML tags and CSS3 elements. - Note that some of these tags are de-standardized in HTML documentation but are recognized in MOBI.