Without debating the political implications of the word “uncommon”, it is a fact that the vast majority of Kindle ebooks are written in Latin script. The reasons for this could fill a thesis, but one basic and practical reason is that the default Kindle fonts do not support the more obscure regions of the Unicode character map. For those languages that fall within such regions, the only option is to embed a custom font and force the Kindle device or app to render the text in that font. This is assuming your ebook can get past Amazon’s seemingly arbitrary language limitation in the first place.

Amazon’s newish Kindle ebook format, KF8, allows font embedding (as per the international ePub specifications), but the older MOBI format doesn’t. As I noted in my list of Kindle devices and apps that support KF8, one (I assume) commonly used app, Kindle for iPhone/iPad, is still handicapped with the older format, and therefore does not support embedded fonts.

Today, I completed the ebook design and conversion of a bilingual collection of poems by the Sri Lankan poet Cheran, who writes in Tamil. When opened in the Kindle App for iPad, it simply displayed a mess of random characters in place of all the Tamil script. So, true to Laura Brady’s tenet, “degrade gracefully”, the only solution was to make the MOBI version of the ebook, which would be read by iPads, iPhones and Kindle 2s, acceptably free of mess, by rendering it on those devices as a monolingual, English-only text. The steps I took to do this are below, including how to embed a font in the first place (the following steps assume you are creating a “.mobi” ebook file from scratch, or a “.epub” file for automatic conversion to “.mobi”, and can edit the HTML and CSS):

  1. In the root folder of your extracted/uncompressed ebook, create a folder named “Fonts”. In it, place all the font files you would like embedded.
  2. For each of the fonts that you wish to embed, and for each font style, you need a separate CSS rule, as follows:
@font-face {
  font-family: /*[the name of your font as used elsewhere in your CSS eg:]*/ Army;
  font-style: normal /*or*/ italic;
  font-weight: normal /*or*/ bold /*or*/ /*some other value*/;
  src: url("../Fonts//*[your font's filename eg:]*/ Army.ttf");
}
  1. In the “content.opf” file in your ebook’s root folder, type an entry for each of your embedded fonts within the <manifest> section as follows:
    <item href="Fonts/Army.ttf" id="Army.ttf" media-type="application/x-font-ttf" />
    where the “id” equals the font’s filename, and the “media-type” refers to your font’s file format according to the following table:</p> > ttf as “application/x-font-ttf” or “application/x-font-truetype”
    > otf as “application/x-font-opentype”
    > woff as “application/x-font-woff”
    > eot as “application/vnd.ms-fontobject”

Hey presto, your font has been embedded. Now, to make your foreign text disappear in the MOBI format. We’ll use the “display : none” CSS property, as follows:

  1. Create a new media query rule at the bottom of your CSS stylesheet (this is important due to the cascading nature of CSS – later rules override earlier rules):
    @media amzn-mobi {}
  2. Copy the selector for each paragraph you want to hide in the MOBI version of your ebook, and paste it between the curly brackets in the new media query. Then add the CSS property “display : none” within that pasted selector’s own curly brackets.

For example, this:

p.tamil {
  font-family : "My Tamil Font", sans-serif;
  font-weight : normal;
  font-style : normal;
  font-size : 0.8em;
  text-decoration : none;
  font-variant : normal;
  line-height : 1;
  text-align : left;
  color : #000000;
  text-indent : -1.2em;
  margin : 0px 0px 0px 1.2em;
}

becomes this:

p.tamil {
  font-family : "My Tamil Font", sans-serif;
  font-weight : normal;
  font-style : normal;
  font-size : 0.8em;
  text-decoration : none;
  font-variant : normal;
  line-height : 1;
  text-align : left;
  color : #000000;
  text-indent : -1.2em;
  margin : 0px 0px 0px 1.2em;
}
@media amzn-mobi {
  p.tamil {
    display: none;
  }
}

That’s pretty much it. You can stack as many selectors within your media query as you need. Make sure to test your ebook carefully – for any text dispersed within the foreign-language sections that isn’t using an embedded font, and will therefore not be hidden by the above CSS adjustments. One final note: I wouldn’t recommend applying these changes to an EPUB ebook that’s going to remain as an EPUB ebook. I can’t vouch for the media query “@media amzn-mobi” being ignored by all EPUB readers – there have been conflicts noted with the Nook. Make the above changes only to a “.mobi” ebook file, or to a “.epub” that you’re planning on using only to convert automatically to a “.mobi” using Amazon’s upload conversion tool.


Thanks to William Ockham (!) for suggesting the improvements to the above code.