View Single Post
Old 10-28-2011, 11:04 AM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,976
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
In the CSS
Code:
@font-face {
  font-family: "Charis SIL";
  font-weight: normal;
  font-style: normal;
  src: url(fonts/CharisSILR.ttf)
}
@font-face {
  font-family: "Charis SIL";
  font-weight: bold;
  font-style: normal;
  src: url(fonts/CharisSILB.ttf)
}
@font-face {
  font-family: "Charis SIL";
  font-weight: normal;
  font-style: italic;
  src: url(fonts/CharisSILI.ttf)
}
@font-face {
  font-family: "Charis SIL";
  font-weight: bold;
  font-style: italic;
  src: url(fonts/CharisSILBI.ttf)
}
@font-face {
  font-family: "Old Claude LP Oldstyle Figures";
  font-weight: normal;
  font-style: normal;
  src: url(fonts/Old_Claude_LP_Oldstyle_Figures.ttf)
}
body {
  font-family: "Charis SIL", serif;
  widows: 0;
  orphans: 0;
  margin-top: 0;
  margin-bottom: 0;
  margin-left: 0;
  margin-right: 0;
  text-align: justify;
  font-size: 95%;
  line-height: 1.04em
}
In the OPF in the manifest section
Code:
<item href="fonts/CharisSILB.ttf" id="font1" media-type="application/x-font-ttf"/>
<item href="fonts/CharisSILBI.ttf" id="font2" media-type="application/x-font-ttf"/>
<item href="fonts/CharisSILI.ttf" id="font3" media-type="application/x-font-ttf"/>
<item href="fonts/CharisSILR.ttf" id="font4" media-type="application/x-font-ttf"/>
<item href="fonts/Old_Claude_LP_Oldstyle_Figures.ttf" id="font5" media-type="application/x-font-ttf"/>
Also in the CSS
Code:
span.drop-cap {
	font-family: "Old Claude LP Oldstyle Figures", serif;
	font-weight: normal;
	font-style: normal;
	font-size: 1.17em;
}
Those are all the relevant bits of code in the CSS and OPF for embedding these fonts. Also, the font files are in the directory fonts which is right under the directory the CSS and OPF are in. /OEBS/fonts/ OEBS has all the other files (in this case) and fonts has the fonts.

I hope this helps. This will mostly work for iBooks but you do have to add some non-standard code elsewhere for this to work. ON the Kobo, they botched things big time and refuse to listen to the bug report I've mentioned to them. The font-family in the body doesn't work on a Kobo. The drop-cap font will work fine. For a Kobo, you'll have to move the font-family from body to all the other CSS styles you use where that font is to be used. But in most cases like Sony, B&N, ADE (desktop), iRiver, Onyx, Boox, Bookeen, etc, this will work as is.

Charis SIL is the font that most publishers embed as it is a good looking font and it's free.
JSWolf is offline   Reply With Quote