KF8

From MobileRead
Jump to: navigation, search

KF8 is Amazons 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.

Features include:

  • HTML5 support - An ePub 3 feature.
  • Drop caps - Can be done in ePub 2.1 using CSS
  • 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.

[edit] The Format

The internal format has been decoded using mobi_unpack. It reveals that the basic format remains as a PDB file similar in structure to MOBI. Generally an KF8 file will 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. Mobi_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.

[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. 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.

[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 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;
}
}
@media not amzn-mobi {
.kf8only {
display: inline;
}
.mobionly {
display: none;
}
}
  • Kindle does not handle the &#173; 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.

[edit] For more information

Personal tools
Namespaces

Variants
Actions
Navigation
MobileRead Networks
Toolbox
Advertisement