Click the button below to start reading about our company.

Font Embedding and Font Obfuscation/Mangling

There has as been a lot a talk at #ePrdctn Hour recently about font embedding and font obfuscation/mangling. I wanted to provide some resources in case anyone is struggling with the same issues.

Embedding Fonts

Liza Daley has a great post on her Threepress Consulting blog titled “How to embed fonts in ePub files” that explains how to embed fonts but also examines the issues around choosing fonts, font licenses, and how to actually embed a font.

Liz Castro has a post on her Pig, Gourds, and Wikis blog titled “Embedding Fonts in ePUB—iPad, iPhone AND Nook”  that will walk you through embedding fonts for those devices and stores.

Font Obfuscation

When you embed a font in an ePUB, the font files are included in the ePUB itself. This potentially means that someone could open an ePUB file, take the font files out, and use them without license or permission. This would make you a potential distributor of the font, and would likely violate your font license. To avoid this, fonts can be obfuscated or mangled, making it impossible to remove the font from the ePUB and use it anywhere else.

As Liza Daley notes in her post, Adobe has open-source code in epub-tools to enable this, and provides detailed documentation on how to use it.

The International Digital Publishing Forum (IDPF), the institution responsible for the ePUB spec, also has information on font embedding and obfuscation/mangling, including an obfuscation algorithm on their page “Font Embedding for Open Container Format Files.”

I’ve also found a python script that encodes the fonts found in an ePUB. This script encodes the fonts according to the method Adobe uses in ADE, but it does not use the IDPF method.

Adobe InDesign will obfuscate embedded fonts when converting to ePUB. There is some question about issues surrounding validation, however, as described in the posts “InDesign CS5.5, Embedded Fonts and Validation”. and “Best Practice: Embed Fonts??” on the Mobile Read forum.

Sigil now has a font obfuscation menu as an option for embedded fonts in ePUBs. It was added at this update: “Sigil v0.3.1 – added a new ‘Font Obfuscation’ context menu for font files in the Book Browser; the user can now select (or de-select) the use of Adobe’s or the IDPF’s font obfuscation methods; this also resolves the problem where Sigil refused to open epub files that use such obfuscated fonts with the message that the epub has DRM.” Here’s what it looks like:

The Sigil font obfuscation menu

The font obfuscation issue is one area where it appears there isn’t really a best practice established yet, at least not with respect to licensed fonts that require obfuscation if you are going to include them in an ePUB. If you are embedding licensed fonts in your ePUBs, you may want to speak with the foundry licensing the font to see what their recommendations are for obfuscating the font. You might also consider free, open-source fonts like you’ll find at Google Web Fonts.