View Single Post
Old 06-05-2009, 12:31 AM   #21
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 714
Karma: 2003751
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Glo HD
The "true" (font within epub file, not on device) embedding is also easy.

You have to use OpenType fonts, for example: Gentium.

1. If you haven't done so yet, check ePub Format Construction Guide

2.Add something like this to *.opf:
Quote:
<item id="fontname"
href="fonts/Fontname.otf"
media-type="image/x-font-ttf"/>

<item id="fontname-italic"
href="fonts/Fontname-Italic.otf"
media-type="image/x-font-ttf"/>

<item id="fontname-bold"
href="fonts/Fontname-Bold.otf"
media-type="image/x-font-ttf"/>

<item id="fontname-bolditalic"
href="fonts/Fontname-BoldItalic.otf"
media-type="image/x-font-ttf"/>
3. create "fonts" directory and copy your fonts there

4. And an entry like this into css/*.css file will make it a default font:
Quote:
@font-face {
font-family: "Fontname";
font-style: normal ;
font-weight: normal ;
src: url("../fonts/Fontname.otf")}

@font-face {
font-family: "Fontname";
font-style: italic ;
font-weight: normal ;
src: url("../fonts/Fontname-Italic.otf")}
@font-face {
font-family: "Fontname";
font-style: normal ;
font-weight: bold ;
src: url("../fonts/Fontname-Bold.otf")}

@font-face {
font-family: "Fontname";
font-style: italic ;
font-weight: bold ;
src: url("../fonts/Fontname-BoldItalic.otf")}

body {
font-family: "Fontname";}
5. Create the epub file:
Quote:
zip -q0X filename.epub mimetype
zip -qXr9D filename.epub *
And you have a slightly larger epub file that does not depend on fonts installed on the device.
Ankh is offline   Reply With Quote