First, I adapted my Fixed Layout example (from my original miniguide on the subject, which desperately needs updating now) so that it conformed with the new IDPF spec. This required:
In the content.opf file:• Add
prefix="rendition: http://www.idpf.org/vocab/rendition/#to the
packageelement as well.
<meta property="dcterms:modified">2012-05-08</meta>to the
packageelement. This is a great, new required element that hopefully will help with caching problems, among other things, as it's supposed to contain the last date the content was modified.
Still in the content.opf file, we get to the stuff that determines how the fixed layout book is displayed, the so-called "rendition" options. (Thankfully, the CIA is not involved.)
There are three principal
layout(with values of
reflowable, that is whether you want it fixed or flowing),
orientation(with values of
auto, that is, whether a certain orientation should be forced), and
spread(with values of
auto, that is, whether the ereader should use facing pages—aka a synthetic spread—in given orientations).
I promise to explain these in more detail in the upcoming new edition of the Fixed Layout miniguide!
Here I've chosen the most basic fixed layout options: that it be fixed layout, that it can be viewed in either a horizontal or vertical orientation, and that it always be displayed with facing pages.
In the content itself (the XHTML):The code is not very different. As with all EPUB3 documents, I've eliminated the DOCTYPE, made sure the xml declaration is present, and used a simpler character set declaration:
Last but not least, add the
metatag for the viewport, as usual:
The new TOCFinally, you have to create on extra file, the new HTML TOC, or
navelement. It's not much more than an ordered list, with each of the TOC items in its own list item, along with the all important
<nav xmlns:epub="http://www.idpf.org/2007/ops" epub:type="toc" id="toc">
Here's what my toc.xhtml file looks like:
And, of course, don't forget to declare the toc.xhtml file in the content.opf file:
<item id="toc" href="nav.xhtml" properties="nav" media-type="application/xhtml+xml"/>
And you're done!Now, zip it up as usual, and run it by EpubCheck3.0b5 to make sure you did it all right.
Then, in Google Chrome (it won't work in other browsers), download the very latest version of Readium (released this morning!), it's 0.2.4, kindly fixed and uploaded by Matthew Robertson, and add your book to the library.
And voilà, you can see a fixed layout book on your desktop!!!
What, you say, you don't see facing pages? Click the facing pages button in the Readium pop-up menu that appears when you hover over the bottom-right corner of the screen.
And where are the embedded fonts? I'm not sure yet if that's a problem with this very new software, or if I haven't embedded them properly. It's definitely true that only OTF and WOFF fonts are supported in EPUB3, but I use WOFF in my example, so they *should* be showing.
Ah, but I hear a bigger worry... why should you go to all this trouble to create a format that only works with a fledgling ereader that no-one uses yet? And I could try to convince you about the importance of standards, but hopefully the following screenshot is more powerful: because the IDPF's EPUB 3 Fixed Layout spec works in iBooks!!! Apple and Barnes & Noble (and others) were involved with the IDPF in creating the Fixed Layout standard and Apple already supports it as you can see the same file showed here in iBooks:
This is a great development, and the IDPF should be commended. Hopefully there will soon be a time when we can create a single fixed layout EPUB file and it will work properly in all ereaders—Barnes & Noble also worked closely with the IDPF to develop this spec—and on the desktop. Even in Kindle.
The best way to help make this happen is to start using the new EPUB3 Fixed Layout format right now: create lots of examples, view them in Readium and help contribute to making Readium a more powerful ereader.
You can download my new EPUB3 FXL example here. Feel free to open it up and play with it. I'd love to see any examples you create!
Don't forget: subscribers receive all my blog posts via email, as well as other perks, and help to keep me writing. Thanks to all of you!