11

Assuming that I am targeting non-tablet eBook readers such as Kindle and nook, is it possible to layout a book with some text in the default font of the device and some paragraphs in a special font embedded in the book? I know some HTML5 and CSS features are supported, but is font embeding going to be widely usable or will this currently get me into a miserable mess?

I specifically do not want to override the default font family preferences of the device, only that of some text blocks so any solutions that effect the entire work would not work for me.

  • I feel like such things should be covered by the EPUB standard. I take it they are not? – Raphael Feb 7 '14 at 11:07
  • Many aspects of the epub spec (like support for fonts, multimedia, and JavaScript) are optional. It makes sense, because epub is built to be device-agnostic, but it's still frustrating and the cause of much of the fragmentation in the epub ecosystem. – Tom Feb 10 '14 at 17:29
  • Can someone explain how to embed fonts (not if it will work) How Can i read hebrew .docx files with there original fonts on a kindle paperwhite – Arye Eidelman Mar 18 '14 at 2:13
9

You can definitely embed fonts, yes. There are a few issues to watch out for when doing so, however:

  • You may not have a license to use the font in ebooks. The font needs to be licensed in such a way as to not just allow use, but also distribution. There are a number of open source fonts available that do permit redistribution--make sure you read the license, though, before using any of them. Many of them will also require that the license be included; it's easy enough to just throw that into the font's directory, but be sure to actually do it if the license requires it.
  • Many reading systems (I'm looking at you, Nook) will by default override publisher CSS and use their own instead. If you use fonts as the sole differentiator for different types of information, you'll lose that info when publisher CSS is turned off. If you're using a different font in place of bold for emphasis, consider markup up the text as <b class="exclamation"> ... </b> instead of <span class="exclamation"> ... </span>. Then you can define b.exclamation { Font-weight: normal; font-family: awesome_font; } in your CSS. That will make the text bold if publisher CSS is off, but put it in your awesome font if publisher CSS is working.
  • 1
    Do you know whether some/all ereaders honor !important? That would be a good way to overrule the device setting in specific places. (I appreciate your solution for the gracious fallback.) – Raphael Feb 10 '14 at 14:00
  • Many readers do support !important, but I haven't done testing to see whether this overrides the publisher styles setting. My impression is that the readers that ignore publisher styles effectively ignore the whole stylesheet, meaning that the !important tag would never be seen. As I said, though, I've done no testing on that and could be totally off base. – Tom Feb 10 '14 at 17:31
  • I guess I'll click something together and have a try with my Kobo later. – Raphael Feb 10 '14 at 17:32
  • I'd be interested to hear what you find! – Tom Feb 10 '14 at 17:33
5

I think that every device has its own behaviour, so I don't know if there is some setting that can be used as a general solution.

In example, I have a Kobo ereader, and it is capable to do what you ask; if there is a custom font inside the ebook, and it is used only for titles or some paragraphs (i.e. to format code in computer science books), for the rest of text without any particular formatting it falls back to the default settings.
Kobo ereaders also have many customization setting for the ebook typography.

enter image description here

enter image description here

In my experience, if I change them (expecially by selecting a non-default font), they will take the precedence over any formatting inside the ebook. Thus the order of precedence is like that:
custom font settings > ebook internal formatting > default ereader settings.

In example, for books containing code usually it is displayed with a fixed width font, and if this font is included in the ebook and the relative text is correctly styled, it is displayed like that, overriding the default settings; but if I change my own visualizations settings, it will override also any particular styling declared in the book itself, for every bit of text. If in the "justification" setting I choose "aligned to left", it will do so not only on the main text body but also in titles and every other bit of text.

But this is the how Kobo readers work, I don't know if other devices have the same behaviour. Your best bet is to test your ebook in as many devices as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.