dita4publishers / org.dita4publishers.epub

DITA-to-EPUB transformation type
Apache License 2.0
8 stars 4 forks source link

Font embedding with iBooks #86

Open Hasimir opened 7 years ago

Hasimir commented 7 years ago

As with the thumbnail of the cover image, iBooks also has some special rules for utilising embedded fonts. Specifically, embedded fonts will not be used, whether obfuscated or not, unless there is an additional XML file in the META-INF/ directory. The file does not need to be in the manifest.

The file name is com.apple.ibooks.display-options.xml and must contain the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<display_options>
  <platform name="*">
    <option name="specified-fonts">true</option>
  </platform>
</display_options>

Full path of file: META-INF/com.apple.ibooks.display-options.xml

This doesn't change at all, regardless of fonts, font location or whether they're obfuscated or not. It also doesn't affect anything else. What it does do, however, is allow iBooks to use the fonts in the preferred order and to use embedded fonts where necessary.

It also works with both EPUB 2 and 3.

Ideally this file should be copied into the META-INF/ directory in an EPUB if fonts are included. Perhaps set it to detect whether or not font-manifest.xml has been called in the transformation or something like that.