XML technologies / ePUB / ePub für (In)Designer / Embedded fonts and special characters / Embedding fonts

(Excerpt from “ePub für (In)Designer — Mit InDesign Schritt für Schritt zum E-Book” by Sascha Heck & Yves Apel)

Embedding an InDesign font into ePub is easy; finding a suitable font is not.

Point 1: formats

Most e-readers support OpenType (otf), TrueType (ttf) and Scalable Vector Graphics (svg). InDesign supports more formats, but not Scalable Vector Graphics (svg), limiting you to OpenType and TrueType.

Point 2: licenses

ePub font embedding differs from PDF, where extraction requires special knowledge. ePub usually contains an unencrypted font copy. InDesign encrypts fonts with an Adobe algorithm, preventing their reuse. Licensing specialists debate whether this is distribution rather than embedding. You must check whether your font license permits ePub use and redistribution. If uncertain or the license is unclear, contact the font vendor directly.

Point 3: where to obtain fonts without stealing

Redistributable commercial fonts remain rare. Free fonts abound, but commercial-use permission is often unclear and quality questionable.

A large selection for commercial use and embedding in ePub and websites is available from Font Squirrel.

Embedding fonts during InDesign ePub export

Once a suitable font is used in InDesign, during ePub export on the tab Contents enable Include Embeddable Fonts. InDesign creates the sometimes complex embedding code automatically.

EPUB Export Options: Include Embeddable Fonts

Figure: EPUB Export Options—Include Embeddable Fonts.

Adding a font manually

Unpack ePub and copy your font into the fonts subfolder of OEBPS.

OEBPS/fonts: copy the font manually

Figure: OEBPS/fonts—copy the font manually.

Open content.opf in an editor and add the code line or lines under <manifest> as <item id="Dateiname.otf" href="fonts/Dateiname.otf" media-type="application/x-font-otf"/> in this example:

<manifest>
   <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
   <item id="css" href="template.css" media-type="text/css"/>
   <item id="Fontembedding_CS55" href="Fontembedding_CS55.html" media-type="application/xhtml+xml"/>
   <item id="x218.png" href="images/218.png" media-type="image/png"/>
   <item id="OpenSans.otf" href="fonts/OpenSans.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-Bold.otf" href="fonts/OpenSans-Bold.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-BoldItalic.otf" href="fonts/OpenSans-BoldItalic.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-Extrabold.otf" href="fonts/OpenSans-Extrabold.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-ExtraboldItalic.otf" href="fonts/OpenSans-ExtraboldItalic.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-Italic.otf" href="fonts/OpenSans-Italic.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-Light.otf" href="fonts/OpenSans-Light.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-Semibold.otf" href="fonts/OpenSans-Semibold.otf" media-type="application/x-font-otf"/>
   <item id="OpenSans-SemiboldItalic.otf" href="fonts/OpenSans-SemiboldItalic.otf" media-type="application/x-font-otf"/>
   <item id="OpenSansLight-Italic.otf" href="fonts/OpenSansLight-Italic.otf" media-type="application/x-font-otf"/>
</manifest>

Open template.css in the editor and add these lines at the beginning. Each font needs a separate entry:

@font-face{
   font-family: "Schriftname";
   font-style: normal;
   font-weight: normal;
   src: url("fonts/Dateiname.otf");
}

Then specify the manually added font in CSS styles:

p.Absatzformat {
   font-family: "Schriftname", sans-serif;
   font-weight: normal;
   font-style: normal;
}

Eliminating problems

Adobe InDesign encrypts embedded fonts, allowing distribution without violating licensing rights, though please clarify details with your vendor. Some readers cannot handle this encryption. Replace fonts to remove it, provided you have the necessary rights.

Unpack ePub again and replace OEBPS/fonts contents with original unencrypted fonts, retaining filenames. If TrueType was used, InDesign converted it to OpenType; search content.opf and template.css for otf and replace with ttf.

Delete encryption.xml from META-INF.

Adobe-supported devices are listed under Digital Editions Supported Devices.

Enabling on iOS

Through iOS4.2 and iBooks 1.2, embedded fonts were unsupported. From iBooks 1.2, explicitly declare that they exist and must be used. Create META-INF’s file named exactly com.apple.ibooks.display-options.xml and enter this XML code:

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

Reassemble ePub and transfer to iPhone/iPad; iBooks can now display embedded fonts.

  

 

 

 

back to top