Embedding Fonts in eBooks

Image for Embedding Fonts in eBooks

Original font selected

Image for Embedding Fonts in eBooks

Can I use this font in my eBook? The FAQs at Fontsquirrel

Edit: This article has been updated to take account of Indesign CC.

Note: The information provided here applies to eBooks created with the ePub3 standard. The font embedding techniques herein will only work properly if the ePub validates to the ePub3 standard.

Different devices offer different fonts, which may not be under the control of the book designer.

The iPad is the most sophisticated tablet that has a lot of built-in fonts, and these are available to the ebook designer.

When exporting to ePub from InDesign you can specify that the fonts are embedded.

InDesign CS6 CreativeCloud will encrypt the fonts using a method acceptable for the ePUB3 standard recognised by the International Digital Publishers Forum(IDPF). Unfortunately, the font files are also obvuscated and this is not acceptable to some eReaders.

Naturally enough, fonts embedded from the InDesign export to ePub3, will display correctly in Adobe Digital Editions. But what about getting these fonts to display on the Apple iOS devices, such as the iPad?

furthermore...

First, you will have chosen 'include embeddable fonts' when exporting ePub3 from InDesign.

This will have put the fonts in a folder called 'font' inside the ePUB. It will also have put a file inside the META-INF folder called encryption.xml.

While these fonts may succesfully render on some devices and most likely with Adobe Digital Editions, the font will not display on the iPad unless they happen to be the same fonts that are available on that device.

How can we make the iPad recognise the fonts?

Edit: InDesign CC has improved the way that the fonts are embedded, obfuscated and included in the ePub package, so you may not need to follow the instructions below. However, if you are still using InDesign CS6, then the following does apply to you.

Here are the steps:

1. Open the content.opf file in the ePUB package and change this:

<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="bookid" version="3.0">

to this:

<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="bookid" version="3.0" prefix="rendition: http://www.idpf.org/vocab/rendition/# ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/">;

Note: InDesign CC (9.2 and above), does include this already.

This is adding some essential namespace vocabularies to the eBook.

2. Now add the following inside the metadata section of this same file:

<meta property="ibooks:specified-fonts">true</meta>

Note: InDesign CC (9.2 and above), does include this already.

With this 'switch' in the metadata for the book, the user interface for user font selection within iBooks, will show 'original' ticked. at the tiop of the list.

3. So far this is good, but unfortunately, Adobe have obvuscated the fonts so you will need to replace them with the unalduterated ones. Can you have a look inside the font folder of the ePUB file and get the name of the fonts from there? Note that if they have .ttf then they are truetype fonts - .otf and they are opentype fonts. If you can, find these fonts on the web and download to your downloads folder.

Essentially, you need to replace the fonts inside the ePUB with the original ones.

If you are using Oxygen, you do this by right-clicking the font folder and then select add-files... If you do not have an editor that will edit the insides of the ePUB then you must unpack the file, replace the fonts and then re-pack.

The important thing is that the fonts must be replaced with exactly the same names, otherwise this will not work without further editing of the content.opf file.

Note: None of this is required if you are using InDesign CC 9.2 or above

Licensing and Copyright Issues

The reason that Adobe InDesign is encrypting the fonts in the first place is to satisfy font vendors that they are not encouraging illegal font re-distribution. So, if you want to embed fonts and make them work on the iPad, you should check that you have the rights to do this first.

My advice is that you only use fonts where the license terms allow for fonts to be re-distributed.

You need to locate 'open source' fonts and I suggest the Fontsquirrel web site.

Conforming to the License

When reading the terms of use of the font you may find, that the license must be included within your package and be human-readable. My suggestion is that you turn this license text into an HTML document and add this as a non-linear resource in the ePUB. This means that it needs to be linked somewhere, from within your book. Here is a good use of the colophon page!

Font Formats

There are several formats for fonts; truetype, opentype, WOFF (Web Open Font Format) and some others. WOFF is recommended by the IDPF and is mentioned in the specification for ePUB3, however, this format is not often available.

The iPad’s support for the OpenType format seems a bit patchy in my experience. Sometimes, fonts in this format seem to have difficulty diplaying properly in sizes other than 100%.

The Apple iOS fonts

The Apple devices such as the iPad already include a very large range of fonts, and if you wish, you can specify any of these fonts, without the need to embed them.

If you sidestep over to this web site: iosfonts you can have a look at the many fonts at your disposal. There is an issue though, and that goes back to the use of InDesign to build your eBook. If you are a PC Windows user, then this is slightly more complex.

The steps to take if you are using the iOS built-in fonts.

If you are using InDesign on a MAC then these fonts will be available in the font listing. On a PC, you will need to choose something similar. Windows PC InDesign users may not be able to simulate exactly the appearance of the typeface.

  1. When you export the ePUB from InDesign, be sure to swtich on 'include embeddable fonts'.
  2. Edit the ePUB and remove the file called encryption.xml inside the META-INF folder.
  3. Follow the steps at the top of this article to change some essential metadata in the content.opf file.
  4. Add the following to the content.opf file:<meta property="ibooks:specified-fonts">true</meta>
  5. In the CSS file you will need to remove the lines that have @font-face at the start. They are not needed for the fonts that are included on the iPad.
  6. In the CSS for the selector rules, be sure that the font-famly name is the same as on this iosfonts web site.
  7. Test!

*Apple Developers using iBooks Proofer

If you have an account with Apple and you use the proofer to get your books on to the iPad for testing, you cannot use any encryption at all. You can only test by getting your ePUB onto the device by other means.

Posted on 23 Mar around 6pm

Tags:

Commenting is not available in this channel entry.