View Single Post
Old 11-07-2009, 05:12 PM   #1
fiery
Member
fiery began at the beginning.
 
Posts: 12
Karma: 18
Join Date: Nov 2009
Device: Cybook Opus
Post How to embed fonts in ePub after Calibre

This is my simple step by step guide how to embed fonts in epub files after Calibre convertion. For me the most important advantage is that ADE and my reader device finally show readable Cyrillic letters instead of ???.

1. When you convert with Calibre turn on "No default cover" available at EPUB Output!

2. Open the epub file using 7-zip (or other zip utility). Add the fonts bellow and edit the files directly in the archive through the 7-zip explorer (you may need to change the default editor for .css/.opf/.xhtml files to WordPad for example (I use SciTE)).

---------------
3. Add the following Serif fonts to the epub file. Fonts are available at C:\Program Files\Calibre2\resources\fonts\liberation:
---------------
LiberationSerif-Regular.ttf
LiberationSerif-Italic.ttf
LiberationSerif-BoldItalic.ttf
LiberationSerif-Bold.ttf

---------------
4. content.opf - insert the <item... lines after the <manifest>
---------------
<manifest>
<item href="LiberationSerif-Regular.ttf" media-type="application/octet-stream" id="id1"/>
<item href="LiberationSerif-Italic.ttf" media-type="application/octet-stream" id="id2"/>
<item href="LiberationSerif-BoldItalic.ttf" media-type="application/octet-stream" id="id3"/>
<item href="LiberationSerif-Bold.ttf" media-type="application/octet-stream" id="id4"/>


---------------
5. stylesheet.css - insert the following text after the first line
---------------
@font-face {
font-style: italic;
font-family: 'Liberation', serif, sans-serif;
font-weight: normal;
src: url(LiberationSerif-Italic.ttf);
}
@font-face {
font-style: normal;
font-family: 'Liberation', serif, sans-serif;
font-weight: normal;
src: url(LiberationSerif-Regular.ttf);
}
@font-face {
font-style: italic;
font-family: 'Liberation', serif, sans-serif;
font-weight: bold;
src: url(LiberationSerif-BoldItalic.ttf);
}
@font-face {
font-style: normal;
font-family: 'Liberation', serif, sans-serif;
font-weight: bold;
src: url(LiberationSerif-Bold.ttf);
}



-----------------------------------------------------------------
Cybook Opus users - if you want to use these fonts only on your device - first copy all Liberation fonts to your Cybook Opus Fonts folder. Then edit the stylesheet.css file (or enter it at Calibre -> Look & Feel -> External CSS field):
----------------
1. stylesheet.css - insert the following text after the first line
----------------
@font-face {
font-style: italic;
font-family: 'Liberation', serif, sans-serif;
font-weight: normal;
src: url(res:///mnt/fat/Fonts/LiberationSerif-Italic.ttf);
}
@font-face {
font-style: normal;
font-family: 'Liberation', serif, sans-serif;
font-weight: normal;
src: url(res:///mnt/fat/Fonts/LiberationSerif-Regular.ttf);
}
@font-face {
font-style: italic;
font-family: 'Liberation', serif, sans-serif;
font-weight: bold;
src: url(res:///mnt/fat/Fonts/LiberationSerif-BoldItalic.ttf);
}
@font-face {
font-style: normal;
font-family: 'Liberation', serif, sans-serif;
font-weight: bold;
src: url(res:///mnt/fat/Fonts/LiberationSerif-Bold.ttf);
}
fiery is offline   Reply With Quote