By David Kudler
Garamond. Helvetica. Times. Comic Sans.
Everyone loves fonts, right?[i]
Well, not everyone — but we sure spend a lot of time and energy making sure that we find just the right ones for our print books. And we want our ebooks to look just as good, don’t we?
I certainly get asked about fonts in ebooks a lot.
Here’s the thing: Yes, we can add fonts to an ebook so that it looks beautiful: [ii]
(This is from the ebook for White Robes, the short story that I’ve used as an example in many of the posts I’ve done here. Feel free to download it and poke around!)
How to Embed Fonts
You can add fonts a number of ways:
- Using CSS to make particular fonts display
- Embedding the fonts in your ebook
- Turning text into images
Using CSS to make particular fonts display
Remember back when we were discussing all of the fun ways that you can tell an ereader how to display your ebook — the rules known as Cascading Stylesheets (or CSS)?
Well, maybe not, but trust me: using CSS you can make your text sit up and shake paws.
Say you want to add pretty fonts, like I did here:
All you need to do is add one property to your stylesheet, your header, or in a style attribute:
Except it doesn’t always work.
Why not? Well, for a number of reasons.
First of all, if the ereader doesn’t have the font installed, it doesn’t know how to display it. Trust me: none of them have mgs4brush installed. So your ereader will go with its default sans-serif font, whatever that may be.
Second, even if it is installed, if the user has changed the font settings, their preference takes precedence. Remember: miniscule purple Zapfino on an orange background. If that’s what the reader wants, that’s what the reader gets.
Well, there’s only so much we can do about that second problem — but what about the first, the fact that the fonts aren’t installed?
Turns out there’s a way around that.
Embedding fonts in your ebook
You can actually put the font files right into your ebook, so that the text should display the way you want it to even if it isn’t installed on the ereader. This is called embedding fonts.
Remember that each ebook is just a big ZIP archive, made up of HTML and support files. A website in a box.
Well, one of the kinds of support files that ebooks support is OTF (OpenType Font) fonts.[iii]
There are a few ways to embed your font(s) into your ebook:
- By hand
Adding fonts by hand is relatively straight forward, if you know what you’re doing. Unfortunately, describing the process would take up an entire post. Fortunately, the lovely folks at Kobo have already written the post for me.[iv]
When I’m working in Sigil, my ebook editing software of choice, fonts have to be added this way. It involves actually adding the font file(s), as well as adding code to both your OPF file and CSS stylesheets. None of this is terribly difficult — but if looking under the hood of your ebook is scary, perhaps this isn’t the method for you.
If you’re interested in the underpinnings of ePub, are an inveterate do-it-yourselfer, or just don’t trust anything that isn’t spelled out, check the post out.
Of course, this being the twenty-first century, there’s an app for that. Several, in fact. I mean, if there’s a straight-forward, repetitive process involving digital files, someone will have written a script to simplify it. One of the most convenient is built in to recent versions of the ebook multi-tool app Calibre. I’ve recommended Calibre many times before, both as an ebook reading app, an ebook conversion app, and a pretty good WYSIWYG ebook editing app. [v]
To add a font to your ebook in Calibre, first open the book in Calibre’s book editor by right-clicking (or control-clicking) on the title, then selecting Edit Book. This opens the book editing utility (essentially, the part of Calibre that’s like Sigil).
Now, make sure you know where the font file you want to add is located. Mine in this example is called Risuko.otf. It’s a font I created for my books using Font Forge.
The next thing you’re going to have to do is edit one of your styles to call the font, if you haven’t already done so. Remember the book title page I showed above? Well, the style for that text includes a line that looks like this:
I’m going to edit it to call my custom font:
Next, go to the Tool menu and select Manage Fonts.
See Risuko there on line 15? That’s the one we want to embed!
Click on the button that reads Embed all fonts.[vi]
If you’re sure you’re done editing the book, you can also click the button reading Subset all fonts — this will get rid of any glyphs (characters) that aren’t used in the ebook.[vii]
Calibre has added a new CSS stylesheet in your ebook called fonts.css. Its only purpose is to keep track of the new font(s) you’ve added to your ebook.
Now my title displays in my custom font, Risuko, while the subtitle and byline are in another font:
You can see that the title is bolder, less flowing than the rest.
Not exactly point-and-click easy, but easier than doing it by hand!
If you want fonts embedded in your ebook and you’re exporting it from Adobe InDesign, then presto! There’s an easy-ish way to do that. [viii]
When you’re exporting your book to ePub format, go to the HTML & CSS tab and make sure there’s a checkmark next to Include Embeddable Fonts.
That’s it. InDesign will make sure that your new ePub file includes all of the fonts that it needs to display just the way you want it to.
The Problem with Embedding Fonts
There are a couple of problems with embedding fonts — both practically and legally:
If you want to embed the fonts into an ebook that you’re going to upload to KDP, you can’t simply upload the ePub file — which has long been my practice and recommendation. If you try, KDP will strip out all embedded fonts — and may even delete references to them in the stylesheets. So we need to upload something other than an ePub file.
Rather, you have to convert the file into one of Amazon’s Frankenstein so-called “mobi” files — a package that combines an old PalmPilot format (MOBI7) and Amazon’s own version of ePub3 (KF8) — and then upload that.
To do this, you need to use either the kindlegen Java script or (my preference) Amazon’s Kindle Previewer app. To use Previewer, just drag and drop your ePub file[ix] onto the app’s window. The app will then convert the book; this can take a while so go grab a cup of coffee or tea or Red Bull or whatever. Once the conversion is complete, your book will show up in the Previewer window. Here’s the opening of my novel Risuko in Previewer:
Note that the series and book title are in my custom font, while the subtitle and byline are in the other brush font, mgs4brush.
Preview the file in all the different formats: [x]
- Tablet (that is, as it will look on a Kindle Fire or iPad)
- Phone (that is, how it will look in the iOS or Android Kindle app)
- Kindle E-reader (that is, how it will look on black-and-white eInk Kindles like the Paperwhite)
You can’t edit the converted file, unfortunately. If you’re unhappy with how the converted ebook displays, go back and edit the ePub file, then reconvert.
Once you’re happy, export the file by selecting Export in the File menu. Make sure you keep track of where the file is.[xi] Now you can upload you’re brand new “mobi” file to KDP — and Amazon (probably) won’t strip out the fonts.
They still might, however. And other retailers and aggregators may bounce back your font-stuffed file. Even if they don’t, embedding may be problematic. Why?
Because every one of those fonts you just embedded in your ebook was created by someone. And any creative work is, as I discussed recently, protected by copyright law.[xii] And putting someone else’s copyrighted work inside of your own and then selling it without their permission is, in fact, a form of intellectual property theft.
You wouldn’t want anyone to do that to your work, would you?
Just because you have a font installed on your computer doesn’t mean that you have a license to use it to design your print books, and it certainly doesn’t mean you can bundle it into your ebook (where people can easily unzip the file and extract the font) and sell it. You have to know if you have the license to embed the font in your ebook.
How do you know?
First of all, read David Bergland’s excellent article, Where Can I Legally Use My Fonts?
Essentially, it depends on how you acquired the font.
If you downloaded the font from an online store (or as I’ve occasionally done, directly from the designer), there was a license agreement — you probably skipped over that bit. Go back and read the fine print. It should tell you whether electronic distribution or ebook distribution rights were included in the license.
If it came with your computer — or with a software package like Microsoft Office or Adobe InDesign — the license you acquired with that software it almost certainly didn’t include the right to embed it in an ePub or mobi file. Sorry. You can go back and look — some of Microsoft’s fonts, for example, and some of the ones included in Apple’s OS — are actually public domain, and so free to use. But you need to check.
Do a web search along the lines of Calibri font license. See what kind of information comes up. At the very least, you should find some legitimate stores that will help you find out who created and owns the font.
You can also try looking at the actual font file — in the Mac Finder, use Get Info (command-i). In Windows, right-click and select Properties, then look in the Details tab. Either way, you should see some information about the font’s creator, its copyright status, and possibly its license.
Once you find out who created the font and/or owns the copyright, do a search on the creator’s site to figure out what kind of licensing arrangement came with the font, and, if that doesn’t include the right to embed the font in your ebooks, what is available to you.
If you’re fortunate — or were very careful (as I was) — the fonts you want to use have all either included ebook rights, been released into the public domain by their creator[xiii], or are available through a GNU or Creative Commons license in exchange for attribution or the like.
Otherwise, take a deep breath: you’ll need to purchase a license. Which could run you anywhere from a few dollars to thousands.
Are you still sure you want to include that font?
Gee, wouldn’t it be nice if there were a way to embed fonts into our ebooks that folks can’t get at?
There is: obfuscation.
Essentially, font obfuscation encrypts the font file(s) embedded in the ebook so that the ereader can use them, but dishonest types can’t unZIP your ebook and steal them.
There are two methods of obfuscation:
- One created by the body that oversees development of the ePub file format, the IDPF
- Another created by the largest licensor of typefaces, Adobe (makers of Photoshop, InDesign, etc.)
When you export an ebook from InDesign with fonts embedded, they’re automatically obfuscated using the Adobe method.
In other conversion and editing software, you can add obfuscation using the IDPF method.
The problem is what often occurs when you have two standards: neither of them quite works.
Oh, they work — but getting retailers to take files with obfuscated fonts aboard is almost impossible.
So unless you’re using fonts that you yourself created (like my Risuko font) or that you have a license for, your choice is bleak: be a thief, or…
In addition, no matter what you do, different ereaders will handle different embedded fonts differently. Some can’t display them at all (older models especially) while some display them incredibly inconsistently. And, in many cases, if the reader has set the preferences to read in a particular font (as opposed to what most ereaders refer to in their font menu as the original or publisher font), then it will display as they wish it to display, rather than displaying the font you spent all of that effort making sure was embedded. New Kindles are all set to display everything in their proprietary font Bookerly.
Often, it makes sense to take a deep breath, save some file size, and just allow the ereader to display the way the reader wants it to display.
Of course, there is still one other option….
Turning text into images
Yeah. This is actually the most consistently effective way to get the fancy title pages, chapter heads, and drop caps you’re looking for.
Turn the text — formatted just the way you want it — into JPEG images, and then import those into the book.
Remember, the legal problem isn’t using the font; it’s including the font file in your ebook.
So, instead of going to all of the trouble above to embed the font, design your ebook so that it looks exactly the way you want it — you can do this in the ePub file or in the file you exported from — and then… take a screen shot.
I’ve already shown you examples in the sections above — all of the visual samples from my books were simply screenshots of the ebook.
To this, first get the section of text looking just the way you want it.
If you’re on a Mac, press shift-command-4, then draw the rectangle over the section of text you want to use.
If you’re on a Windows PC, use the Snipping Tool or press Windows-PrntScrn.
Find the image and crop it. Rename it so that you can easily recognize it (remember: no spaces in ePub filenames — use hyphens or underlines).
Import them into your ebook, and then place them where you want them to go, using CSS to define the size at which the image should display, and add any fancy flourishes, (like floating a drop cap to the left, for example).
There you are!
Since nothing’s perfect, there are disadvantages to this approach to.
You’re adding file size — probably more than you would if you embedded the font(s). Amazon will ding you $0.15/MB of file size with each purchase, if you’re using their most popular royalty plan.
If you replace the chapter or section head text with an image, automatic nav-menu tools won’t know what to call the section. So make sure you have already created the navigation menu/table of contents before you replace the text with images.
Those images won’t reflow — so if someone’s reading on a phone or has blown the text up large because they’re visually impaired, the images will stay as they are.
Finally, old Kindles really don’t handle images terribly well — they all show up on their own line. No floating or flowing or insetting allowed. The drop cap will appear on a separate line from the rest of the text. There are ways to handle that, but they’re a pain; you may decide they’re not worth it. [xiv]
So basically, after all of that, what I can recommend is this:
- If you’re sure you legally have the right to embed, consider it. (I don’t recommend you bother with obfuscation — like DRM, it tends to be more a hinderance than an effective way of stopping thieves.)
- If that doesn’t work, consider using images of the text you’re most concerned with.
- If neither of those sounds attractive or workable, relax and let the Bookerly be with you.
[i]Okay, because I know I’ll make Joel Friedlander unhappy if I don’t, I’m going to remind us all that those beautifully designed collections of letters, numbers, etc., are actually called typefaces; it is their variations (bold, italic, old-style numerals, etc.) that are called fonts. We can thank Steve Jobs for committing synecdoche and apply the name of the part to represent the whole. We forgive you, Steve.
[ii]And adding fonts isn’t just about esthetics. Perhaps you’re writing a book for dyslexics and want to add a font that they’ll find easier to read. Or perhaps you’re including words in non-latin-alphabet languages; many fonts, even Unicode-compliant ones, lack glyphs for every possible character in every written language.
[iii]Which is a pain. There are many kinds of font file formats — TTF (TrueType Fonts), PostScript fonts, etc. — that you can’t use in ePub ebooks. If you want to use one, you could either look to see if the source for your font offers it in OTF format, or use Font Forge (not a simple solution) or another conversion tool to change the font to OTF format.
[iv]Fonts embedded in this manner (which follows the ePub3 standard) should work in ebooks uploaded to other retailers as well — with a few limitations, noted below.
[v]As stated many times before, I usually use the one-trick pony Sigil. Because I’ve been using it for nearly a decade, and I like it. But Calibre has most of the same functions, and can serve as a sort of iTunes-for-ebooks library app besides.
[vi]Before Joel or any font designers out there kill me, yes, I know there’s a real problem with doing this. I’ll talk that through in a minute.
[vii]This will make you feel virtuous. And if you’re trying to shrink the last few KB out of your ebook, size, go for it. However, the only retailer that docks your royalty by file size is Amazon — and, as I explain below, they don’t allow you to display embedded fonts anyway. So If I were you, I wouldn’t bother. Still — your choice.
[viii]Which is remarkable, because as powerful as InDesign is, very little about it could be considered easy.
[ix]It will also convert a number of other file formats, including Word doc. RTF file or HTML file. But you can’t embed fonts in those!
[x]This preview isn’t 100% accurate — it will, for example, draw on the system fonts installed on you computer, so it will likely display text in fonts that aren’t embedded. Also, that Kindle E-Reader preview won’t accurately preview the MOBI7 version of the file that will display on old-style Kindles. Caveat excogitatoris. (Designer beware.)
[xi]I usually rename the file to include the version number, just so that I can keep track of what came from where.
[xii]In fact, the US doesn’t allow typeface designers to copyright typeface designs (though many other nations do). But digital fonts? Those are code. Those are protected.
[xiii]Not by some site that promises you every typeface known to man for free. Just because they’re offering it for free doesn’t mean they have the right to distribute it; that’s their fault, but ignorance is no defense.
[xiv]Okay, if you’re down here, I know you’re geeky enough to be curious. How you make it work is using special media queries for Kindles. Using these, you set the display property for the drop cap image to none if the reader is MOBI7, while you set the display of the first letter in the paragraph to none if it’s KF8. This is, essentially, the same way to make line indents work in poetry work properly for both old and new Kindles. Aren’t you glad you asked?