Apr 11, 2012

iBooks + Dhivehi / Thaana (no jailbreak necessary)

Came across an old experiment I conducted a few months ago when iBooks was the hot new thing on the block. I envisioned a few Dhivehi novella's published on the platform.

Getting iBooks to play nice with Thaana is no mean feat - mostly because a) iOS doesn't support thaana by default, b) apple's ePub support is a little bit finicky (and a little subject to what they believe is the way to do it).

so after a little experimentation, using the Sigil, the free Epub editor I set out to find out just what it takes to force iBooks into accepting a thaana book. I used Sigil because iBooks Author does NOT support right to left typing, which is a bit of a bummer… also, I wanted the methods here to be as accessible to everybody as possible.

The bottom line is that it works… but requires a little bit of hackery.

The only REAL thing that needs to be done in order to do this, is use embedded fonts. thus, by declaring something like say `@font-face { font-family: Faruma; src: (../Fonts/faruma.ttf);}` in the ePubs css, and then using it is sufficient to get it to display the relevant font.

BUT here is the kicker… that only works for for headers and other "non-body" structures. meaning, anything inside a paragraph tag for instance, does not get styled. To over-come this, we can wrap the text in a <cite> tag, which works.

The above works with both Unicode and Non-Unicode thaana writing systems. using unicode is fairly straightforward, and also recommended for the sake of being consistent. non-unicode layouts require additionally specifying `unicode-bidi : bidi-override` to mitigate the directional issues.

To illustrate, I have attached two sample epubs (one using unicode, and the other not) to demonstrate. Please feel free to open these up in Sigil and exploring the structure.



I used "thaana unicode akeh" for the unicode example, and "A_Faseyha" for the non-unicode example. Needless to say A_Faseyha looks much better. That however is easily customizable.

Screenshots below (UNICODE, NON-UNICODE)


IMG 0428IMG 0426