Sunday, March 14, 2010

Embedding Russian/Cyrillic/Unicode Fonts in EPUB books

I'd like to read Russian literature in its original language. So I downloaded Leo Tolstoy's Anna Karenina and put it in my Nook.


  1. The original format of the book was a Word document. I had to save it as text file and convert its character set from Windows Cyrillic (CP1251) to UTF-8 using Iconv.

    iconv -f CP1251 -t UTF-8 annakarenina.txt > annakarenina-u.txt


  2. I opened the text file with Sigil, formatted it and saved it as EPUB file.

  3. Put Unicode fonts in the EPUB file that have a cyrillic range. You can do so with 7-zip. I recommend Book Antiqua, MinionPro or DejaVu Serif.

    • antquab.ttf
    • antquabi.ttf
    • antquai.ttf
    • bkant.ttf


  4. Edit content.opf so that it has references to the fonts:

    <item id="font.bold" href="fonts/antquab.ttf" media-type="application/x-font-truetype"/>

    <item id="font.bolditalic" href="fonts/antquabi.ttf" media-type="application/x-font-truetype"/>

    <item id="font.italic" href="fonts/antquai.ttf" media-type="application/x-font-truetype"/>

    <item id="font.regular" href="fonts/bkant.ttf" media-type="application/x-font-truetype"/>

  5. Edit the stylesheet.

    @font-face {
    font-family: "Book Antiqua";
    font-weight: normal;
    font-style: normal;
    src: url(../fonts/bkant.ttf);
    }
    @font-face {
    font-family: "Book Antiqua";
    font-weight: normal;
    font-style: italic;
    src: url(../fonts/antquai.ttf);
    }
    @font-face {
    font-family: "Book Antiqua";
    font-weight: bold;
    font-style: normal;
    src: url(../fonts/antquab.ttf);
    }
    @font-face {
    font-family: "Book Antiqua";
    font-weight: bold;
    font-style: italic;
    src: url(../fonts/antquabi.ttf);
    }
    a {
    color: inherit;
    text-decoration: inherit;
    }
    em, i {
    font-family: "Book Antiqua", serif;
    font-weight: normal;
    font-style: italic;
    }
    strong, b, h1, h2, h3, h4, h5 {
    font-family: "Book Antiqua", serif;
    font-weight: bold;
    font-style: normal;
    }
    p {
    text-indent: 2em;
    margin-top: 0pt;
    margin-bottom: 0pt;
    }
    body {
    font-family: "Book Antiqua", serif;
    margin-left: 5pt;
    margin-right: 5pt;
    text-align: justify;
    }
    .sgc-1 {text-align: center}
    .sgc-2 {text-align: right}



To see how a Russian ebook might look on your Nook or any other reader, download and try my ebook Anna Karerina.

1 comment:

  1. Thank you, I really appreciate your help with the matter of adding fonts:) I thought it might be complicated, but it is really quite simple once you explained it.

    ReplyDelete

About This Blog

KBlog logo This blog is about current events and issues concerning general population. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

icon
Powered By Blogger