Wednesday, March 10, 2010

How to embed Unicode fonts in EPUB ebooks

I own a Barnes and Noble's Nook and recently had a trouble reading a Vietnamese novel on Nook. But I resolved the issue by hacking the EPUB ebook as explained below:



  1. Get the Unicode fonts that you want for your ebook. The following fonts come with Adobe Reader and cover enough Unicode ranges.
    • MyriadPro-Bold.otf
    • MyriadPro-It.otf
    • MyriadPro-Regular.otf

    With 7-zip, put the Unicode fonts in your ebook.
  2. Extract content.opf from your ebook and insert the following lines in the manifest section:
    <item href="MyriadPro-Bold.otf" id="embedded.font.bold" media-type="font/opentype"/>

    <item href="MyriadPro-It.otf" id="embedded.font.italic" media-type="font/opentype"/>

    <item href="MyriadPro-Regular.otf" id="embedded.font.regular" media-type="font/opentype"/>
    Put content.opt back into the ebook file.
  3. Extract stylesheet.css from the ebook and append the following contents:
    @font-face {
    font-family: "Myriad Pro";
    font-weight: normal;
    font-style: normal;
    src: url(MyriadPro-Regular.otf);
    }
    @font-face {
    font-family: "Myriad Pro";
    font-weight: normal;
    font-style: italic;
    src: url(MyriadPro-It.otf);
    }
    @font-face {
    font-family: "Myriad Pro";
    font-weight: bold;
    font-style: normal;
    src: url(MyriadPro-Bold.otf);
    }
    a {
    color: inherit;
    text-decoration: inherit;
    }
    em, i {
    font-family: "Myriad Pro", sans-serif;
    font-weight: normal;
    font-style: italic;
    }
    strong, b, h1, h2, h3, h4, h5 {
    font-family: "Myriad Pro", sans-serif;
    font-weight: bold;
    font-style: normal;
    }
    body {
    font-family: "Myriad Pro", sans-serif;
    margin-left: 5pt;
    margin-right: 5pt;
    text-align: justify;
    }
    p {
    text-indent: 2em;
    margin-top: 0pt;
    margin-bottom: 0pt;
    }
    Put stylesheet back in your ebook.
  4. Try and read your ebook with Adobe Digital Editions or your favorite ebook reader.

2 comments:

  1. can u please make an example for that because i'm so confuse about "manifest section"..what is that?
    Thank you so much

    ReplyDelete
  2. the think your method is working here. please could you be more in details.
    thanks

    ReplyDelete

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger